Browse Source

Fix loading issue using the new layout

pull/167/head
Eugenio Parodi 3 years ago
parent
commit
530aca0ee9
  1. 8
      TermTk/TTkUiTools/uiloader.py
  2. 1
      ttkDesigner/app/designer.py
  3. 10
      ttkDesigner/app/superobj/superwidget.py

8
TermTk/TTkUiTools/uiloader.py

@ -284,6 +284,14 @@ class TTkUiLoader():
return widget
@staticmethod
def normalise(ui):
cb = {'1.0.0' : TTkUiLoader._convert_1_0_1_to_2_0_0,
'1.0.1' : TTkUiLoader._convert_1_0_1_to_2_0_0,
'2.0.0' : lambda x: x
}.get(ui['version'], lambda x: x)
return cb(ui)
@staticmethod
def loadDict(ui, baseWidget:TTkWidget=None, kwargs=None) -> TTkWidget:
'''load the dictionary representing the ui definition of the widget

1
ttkDesigner/app/designer.py

@ -277,6 +277,7 @@ class TTkDesigner(TTkGridLayout):
with open(fileName) as fp:
dd = json.load(fp)
dd = TTkUiLoader.normalise(dd)
sw = SuperWidget.loadDict(self, self._windowEditor.viewport(), dd['tui'])
self._windowEditor.importSuperWidget(sw)
self._sigslotEditor.importConnections(dd['connections'])

10
ttkDesigner/app/superobj/superwidget.py

@ -172,15 +172,19 @@ class SuperWidget(ttk.TTkContainer):
sch = SuperWidget.loadDict(designer, parent, ch)
if issubclass(type(sch),so.SuperLayout):
schl = sch
else:
elif issubclass(type(sch),so.SuperWidgetContainer):
schl = sch._superLayout
else:
schl = None
if issubclass(type(sl),so.SuperLayoutGrid):
sl.layout().addWidget(sch,ch['row'],ch['col'],ch['rowspan'],ch['colspan'])
schl.setDropBorder(1)
if schl:
schl.setDropBorder(1)
else:
sl.layout().addWidget(sch)
schl.setDropBorder(0)
if schl:
schl.setDropBorder(0)
return sup
def updateAll(self):

Loading…
Cancel
Save