diff --git a/kivyblocks/baseWidget.py b/kivyblocks/baseWidget.py index bce4976..a5d02c3 100755 --- a/kivyblocks/baseWidget.py +++ b/kivyblocks/baseWidget.py @@ -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): diff --git a/kivyblocks/dg.py b/kivyblocks/dg.py index 636477b..e42048f 100644 --- a/kivyblocks/dg.py +++ b/kivyblocks/dg.py @@ -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) diff --git a/kivyblocks/i18n.py b/kivyblocks/i18n.py index fd308a8..0a4314e 100644 --- a/kivyblocks/i18n.py +++ b/kivyblocks/i18n.py @@ -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 diff --git a/kivyblocks/toolbar.py b/kivyblocks/toolbar.py index 200acbf..dd917cb 100644 --- a/kivyblocks/toolbar.py +++ b/kivyblocks/toolbar.py @@ -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, diff --git a/test/ttdg.py b/test/ttdg.py index 508265a..de4a69b 100644 --- a/test/ttdg.py +++ b/test/ttdg.py @@ -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()