bugfix
This commit is contained in:
parent
78213544fd
commit
619f6d4718
@ -261,6 +261,7 @@ class Blocks(EventDispatcher):
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
def __build(self,desc:dict,ancestor=None):
|
def __build(self,desc:dict,ancestor=None):
|
||||||
|
print('__build(),desc=',desc)
|
||||||
widgetClass = desc.get('widgettype',None)
|
widgetClass = desc.get('widgettype',None)
|
||||||
if not widgetClass:
|
if not widgetClass:
|
||||||
print("__build(), desc invalid", desc)
|
print("__build(), desc invalid", desc)
|
||||||
@ -304,19 +305,33 @@ class Blocks(EventDispatcher):
|
|||||||
def build_rest(self, widget,desc,ancestor,t=None):
|
def build_rest(self, widget,desc,ancestor,t=None):
|
||||||
bcnt = 0
|
bcnt = 0
|
||||||
btotal = len(desc.get('subwidgets',[]))
|
btotal = len(desc.get('subwidgets',[]))
|
||||||
def doit(self,widget,bcnt,btotal,desc,o,w):
|
params={
|
||||||
bcnt += 1
|
'blocks':self,
|
||||||
|
'bcnt':bcnt,
|
||||||
|
'btotal':btotal,
|
||||||
|
'desc':desc,
|
||||||
|
'widget':widget
|
||||||
|
}
|
||||||
|
def doit(params,o,w):
|
||||||
|
params['bcnt'] += 1
|
||||||
|
bcnt = params['bcnt']
|
||||||
|
btotal = params['btotal']
|
||||||
|
blocks = params['blocks']
|
||||||
|
desc = params['desc']
|
||||||
|
widget = params['widget']
|
||||||
if hasattr(widget,'parenturl'):
|
if hasattr(widget,'parenturl'):
|
||||||
w.parenturl = widget.parenturl
|
w.parenturl = widget.parenturl
|
||||||
widget.add_widget(w)
|
widget.add_widget(w)
|
||||||
|
print('bcnt=',bcnt,'btotal=',btotal,'desc=',desc)
|
||||||
if bcnt >= btotal:
|
if bcnt >= btotal:
|
||||||
for b in desc.get('binds',[]):
|
for b in desc.get('binds',[]):
|
||||||
self.buildBind(widget,b)
|
print('buildBind() called',b)
|
||||||
|
blocks.buildBind(widget,b)
|
||||||
|
|
||||||
def doerr(o,e):
|
def doerr(o,e):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
f = partial(doit,self,widget,bcnt,btotal,desc)
|
f = partial(doit,params)
|
||||||
for sw in desc.get('subwidgets',[]):
|
for sw in desc.get('subwidgets',[]):
|
||||||
b = Blocks()
|
b = Blocks()
|
||||||
b.bind(on_built=f)
|
b.bind(on_built=f)
|
||||||
@ -335,6 +350,7 @@ class Blocks(EventDispatcher):
|
|||||||
return
|
return
|
||||||
f = self.buildAction(widget,desc)
|
f = self.buildAction(widget,desc)
|
||||||
w.bind(**{event:f})
|
w.bind(**{event:f})
|
||||||
|
print('w=',w,event,desc)
|
||||||
|
|
||||||
def uniaction(self,widget,desc, *args):
|
def uniaction(self,widget,desc, *args):
|
||||||
acttype = desc.get('actiontype')
|
acttype = desc.get('actiontype')
|
||||||
@ -475,6 +491,7 @@ class Blocks(EventDispatcher):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def doerr(o,e):
|
def doerr(o,e):
|
||||||
|
print('blocks.py:wigetBuild() failed,desc=',desc)
|
||||||
self.dispatch('on_failed',e)
|
self.dispatch('on_failed',e)
|
||||||
|
|
||||||
name = desc['widgettype']
|
name = desc['widgettype']
|
||||||
|
@ -394,7 +394,4 @@ class DataGrid(WidgetReady, BoxLayout):
|
|||||||
fs.append(f)
|
fs.append(f)
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
def on_ready(self,o,v=None):
|
|
||||||
print('***********onRadey*************')
|
|
||||||
|
|
||||||
Factory.register('DataGrid',DataGrid)
|
Factory.register('DataGrid',DataGrid)
|
||||||
|
@ -1,10 +1,36 @@
|
|||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.uix.floatlayout import FloatLayout
|
from kivy.uix.floatlayout import FloatLayout
|
||||||
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.uix.button import Button
|
from kivy.uix.button import Button
|
||||||
from kivy.uix.label import Label
|
from kivy.uix.label import Label
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from .utils import CSize
|
from .utils import CSize
|
||||||
|
|
||||||
|
class TwinShapeMenuBar(BoxLayout):
|
||||||
|
def __init__(self,**kw):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class MultiPanel(BoxLayout):
|
||||||
|
def __init__(self,bar_width=CSize(2),**kw):
|
||||||
|
BoxLayout.__init__(self,**kw)
|
||||||
|
self.panels = []
|
||||||
|
self.bar_width = bar_width
|
||||||
|
self.menubar = TwinShapeMenuBar(self,bar_width=bar_width)
|
||||||
|
self.cur_panel = None
|
||||||
|
self.bind(on_size=self.sizeChanged)
|
||||||
|
|
||||||
|
def sizeChanged(self,*args):
|
||||||
|
if len(self.panels) == 0:
|
||||||
|
return
|
||||||
|
if len(self.panels) == 1:
|
||||||
|
self.cur_panel.height = self.height - self.menubar.height
|
||||||
|
self.cur_panel.width = self.height - self.menubar.width
|
||||||
|
return
|
||||||
|
|
||||||
|
self.menubar.sizeChanged(self)
|
||||||
|
self.cur_panel.height = self.height - self.menubar.height
|
||||||
|
self.cur_panel.width = self.height - self.menubar.width
|
||||||
|
|
||||||
class PageContainer(FloatLayout):
|
class PageContainer(FloatLayout):
|
||||||
def __init__(self,**kw):
|
def __init__(self,**kw):
|
||||||
super().__init__(**kw)
|
super().__init__(**kw)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from kivy.uix.button import Button, ButtonBehavior
|
from kivy.uix.behaviors import TouchRippleButtonBehavior
|
||||||
from kivy.graphics import Color, Rectangle
|
from kivy.graphics import Color, Rectangle
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
@ -7,7 +7,7 @@ from kivy.factory import Factory
|
|||||||
from kivyblocks.ready import WidgetReady
|
from kivyblocks.ready import WidgetReady
|
||||||
from kivyblocks.bgcolorbehavior import BGColorBehavior
|
from kivyblocks.bgcolorbehavior import BGColorBehavior
|
||||||
|
|
||||||
class PressableBox(ButtonBehavior, BoxLayout):
|
class PressableBox(TouchRippleButtonBehavior, BoxLayout):
|
||||||
def __init__(self,border_width=1,
|
def __init__(self,border_width=1,
|
||||||
bgcolor=[0,1,0,1],
|
bgcolor=[0,1,0,1],
|
||||||
selected_color=[1,0,0,1],
|
selected_color=[1,0,0,1],
|
||||||
@ -17,7 +17,7 @@ class PressableBox(ButtonBehavior, BoxLayout):
|
|||||||
border_width,
|
border_width,
|
||||||
border_width],
|
border_width],
|
||||||
**kw)
|
**kw)
|
||||||
ButtonBehavior.__init__(self)
|
TouchRippleButtonBehavior.__init__(self)
|
||||||
self.b_bgcolor = bgcolor
|
self.b_bgcolor = bgcolor
|
||||||
self.border_width = border_width
|
self.border_width = border_width
|
||||||
self.b_selected_color = selected_color
|
self.b_selected_color = selected_color
|
||||||
@ -93,6 +93,7 @@ class ToggleItems(BGColorBehavior, BoxLayout):
|
|||||||
self.register_event_type('on_changed')
|
self.register_event_type('on_changed')
|
||||||
|
|
||||||
def on_changed(self,v=None):
|
def on_changed(self,v=None):
|
||||||
|
print('Toggle on_changed fired')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def select_item(self,o=None):
|
def select_item(self,o=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user