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