This commit is contained in:
yumoqing 2020-12-04 15:29:17 +08:00
parent 6569482bfd
commit a36ada0574
3 changed files with 15 additions and 6 deletions

View File

@ -181,8 +181,8 @@ class InputBox(BoxLayout):
options = self.uidef.get('options',{}).copy() options = self.uidef.get('options',{}).copy()
options.update(self.options.get('uiparams',{})) options.update(self.options.get('uiparams',{}))
options['allow_copy'] = True options['allow_copy'] = True
options['width'] = 1 options['width'] = options.get('width',20)
options['height'] = 2.5 options['height'] = options.get('height',1)
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'))

View File

@ -19,6 +19,8 @@
}, },
} }
""" """
from appPublic.uniqueID import getID
from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
from kivy.clock import Clock from kivy.clock import Clock
from kivy.factory import Factory from kivy.factory import Factory
@ -28,15 +30,21 @@ from .bgcolorbehavior import BGColorBehavior
class TabsPanel(BGColorBehavior, TabbedPanel): class TabsPanel(BGColorBehavior, TabbedPanel):
def __init__(self,color_level=-1, def __init__(self,color_level=-1,
radius=[], radius=[],
tabs=[],
**options): **options):
self.tabs_list = options.get('tabs') self.tabs_list = tabs
TabbedPanel.__init__(self,**options) TabbedPanel.__init__(self,**options)
BGColorBehavior.__init__(self,color_level=color_level, BGColorBehavior.__init__(self,color_level=color_level,
radius=radius) radius=radius)
Clock.schedule_once(self.add_tabs,0) Clock.schedule_once(self.add_tabs,0)
def add_tab(self,text,desc): def newname(self):
return getID()
def add_tab(self,name,text,desc):
def add(o,w): def add(o,w):
if not hasattr(w,'widget_id'):
w.widget_id = name
self.add_widget(TabbedPanelItem(text=text,content=w)) self.add_widget(TabbedPanelItem(text=text,content=w))
blocks = Factory.Blocks() blocks = Factory.Blocks()
blocks.bind(on_built=add) blocks.bind(on_built=add)
@ -44,9 +52,10 @@ class TabsPanel(BGColorBehavior, TabbedPanel):
def add_tabs(self,*args): def add_tabs(self,*args):
for d in self.tabs_list: for d in self.tabs_list:
name = d.get('name',self.newname())
text = d['text'] text = d['text']
desc = d['content'] desc = d['content']
self.add_tab(text,desc) self.add_tab(name,text,desc)
Factory.register('TabsPanel',TabsPanel) Factory.register('TabsPanel',TabsPanel)

View File

@ -71,7 +71,7 @@ class StrInput(TextInput):
a['password'] = kv.get('password',False) a['password'] = kv.get('password',False)
a['multiline'] = kv.get('multiline',False) a['multiline'] = kv.get('multiline',False)
Logger.info('TextInput:a=%s,h=%d,w=%d,CSize(1)=%d',a,h,w,CSize(1)) Logger.info('TextInput:a=%s,kv=%s',a,kv)
super(StrInput,self).__init__(**a) super(StrInput,self).__init__(**a)
self.old_value = None self.old_value = None
self.register_event_type('on_changed') self.register_event_type('on_changed')