bugfix
This commit is contained in:
parent
2b47c02f6b
commit
5ac654366e
2296
kivyblocks/blocks.c
2296
kivyblocks/blocks.c
File diff suppressed because it is too large
Load Diff
@ -491,7 +491,8 @@ class Blocks(EventDispatcher):
|
||||
d = self.getActionData(widget,desc, *args)
|
||||
ns = {
|
||||
"self":target,
|
||||
"args":args
|
||||
"args":args,
|
||||
"kwargs":d
|
||||
}
|
||||
if d:
|
||||
ns.update(d)
|
||||
@ -692,7 +693,10 @@ class Blocks(EventDispatcher):
|
||||
from_widget=from_widget.parent)
|
||||
return None
|
||||
else:
|
||||
for c in from_widget.children:
|
||||
children = [i for i in from_widget.children]
|
||||
if hasattr(from_widget, 'get_subwidgets'):
|
||||
children = from_widget.get_subwidgets()
|
||||
for c in children:
|
||||
ret = find_widget_by_id(id,from_widget=c)
|
||||
if ret:
|
||||
return ret
|
||||
|
1530
kivyblocks/dg.c
1530
kivyblocks/dg.c
File diff suppressed because it is too large
Load Diff
@ -411,9 +411,13 @@ class DataGrid(WidgetReady, BoxLayout):
|
||||
if self.freeze_part and o == self.freeze_part.body:
|
||||
self.normal_part.body.scroll_y = o.scroll_y
|
||||
|
||||
if o.scroll_y <= 0.001:
|
||||
if o.scroll_y <= 0.01:
|
||||
print('loading next page...', self.dataloader.curpage)
|
||||
self.loading = True
|
||||
self.dataloader.loadNextPage()
|
||||
if o.scroll_y >= 0.999:
|
||||
if o.scroll_y >= 0.99:
|
||||
print('loading previous page...', self.dataloader.curpage)
|
||||
self.loading = True
|
||||
self.dataloader.loadPreviousPage()
|
||||
|
||||
def getValue(self):
|
||||
@ -484,8 +488,6 @@ class DataGrid(WidgetReady, BoxLayout):
|
||||
data['data'] = recs2
|
||||
f = partial(self.add_page_delay,data)
|
||||
Clock.schedule_once(f, 0)
|
||||
print('body=', self.normal_part.body.size,
|
||||
'inner=', self.normal_part.body._inner.size)
|
||||
|
||||
def add_page_delay(self, data, *args):
|
||||
recs = data['data']
|
||||
@ -505,6 +507,7 @@ class DataGrid(WidgetReady, BoxLayout):
|
||||
self.dataloader.bufferObjects(page,ids)
|
||||
x = self.dataloader.getLocater()
|
||||
self.locater(x)
|
||||
self.loading = False
|
||||
|
||||
def delete_page(self,o,data):
|
||||
print('dg.py:delete_page() called')
|
||||
|
@ -1,4 +1,6 @@
|
||||
from kivy.factory import Factory
|
||||
from kivy.properties import NumericProperty, StringProperty, \
|
||||
DictProperty, ListProperty, OptionProperty, BooleanProperty
|
||||
from kivy.logger import Logger
|
||||
from kivy.uix.textinput import TextInput
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
@ -23,7 +25,7 @@ form options
|
||||
"toolbar":
|
||||
"dataloader":{
|
||||
"dataurl":"first"
|
||||
"datatarget":"second",
|
||||
"datatargment":"second",
|
||||
"datarfname":"third"
|
||||
"params":
|
||||
"method"
|
||||
@ -52,9 +54,11 @@ form options
|
||||
|
||||
class InputBox(BoxLayout):
|
||||
def __init__(self, form, **options):
|
||||
self.input_widget = None
|
||||
self.form = form
|
||||
self.options = options
|
||||
self.uitype = options.get('uitype',options.get('datatype','str'))
|
||||
self.size_hint = (None, None)
|
||||
width = self.form.inputwidth
|
||||
height = self.form.inputheight
|
||||
if self.uitype == 'text':
|
||||
@ -82,6 +86,18 @@ class InputBox(BoxLayout):
|
||||
pos=self.setSize)
|
||||
self.register_event_type("on_datainput")
|
||||
|
||||
def on_size(self, *args):
|
||||
if self.input_widget is None:
|
||||
return
|
||||
self.labeltext.size_hint_x = None
|
||||
if self.form.labelwidth < 1:
|
||||
self.labeltext.width = self.width * self.form.labelwidth - \
|
||||
CSize(1)
|
||||
else:
|
||||
self.labeltext.width = CSize(self.form.labelwidth)
|
||||
|
||||
self.input_widget.size_hint_x = None
|
||||
self.input_widget.width = self.width - self.labeltext.width - CSize(1)
|
||||
def on_datainput(self,o,v=None):
|
||||
print('on_datainput fired ...',o,v)
|
||||
|
||||
@ -92,8 +108,14 @@ class InputBox(BoxLayout):
|
||||
opts = {
|
||||
"orientation":"horizontal",
|
||||
"size_hint_y":None,
|
||||
"height":CSize(2)
|
||||
"height":CSize(self.form.inputheight)
|
||||
}
|
||||
if self.form.inputwidth > 1:
|
||||
opts['size_hint_x'] = None
|
||||
opts['width'] = CSize(self.form.inputwidth)
|
||||
else:
|
||||
opts['size_hint_x'] = self.form.inputwidth
|
||||
|
||||
bl = BoxLayout(**opts)
|
||||
self.add_widget(bl)
|
||||
label = self.options.get('label',self.options.get('name'))
|
||||
@ -102,6 +124,12 @@ class InputBox(BoxLayout):
|
||||
"otext":label,
|
||||
"font_size":CSize(1),
|
||||
}
|
||||
if self.form.labelwidth < 1:
|
||||
kwargs['size_hint_x'] = self.form.labelwidth
|
||||
else:
|
||||
kwargs['size_hint_x'] = None
|
||||
kwargs['width'] = CSize(self.form.labelwidth)
|
||||
|
||||
self.labeltext = Text(**kwargs)
|
||||
bl.add_widget(self.labeltext)
|
||||
if self.options.get('required',False):
|
||||
@ -115,6 +143,11 @@ class InputBox(BoxLayout):
|
||||
options['hint_text'] = i18n(self.options.get('hint_text'))
|
||||
f = get_input_builder(self.uitype)
|
||||
self.input_widget = f(options)
|
||||
if self.form.labelwidth < 1:
|
||||
self.input_widget.size_hint_x = 1 - self.form.labelwidth
|
||||
else:
|
||||
self.input_widget.size_hint_x = None
|
||||
self.input_widget.width = self.width - self.labeltext.width - CSize(1)
|
||||
if self.options.get('readonly'):
|
||||
self.input_widget.disabled = True
|
||||
if self.options.get('value'):
|
||||
@ -171,17 +204,21 @@ class InputBox(BoxLayout):
|
||||
|
||||
def defaultToolbar():
|
||||
return {
|
||||
"img_size_c":1.5,
|
||||
"text_size_c":0.7,
|
||||
"img_size_c":1,
|
||||
"text_size_c":1,
|
||||
"toolbar_orient":"H",
|
||||
"tool_orient":"horizontal",
|
||||
"tools":[
|
||||
{
|
||||
"name":"__submit",
|
||||
"img_src":"/imgs/submit.png",
|
||||
"source_on":blockImage("save.png"),
|
||||
"source_off":blockImage("save.png"),
|
||||
"label":"submit"
|
||||
},
|
||||
{
|
||||
"name":"__clear",
|
||||
"img_src":"/imgs/clear.png",
|
||||
"source_on":blockImage("clear.png"),
|
||||
"source_off":blockImage("clear.png"),
|
||||
"label":"clear"
|
||||
}
|
||||
]
|
||||
@ -189,44 +226,30 @@ def defaultToolbar():
|
||||
}
|
||||
|
||||
class Form(WidgetCSS, WidgetReady, BoxLayout):
|
||||
cols = NumericProperty(1)
|
||||
csscls=StringProperty('formcss')
|
||||
input_css=StringProperty('formfieldcss')
|
||||
inputwidth=NumericProperty(1)
|
||||
inputheight=NumericProperty(3)
|
||||
labelwidth=NumericProperty(0.3)
|
||||
toolbar_at=OptionProperty('top', \
|
||||
options=['top','bottom','left','right'])
|
||||
dataloader=DictProperty(None)
|
||||
fields = ListProperty([])
|
||||
toolbar=DictProperty(None)
|
||||
submit=DictProperty(None)
|
||||
clear=DictProperty(None)
|
||||
notoolbar=BooleanProperty(False)
|
||||
def __init__(self,
|
||||
cols=1,
|
||||
csscls='default',
|
||||
input_css='input',
|
||||
inputwidth=0,
|
||||
inputheight=3,
|
||||
labelwidth=0.3,
|
||||
notoolbar=False,
|
||||
toolbar_at='top', #'top', 'bottom', 'left', 'right'
|
||||
dataloader={},
|
||||
fields=[],
|
||||
submit={},
|
||||
clear={},
|
||||
toolbar={},
|
||||
**options):
|
||||
self.inputwidth = 1
|
||||
self.input_css = input_css
|
||||
self.inputheight = inputheight
|
||||
self.labelwidth= labelwidth
|
||||
self.fields = fields
|
||||
self.notoolbar = notoolbar
|
||||
self.submit = submit
|
||||
self.clear = clear
|
||||
self.toolbar = toolbar
|
||||
self.toolbar_at=toolbar_at
|
||||
self.dataloader = dataloader
|
||||
self.readiedInput = 0
|
||||
if self.toolbar_at in ['top','bottom']:
|
||||
options['orientation'] = 'vertical'
|
||||
else:
|
||||
options['orientation'] = 'horizontal'
|
||||
print('options=', options)
|
||||
super(Form, self).__init__(**options)
|
||||
#BoxLayout.__init__(self, **options)
|
||||
#WidgetReady.__init__(self)
|
||||
#WidgetCSS.__init__(self)
|
||||
self.csscls = csscls
|
||||
self.cols = self.options_cols = cols
|
||||
SUPER(Form, self, options)
|
||||
if self.inputwidth <= 1:
|
||||
self.cols = 1
|
||||
self.options_cols = self.cols
|
||||
if isHandHold() and Window.width < Window.height:
|
||||
self.cols = 1
|
||||
self.options = options
|
||||
@ -239,53 +262,47 @@ class Form(WidgetCSS, WidgetReady, BoxLayout):
|
||||
|
||||
if not self.notoolbar:
|
||||
if self.toolbar_at in ['top', 'bottom']:
|
||||
self.fsc.height = self.height - self.toolbar.height
|
||||
self.fsc.height = self.height - self.toolbar_w.height
|
||||
else:
|
||||
self.fsc.width = self.width - self.toolbar.width
|
||||
self.fsc.width = self.width - self.toolbar_w.width
|
||||
else:
|
||||
if self.toolbar_at in ['top', 'bottom']:
|
||||
self.fsc.height = self.height
|
||||
else:
|
||||
self.fsc.width = self.width
|
||||
self.fsc.org_box_width = self.width / self.options_cols
|
||||
if self.notoolbar:
|
||||
return
|
||||
|
||||
def init(self):
|
||||
if not self.notoolbar:
|
||||
desc = defaultToolbar()
|
||||
desc1 = self.toolbar
|
||||
tools = desc['tools'].copy()
|
||||
if desc1:
|
||||
tools = desc['tools'] + desc1['tools']
|
||||
desc1['tools'] = tools
|
||||
desc = desc1
|
||||
desc.update(desc1)
|
||||
tools = tools + desc1['tools']
|
||||
if self.submit:
|
||||
kw = self.submit.copy()
|
||||
if kw.get('name'):
|
||||
del kw['name']
|
||||
for t in desc['tools']:
|
||||
for t in tools:
|
||||
if t['name'] == '__submit':
|
||||
t.update(kw)
|
||||
if self.clear:
|
||||
kw = self.clear.copy()
|
||||
if kw.get('name'):
|
||||
del kw['name']
|
||||
for t in desc['tools']:
|
||||
for t in tools:
|
||||
if t['name'] == '__clear':
|
||||
t.update(kw)
|
||||
|
||||
desc['tools'] = tools
|
||||
if self.toolbar_at in ['top', 'bottom']:
|
||||
desc['orientation'] = 'horizontal'
|
||||
desc['size_hint_y'] = None
|
||||
desc['height'] = CSize(desc['img_size_c'] + \
|
||||
desc['text_size_c'])
|
||||
desc['toolbar_orient'] = 'H'
|
||||
else:
|
||||
desc['orientation'] = 'vertical'
|
||||
desc['size_hint_x'] = None
|
||||
desc['width'] = CSize(desc['img_size_c'] + \
|
||||
desc['text_size_c'])
|
||||
desc['toolbar_orient'] = 'V'
|
||||
desc['tool_orient'] = 'veritcal'
|
||||
|
||||
self.toolbar = Toolbar(**desc)
|
||||
self.toolbar_w = Factory.Toolbar(**desc)
|
||||
self.fsc = VResponsiveLayout(
|
||||
self.inputwidth,
|
||||
self.cols,
|
||||
@ -293,10 +310,10 @@ class Form(WidgetCSS, WidgetReady, BoxLayout):
|
||||
)
|
||||
|
||||
if self.toolbar_at in ['top', 'left'] and not self.notoolbar:
|
||||
self.add_widget(self.toolbar)
|
||||
self.add_widget(self.toolbar_w)
|
||||
self.add_widget(self.fsc)
|
||||
if self.toolbar_at in ['bottom', 'right'] and not self.notoolbar:
|
||||
self.add_widget(self.toolbar)
|
||||
self.add_widget(self.toolbar_w)
|
||||
|
||||
self.fieldWidgets=[]
|
||||
for f in self.fields:
|
||||
@ -348,7 +365,7 @@ class Form(WidgetCSS, WidgetReady, BoxLayout):
|
||||
Logger.info('kivyblcks: input check success')
|
||||
return True
|
||||
|
||||
def on_submit(self,v=None):
|
||||
def on_submit(self,o, v=None):
|
||||
print('Form():on_submit fired ...',v)
|
||||
return False
|
||||
|
||||
|
@ -56,7 +56,7 @@ class Hirarchy(ScrollPanel):
|
||||
icon = StringProperty(None)
|
||||
single_expand = BooleanProperty(False)
|
||||
def __init__(self, **kw):
|
||||
self.register_event_type('on_selected')
|
||||
self.register_event_type('on_press')
|
||||
self.tree = TreeView(hide_root=True)
|
||||
self.tree.size_hint = (None, None)
|
||||
self.tree.bind(on_node_expand=self.check_load_subnodes)
|
||||
@ -65,11 +65,11 @@ class Hirarchy(ScrollPanel):
|
||||
if self.url:
|
||||
self.data = self.get_remote_data()
|
||||
|
||||
def on_selected(self, node):
|
||||
def on_press(self, node):
|
||||
print('selected node=', node)
|
||||
|
||||
def node_selected(self, o, v):
|
||||
self.dispatch('on_selected', o.selected_node)
|
||||
self.dispatch('on_press', o.selected_node)
|
||||
|
||||
def collapse_others(self, node):
|
||||
for n in self.tree.iterate_open_nodes(node=node.parent_node):
|
||||
@ -136,7 +136,7 @@ class Menu(Hirarchy):
|
||||
self.target_w = None
|
||||
super(Menu, self).__init__(**kw)
|
||||
|
||||
def on_selected(self, node):
|
||||
def on_press(self, node):
|
||||
data = {}
|
||||
dw = node.data.get('datawidget')
|
||||
if dw:
|
||||
|
@ -140,7 +140,6 @@ sub-widget's description file format
|
||||
bar_at='top',
|
||||
enable_on_close=False,
|
||||
left_menu=None, **kw):
|
||||
print('PagePanel().__init__():', bar_size, bar_at, left_menu)
|
||||
self.bar_size = bar_size
|
||||
self.bar_at = bar_at
|
||||
self.singlepage = singlepage
|
||||
@ -243,6 +242,14 @@ sub-widget's description file format
|
||||
self.left_menu_showed = False
|
||||
self.right_menu_showed = False
|
||||
|
||||
def get_subwidgets(self):
|
||||
children = [self.bar]
|
||||
if self.fixed_before:
|
||||
children.append(self.fixed_before)
|
||||
if self.fixed_after:
|
||||
children.append(self.fixed_after)
|
||||
return children + self.sub_widgets
|
||||
|
||||
def on_close_handle(self, o, *args):
|
||||
print('app.on_close fired, ...')
|
||||
if not self.enable_on_close:
|
||||
@ -281,11 +288,12 @@ sub-widget's description file format
|
||||
|
||||
def on_swipe_next_page(self, o, *args):
|
||||
if len(self.swipe_buffer) < 1:
|
||||
return
|
||||
return True
|
||||
self.swipe_right = True
|
||||
w = self.swipe_buffer[0]
|
||||
del self.swipe_buffer[0]
|
||||
self.add_widget(w)
|
||||
return True
|
||||
|
||||
def clear_widgets(self):
|
||||
self.bar_back.clear_widgets()
|
||||
@ -293,16 +301,18 @@ sub-widget's description file format
|
||||
self.bar_right_menu.clear_widgets()
|
||||
|
||||
def add_widget(self, w, *args):
|
||||
print('here ....')
|
||||
if not self.swipe_right:
|
||||
self.swipe_buffer = []
|
||||
self.swipe_right = False
|
||||
self.clear_widgets()
|
||||
if len(self.sub_widgets) > 0:
|
||||
pass
|
||||
if self.singlepage:
|
||||
self.sub_widgets = []
|
||||
self.sub_widgets.append(w)
|
||||
self.show_currentpage()
|
||||
show_widget_info(self)
|
||||
for w in self.get_subwidgets():
|
||||
show_widget_info(w)
|
||||
|
||||
def show_left_menu(self, o):
|
||||
def x(*args):
|
||||
@ -345,6 +355,7 @@ sub-widget's description file format
|
||||
return True
|
||||
mc = MenuContainer()
|
||||
mc.add_widget(w.menu_widget)
|
||||
self.w.menu_widget.bind(on_press=mc.dismiss)
|
||||
mc.size_hint = (None,None)
|
||||
mc.height = self.content.height
|
||||
mc.width = self.width * 0.4
|
||||
|
@ -83,10 +83,13 @@ class PageLoader(EventDispatcher):
|
||||
dir:'up' or 'down'
|
||||
}
|
||||
"""
|
||||
pass
|
||||
|
||||
def do_search(self,o,params):
|
||||
self.newbegin = True
|
||||
self.total_cnt = 0
|
||||
self.total_page = 0
|
||||
self.curpage = 0
|
||||
self.dir = 'down'
|
||||
self.dispatch('on_newbegin')
|
||||
self.params.update(params)
|
||||
self.loadPage(1)
|
||||
@ -102,12 +105,6 @@ class PageLoader(EventDispatcher):
|
||||
self.page_rows = row_cnt
|
||||
if self.total_cnt != 0:
|
||||
self.calculateTotalPage()
|
||||
self.reload()
|
||||
|
||||
def reload(self):
|
||||
if self.curpage == 0:
|
||||
self.curpage = 1
|
||||
self.loadPage(self.curpage)
|
||||
|
||||
def show_page(self,o,d):
|
||||
p = (self.curpage - 1) * self.page_rows + 1
|
||||
@ -122,45 +119,49 @@ class PageLoader(EventDispatcher):
|
||||
"data":d['rows']
|
||||
}
|
||||
self.dispatch('on_pageloaded',d)
|
||||
self.loading = False
|
||||
|
||||
def onerror(self,o,e):
|
||||
traceback.print_exc()
|
||||
alert(str(e),title='alert')
|
||||
self.loading = False
|
||||
|
||||
def loadNextPage(self):
|
||||
if self.loading:
|
||||
print('is loading, return')
|
||||
return
|
||||
|
||||
if self.total_page > 0 and self.curpage >=self.total_page:
|
||||
return
|
||||
p = self.curpage + 1
|
||||
self.loadPage(p)
|
||||
|
||||
def loadPreviousPage(self):
|
||||
if self.loading:
|
||||
print('is loading, return')
|
||||
return
|
||||
|
||||
if self.curpage <= 1:
|
||||
return
|
||||
p = self.curpage - 1
|
||||
self.loadPage(p)
|
||||
|
||||
def loadPage(self,p):
|
||||
if p == self.curpage:
|
||||
return
|
||||
|
||||
if self.loading:
|
||||
print('is loading, return')
|
||||
return
|
||||
|
||||
self.loading = True
|
||||
print(f'loading {p} page, {self.curpage}')
|
||||
if self.curpage > p:
|
||||
self.dir = 'up'
|
||||
elif self.curpage == p:
|
||||
self.dir = 'reload'
|
||||
else:
|
||||
self.dir = 'down'
|
||||
self.curpage = p
|
||||
self.loading = True
|
||||
self.loader.load()
|
||||
"""
|
||||
params = self.params.copy()
|
||||
params.update({
|
||||
"page":self.curpage,
|
||||
"rows":self.page_rows
|
||||
})
|
||||
realurl = absurl(self.url,self.target.parenturl)
|
||||
loader = HTTPDataHandler(realurl,params=params)
|
||||
loader.bind(on_success=self.show_page)
|
||||
loader.bind(on_failed=self.httperror)
|
||||
loader.handle()
|
||||
"""
|
||||
|
||||
"""
|
||||
{
|
||||
@ -190,6 +191,13 @@ class RelatedLoader(PageLoader):
|
||||
self.widget = None
|
||||
self.register_event_type('on_deletepage')
|
||||
|
||||
def do_search(self,o,params):
|
||||
self.objectPages = {}
|
||||
self.totalObj = 0
|
||||
self.MaxbufferPage = 3
|
||||
self.locater = 1/self.MaxbufferPage
|
||||
super().do_search(o, params)
|
||||
|
||||
def getLocater(self):
|
||||
if self.newbegin:
|
||||
self.newbegin = False
|
||||
@ -206,7 +214,6 @@ class RelatedLoader(PageLoader):
|
||||
def setPageRows(self,row_cnt):
|
||||
if self.total_cnt != 0:
|
||||
self.calculateTotalPage()
|
||||
self.reload()
|
||||
|
||||
def doBufferMaintain(self):
|
||||
siz = len(self.objectPages.keys())
|
||||
@ -234,12 +241,8 @@ class RelatedLoader(PageLoader):
|
||||
self.doBufferMaintain()
|
||||
self.totalObj += len(data['rows'])
|
||||
super().show_page(o,data)
|
||||
self.loading = False
|
||||
|
||||
def loadPreviousPage(self):
|
||||
if self.loading:
|
||||
return
|
||||
|
||||
pages = self.objectPages.keys()
|
||||
if len(pages) < 1:
|
||||
return
|
||||
@ -252,8 +255,6 @@ class RelatedLoader(PageLoader):
|
||||
self.loadPage(page)
|
||||
|
||||
def loadNextPage(self):
|
||||
if self.loading:
|
||||
return
|
||||
pages = self.objectPages.keys()
|
||||
if len(pages) == 0:
|
||||
return
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
from kivy.uix.label import Label
|
||||
from kivy.properties import NumericProperty
|
||||
from kivy.properties import NumericProperty, ColorProperty
|
||||
from kivy.factory import Factory
|
||||
|
||||
from kivyblocks.uitype import view_register, get_value
|
||||
|
||||
class Price(Label):
|
||||
class PriceView(Label):
|
||||
dec = NumericProperty(4)
|
||||
old_price = NumericProperty(None)
|
||||
price = NumericProperty(None)
|
||||
@ -13,7 +13,7 @@ class Price(Label):
|
||||
inc_color = ColorProperty([0.9,0,0,1]) # red
|
||||
dec_color = ColorProperty([0,0.9,0,1]) # green
|
||||
def __init__(self, **kw):
|
||||
super(Price, self).__init__(text='', **kw)
|
||||
super(PriceView, self).__init__(text='', **kw)
|
||||
|
||||
def on_price(self, price):
|
||||
if self.price is None:
|
||||
@ -34,11 +34,17 @@ class Price(Label):
|
||||
self.color = nor_color
|
||||
self.old_price = self.price
|
||||
|
||||
Factory.register('Price', Price)
|
||||
def getValue(self):
|
||||
return self.price
|
||||
|
||||
def setValue(self, v):
|
||||
self.price = v
|
||||
|
||||
Factory.register('PriceView', PriceView)
|
||||
|
||||
def build_view_price_widget(desc, rec=None):
|
||||
v = get_value(desc, rec=rec)
|
||||
return Factory.Price(price=v,
|
||||
return Factory.PriceView(price=v,
|
||||
font_size=CSize(1),
|
||||
halign='right',
|
||||
valign='middle'
|
||||
|
@ -41,7 +41,7 @@ from .paging import PageLoader
|
||||
from .dateinput import DateInput
|
||||
from .block_test import BlockTest
|
||||
from .hirarchy import Hirarchy
|
||||
from .price import Price
|
||||
from .price import PriceView
|
||||
|
||||
r = Factory.register
|
||||
if kivy.platform in ['win','linux', 'macosx']:
|
||||
|
@ -30,6 +30,9 @@ class ScrollPanel(WidgetCSS, ScrollView):
|
||||
self._inner.bind(
|
||||
minimum_width=self._inner.setter('width'))
|
||||
|
||||
def get_subwidgets(self):
|
||||
return self._inner.children
|
||||
|
||||
def create_default_inner(self):
|
||||
kw = {
|
||||
'size_hint':(None,None),
|
||||
|
@ -215,6 +215,11 @@ class ToolPage(Box):
|
||||
name = self.toolbar['tools'][0]['name']
|
||||
self.toolbar_w.select(name)
|
||||
|
||||
def get_subwidgets(self):
|
||||
children = [ i for i in self.children]
|
||||
x = [ i for i in self.content_widgets.values() ]
|
||||
return children + x
|
||||
|
||||
def delete_content_widget(self, o, d):
|
||||
w, dic = d
|
||||
self.del_tool(dic['name'])
|
||||
|
@ -2,13 +2,14 @@ import os
|
||||
from traceback import print_exc
|
||||
from traceback import print_exc
|
||||
from kivy.app import App
|
||||
from kivy.logger import Logger
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from kivy.uix.popup import Popup
|
||||
from kivy.uix.button import Button
|
||||
from kivy.uix.label import Label
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.uix.modalview import ModalView
|
||||
from kivy.uix.image import Image
|
||||
from kivy.uix.image import AsyncImage
|
||||
from appPublic.dictObject import DictObject
|
||||
|
||||
from .kivysize import KivySizes
|
||||
@ -62,7 +63,8 @@ def loaded(widget):
|
||||
|
||||
def loading(parent):
|
||||
fp = os.path.join(os.path.dirname(__file__),'imgs','loading1.gif')
|
||||
image = Image(source=fp,width=CSize(2),height=CSize(2),
|
||||
image = AsyncImage(source=blockImage('loading1.gif'), \
|
||||
width=CSize(2), height=CSize(2),
|
||||
size_hint=(None,None))
|
||||
view = ModalView(auto_dismiss=False)
|
||||
view.add_widget(image)
|
||||
@ -213,3 +215,7 @@ def absurl(url,parent):
|
||||
paths.append(i)
|
||||
return config.uihome + '/'.join(paths)
|
||||
|
||||
def show_widget_info(w, tag='DEBUG'):
|
||||
id = getattr(w, 'widget_id', 'null')
|
||||
msg=f"""{tag}:size_hint={w.size_hint},size={w.size},pos={w.pos},widget_id={id}"""
|
||||
Logger.info(msg)
|
||||
|
Loading…
Reference in New Issue
Block a user