bugfix
This commit is contained in:
parent
7a9cbf194f
commit
b4474b5e21
@ -188,7 +188,9 @@ class Header(WidgetReady, ScrollWidget):
|
|||||||
class Body(WidgetReady, ScrollWidget):
|
class Body(WidgetReady, ScrollWidget):
|
||||||
def __init__(self,part,**kw):
|
def __init__(self,part,**kw):
|
||||||
self.part = part
|
self.part = part
|
||||||
|
kw.update({'spacing':self.part.datagrid.linewidth})
|
||||||
super(Body, self).__init__(**kw)
|
super(Body, self).__init__(**kw)
|
||||||
|
self.size_hint=(1,1)
|
||||||
self.idRow = {}
|
self.idRow = {}
|
||||||
self.bind(on_scroll_stop=self.part.datagrid.on_scrollstop)
|
self.bind(on_scroll_stop=self.part.datagrid.on_scrollstop)
|
||||||
if self.part.freeze_flag:
|
if self.part.freeze_flag:
|
||||||
@ -259,6 +261,7 @@ class DataGridPart(WidgetReady, BoxLayout):
|
|||||||
kw['size_hint'] = (1,None)
|
kw['size_hint'] = (1,None)
|
||||||
kw['height'] = self.datagrid.rowHeight()
|
kw['height'] = self.datagrid.rowHeight()
|
||||||
|
|
||||||
|
self.header = None
|
||||||
if not self.datagrid.noheader:
|
if not self.datagrid.noheader:
|
||||||
self.header = Header(self,**kw)
|
self.header = Header(self,**kw)
|
||||||
self.add_widget(self.header)
|
self.add_widget(self.header)
|
||||||
@ -274,6 +277,15 @@ class DataGridPart(WidgetReady, BoxLayout):
|
|||||||
def addRow(self,id, data):
|
def addRow(self,id, data):
|
||||||
return self.body.addRow(id, data)
|
return self.body.addRow(id, data)
|
||||||
|
|
||||||
|
def on_size(self, o, s=None):
|
||||||
|
if not hasattr(self, 'body'):
|
||||||
|
return
|
||||||
|
self.body.size_hint_y = None
|
||||||
|
if self.header:
|
||||||
|
self.body.height = self.height - self.header.height
|
||||||
|
else:
|
||||||
|
self.body.height = self.height
|
||||||
|
|
||||||
|
|
||||||
class DataGrid(WidgetReady, BoxLayout):
|
class DataGrid(WidgetReady, BoxLayout):
|
||||||
"""
|
"""
|
||||||
@ -408,9 +420,6 @@ class DataGrid(WidgetReady, BoxLayout):
|
|||||||
return self.row_height
|
return self.row_height
|
||||||
|
|
||||||
def calculateShowRows(self,t):
|
def calculateShowRows(self,t):
|
||||||
print('body height=',self.normal_part.body.height
|
|
||||||
,'row_height=',self.rowHeight()
|
|
||||||
)
|
|
||||||
self.show_rows = int(self.normal_part.body.height/self.rowHeight())
|
self.show_rows = int(self.normal_part.body.height/self.rowHeight())
|
||||||
self.dataloader.setPageRows(self.show_rows)
|
self.dataloader.setPageRows(self.show_rows)
|
||||||
|
|
||||||
|
@ -6,11 +6,14 @@ from kivy.graphics import Color, Ellipse,Rectangle
|
|||||||
|
|
||||||
class ScrollWidget(ScrollView):
|
class ScrollWidget(ScrollView):
|
||||||
def __init__(self,**kw):
|
def __init__(self,**kw):
|
||||||
super(ScrollWidget,self).__init__(**kw)
|
super(ScrollWidget,self).__init__()
|
||||||
self.effect_cls = ScrollEffect
|
self.effect_cls = ScrollEffect
|
||||||
self.sized_widgets = []
|
self.sized_widgets = []
|
||||||
self._inner = BoxLayout(orientation='vertical',padding=5,
|
kw.update({
|
||||||
spacing=8,size_hint=(None,None))
|
'size_hint':(None,None),
|
||||||
|
'orientation':'vertical'
|
||||||
|
})
|
||||||
|
self._inner = BoxLayout(**kw)
|
||||||
self._inner.bind(
|
self._inner.bind(
|
||||||
minimum_height=self._inner.setter('height'))
|
minimum_height=self._inner.setter('height'))
|
||||||
self._inner.bind(
|
self._inner.bind(
|
||||||
|
@ -69,9 +69,9 @@ class WidgetCSS(object):
|
|||||||
self.width = CSize(self.width_cm)
|
self.width = CSize(self.width_cm)
|
||||||
|
|
||||||
def set_child_fgcolor(self, c):
|
def set_child_fgcolor(self, c):
|
||||||
if not hasattr(c,'fgcolor'):
|
if not self.fgcolor:
|
||||||
return
|
return
|
||||||
if c.fgcolor:
|
if isinstance(c, WidgetCSS):
|
||||||
return
|
return
|
||||||
if isinstance(c, TextInput):
|
if isinstance(c, TextInput):
|
||||||
c.foreground_color = self.fgcolor
|
c.foreground_color = self.fgcolor
|
||||||
|
Loading…
Reference in New Issue
Block a user