bugfix
This commit is contained in:
parent
979ac006b2
commit
c0c749f66c
@ -74,7 +74,7 @@ from .threadcall import HttpClient
|
|||||||
from .i18n import I18n
|
from .i18n import I18n
|
||||||
from .widget_css import WidgetCSS
|
from .widget_css import WidgetCSS
|
||||||
from .ready import WidgetReady
|
from .ready import WidgetReady
|
||||||
from .utils import CSize
|
from .utils import CSize, kwarg_pop
|
||||||
from .swipebehavior import SwipeBehavior
|
from .swipebehavior import SwipeBehavior
|
||||||
|
|
||||||
if platform == 'android':
|
if platform == 'android':
|
||||||
@ -90,6 +90,7 @@ class WrapText(Label):
|
|||||||
class Box(WidgetCSS, WidgetReady, BoxLayout):
|
class Box(WidgetCSS, WidgetReady, BoxLayout):
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
try:
|
try:
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(Box, self).__init__(**kw)
|
super(Box, self).__init__(**kw)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Box(',kw,') Error')
|
print('Box(',kw,') Error')
|
||||||
@ -108,6 +109,7 @@ class VBox(Box):
|
|||||||
|
|
||||||
class SwipeBox(SwipeBehavior, Box):
|
class SwipeBox(SwipeBehavior, Box):
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(SwipeBox, self).__init__(**kw)
|
super(SwipeBox, self).__init__(**kw)
|
||||||
|
|
||||||
|
|
||||||
@ -138,6 +140,7 @@ class Text(Label):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
kwargs.update(fontsize)
|
kwargs.update(fontsize)
|
||||||
|
kwarg_pop(self, kwargs)
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
if self._i18n:
|
if self._i18n:
|
||||||
self.i18n = I18n()
|
self.i18n = I18n()
|
||||||
|
@ -10,7 +10,7 @@ from kivy.properties import NumericProperty, DictProperty, \
|
|||||||
|
|
||||||
from kivyblocks.ready import WidgetReady
|
from kivyblocks.ready import WidgetReady
|
||||||
from kivyblocks.bgcolorbehavior import BGColorBehavior
|
from kivyblocks.bgcolorbehavior import BGColorBehavior
|
||||||
from kivyblocks.utils import CSize
|
from kivyblocks.utils import CSize, kwarg_pop
|
||||||
from kivyblocks.baseWidget import Box, Text
|
from kivyblocks.baseWidget import Box, Text
|
||||||
from kivyblocks.widget_css import WidgetCSS
|
from kivyblocks.widget_css import WidgetCSS
|
||||||
|
|
||||||
@ -23,6 +23,7 @@ class ClickableBox(TouchRippleButtonBehavior, Box):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
border_width=1,
|
border_width=1,
|
||||||
**kw):
|
**kw):
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ClickableBox, self).__init__(
|
super(ClickableBox, self).__init__(
|
||||||
padding=[border_width,
|
padding=[border_width,
|
||||||
border_width,
|
border_width,
|
||||||
@ -38,11 +39,15 @@ class ClickableBox(TouchRippleButtonBehavior, Box):
|
|||||||
|
|
||||||
class ClickableText(ClickableBox):
|
class ClickableText(ClickableBox):
|
||||||
text = StringProperty(' ')
|
text = StringProperty(' ')
|
||||||
|
fontsize = NumericProperty(1)
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
print('ClickableText begin inited')
|
print('ClickableText begin inited')
|
||||||
self.txt_w = None
|
self.txt_w = None
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ClickableText, self).__init__(**kw)
|
super(ClickableText, self).__init__(**kw)
|
||||||
self.txt_w = TinyText(text=self.text, i18n=True)
|
self.txt_w = TinyText(otext=self.text,
|
||||||
|
i18n=True,
|
||||||
|
font_size=CSize(self.fontsize))
|
||||||
self.txt_w.bind(texture_size=self.reset_size)
|
self.txt_w.bind(texture_size=self.reset_size)
|
||||||
self.add_widget(self.txt_w)
|
self.add_widget(self.txt_w)
|
||||||
self.txt_w.size_hint = (None, None)
|
self.txt_w.size_hint = (None, None)
|
||||||
@ -67,6 +72,7 @@ class ClickableIconText(ClickableText):
|
|||||||
img_kw = DictProperty({})
|
img_kw = DictProperty({})
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
self.img_w = None
|
self.img_w = None
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ClickableIconText, self).__init__(**kw)
|
super(ClickableIconText, self).__init__(**kw)
|
||||||
print('ClickableIconText inited')
|
print('ClickableIconText inited')
|
||||||
|
|
||||||
@ -101,6 +107,7 @@ class ToggleText(ClickableText):
|
|||||||
css_on = StringProperty('default')
|
css_on = StringProperty('default')
|
||||||
css_off = StringProperty('default')
|
css_off = StringProperty('default')
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ToggleText, self).__init__(**kw)
|
super(ToggleText, self).__init__(**kw)
|
||||||
|
|
||||||
def toggle(self):
|
def toggle(self):
|
||||||
@ -136,6 +143,7 @@ class ToggleIconText(ToggleText):
|
|||||||
img_kw = DictProperty({})
|
img_kw = DictProperty({})
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
self.img_w = None
|
self.img_w = None
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ToggleIconText, self).__init__(**kw)
|
super(ToggleIconText, self).__init__(**kw)
|
||||||
self.source = self.source_off
|
self.source = self.source_off
|
||||||
self.img_w = AsyncImage(source=self.source, **self.img_kw)
|
self.img_w = AsyncImage(source=self.source, **self.img_kw)
|
||||||
@ -164,6 +172,7 @@ class ClickableImage(ClickableBox):
|
|||||||
img_kw = DictProperty(None)
|
img_kw = DictProperty(None)
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
self.img_w = None
|
self.img_w = None
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ClickableImage, self).__init__(**kw)
|
super(ClickableImage, self).__init__(**kw)
|
||||||
self.img_w = AsyncImage(source=self.source, **self.img_kw)
|
self.img_w = AsyncImage(source=self.source, **self.img_kw)
|
||||||
self.add_widget(self.img_w)
|
self.add_widget(self.img_w)
|
||||||
@ -180,6 +189,7 @@ class ToggleImage(ClickableImage):
|
|||||||
source_off = StringProperty(None)
|
source_off = StringProperty(None)
|
||||||
select_state = BooleanProperty(False)
|
select_state = BooleanProperty(False)
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
|
kwarg_pop(self, kw)
|
||||||
super(ToggleImage, self).__init__(**kw)
|
super(ToggleImage, self).__init__(**kw)
|
||||||
self.source = self.source_on
|
self.source = self.source_on
|
||||||
|
|
||||||
|
@ -12,34 +12,35 @@ class ScrollPanel(ScrollView):
|
|||||||
y_padding_c = NumericProperty(0)
|
y_padding_c = NumericProperty(0)
|
||||||
bgcolor = ListProperty([0.2, 0.2, 0.2, 1])
|
bgcolor = ListProperty([0.2, 0.2, 0.2, 1])
|
||||||
orient = StringProperty('V')
|
orient = StringProperty('V')
|
||||||
|
|
||||||
def __init__(self,inner=None, **kw):
|
def __init__(self,inner=None, **kw):
|
||||||
|
print('ScrollPanel:kw=', kw)
|
||||||
super(ScrollPanel,self).__init__(**kw)
|
super(ScrollPanel,self).__init__(**kw)
|
||||||
self.effect_cls = ScrollEffect
|
self.effect_cls = ScrollEffect
|
||||||
if not inner:
|
if not inner:
|
||||||
kw = {
|
kw = {
|
||||||
'size_hint':(None,None),
|
'size_hint':(None,None),
|
||||||
'bgcolor':self.bgcolor,
|
'bgcolor':self.bgcolor,
|
||||||
'orientation':'vertical' if self.orient=='V' else 'horizontal'
|
|
||||||
}
|
}
|
||||||
desc = {
|
desc = {
|
||||||
"widgettype":"Box",
|
"widgettype":"Box",
|
||||||
"options":kw
|
"options":kw
|
||||||
}
|
}
|
||||||
self._inner = Factory.Blocks().widgetBuild(desc)
|
self._inner = Factory.Blocks().widgetBuild(desc)
|
||||||
|
if not self._inner:
|
||||||
|
print('desc=', desc)
|
||||||
|
raise Exception('widget build failed')
|
||||||
|
if isinstance(self._inner, BoxLayout):
|
||||||
|
if self.orient.upper() == 'H':
|
||||||
|
self._inner.orientation = 'horizontal'
|
||||||
|
else:
|
||||||
|
self._inner.orientation = 'vertical'
|
||||||
|
self._inner.padding = self._inner.spacing = \
|
||||||
|
[CSize(self.x_padding_c), CSize(self.y_padding_c)]
|
||||||
elif isinstance(inner, Widget):
|
elif isinstance(inner, Widget):
|
||||||
self._inner = inner
|
self._inner = inner
|
||||||
else:
|
else:
|
||||||
self._inner = Factory.Blocks().widgetBuild(inner)
|
self._inner = Factory.Blocks().widgetBuild(inner)
|
||||||
|
|
||||||
if isinstance(self._inner, BoxLayout):
|
|
||||||
if self.orient.upper() == 'H':
|
|
||||||
self._inner.orientation = 'horizontal'
|
|
||||||
else:
|
|
||||||
self._inner.orientation = 'vertical'
|
|
||||||
self._inner.padding = self._inner.spacing = \
|
|
||||||
[CSize(self.x_padding_c), CSize(self.y_padding_c)]
|
|
||||||
|
|
||||||
self._inner.bind(
|
self._inner.bind(
|
||||||
minimum_height=self._inner.setter('height'))
|
minimum_height=self._inner.setter('height'))
|
||||||
self._inner.bind(
|
self._inner.bind(
|
||||||
|
@ -9,7 +9,8 @@ from kivy.uix.widget import Widget
|
|||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
from kivy.properties import StringProperty, ListProperty, NumericProperty
|
from kivy.properties import StringProperty, DictProperty, \
|
||||||
|
ListProperty, NumericProperty
|
||||||
|
|
||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
from appPublic.registerfunction import RegisterFunction
|
from appPublic.registerfunction import RegisterFunction
|
||||||
@ -77,8 +78,8 @@ class Toolbar(Box):
|
|||||||
"size_hint_y":None,
|
"size_hint_y":None,
|
||||||
"i18n":True,
|
"i18n":True,
|
||||||
"height":CSize(self.text_size),
|
"height":CSize(self.text_size),
|
||||||
"font_size":CSize(self.text_size),
|
"fontsize":CSize(self.text_size),
|
||||||
"text":text
|
"otext":text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
desc = {
|
desc = {
|
||||||
@ -142,29 +143,53 @@ class ScrollToolbar(ScrollPanel):
|
|||||||
}
|
}
|
||||||
toolbar has follow attributes
|
toolbar has follow attributes
|
||||||
{
|
{
|
||||||
"img_height_c":image height in charecter size
|
"padding_c":x spacing
|
||||||
"img_width_c":image width in charecter size
|
"img_size_c":image height in charecter size
|
||||||
|
"text_size_c":
|
||||||
|
"orient":"H" or "V"
|
||||||
|
"tool_orient":"horizontal" or "vertical"
|
||||||
"css_on",
|
"css_on",
|
||||||
"css_off",
|
"css_off",
|
||||||
"tools":
|
"tools":
|
||||||
"tool_orient"
|
|
||||||
}
|
}
|
||||||
|
css_on='default',
|
||||||
|
css_off='default',
|
||||||
|
tools=[],
|
||||||
|
tool_orient = 'horizontal',
|
||||||
|
orient='H',
|
||||||
|
padding_c=1,
|
||||||
|
img_size_c=2,
|
||||||
|
text_size_c=1,
|
||||||
|
self.css_on = css_on
|
||||||
|
self.css_off = css_off
|
||||||
|
self.tools=tools
|
||||||
|
self.tool_orient = tool_orient
|
||||||
|
self.orient = orient
|
||||||
|
self.padding_c = padding_c
|
||||||
|
self.img_size_c = img_size_c
|
||||||
|
self.text_size_c = text_size_c
|
||||||
"""
|
"""
|
||||||
|
|
||||||
css_on = StringProperty('default')
|
css_on = StringProperty('default')
|
||||||
css_off = StringProperty('default')
|
css_off = StringProperty('default')
|
||||||
tools = ListProperty([])
|
tools = ListProperty([])
|
||||||
tool_orient = StringProperty('horizontal')
|
tool_orient = StringProperty('horizontal')
|
||||||
img_height_c = NumericProperty(2)
|
orient = StringProperty('H')
|
||||||
img_width_c = NumericProperty(2)
|
padding_c = NumericProperty(1)
|
||||||
|
img_size_c = NumericProperty(2)
|
||||||
|
text_size_c = NumericProperty(1)
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
print('#############init begin##########')
|
kwarg_pop(self, kw)
|
||||||
super(ScrollToolbar, self).__init__(**kw)
|
super(ScrollToolbar, self).__init__(**kw)
|
||||||
print('#############super init end##########')
|
|
||||||
self.register_event_type('on_press')
|
self.register_event_type('on_press')
|
||||||
|
if self.orient == 'H':
|
||||||
|
self._inner.orientation = 'horizontal'
|
||||||
|
else:
|
||||||
|
self._inner.orientation = 'vertical'
|
||||||
|
self.clear_widgets()
|
||||||
self.w_dic = {}
|
self.w_dic = {}
|
||||||
for t in self.tools:
|
for t in self.tools:
|
||||||
label = t.get('label')
|
label = t.get('label', t.get('name', None))
|
||||||
source_on = t.get('source_on', t.get('img_src',None))
|
source_on = t.get('source_on', t.get('img_src',None))
|
||||||
source_off = t.get('source_off', t.get('img_src', None))
|
source_off = t.get('source_off', t.get('img_src', None))
|
||||||
ToggleIconText = Factory.ToggleIconText
|
ToggleIconText = Factory.ToggleIconText
|
||||||
@ -174,19 +199,21 @@ class ScrollToolbar(ScrollPanel):
|
|||||||
w = ToggleIconText(css_on=self.css_on,
|
w = ToggleIconText(css_on=self.css_on,
|
||||||
css_off=self.css_off,
|
css_off=self.css_off,
|
||||||
text=label,
|
text=label,
|
||||||
|
fontsize=CSize(self.text_size_c),
|
||||||
source_on=source_on,
|
source_on=source_on,
|
||||||
source_off=source_off,
|
source_off=source_off,
|
||||||
orientation=self.tool_orient,
|
orientation=self.tool_orient,
|
||||||
img_kw={
|
img_kw={
|
||||||
"size_hint":(None, None),
|
"size_hint":(None, None),
|
||||||
"height":CSize(self.img_height_c),
|
"height":CSize(self.img_size_c),
|
||||||
"width":CSize(self.img_width_c)
|
"width":CSize(self.img_size_c)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
elif label:
|
elif label:
|
||||||
w = ToggleText(css_on=self.css_on,
|
w = ToggleText(css_on=self.css_on,
|
||||||
css_off=self.css_off,
|
css_off=self.css_off,
|
||||||
orientation=self.tool_orient,
|
orientation=self.tool_orient,
|
||||||
|
fontsize=CSize(self.text_size_c),
|
||||||
text=label)
|
text=label)
|
||||||
elif source_on:
|
elif source_on:
|
||||||
w = ToggleImage( source_on=source_on,
|
w = ToggleImage( source_on=source_on,
|
||||||
@ -194,8 +221,8 @@ class ScrollToolbar(ScrollPanel):
|
|||||||
orientation=self.tool_orient,
|
orientation=self.tool_orient,
|
||||||
img_kw={
|
img_kw={
|
||||||
"size_hint":(None, None),
|
"size_hint":(None, None),
|
||||||
"height":CSize(self.img_height_c),
|
"height":CSize(self.img_size_c),
|
||||||
"width":CSize(self.img_width_c)
|
"width":CSize(self.img_size_c)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -203,6 +230,19 @@ class ScrollToolbar(ScrollPanel):
|
|||||||
self.add_widget(w)
|
self.add_widget(w)
|
||||||
self.w_dic[w] = t
|
self.w_dic[w] = t
|
||||||
w.bind(on_press=self.tool_press)
|
w.bind(on_press=self.tool_press)
|
||||||
|
|
||||||
|
if self.orient == 'horizontal':
|
||||||
|
self.do_scroll_y = False
|
||||||
|
self.size_hint_y = None
|
||||||
|
if len(self.w_dic.keys()) > 0:
|
||||||
|
self.height = max([w.height for w in self.w_dic.keys()])
|
||||||
|
self._inner.spacing = CSize(self.padding_c,0)
|
||||||
|
else:
|
||||||
|
self.do_scroll_x = False
|
||||||
|
self.size_hint_x = None
|
||||||
|
if len(self.w_dic.keys()) > 0:
|
||||||
|
self.width = max([w.width for w in self.w_dic.keys() ])
|
||||||
|
self._inner.spacing = CSize(0, self.padding_c)
|
||||||
|
|
||||||
def on_press(self, o):
|
def on_press(self, o):
|
||||||
pass
|
pass
|
||||||
@ -224,83 +264,49 @@ class ScrollToolbar(ScrollPanel):
|
|||||||
self.dispatch('on_press', ret_v)
|
self.dispatch('on_press', ret_v)
|
||||||
|
|
||||||
class ToolPage(BoxLayout):
|
class ToolPage(BoxLayout):
|
||||||
normal_css=StringProperty(None)
|
|
||||||
actived_css=StringProperty(None)
|
|
||||||
toolbar_size = NumericProperty(2)
|
toolbar_size = NumericProperty(2)
|
||||||
img_size = NumericProperty(1.5)
|
|
||||||
text_size = NumericProperty(0.7)
|
|
||||||
tool_at = StringProperty('top')
|
tool_at = StringProperty('top')
|
||||||
tools = ListProperty([])
|
toolbar = DictProperty({})
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
if self.tool_at in [ 'top','bottom']:
|
print('ToolPage:kw=',kw)
|
||||||
orient = 'vertical'
|
|
||||||
else:
|
|
||||||
orient = 'horizontal'
|
|
||||||
kw['orientation'] = orient
|
|
||||||
super(ToolPage, self).__init__(**kw)
|
super(ToolPage, self).__init__(**kw)
|
||||||
|
if self.tool_at in [ 'top','bottom']:
|
||||||
|
self.orientation = 'vertical'
|
||||||
|
else:
|
||||||
|
self.orientation = 'horizontal'
|
||||||
if not self.toolbar_size:
|
if not self.toolbar_size:
|
||||||
self.toolbar_size = self.img_size + self.text_size + 0.3
|
self.toolbar_size = self.img_size + self.text_size + 0.3
|
||||||
self.content_widgets = {}
|
self.content_widgets = {}
|
||||||
self.content = None
|
self.content_w = None
|
||||||
self.toolbar = None
|
self.toolbar_w = None
|
||||||
self.init()
|
self.init()
|
||||||
name = self.tools[0]['name']
|
name = self.toolbar['tools'][0]['name']
|
||||||
self.toolbar.select(name)
|
self.toolbar_w.select(name)
|
||||||
|
|
||||||
def show_page(self, *args):
|
|
||||||
toggle_items = self.toolbar.toggle_items
|
|
||||||
for c in toggle_items.item_widgets:
|
|
||||||
cvalue = c.getValue()
|
|
||||||
if cvalue == self.show_name:
|
|
||||||
c.dispatch('on_press')
|
|
||||||
|
|
||||||
def on_size(self,obj,size):
|
def on_size(self,obj,size):
|
||||||
if self.content is None:
|
if self.content_w is None:
|
||||||
return
|
return
|
||||||
if self.tool_at in ['top','bottom']:
|
if self.tool_at in ['top','bottom']:
|
||||||
self.toolbar.width = self.width
|
self.toolbar_w.width = self.width
|
||||||
self.content.width = self.width
|
self.content_w.width = self.width
|
||||||
self.content.height = self.height - self.toolbar.height
|
self.content_w.height = self.height - self.toolbar_w.height
|
||||||
else:
|
else:
|
||||||
self.toolbar.height = self.height
|
self.toolbar_w.height = self.height
|
||||||
self.content.height = self.height
|
self.content_w.height = self.height
|
||||||
self.content.width = self.width - self.toolbar.width
|
self.content_w.width = self.width - self.toolbar_w.width
|
||||||
print(f'tb-width={self.toolbar.width}')
|
|
||||||
print(f'tb-height={self.toolbar.height}')
|
|
||||||
print(f'c-height={self.content.height}')
|
|
||||||
print(f'c-width={self.content.width}')
|
|
||||||
print(f'height={self.height}')
|
|
||||||
print(f'width={self.width}')
|
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.initFlag = True
|
self.content_w = BoxLayout()
|
||||||
self.mywidgets = {}
|
self.content_w.widget_id = 'content'
|
||||||
self.content = BoxLayout()
|
self.toolbar_w = ScrollToolbar(**self.toolbar)
|
||||||
self.content.widget_id = 'content'
|
|
||||||
opts = {}
|
|
||||||
opts['img_height_c'] = self.img_size
|
|
||||||
opts['img_width_c'] = self.img_size
|
|
||||||
opts['css_on'] = self.actived_css
|
|
||||||
opts['css_off'] = self.normal_css
|
|
||||||
opts['orient'] = 'H'
|
|
||||||
if self.tool_at in ['top','bottom']:
|
|
||||||
opts['size_hint_x'] = 1
|
|
||||||
opts['size_hint_y'] = None
|
|
||||||
opts['height'] = CSize(self.toolbar_size)
|
|
||||||
else:
|
|
||||||
opts['size_hint_y'] = 1
|
|
||||||
opts['size_hint_x'] = None
|
|
||||||
opts['width'] = CSize(self.toolbar_size)
|
|
||||||
opts['tools'] = self.tools
|
|
||||||
self.toolbar = ScrollToolbar(**opts)
|
|
||||||
if self.tool_at in ['top','left']:
|
if self.tool_at in ['top','left']:
|
||||||
self.add_widget(self.toolbar)
|
self.add_widget(self.toolbar_w)
|
||||||
self.add_widget(self.content)
|
self.add_widget(self.content_w)
|
||||||
else:
|
else:
|
||||||
self.add_widget(self.content)
|
self.add_widget(self.content_w)
|
||||||
self.add_widget(self.toolbar)
|
self.add_widget(self.toolbar_w)
|
||||||
|
|
||||||
self.toolbar.bind(on_press=self.on_press_handle)
|
self.toolbar_w.bind(on_press=self.on_press_handle)
|
||||||
|
|
||||||
def build_widget(self, url):
|
def build_widget(self, url):
|
||||||
desc = {
|
desc = {
|
||||||
@ -316,14 +322,14 @@ class ToolPage(BoxLayout):
|
|||||||
name = v.get('name')
|
name = v.get('name')
|
||||||
fress = v.get('fress')
|
fress = v.get('fress')
|
||||||
w = self.content_widgets.get(name)
|
w = self.content_widgets.get(name)
|
||||||
self.content.clear_widgets()
|
self.content_w.clear_widgets()
|
||||||
if w is None or fresh:
|
if w is None or fresh:
|
||||||
url = v.get('url')
|
url = v.get('url')
|
||||||
if url:
|
if url:
|
||||||
w = self.build_widget(url)
|
w = self.build_widget(url)
|
||||||
if w:
|
if w:
|
||||||
self.content_widgets[name] = w
|
self.content_widgets[name] = w
|
||||||
self.content.add_widget(w)
|
self.content_w.add_widget(w)
|
||||||
return
|
return
|
||||||
rfname = v.get('rfname')
|
rfname = v.get('rfname')
|
||||||
if rfname:
|
if rfname:
|
||||||
@ -332,8 +338,9 @@ class ToolPage(BoxLayout):
|
|||||||
if f:
|
if f:
|
||||||
r = f()
|
r = f()
|
||||||
if isinstance(r,Widget):
|
if isinstance(r,Widget):
|
||||||
self.content.add_widget(r)
|
self.content_w.add_widget(r)
|
||||||
return
|
return
|
||||||
if w:
|
if w:
|
||||||
self.content.add_widget(w)
|
self.content_w.add_widget(w)
|
||||||
|
|
||||||
|
Factory.register('ScrollToolbar', ScrollToolbar)
|
||||||
|
@ -31,6 +31,12 @@ class HTTPError(Exception):
|
|||||||
|
|
||||||
alert_widget= None
|
alert_widget= None
|
||||||
|
|
||||||
|
def kwarg_pop(obj, kw):
|
||||||
|
keys = [k for k in kw.keys()]
|
||||||
|
for k in keys:
|
||||||
|
if hasattr(obj, k):
|
||||||
|
setattr(obj, k, kw.pop(k))
|
||||||
|
|
||||||
def blockImage(name):
|
def blockImage(name):
|
||||||
p = os.path.dirname(os.path.abspath(__file__))
|
p = os.path.dirname(os.path.abspath(__file__))
|
||||||
return os.path.join(p,'imgs',name)
|
return os.path.join(p,'imgs',name)
|
||||||
|
Loading…
Reference in New Issue
Block a user