diff --git a/TermTk/TTkUiTools/uiloader.py b/TermTk/TTkUiTools/uiloader.py index 93a36b53..aca8e0f8 100644 --- a/TermTk/TTkUiTools/uiloader.py +++ b/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 diff --git a/ttkDesigner/app/designer.py b/ttkDesigner/app/designer.py index 4c7bea14..763cb40a 100644 --- a/ttkDesigner/app/designer.py +++ b/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']) diff --git a/ttkDesigner/app/superobj/superwidget.py b/ttkDesigner/app/superobj/superwidget.py index f9b3f059..7688e516 100644 --- a/ttkDesigner/app/superobj/superwidget.py +++ b/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):