comparison cagou/core/xmlui.py @ 159:8ed389d15690

xmlui: fixes: - removed global ScrollView as it was conflicting with TabbedPanel, resulting in unusable settings - replaced GridLayout by BoxLayout when suitable, as they now handle minimum_height
author Goffi <goffi@goffi.org>
date Sat, 28 Apr 2018 10:43:54 +0200
parents 0704f3be65cb
children 37638765c97b
comparison
equal deleted inserted replaced
158:976f22cb3ecc 159:8ed389d15690
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from .constants import Const as C 21 from .constants import Const as C
22 from sat.core.log import getLogger 22 from sat.core.log import getLogger
23 log = getLogger(__name__) 23 log = getLogger(__name__)
24 from sat_frontends.tools import xmlui 24 from sat_frontends.tools import xmlui
25 from kivy.uix.scrollview import ScrollView
26 from kivy.uix.boxlayout import BoxLayout 25 from kivy.uix.boxlayout import BoxLayout
27 from kivy.uix.gridlayout import GridLayout 26 from kivy.uix.gridlayout import GridLayout
28 from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem 27 from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
29 from kivy.uix.textinput import TextInput 28 from kivy.uix.textinput import TextInput
30 from kivy.uix.label import Label 29 from kivy.uix.label import Label
272 271
273 272
274 ## Containers ## 273 ## Containers ##
275 274
276 275
277 class VerticalContainer(xmlui.VerticalContainer, GridLayout): 276 class VerticalContainer(xmlui.VerticalContainer, BoxLayout):
278 277
279 def __init__(self, xmlui_parent): 278 def __init__(self, xmlui_parent):
280 self.xmlui_parent = xmlui_parent 279 self.xmlui_parent = xmlui_parent
281 GridLayout.__init__(self) 280 BoxLayout.__init__(self, orientation="vertical")
282 281
283 def _xmluiAppend(self, widget): 282 def _xmluiAppend(self, widget):
284 self.add_widget(widget) 283 self.add_widget(widget)
285 284
286 285
475 474
476 class FormButton(Button): 475 class FormButton(Button):
477 pass 476 pass
478 477
479 478
480 class XMLUIPanelGrid(GridLayout): 479 class XMLUIPanel(xmlui.XMLUIPanel, BoxLayout):
481 pass
482
483 class XMLUIPanel(xmlui.XMLUIPanel, ScrollView):
484 widget_factory = WidgetFactory() 480 widget_factory = WidgetFactory()
485 481
486 def __init__(self, host, parsed_xml, title=None, flags=None, callback=None, ignore=None, whitelist=None, profile=C.PROF_KEY_NONE): 482 def __init__(self, host, parsed_xml, title=None, flags=None, callback=None, ignore=None, whitelist=None, profile=C.PROF_KEY_NONE):
487 ScrollView.__init__(self) 483 BoxLayout.__init__(self, orientation="vertical")
488 self.close_cb = None 484 self.close_cb = None
489 self._grid = XMLUIPanelGrid()
490 self._post_treats = [] # list of callback to call after UI is constructed 485 self._post_treats = [] # list of callback to call after UI is constructed
491 ScrollView.add_widget(self, self._grid)
492 xmlui.XMLUIPanel.__init__(self, 486 xmlui.XMLUIPanel.__init__(self,
493 host, 487 host,
494 parsed_xml, 488 parsed_xml,
495 title=title, 489 title=title,
496 flags=flags, 490 flags=flags,
497 callback=callback, 491 callback=callback,
498 ignore=ignore, 492 ignore=ignore,
499 whitelist=whitelist, 493 whitelist=whitelist,
500 profile=profile) 494 profile=profile)
501
502 def add_widget(self, wid):
503 self._grid.add_widget(wid)
504 495
505 def setCloseCb(self, close_cb): 496 def setCloseCb(self, close_cb):
506 self.close_cb = close_cb 497 self.close_cb = close_cb
507 498
508 def _xmluiClose(self): 499 def _xmluiClose(self):