This commit is contained in:
yumoqing 2020-07-13 17:31:04 +08:00
parent 8bd812834c
commit 26e582019c
3 changed files with 2 additions and 22 deletions

View File

@ -129,11 +129,9 @@ class Blocks(EventDispatcher):
}
body="""def %s(widget,obj=None, v=None):
jsonstr='''%s'''
print(type(widget), type(obj),v,'action():desc=',jsonstr)
desc = json.loads(jsonstr)
app = App.get_running_app()
app.blocks.uniaction(widget, desc)
print('finished')
""" % (fname, json.dumps(desc))
exec(body,globals(),l)
f = l.get(fname,None)
@ -168,7 +166,6 @@ class Blocks(EventDispatcher):
errback=None,**kw):
if url.startswith('file://'):
filename = url[7:]
print(filename)
with codecs.open(filename,'r','utf-8') as f:
b = f.read()
dic = json.loads(b)
@ -182,12 +179,10 @@ class Blocks(EventDispatcher):
def strValueExpr(self,s:str,localnamespace:dict={}):
if not s.startswith('py::'):
print('normal value')
return s
s = s[4:]
try:
v = self.eval(s[4:],localnamespace)
print('return result')
return v
except Exception as e:
print('Exception .... ',e,s)
@ -231,18 +226,13 @@ class Blocks(EventDispatcher):
return d
def valueExpr(self,obj,localnamespace={}):
if type(obj) == type(''):
print('1')
return self.strValueExpr(obj,localnamespace)
if type(obj) == type([]):
print('2')
return self.arrayValueExpr(obj,localnamespace)
if type(obj) == type({}):
print('3')
return self.dictValueExpr(obj,localnamespace)
if isinstance(obj,DictObject):
print('4')
return self.dictValueExpr(obj,localnamespace)
print('5',type(obj))
return obj
def __build(self,desc:dict,ancestor=None):
@ -438,9 +428,9 @@ class Blocks(EventDispatcher):
}
"""
def doit(desc):
Logger.info("blocks:%s",str(desc))
# Logger.info("blocks:%s",str(desc))
desc = self.valueExpr(desc)
Logger.info("blocks:%s",str(desc))
# Logger.info("blocks:%s",str(desc))
try:
widget = self.__build(desc,ancestor=ancestor)
self.dispatch('on_built',widget)

View File

@ -23,9 +23,6 @@ class KivySizes:
self.myFontSizes = config.font_sizes
if name is None:
name = config.font_name
print('font_sizes=',config.font_sizes,
'font_name=',config.font_name,
'myFS=',self.myFontSizes)
x = self.myFontSizes.get(name,None)
if x == None:
x = self.myFontSizes.get('normal')

View File

@ -65,7 +65,6 @@ class PageLoader(EventDispatcher):
x = 1 / self.MaxbufferPage
if self.dir != 'down':
x = 1 - x
print('getLocater(),x=%f,dir=%s,self.curpage=%d' % (x,self.dir,self.curpage))
return x
def on_newbegin(self):
@ -82,7 +81,6 @@ class PageLoader(EventDispatcher):
pass
def do_search(self,o,params):
print('PageLoader().do_search(), on_submit handle....',params)
self.newbegin = True
self.dispatch('on_newbegin')
self.params.update(params)
@ -220,7 +218,6 @@ class RelatedLoader(PageLoader):
self.totalObj += len(data['rows'])
super().show_page(o,data)
self.loading = False
print('buffer pages=',len(self.objectPages.keys()),'pages=',self.objectPages.keys())
def loadPreviousPage(self):
if self.loading:
@ -289,25 +286,21 @@ class Paging(PageLoader):
def loadFirstPage(self,o=None):
if self.curpage == 1:
print('return not loading')
return
self.loadPage(1)
def loadPreviousPage(self,o=None):
if self.curpage < 2:
print('return not loading')
return
self.loadPage(self.curpage-1)
def loadNextPage(self,o=None):
if self.curpage >= self.total_page:
print('return not loading')
return
self.loadPage(self.curpage+1)
def loadLastPage(self,o=None):
if self.curpage >= self.total_page:
print('return not loading')
return
self.loadPage(self.total_page)