Browse Source

Small fixes to sidebar layout after refactoring

ChrisTerBeke 7 years ago
parent
commit
9702ffb794

+ 1 - 1
resources/qml/Settings/SettingView.qml

@@ -24,7 +24,7 @@ Item
     {
         id: globalProfileRow
         height: UM.Theme.getSize("sidebar_setup").height
-//        visible: !sidebar.monitoringPrint && !sidebar.hideSettings
+        visible: !sidebar.monitoringPrint && !sidebar.hideSettings
 
         anchors
         {

+ 13 - 1
resources/qml/Sidebar.qml

@@ -10,7 +10,6 @@ import UM 1.2 as UM
 import Cura 1.0 as Cura
 import "Menus"
 
-
 Rectangle
 {
     id: base;
@@ -92,6 +91,7 @@ Rectangle
         id: header
         width: parent.width
         visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
+
         onShowTooltip: base.showTooltip(item, location, text)
         onHideTooltip: base.hideTooltip()
     }
@@ -106,6 +106,15 @@ Rectangle
         anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0
     }
 
+    onCurrentModeIndexChanged:
+    {
+        UM.Preferences.setValue("cura/active_mode", currentModeIndex);
+        if(modesListModel.count > base.currentModeIndex)
+        {
+            sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true });
+        }
+    }
+
     Label {
         id: settingsModeLabel
         text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified");
@@ -540,6 +549,7 @@ Rectangle
         visible: monitoringPrint
     }
 
+
     SidebarTooltip
     {
         id: tooltip;
@@ -593,6 +603,7 @@ Rectangle
     UM.SettingPropertyProvider
     {
         id: machineExtruderCount
+
         containerStackId: Cura.MachineManager.activeMachineId
         key: "machine_extruder_count"
         watchedProperties: [ "value" ]
@@ -602,6 +613,7 @@ Rectangle
     UM.SettingPropertyProvider
     {
         id: machineHeatedBed
+
         containerStackId: Cura.MachineManager.activeMachineId
         key: "machine_heated_bed"
         watchedProperties: [ "value" ]

+ 4 - 4
resources/qml/SidebarHeader.qml

@@ -40,7 +40,7 @@ Column
         id: extruderSelectionRow
         width: parent.width
         height: Math.floor(UM.Theme.getSize("sidebar_tabs").height * 2 / 3)
-        visible: machineExtruderCount.properties.value > 1
+        visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
 
         anchors
         {
@@ -229,7 +229,7 @@ Column
     {
         id: materialRow
         height: UM.Theme.getSize("sidebar_setup").height
-        visible: Cura.MachineManager.hasMaterials
+        visible: Cura.MachineManager.hasMaterials && !sidebar.monitoringPrint && !sidebar.hideSettings
 
         anchors
         {
@@ -279,7 +279,7 @@ Column
     {
         id: variantRow
         height: UM.Theme.getSize("sidebar_setup").height
-        visible: Cura.MachineManager.hasVariants
+        visible: Cura.MachineManager.hasVariants && !sidebar.monitoringPrint && !sidebar.hideSettings
 
         anchors
         {
@@ -319,7 +319,7 @@ Column
     {
         id: materialInfoRow
         height: Math.floor(UM.Theme.getSize("sidebar_setup").height / 2)
-        visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials
+        visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings
 
         anchors
         {

+ 1 - 5
resources/qml/SidebarSimple.qml

@@ -572,11 +572,7 @@ Item
                                 var steps = parseInt(infillSteps.properties.value)
                                 var infillModelItem = infillModel.get(i)
 
-                                // TODO: somehow this print causes this method not to crash QML when the sidebar view gets unloaded (when switching states)
-                                // TODO: That should be fixed :P
-                                print("test", density, steps, infillModelItem)
-
-                                if (infillModelItem
+                                if (infillModelItem != "undefined"
                                     && density >= infillModelItem.percentageMin
                                     && density <= infillModelItem.percentageMax
                                     && steps >= infillModelItem.stepsMin