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

View File

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

View File

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