diff --git a/kivyblocks/blocksapp.py b/kivyblocks/blocksapp.py index 14d502e..28a0bdb 100644 --- a/kivyblocks/blocksapp.py +++ b/kivyblocks/blocksapp.py @@ -40,6 +40,7 @@ signal.signal(signal.SIGINT, signal_handler) class BlocksApp(App): def build(self): x = PageContainer() + self.userinfo = {} self.title = 'Test Title' self.blocks = Blocks() config = getConfig() @@ -52,6 +53,13 @@ class BlocksApp(App): Clock.schedule_once(self.build1) 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): x = None x = self.blocks.widgetBuild(self.config.root) diff --git a/kivyblocks/form.py b/kivyblocks/form.py index 356a4d9..ee43ed4 100644 --- a/kivyblocks/form.py +++ b/kivyblocks/form.py @@ -29,6 +29,7 @@ form options "uitype", "uiparams", "default", + "readonly", "required" }, ] @@ -137,14 +138,20 @@ class InputBox(BoxLayout): options['allow_copy'] = True if self.options.get('tip'): options['hint_text'] = i18n(self.options.get('tip')) + 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.initflag = True self.input_widget.bind(on_focus=self.on_focus) if 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): if v: self.old_value = o.text @@ -227,7 +234,6 @@ class Form(BoxLayout): class StrSearchForm(BoxLayout): def __init__(self,img_url=None,**options): - print('here ---------------') self.name = options.get('name','search_string') BoxLayout.__init__(self,orientation='horizontal',size_hint_y=None,height=CSize(3)) self.inputwidget = TextInput( @@ -247,7 +253,6 @@ class StrSearchForm(BoxLayout): self.inputwidget.bind(on_text_validate=self.submit_input) def submit_input(self,o,v=None): - print('StrSearchForm():submit_input() called') text = self.inputwidget.text if text != '': d = { diff --git a/kivyblocks/login.py b/kivyblocks/login.py index 1a6cff2..26842f8 100644 --- a/kivyblocks/login.py +++ b/kivyblocks/login.py @@ -24,7 +24,7 @@ logformdesc = { "uitype":"password" } ] - } + }, "binds":[ "wid":"self", "event":"on_submit", diff --git a/kivyblocks/vplayer.py b/kivyblocks/vplayer.py index 2d0618c..c6363d9 100644 --- a/kivyblocks/vplayer.py +++ b/kivyblocks/vplayer.py @@ -190,6 +190,10 @@ class VPlayer(FloatLayout): return True 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) def on_fullscreen(self, instance, value):