bugfix
This commit is contained in:
parent
8b0edbcaed
commit
c7d993e5ad
@ -1,14 +1,16 @@
|
|||||||
from kivy.logger import Logger
|
from kivy.logger import Logger
|
||||||
from kivy.graphics import Color, Rectangle
|
from kivy.graphics import Color, Rectangle, RoundedRectangle
|
||||||
from kivy.properties import ListProperty
|
from kivy.properties import ListProperty
|
||||||
from .color_definitions import getColors
|
from .color_definitions import getColors
|
||||||
|
|
||||||
_logcnt = 0
|
_logcnt = 0
|
||||||
class BGColorBehavior(object):
|
class BGColorBehavior(object):
|
||||||
def __init__(self, color_level=-1,**kwargs):
|
def __init__(self, color_level=-1,radius=[],**kwargs):
|
||||||
self.color_level = color_level
|
self.color_level = color_level
|
||||||
|
self.radius = radius
|
||||||
self.bgcolor = []
|
self.bgcolor = []
|
||||||
self.fgcolor = []
|
self.fgcolor = []
|
||||||
|
self.useOwnColor = False
|
||||||
if color_level != -1:
|
if color_level != -1:
|
||||||
fg,bg= getColors(color_level)
|
fg,bg= getColors(color_level)
|
||||||
self.fgcolor = fg
|
self.fgcolor = fg
|
||||||
@ -59,6 +61,11 @@ class BGColorBehavior(object):
|
|||||||
if self.canvas:
|
if self.canvas:
|
||||||
with self.canvas.before:
|
with self.canvas.before:
|
||||||
Color(*self.bgcolor)
|
Color(*self.bgcolor)
|
||||||
|
if self.radius != []:
|
||||||
|
self.rect = RoundedRectangel(pos=self.pos,
|
||||||
|
size=self.size,
|
||||||
|
radius=self.radius)
|
||||||
|
else:
|
||||||
self.rect = Rectangle(pos=self.pos,
|
self.rect = Rectangle(pos=self.pos,
|
||||||
size=self.size)
|
size=self.size)
|
||||||
else:
|
else:
|
||||||
|
@ -22,6 +22,7 @@ from .paging import Paging, RelatedLoader
|
|||||||
from .ready import WidgetReady
|
from .ready import WidgetReady
|
||||||
from .toolbar import Toolbar
|
from .toolbar import Toolbar
|
||||||
from .i18n import I18nText
|
from .i18n import I18nText
|
||||||
|
from .bgcolorbehavior import BGColorBehavior
|
||||||
|
|
||||||
class BLabel(ButtonBehavior, Text):
|
class BLabel(ButtonBehavior, Text):
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
@ -118,11 +119,12 @@ class Row(GridLayout):
|
|||||||
self.part.datagrid.select_rowid = self.row_id
|
self.part.datagrid.select_rowid = self.row_id
|
||||||
self.part.datagrid.dispatch('on_selected',self)
|
self.part.datagrid.dispatch('on_selected',self)
|
||||||
|
|
||||||
class Header(WidgetReady, ScrollWidget):
|
class Header(WidgetReady, BGColorBehavior, ScrollWidget):
|
||||||
def __init__(self,part,**kw):
|
def __init__(self,part,color_level=-1,**kw):
|
||||||
self.part = part
|
self.part = part
|
||||||
ScrollWidget.__init__(self,**kw)
|
ScrollWidget.__init__(self,**kw)
|
||||||
WidgetReady.__init__(self)
|
WidgetReady.__init__(self)
|
||||||
|
BGColorBehavior.__init__(self,color_level=color_level)
|
||||||
self.init(1)
|
self.init(1)
|
||||||
self.bind(on_scroll_stop=self.part.datagrid.on_scrollstop)
|
self.bind(on_scroll_stop=self.part.datagrid.on_scrollstop)
|
||||||
|
|
||||||
@ -220,14 +222,18 @@ class DataGridPart(WidgetReady, BoxLayout):
|
|||||||
def addRow(self,id, data):
|
def addRow(self,id, data):
|
||||||
return self.body.addRow(id, data)
|
return self.body.addRow(id, data)
|
||||||
|
|
||||||
class DataGrid(WidgetReady, BoxLayout):
|
class DataGrid(WidgetReady, BGColorBehavior, BoxLayout):
|
||||||
row_selected = BooleanProperty(False)
|
row_selected = BooleanProperty(False)
|
||||||
def __init__(self,**options):
|
def __init__(self,color_level=-1,radius=[],**options):
|
||||||
kw = DictObject()
|
kw = DictObject()
|
||||||
kw = setSizeOptions(options,kw)
|
kw = setSizeOptions(options,kw)
|
||||||
kw.orientation = 'vertical'
|
kw.orientation = 'vertical'
|
||||||
|
self.color_level = color_level
|
||||||
|
self.radius = radius
|
||||||
WidgetReady.__init__(self)
|
WidgetReady.__init__(self)
|
||||||
BoxLayout.__init__(self,**kw)
|
BoxLayout.__init__(self,**kw)
|
||||||
|
BGColorBehavior.__init__(self,color_level=color_level,
|
||||||
|
radius=radius)
|
||||||
self.parenturl = options.get('parenturl',None)
|
self.parenturl = options.get('parenturl',None)
|
||||||
self.options = options
|
self.options = options
|
||||||
self.noheader = options.get('noheader',False)
|
self.noheader = options.get('noheader',False)
|
||||||
|
@ -259,7 +259,9 @@ class Form(BGColorBehavior, BoxLayout):
|
|||||||
self.options = options
|
self.options = options
|
||||||
BoxLayout.__init__(self, orientation='vertical')
|
BoxLayout.__init__(self, orientation='vertical')
|
||||||
self.color_level = self.options.get('color_level', 0)
|
self.color_level = self.options.get('color_level', 0)
|
||||||
BGColorBehavior.__init__(self,color_level=self.color_level)
|
BGColorBehavior.__init__(self,
|
||||||
|
color_level=self.options.get('color_level',-1),
|
||||||
|
radius=self.options.get('radius',[]))
|
||||||
self.readiedInput = 0
|
self.readiedInput = 0
|
||||||
self.cols = self.options_cols = self.options.get('cols',1)
|
self.cols = self.options_cols = self.options.get('cols',1)
|
||||||
if isHandHold() and Window.width < Window.height:
|
if isHandHold() and Window.width < Window.height:
|
||||||
|
@ -15,9 +15,11 @@ logger_func = {'quiet': Logger.critical, 'panic': Logger.critical,
|
|||||||
|
|
||||||
|
|
||||||
class NewVideo(BGColorBehavior, Video):
|
class NewVideo(BGColorBehavior, Video):
|
||||||
def __init__(self,**kw):
|
def __init__(self,color_level=-1,radius=[],**kw):
|
||||||
Video.__init__(self, **kw)
|
Video.__init__(self, **kw)
|
||||||
BGColorBehavior.__init__(self)
|
BGColorBehavior.__init__(self,
|
||||||
|
color_level=color_level,
|
||||||
|
radius=radius)
|
||||||
Window.allow_screensaver = False
|
Window.allow_screensaver = False
|
||||||
set_log_callback(self.ffplayerLog)
|
set_log_callback(self.ffplayerLog)
|
||||||
|
|
||||||
|
@ -26,12 +26,13 @@ from kivy.factory import Factory
|
|||||||
from .bgcolorbehavior import BGColorBehavior
|
from .bgcolorbehavior import BGColorBehavior
|
||||||
|
|
||||||
class TabsPanel(BGColorBehavior, TabbedPanel):
|
class TabsPanel(BGColorBehavior, TabbedPanel):
|
||||||
def __init__(self,**options):
|
def __init__(self,color_level=-1,
|
||||||
|
radius=[],
|
||||||
|
**options):
|
||||||
self.tabs_list = options.get('tabs')
|
self.tabs_list = options.get('tabs')
|
||||||
self.color_level = options.get('color_level',0)
|
TabbedPanel.__init__(self,**options)
|
||||||
opts = {k:v for k,v in options.items() if k not in ['tabs','color_level']}
|
BGColorBehavior.__init__(self,color_level=color_level,
|
||||||
TabbedPanel.__init__(self,**opts)
|
radius=radius)
|
||||||
BGColorBehavior.__init__(self)
|
|
||||||
Clock.schedule_once(self.add_tabs,0)
|
Clock.schedule_once(self.add_tabs,0)
|
||||||
|
|
||||||
def add_tab(self,text,desc):
|
def add_tab(self,text,desc):
|
||||||
|
@ -60,11 +60,14 @@ class PressableBox(TouchRippleButtonBehavior, BoxLayout):
|
|||||||
class ToggleItems(BGColorBehavior, BoxLayout):
|
class ToggleItems(BGColorBehavior, BoxLayout):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
color_level=1,
|
color_level=1,
|
||||||
|
radius=[],
|
||||||
items_desc=[],
|
items_desc=[],
|
||||||
border_width=1,
|
border_width=1,
|
||||||
**kw):
|
**kw):
|
||||||
BoxLayout.__init__(self, **kw)
|
BoxLayout.__init__(self, **kw)
|
||||||
BGColorBehavior.__init__(self,color_level=color_level)
|
BGColorBehavior.__init__(self,
|
||||||
|
color_level=color_level,
|
||||||
|
radius=radius)
|
||||||
self.item_widgets = []
|
self.item_widgets = []
|
||||||
for desc in items_desc:
|
for desc in items_desc:
|
||||||
c = PressableBox(border_width=border_width,
|
c = PressableBox(border_width=border_width,
|
||||||
|
@ -41,7 +41,8 @@ class Tool(ButtonBehavior, BGColorBehavior, BoxLayout):
|
|||||||
ButtonBehavior.__init__(self)
|
ButtonBehavior.__init__(self)
|
||||||
BoxLayout.__init__(self,
|
BoxLayout.__init__(self,
|
||||||
size_hint_y=None)
|
size_hint_y=None)
|
||||||
BGColorBehavior.__init__(self,color_level=ancestor.color_level)
|
BGColorBehavior.__init__(self,color_level=ancestor.color_level,
|
||||||
|
radius=ancestor.radius)
|
||||||
self.bl = BoxLayout(orientation='vertical',
|
self.bl = BoxLayout(orientation='vertical',
|
||||||
size_hint_y=None)
|
size_hint_y=None)
|
||||||
self.add_widget(self.bl)
|
self.add_widget(self.bl)
|
||||||
@ -134,12 +135,6 @@ class Toolbar(BGColorBehavior, GridLayout):
|
|||||||
tool.bind(on_press=self.tool_press)
|
tool.bind(on_press=self.tool_press)
|
||||||
self.height = tool.height * 1.1
|
self.height = tool.height * 1.1
|
||||||
|
|
||||||
def on_size(self,obj,size):
|
|
||||||
return
|
|
||||||
with self.canvas.before:
|
|
||||||
Color(0.3,0.3,0.3,1)
|
|
||||||
Rectangle(pos=self.pos,size=self.size)
|
|
||||||
|
|
||||||
def tool_press(self,o,v=None):
|
def tool_press(self,o,v=None):
|
||||||
for n,w in self.tool_widgets.items():
|
for n,w in self.tool_widgets.items():
|
||||||
active = False
|
active = False
|
||||||
@ -166,16 +161,18 @@ Toolpage options
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
class ToolPage(BGColorBehavior, BoxLayout):
|
class ToolPage(BGColorBehavior, BoxLayout):
|
||||||
def __init__(self,**opts):
|
def __init__(self,color_level=-1,radius=[],**opts):
|
||||||
self.opts = DictObject(**opts)
|
self.opts = DictObject(**opts)
|
||||||
self.parenturl = opts.get('parenturl',None)
|
|
||||||
if self.opts.tool_at in [ 'top','bottom']:
|
if self.opts.tool_at in [ 'top','bottom']:
|
||||||
orient = 'vertical'
|
orient = 'vertical'
|
||||||
else:
|
else:
|
||||||
orient = 'horizontal'
|
orient = 'horizontal'
|
||||||
color_level=self.opts.color_level or 0
|
self.color_level=self.opts.color_level or 0
|
||||||
|
self.radius = self.opts.radius
|
||||||
BoxLayout.__init__(self,orientation=orient)
|
BoxLayout.__init__(self,orientation=orient)
|
||||||
BGColorBehavior.__init__(self,color_level=color_level)
|
BGColorBehavior.__init__(self,
|
||||||
|
color_level=color_level,
|
||||||
|
radius=radius)
|
||||||
self.content = None
|
self.content = None
|
||||||
self.toolbar = None
|
self.toolbar = None
|
||||||
self.init()
|
self.init()
|
||||||
|
@ -69,8 +69,10 @@ class NodeTrigger(ButtonBehavior, EmptyBox):
|
|||||||
Triangle(points=points)
|
Triangle(points=points)
|
||||||
# print('pos=',self.pos,'size=',self.size)
|
# print('pos=',self.pos,'size=',self.size)
|
||||||
|
|
||||||
class TreeNode(BoxLayout):
|
class TreeNode(BGColorBehavior,BoxLayout):
|
||||||
def __init__(self,data,tree=None,
|
def __init__(self,data,tree=None,
|
||||||
|
color_level=-1,
|
||||||
|
radius=[],
|
||||||
parentNode=None,
|
parentNode=None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@ -79,7 +81,11 @@ class TreeNode(BoxLayout):
|
|||||||
if children miss, it is a leaf node,if children is a empty array, is mean need load at it is first expanded.
|
if children miss, it is a leaf node,if children is a empty array, is mean need load at it is first expanded.
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
self.color_level = color_level if color_level != -1 else tree.color_level + 1
|
||||||
|
self.radius = radius if radius!=[] else tree.audius
|
||||||
BoxLayout.__init__(self,orientation='vertical',size_hint=(None,None))
|
BoxLayout.__init__(self,orientation='vertical',size_hint=(None,None))
|
||||||
|
BGColorBehavior.__init__(self,color=self.color_level,
|
||||||
|
radius=self.radius)
|
||||||
self.treeObj = tree
|
self.treeObj = tree
|
||||||
self.parentNode = parentNode
|
self.parentNode = parentNode
|
||||||
self.data = data
|
self.data = data
|
||||||
@ -282,10 +288,13 @@ tree options
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
class Tree(BGColorBehavior, ScrollWidget):
|
class Tree(BGColorBehavior, ScrollWidget):
|
||||||
def __init__(self,**options):
|
def __init__(self,color_level=-1,radius=[],**options):
|
||||||
self.color_level = options.get('color_level',0)
|
self.color_level = color_level
|
||||||
|
self.radius = radius
|
||||||
ScrollWidget.__init__(self)
|
ScrollWidget.__init__(self)
|
||||||
BGColorBehavior.__init__(self,color_level=self.color_level)
|
BGColorBehavior.__init__(self,
|
||||||
|
color_level=self.color_level,
|
||||||
|
radius = self.radius)
|
||||||
self.options = DictObject(**options)
|
self.options = DictObject(**options)
|
||||||
self.nodes = []
|
self.nodes = []
|
||||||
self.initflag = False
|
self.initflag = False
|
||||||
|
Loading…
Reference in New Issue
Block a user