diff --git a/kivyblocks/form.py b/kivyblocks/form.py index c97cb20..467e26d 100644 --- a/kivyblocks/form.py +++ b/kivyblocks/form.py @@ -190,11 +190,15 @@ class InputBox(BoxLayout): self.input_widget = self.uidef['wclass'](**options) if self.options.get('readonly'): self.input_widget.disabled = True + if self.options.get('value'): + self.input_widget.setValue(self.options.get('value')) + elif self.options.get('default_value'): + self.input_widget.setValue(self.options.get('default_value')) + self.input_widget.widget_id = self.options['name'] self.add_widget(self.input_widget) self.initflag = True self.input_widget.bind(on_focus=self.on_focus) - self.input_widget.setValue(self.options.get('default','')) self.dispatch('on_ready', self) def check(self): @@ -338,15 +342,19 @@ class StrSearchForm(BoxLayout): def __init__(self,img_url=None,**options): self.name = options.get('name','search_string') BoxLayout.__init__(self,orientation='horizontal',size_hint_y=None,height=CSize(3)) - self.input_widget = TextInput( + self.input_widget = StrInput( text='', multiline=False, allow_copy=True, - font_size=CSize(1), + halign='middle', + font_size=1, size_hint_y=None, - height=CSize(3)) + size_hint_x=1, + height=2) self.add_widget(self.input_widget) self.register_event_type('on_submit') + v = options.get('value',options.get('default_value','')) + self.input_widget.setValue(v) self.input_widget.bind(on_text_validate=self.submit_input) def getValue(self): diff --git a/kivyblocks/register.py b/kivyblocks/register.py index 1ae9d6f..d074a21 100644 --- a/kivyblocks/register.py +++ b/kivyblocks/register.py @@ -1,3 +1,4 @@ +import kivy from kivy.utils import platform from .baseWidget import * from .tree import Tree, TextTree, PopupMenu @@ -24,10 +25,13 @@ from .message import Conform from .pagepanel import PagePanel from .markdown import Markdown from .custom_camera import CustomCamera, QrReader -from .camerawithmic import CameraWithMic, ScreenWithMic +from .camerawithmic import CameraWithMic +if kivy.platform in ['win','linux', 'macosx']: + from .camerawithmic import ScreenWithMic r = Factory.register -r('ScreenWithMic', ScreenWithMic) +if kivy.platform in ['win','linux', 'macosx']: + r('ScreenWithMic', ScreenWithMic) r('CameraWithMic', CameraWithMic) r('CustomCamera', CustomCamera) r('QrReader', QrReader) diff --git a/readme/.opencv-android编译出错.md.swp b/readme/.opencv-android编译出错.md.swp deleted file mode 100644 index e72ad0a..0000000 Binary files a/readme/.opencv-android编译出错.md.swp and /dev/null differ