bugfix
This commit is contained in:
parent
efcd7785b9
commit
ab79735f7f
@ -1,6 +1,7 @@
|
|||||||
from kivy.uix.textinput import TextInput
|
from kivy.uix.textinput import TextInput
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
|
from kivy.graphics import Color
|
||||||
from kivycalendar import DatePicker
|
from kivycalendar import DatePicker
|
||||||
from .responsivelayout import VResponsiveLayout
|
from .responsivelayout import VResponsiveLayout
|
||||||
from .widgetExt.inputext import FloatInput,IntegerInput, \
|
from .widgetExt.inputext import FloatInput,IntegerInput, \
|
||||||
@ -82,7 +83,7 @@ uitypes = {
|
|||||||
"wclass":StrInput,
|
"wclass":StrInput,
|
||||||
"options":{
|
"options":{
|
||||||
"multiline":True,
|
"multiline":True,
|
||||||
"height":CSize(6),
|
"height":CSize(9),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"teleno":{
|
"teleno":{
|
||||||
@ -127,23 +128,35 @@ class InputBox(BoxLayout):
|
|||||||
i18n = I18n()
|
i18n = I18n()
|
||||||
if self.initflag:
|
if self.initflag:
|
||||||
return
|
return
|
||||||
label = self.options.get('label',self.options.get('name'))
|
opts = {
|
||||||
if self.options.get('required'):
|
"orientation":"vertical",
|
||||||
label = label + '*'
|
|
||||||
kwargs = {
|
|
||||||
"otext":label,
|
|
||||||
"font_size":CSize(1),
|
|
||||||
"size_hint_y":None,
|
"size_hint_y":None,
|
||||||
"height":CSize(3)
|
"height":CSize(3)
|
||||||
}
|
}
|
||||||
if self.labelwidth<=1:
|
if self.labelwidth<=1:
|
||||||
kwargs['size_hint_x'] = self.labelwidth
|
opts['size_hint_x'] = self.labelwidth
|
||||||
else:
|
else:
|
||||||
kwargs['size_hint_x'] = None
|
opts['size_hint_x'] = None
|
||||||
kwargs['width'] = self.labelwidth
|
opts['width'] = self.labelwidth
|
||||||
|
bl = BoxLayout(**opts)
|
||||||
|
self.add_widget(bl)
|
||||||
|
label = self.options.get('label',self.options.get('name'))
|
||||||
|
kwargs = {
|
||||||
|
"otext":label,
|
||||||
|
"font_size":CSize(1),
|
||||||
|
"size_hint_x":None,
|
||||||
|
"width":CSize(len(label)),
|
||||||
|
"size_hint_y":None,
|
||||||
|
"height":CSize(3)
|
||||||
|
}
|
||||||
self.labeltext = I18nText(**kwargs)
|
self.labeltext = I18nText(**kwargs)
|
||||||
self.add_widget(self.labeltext)
|
bl.add_widget(self.labeltext)
|
||||||
|
if self.options.get('required',False):
|
||||||
|
star = Label(text='*',
|
||||||
|
color=(1,0,0,1),
|
||||||
|
size_hint_x=None,
|
||||||
|
width=CSize(1))
|
||||||
|
bl.add_widget(star)
|
||||||
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
|
||||||
@ -152,7 +165,6 @@ class InputBox(BoxLayout):
|
|||||||
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'))
|
||||||
|
|
||||||
print('uitype=',self.options['uitype'], self.uitype, 'uidef=',self.uidef)
|
|
||||||
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
|
||||||
@ -160,8 +172,7 @@ class InputBox(BoxLayout):
|
|||||||
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'):
|
self.input_widget.setValue(self.options.get('default',''))
|
||||||
self.input_widget.setValue(self.options.get('default'))
|
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.input_widget.setValue('')
|
self.input_widget.setValue('')
|
||||||
@ -228,9 +239,9 @@ class Form(BoxLayout):
|
|||||||
self.add_widget(self.toolbar)
|
self.add_widget(self.toolbar)
|
||||||
self.add_widget(self.fsc)
|
self.add_widget(self.fsc)
|
||||||
self.fieldWidgets=[]
|
self.fieldWidgets=[]
|
||||||
|
previous_w = None
|
||||||
for f in self.options['fields']:
|
for f in self.options['fields']:
|
||||||
w = InputBox(self, **f)
|
w = InputBox(self, **f)
|
||||||
# print('w size=',w.size)
|
|
||||||
self.fsc.add_widget(w)
|
self.fsc.add_widget(w)
|
||||||
self.fieldWidgets.append(w)
|
self.fieldWidgets.append(w)
|
||||||
blocks = App.get_running_app().blocks
|
blocks = App.get_running_app().blocks
|
||||||
|
BIN
kivyblocks/imgs/cancel.png
Normal file
BIN
kivyblocks/imgs/cancel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 14 KiB |
@ -16,6 +16,7 @@ logformdesc = {
|
|||||||
"name":"userid",
|
"name":"userid",
|
||||||
"label":"user name",
|
"label":"user name",
|
||||||
"datatype":"str",
|
"datatype":"str",
|
||||||
|
"required":True,
|
||||||
"uitype":"string"
|
"uitype":"string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user