This commit is contained in:
yumoqing 2019-12-21 18:28:00 +08:00
parent f8c06c9e8e
commit 8dc469d966
4 changed files with 21 additions and 4 deletions

View File

@ -40,6 +40,7 @@ signal.signal(signal.SIGINT, signal_handler)
class BlocksApp(App): class BlocksApp(App):
def build(self): def build(self):
x = PageContainer() x = PageContainer()
self.userinfo = {}
self.title = 'Test Title' self.title = 'Test Title'
self.blocks = Blocks() self.blocks = Blocks()
config = getConfig() config = getConfig()
@ -52,6 +53,13 @@ class BlocksApp(App):
Clock.schedule_once(self.build1) Clock.schedule_once(self.build1)
return x return x
def setUserInfo(self,uinfo):
d = {}
d['userid'] = uinfo['userid']
d['password'] = uinfo.get('password','')
d['authcode'] = uinfo.get('authcode','')
self.userinfo = d
def build1(self,t): def build1(self,t):
x = None x = None
x = self.blocks.widgetBuild(self.config.root) x = self.blocks.widgetBuild(self.config.root)

View File

@ -29,6 +29,7 @@ form options
"uitype", "uitype",
"uiparams", "uiparams",
"default", "default",
"readonly",
"required" "required"
}, },
] ]
@ -137,14 +138,20 @@ class InputBox(BoxLayout):
options['allow_copy'] = True options['allow_copy'] = True
if self.options.get('tip'): if self.options.get('tip'):
options['hint_text'] = i18n(self.options.get('tip')) options['hint_text'] = i18n(self.options.get('tip'))
self.input_widget = self.uidef['wclass'](**options) self.input_widget = self.uidef['wclass'](**options)
self.form[self.options['name']] = self.input_widget if self.options.get('readonly'):
self.input_widget.disabled = True
self.form.widget_ids[self.options['name']] = self.input_widget
self.add_widget(self.input_widget) self.add_widget(self.input_widget)
self.initflag = True self.initflag = True
self.input_widget.bind(on_focus=self.on_focus) self.input_widget.bind(on_focus=self.on_focus)
if self.options.get('default'): if self.options.get('default'):
self.input_widget.setValue(self.options.get('default')) self.input_widget.setValue(self.options.get('default'))
def clear(self):
self.input_widget.setValue('')
def on_focus(self,o,v): def on_focus(self,o,v):
if v: if v:
self.old_value = o.text self.old_value = o.text
@ -227,7 +234,6 @@ class Form(BoxLayout):
class StrSearchForm(BoxLayout): class StrSearchForm(BoxLayout):
def __init__(self,img_url=None,**options): def __init__(self,img_url=None,**options):
print('here ---------------')
self.name = options.get('name','search_string') self.name = options.get('name','search_string')
BoxLayout.__init__(self,orientation='horizontal',size_hint_y=None,height=CSize(3)) BoxLayout.__init__(self,orientation='horizontal',size_hint_y=None,height=CSize(3))
self.inputwidget = TextInput( self.inputwidget = TextInput(
@ -247,7 +253,6 @@ class StrSearchForm(BoxLayout):
self.inputwidget.bind(on_text_validate=self.submit_input) self.inputwidget.bind(on_text_validate=self.submit_input)
def submit_input(self,o,v=None): def submit_input(self,o,v=None):
print('StrSearchForm():submit_input() called')
text = self.inputwidget.text text = self.inputwidget.text
if text != '': if text != '':
d = { d = {

View File

@ -24,7 +24,7 @@ logformdesc = {
"uitype":"password" "uitype":"password"
} }
] ]
} },
"binds":[ "binds":[
"wid":"self", "wid":"self",
"event":"on_submit", "event":"on_submit",

View File

@ -190,6 +190,10 @@ class VPlayer(FloatLayout):
return True return True
def on_state(self,o,v): def on_state(self,o,v):
if self._video.state == 'play':
Window.allow_screensaver = False
else:
Window.allow_screensaver = True
print('onstate()',o,v,self._video.state) print('onstate()',o,v,self._video.state)
def on_fullscreen(self, instance, value): def on_fullscreen(self, instance, value):