Browse Source

CURA-5253 Initialize UI elements right after the qml files were loaded.

Diego Prado Gesto 6 years ago
parent
commit
b582ac7526
2 changed files with 9 additions and 8 deletions
  1. 4 7
      cura/CuraApplication.py
  2. 5 1
      resources/qml/Topbar.qml

+ 4 - 7
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()

+ 5 - 1
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