From b582ac7526424f7041273991c6c8174845d9b412 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 30 Apr 2018 15:09:52 +0200 Subject: [PATCH] CURA-5253 Initialize UI elements right after the qml files were loaded. --- cura/CuraApplication.py | 11 ++++------- resources/qml/Topbar.qml | 6 +++++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index db7a436745..f3f0ce2923 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -724,12 +724,6 @@ class CuraApplication(QtApplication): controller = self.getController() - # Initialize UI state - controller.setActiveStage("PrepareStage") - controller.setActiveView("SolidView") - controller.setCameraTool("CameraTool") - controller.setSelectionTool("SelectionTool") - t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis, ToolHandle.ZAxis]) @@ -766,8 +760,11 @@ class CuraApplication(QtApplication): self._qml_import_paths.append(Resources.getPath(self.ResourceTypes.QmlFiles)) self.initializeEngine() - # Make sure the correct stage is activated after QML is loaded + # Initialize UI state controller.setActiveStage("PrepareStage") + controller.setActiveView("SolidView") + controller.setCameraTool("CameraTool") + controller.setSelectionTool("SelectionTool") # Hide the splash screen self.closeSplash() diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 56b7bccb0e..17819dbd27 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -201,7 +201,11 @@ Rectangle // the connection to UM.ActiveView will trigger update so there is no reason to call it manually here } - onCurrentIndexChanged: viewModeButton.setActiveIndex(model.getItem(currentIndex).id) + onCurrentIndexChanged: + { + if (model.getItem(currentIndex).id != undefined) + viewModeButton.setActiveIndex(model.getItem(currentIndex).id) + } currentIndex: getActiveIndex() // watch the active view proxy for changes made from the menu item