bugfix
This commit is contained in:
parent
07bea7bb61
commit
0b2a01cec6
BIN
kivyblocks/.uitype.py.swp
Normal file
BIN
kivyblocks/.uitype.py.swp
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/bgcolorbehavior.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/bgcolorbehavior.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/blocksapp.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/blocksapp.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/color_definitions.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/color_definitions.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/colorcalc.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/colorcalc.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/kivysize.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/kivysize.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/login.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/login.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/pagescontainer.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/pagescontainer.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/ready.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/ready.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/threadcall.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/threadcall.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/uitype.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/uitype.cpython-39.pyc
Normal file
Binary file not shown.
BIN
kivyblocks/__pycache__/utils.cpython-39.pyc
Normal file
BIN
kivyblocks/__pycache__/utils.cpython-39.pyc
Normal file
Binary file not shown.
@ -2,6 +2,7 @@
|
||||
import os
|
||||
import sys
|
||||
from kivy.resources import resource_add_path
|
||||
from kivy.config import Config
|
||||
resource_add_path(os.path.join(os.path.dirname(__file__),'./ttf'))
|
||||
Config.set('kivy', 'default_font', [
|
||||
'msgothic',
|
||||
@ -17,7 +18,6 @@ from appPublic.uniqueID import getID
|
||||
from appPublic.rsa import RSA
|
||||
|
||||
from kivy.factory import Factory
|
||||
from kivy.config import Config
|
||||
from kivy.metrics import sp,dp,mm
|
||||
from kivy.core.window import WindowBase, Window
|
||||
from kivy.clock import Clock
|
||||
|
BIN
kivyblocks/imgs/crud_add.png
Normal file
BIN
kivyblocks/imgs/crud_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
kivyblocks/imgs/crud_browser.png
Normal file
BIN
kivyblocks/imgs/crud_browser.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
kivyblocks/imgs/crud_del.png
Normal file
BIN
kivyblocks/imgs/crud_del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
kivyblocks/imgs/crud_edit.png
Normal file
BIN
kivyblocks/imgs/crud_edit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
kivyblocks/imgs/crud_filter.png
Normal file
BIN
kivyblocks/imgs/crud_filter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -8,6 +8,8 @@ we use a register machinans to maintian the ui type information to build the vie
|
||||
|
||||
import ujson as json
|
||||
from kivy.factory import Factory
|
||||
from kivy.properties import NumericProperty, StringProperty, \
|
||||
BooleanProperty
|
||||
from kivy.uix.label import Label
|
||||
|
||||
from appPublic.myTE import string_template_render
|
||||
@ -17,6 +19,36 @@ from .baseWidget import WrapText, Text
|
||||
from .widgetExt.inputext import FloatInput,IntegerInput, \
|
||||
StrInput,SelectInput, BoolInput, AmountInput, Password
|
||||
|
||||
class StringView(Label):
|
||||
def __init__(self, **kw):
|
||||
super(StringView, self).__init__(**kw)
|
||||
self.wrap = True
|
||||
self.halign = 'left'
|
||||
self.valign = 'middle'
|
||||
|
||||
def getValue(self):
|
||||
return self.text
|
||||
|
||||
def setValue(self, v):
|
||||
self.text = str(v)
|
||||
|
||||
class PasswordView(StringView):
|
||||
def __init__(self, text='*', **kw):
|
||||
super(PasswordView, self).__init__(text=text, **kw)
|
||||
|
||||
def getValue(self):
|
||||
return None
|
||||
|
||||
def setValue(self, v):
|
||||
pass
|
||||
|
||||
class TextView(WrapText):
|
||||
def getValue(self):
|
||||
return self.text
|
||||
|
||||
def setValue(self, v):
|
||||
self.text = v
|
||||
|
||||
view_widget_builders = {
|
||||
}
|
||||
|
||||
@ -62,7 +94,7 @@ def get_value(desc, rec=None):
|
||||
|
||||
def build_view_str_widget(desc, rec=None):
|
||||
txt = get_value(desc, rec=rec)
|
||||
return Label(text=str(txt) if txt else '',
|
||||
return StringView(text=str(txt) if txt else '',
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
valign='middle')
|
||||
@ -74,7 +106,7 @@ view_register('timestamp', build_view_str_widget)
|
||||
|
||||
def build_view_text_widget(desc, rec=None):
|
||||
txt = get_value(desc, rec=rec)
|
||||
return WrapText(text=str(txt) if txt else '',
|
||||
return TextView(text=str(txt) if txt else '',
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
valign='middle')
|
||||
@ -82,32 +114,74 @@ def build_view_text_widget(desc, rec=None):
|
||||
view_register('text', build_view_text_widget)
|
||||
|
||||
def build_view_passwd_widget(desc, rec=None):
|
||||
return Label(text='*',
|
||||
return PasswordView(text='*',
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
valign='middle')
|
||||
|
||||
view_register('password', build_view_passwd_widget)
|
||||
|
||||
class BoolView(Label):
|
||||
value = BooleanProperty(False)
|
||||
def __init__(self, text='', **kw):
|
||||
super(BoolView, self).__init__(text='', **kw)
|
||||
self.wrap = True
|
||||
self.halign = 'center'
|
||||
self.valign = 'middle'
|
||||
|
||||
def on_value(self, *args):
|
||||
if self.value:
|
||||
self.text = 'true'
|
||||
else:
|
||||
self.text = 'false'
|
||||
|
||||
def getValue(self):
|
||||
return self.value
|
||||
|
||||
def setValue(self, v):
|
||||
self.value = v
|
||||
|
||||
def build_view_bool_widget(desc, rec=None):
|
||||
v = get_value(desc, rec)
|
||||
if v is not None:
|
||||
return Label(text='True' if v else 'False',
|
||||
return BoolView(value=v,
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
valign='middle')
|
||||
|
||||
default_value = desc.get('nullvalue','')
|
||||
return Label(text=default_value,
|
||||
default_value = desc.get('nullvalue',False)
|
||||
return BoolView(value=default_Value,
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
valign='middle')
|
||||
|
||||
view_register('bool', build_view_bool_widget)
|
||||
|
||||
class IntView(Text):
|
||||
value = NumericProperty(None)
|
||||
nullstr = StringProperty('')
|
||||
def __init__(self, **kw):
|
||||
super(IntView, self).__init__(text='', **kw)
|
||||
self.wrap = True
|
||||
self.halign = 'right'
|
||||
self.valign = 'middle'
|
||||
|
||||
def on_value(self, *args):
|
||||
if self.value is not None:
|
||||
self.text = str(v)
|
||||
else:
|
||||
self.text = self.nullstr
|
||||
|
||||
def setValue(self, v):
|
||||
self.value = v
|
||||
|
||||
def getValue(self):
|
||||
return self.value
|
||||
|
||||
def build_view_int_widget(desc, rec=None):
|
||||
v = get_value(desc, rec=rec)
|
||||
default_value = desc.get('nullvalue','')
|
||||
return Label(text=str(v) if v is not None else default_value,
|
||||
return IntValue(value=v,
|
||||
nullstr=desc.get('nullstr',''),
|
||||
font_size=CSize(1),
|
||||
halign='right',
|
||||
valign='middle'
|
||||
@ -115,11 +189,33 @@ def build_view_int_widget(desc, rec=None):
|
||||
|
||||
view_register('int', build_view_int_widget)
|
||||
|
||||
class FloatView(Text):
|
||||
value = NumericProperty(None)
|
||||
nullstr = StringProperty('')
|
||||
dec = NumericProperty(2)
|
||||
def __init__(self, **kw):
|
||||
super(FloatView, self).__init__(text=self.nullstr, **kw)
|
||||
self.wrap = True
|
||||
self.halign = 'right'
|
||||
self.valign = 'middle'
|
||||
|
||||
def on_value(self, *args):
|
||||
if self.value is None:
|
||||
self.text = self.bullstr
|
||||
f = '%%.0%df' % self.dec
|
||||
self.text = f % self.value
|
||||
|
||||
def getValue(self):
|
||||
return self.value
|
||||
|
||||
def setValue(self, v):
|
||||
self.value = v
|
||||
|
||||
def build_view_float_widget(desc, rec=None):
|
||||
v = get_value(desc, rec=rec)
|
||||
f = '%%.0%df' % desc.get('dec',2)
|
||||
default_value = desc.get('nullvalue','')
|
||||
return Label(text=f % float(v) if v is not None else default_value,
|
||||
return FloatView(value=v,
|
||||
dec=desc.get('dec', 2),
|
||||
nullstr=desc.get('nullstr',''),
|
||||
font_size=CSize(1),
|
||||
halign='right',
|
||||
valign='middle'
|
||||
@ -141,9 +237,16 @@ def build_view_code_widget(desc, rec=None):
|
||||
|
||||
view_register('code', build_view_code_widget)
|
||||
|
||||
def amount_str(v, dec):
|
||||
f = '%%.0%df' % dec
|
||||
s = f % v
|
||||
class AmountView(FloatView):
|
||||
def on_value(self, *args):
|
||||
if self.value is None:
|
||||
self.text = self.nullstr
|
||||
else:
|
||||
self.text = self.amount_str()
|
||||
|
||||
def amount_str(self):
|
||||
f = '%%.0%df' % self.dec
|
||||
s = f % self.value
|
||||
parts = s.split('.')
|
||||
p_int = parts[0]
|
||||
subs = []
|
||||
@ -165,10 +268,10 @@ def amount_str(v, dec):
|
||||
|
||||
def build_view_amount_widget(desc, rec=None):
|
||||
v = get_value(desc, rec=rec)
|
||||
defaultvalue = desc.get('nullvalue', '')
|
||||
if v:
|
||||
f = '%%.0%df' % desc.get('dec',2)
|
||||
return Label(text=amount_str(v, dec),
|
||||
defaultvalue = desc.get('nullstr', '')
|
||||
return Amount(value=v,
|
||||
dec=desc.get('dec', 2),
|
||||
nullstr=defaultvale,
|
||||
font_size=CSize(1),
|
||||
halign='right',
|
||||
valign='middle'
|
||||
|
Loading…
Reference in New Issue
Block a user