This commit is contained in:
yumoqing 2021-02-03 18:12:12 +08:00
parent 6738c7e76c
commit ac8b3969cb
3 changed files with 18 additions and 6 deletions

View File

@ -190,11 +190,15 @@ class InputBox(BoxLayout):
self.input_widget = self.uidef['wclass'](**options) self.input_widget = self.uidef['wclass'](**options)
if self.options.get('readonly'): if self.options.get('readonly'):
self.input_widget.disabled = True 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.input_widget.widget_id = self.options['name']
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)
self.input_widget.setValue(self.options.get('default',''))
self.dispatch('on_ready', self) self.dispatch('on_ready', self)
def check(self): def check(self):
@ -338,15 +342,19 @@ class StrSearchForm(BoxLayout):
def __init__(self,img_url=None,**options): def __init__(self,img_url=None,**options):
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.input_widget = TextInput( self.input_widget = StrInput(
text='', text='',
multiline=False, multiline=False,
allow_copy=True, allow_copy=True,
font_size=CSize(1), halign='middle',
font_size=1,
size_hint_y=None, size_hint_y=None,
height=CSize(3)) size_hint_x=1,
height=2)
self.add_widget(self.input_widget) self.add_widget(self.input_widget)
self.register_event_type('on_submit') 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) self.input_widget.bind(on_text_validate=self.submit_input)
def getValue(self): def getValue(self):

View File

@ -1,3 +1,4 @@
import kivy
from kivy.utils import platform from kivy.utils import platform
from .baseWidget import * from .baseWidget import *
from .tree import Tree, TextTree, PopupMenu from .tree import Tree, TextTree, PopupMenu
@ -24,9 +25,12 @@ from .message import Conform
from .pagepanel import PagePanel from .pagepanel import PagePanel
from .markdown import Markdown from .markdown import Markdown
from .custom_camera import CustomCamera, QrReader 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 = Factory.register
if kivy.platform in ['win','linux', 'macosx']:
r('ScreenWithMic', ScreenWithMic) r('ScreenWithMic', ScreenWithMic)
r('CameraWithMic', CameraWithMic) r('CameraWithMic', CameraWithMic)
r('CustomCamera', CustomCamera) r('CustomCamera', CustomCamera)