bugfix
This commit is contained in:
parent
b67dac6271
commit
9146cdb9ba
@ -82,14 +82,8 @@ class WrapText(Label):
|
||||
texture_size=lambda *x: self.setter('height')(self, self.texture_size[1]))
|
||||
|
||||
|
||||
class Text(BGColorBehavior, Label):
|
||||
def __init__(self,bgcolor=[],fgcolor=[],color_level=-1,**kw):
|
||||
self.options = DictObject(**kw)
|
||||
kwargs = kw.copy()
|
||||
Label.__init__(self,**kwargs)
|
||||
BGColorBehavior.__init__(self,bgcolor=bgcolor,
|
||||
fgcolor=fgcolor,
|
||||
color_level=color_level)
|
||||
class Text(Label):
|
||||
pass
|
||||
|
||||
class PressableImage(ButtonBehavior,AsyncImage):
|
||||
def on_press(self):
|
||||
|
@ -9,6 +9,7 @@ from kivy.properties import BooleanProperty
|
||||
from kivy.properties import ListProperty
|
||||
from kivy.graphics import Color, Rectangle
|
||||
from kivy.app import App
|
||||
from kivy.factory import Factory
|
||||
|
||||
from appPublic.dictObject import DictObject
|
||||
from appPublic.timecost import TimeCost
|
||||
@ -46,7 +47,7 @@ class Cell(BoxLayout):
|
||||
)
|
||||
if not self.row.header and self.desc.get('viewer'):
|
||||
viewer = self.desc.get('viewer')
|
||||
blocks = App.get_running_app().blocks
|
||||
blocks = Factory.Blocks()
|
||||
if isinstance(viewer,str):
|
||||
l = self.desc.copy()
|
||||
l['row'] = self.row
|
||||
@ -59,14 +60,12 @@ class Cell(BoxLayout):
|
||||
if desc['header']:
|
||||
bl = I18nText(otext=str(desc['value']),
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
bgColor=self.row.part.datagrid.header_bgcolor
|
||||
halign='left'
|
||||
)
|
||||
else:
|
||||
bl = BLabel(text = str(desc['value']),
|
||||
font_size=CSize(1),
|
||||
halign='left',
|
||||
bgColor=self.row.part.datagrid.body_bgcolor
|
||||
halign='left'
|
||||
)
|
||||
self.add_widget(bl)
|
||||
bl.bind(on_press=self.cell_press)
|
||||
@ -376,6 +375,10 @@ class DataGrid(WidgetReady, BoxLayout):
|
||||
self.normal_part.body.addRow(id, data, **kw)
|
||||
return id
|
||||
|
||||
def setData(self,data):
|
||||
for d in data:
|
||||
self.addRow(d)
|
||||
|
||||
def delRow(self,id,**kw):
|
||||
if self.freeze_part:
|
||||
self.freeze_part.body.delRowById(id)
|
||||
|
@ -4,6 +4,7 @@ from kivy.properties import StringProperty
|
||||
from appPublic.Singleton import SingletonDecorator
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from .baseWidget import Text
|
||||
from .threadcall import HttpClient
|
||||
|
||||
@SingletonDecorator
|
||||
class I18n:
|
||||
@ -20,7 +21,8 @@ class I18n:
|
||||
app = App.get_running_app()
|
||||
config = getConfig()
|
||||
url = '%s%s/%s' % (config.uihome, config.i18n_url, lang)
|
||||
d = app.hc.get(url)
|
||||
hc = HttpClient()
|
||||
d = hc.get(url)
|
||||
print('i18n() %s get data=' % url, d, type(d))
|
||||
self.kvlang[lang] = d
|
||||
|
||||
|
@ -62,8 +62,7 @@ class Tool(ButtonBehavior, BGColorBehavior, BoxLayout):
|
||||
|
||||
tsize = CSize(self.opts.text_size)
|
||||
label = self.opts.label or self.opts.name
|
||||
self.lbl = I18nText(color_level=self.ancestor.color_level,
|
||||
otext=label,
|
||||
self.lbl = I18nText( otext=label,
|
||||
font_size=int(tsize),
|
||||
text_size=(CSize(len(label)), tsize),
|
||||
height=tsize,
|
||||
|
@ -7,7 +7,7 @@ from kivy.clock import Clock
|
||||
from appPublic.folderUtils import ProgramPath
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.timecost import TimeCost
|
||||
from kivyblocks.blocksapp import BlocksApp
|
||||
from kivyblocks.blocksapp import appBlocksHack
|
||||
|
||||
if __name__ == '__main__':
|
||||
pp = ProgramPath()
|
||||
@ -378,7 +378,12 @@ name293 subject293 34 1 1 1992"""
|
||||
r[f['name']] = d[i]
|
||||
return r
|
||||
|
||||
MyApp().run()
|
||||
def on_close(self,*args,**kwargs):
|
||||
return True
|
||||
|
||||
myapp = MyApp()
|
||||
appBlocksHack(myapp)
|
||||
myapp.run()
|
||||
tc = TimeCost('show')
|
||||
tc.show()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user