Browse Source

Merge branch '4.0' into unify_font_types

Lipu Fei 6 years ago
parent
commit
d97b812ccd

+ 4 - 3
cura/CuraApplication.py

@@ -51,7 +51,7 @@ from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob
 from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob
 from cura.Arranging.ShapeArray import ShapeArray
 from cura.MultiplyObjectsJob import MultiplyObjectsJob
-from cura.PrintersModel import PrintersModel
+from cura.GlobalStacksModel import GlobalStacksModel
 from cura.Scene.ConvexHullDecorator import ConvexHullDecorator
 from cura.Operations.SetParentOperation import SetParentOperation
 from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator
@@ -499,7 +499,8 @@ class CuraApplication(QtApplication):
         preferences.addPreference("cura/choice_on_profile_override", "always_ask")
         preferences.addPreference("cura/choice_on_open_project", "always_ask")
         preferences.addPreference("cura/use_multi_build_plate", False)
-
+        preferences.addPreference("view/settings_list_height", 600)
+        preferences.addPreference("view/settings_visible", False)
         preferences.addPreference("cura/currency", "€")
         preferences.addPreference("cura/material_settings", "{}")
 
@@ -971,7 +972,7 @@ class CuraApplication(QtApplication):
         qmlRegisterType(MultiBuildPlateModel, "Cura", 1, 0, "MultiBuildPlateModel")
         qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer")
         qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel")
-        qmlRegisterType(PrintersModel, "Cura", 1, 0, "PrintersModel")
+        qmlRegisterType(GlobalStacksModel, "Cura", 1, 0, "GlobalStacksModel")
 
         qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel")
         qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel")

+ 3 - 9
cura/PrintersModel.py → cura/GlobalStacksModel.py

@@ -12,7 +12,8 @@ from cura.PrinterOutputDevice import ConnectionType
 
 from cura.Settings.GlobalStack import GlobalStack
 
-class PrintersModel(ListModel):
+
+class GlobalStacksModel(ListModel):
     NameRole = Qt.UserRole + 1
     IdRole = Qt.UserRole + 2
     HasRemoteConnectionRole = Qt.UserRole + 3
@@ -41,21 +42,14 @@ class PrintersModel(ListModel):
         if isinstance(container, GlobalStack):
             self._update()
 
-    ##  Handler for container name change events.
-    def _onContainerNameChanged(self):
-        self._update()
-
     def _update(self) -> None:
         items = []
-        for container in self._container_stacks:
-            container.nameChanged.disconnect(self._onContainerNameChanged)
 
         container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine")
 
         for container_stack in container_stacks:
-            connection_type = container_stack.getMetaDataEntry("connection_type")
+            connection_type = int(container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value))
             has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
-
             if container_stack.getMetaDataEntry("hidden", False) in ["True", True]:
                 continue
 

+ 2 - 2
cura/PrinterOutputDevice.py

@@ -36,7 +36,7 @@ class ConnectionState(IntEnum):
 
 
 class ConnectionType(IntEnum):
-    Unknown = 0
+    NotConnected = 0
     UsbConnection = 1
     NetworkConnection = 2
     CloudConnection = 3
@@ -74,7 +74,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
     # Signal to indicate that the configuration of one of the printers has changed.
     uniqueConfigurationsChanged = pyqtSignal()
 
-    def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.Unknown, parent: QObject = None) -> None:
+    def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.NotConnected, parent: QObject = None) -> None:
         super().__init__(device_id = device_id, parent = parent) # type: ignore  # MyPy complains with the multiple inheritance
 
         self._printers = []  # type: List[PrinterOutputModel]

+ 1 - 1
cura/Settings/MachineManager.py

@@ -527,7 +527,7 @@ class MachineManager(QObject):
     @pyqtProperty(bool, notify = printerConnectedStatusChanged)
     def activeMachineHasRemoteConnection(self) -> bool:
         if self._global_container_stack:
-            connection_type = self._global_container_stack.getMetaDataEntry("connection_type")
+            connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value))
             return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
         return False
 

+ 3 - 37
plugins/PostProcessingPlugin/PostProcessingPlugin.qml

@@ -484,7 +484,7 @@ UM.Dialog
         onClicked: dialog.accept()
     }
 
-    Button
+    Cura.SecondaryButton
     {
         objectName: "postProcessingSaveAreaButton"
         visible: activeScriptsList.count > 0
@@ -492,41 +492,7 @@ UM.Dialog
         width: height
         tooltip: catalog.i18nc("@info:tooltip", "Change active post-processing scripts")
         onClicked: dialog.show()
-
-        style: ButtonStyle
-        {
-            background: Rectangle
-            {
-                id: deviceSelectionIcon
-                border.width: UM.Theme.getSize("default_lining").width
-                border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") :
-                                  control.pressed ? UM.Theme.getColor("action_button_active_border") :
-                                  control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border")
-                color: !control.enabled ? UM.Theme.getColor("action_button_disabled") :
-                           control.pressed ? UM.Theme.getColor("action_button_active") :
-                           control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
-                Behavior on color { ColorAnimation { duration: 50; } }
-
-                anchors.left: parent.left
-                anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2)
-
-                width: parent.height
-                height: parent.height
-
-                UM.RecolorImage
-                {
-                    anchors.verticalCenter: parent.verticalCenter
-                    anchors.horizontalCenter: parent.horizontalCenter
-                    width: Math.round(parent.width / 2)
-                    height: Math.round(parent.height / 2)
-                    sourceSize.height: height
-                    color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") :
-                               control.pressed ? UM.Theme.getColor("action_button_active_text") :
-                               control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text")
-                    source: "postprocessing.svg"
-                }
-            }
-            label: Label { }
-        }
+        iconSource: "postprocessing.svg"
+        fixedWidthMode: true
     }
 }

+ 2 - 2
plugins/SimulationView/LayerSlider.qml

@@ -163,9 +163,9 @@ Item
             id: rangleHandleLabel
 
             height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
-            x: parent.x + parent.width + UM.Theme.getSize("default_margin").width
+            x: parent.x - width - UM.Theme.getSize("default_margin").width
             anchors.verticalCenter: parent.verticalCenter
-            target: Qt.point(sliderRoot.width + width, y + height / 2)
+            target: Qt.point(sliderRoot.width, y + height / 2)
             visible: sliderRoot.activeHandle == parent
 
             // custom properties

+ 2 - 1
plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py

@@ -620,8 +620,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
         if material_group_list is None:
             material_name = i18n_catalog.i18nc("@label:material", "Empty") if len(material_data.get("guid", "")) == 0 \
                         else i18n_catalog.i18nc("@label:material", "Unknown")
+
             return MaterialOutputModel(guid = material_data.get("guid", ""),
-                                        type = material_data.get("type", ""),
+                                        type = material_data.get("material", ""),
                                         color = material_data.get("color", ""),
                                         brand = material_data.get("brand", ""),
                                         name = material_data.get("name", material_name)

+ 1 - 0
resources/qml/ActionPanel/ActionPanelWidget.qml

@@ -23,6 +23,7 @@ Rectangle
     border.width: UM.Theme.getSize("default_lining").width
     border.color: UM.Theme.getColor("lining")
     radius: UM.Theme.getSize("default_radius").width
+    z: 10
 
     property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled
 

+ 0 - 1
resources/qml/ActionPanel/OutputDevicesActionButton.qml

@@ -93,7 +93,6 @@ Item
                         onClicked:
                         {
                             UM.OutputDeviceManager.setActiveDevice(model.id)
-                            widget.requestWriteToDevice()
                             popup.close()
                         }
                     }

+ 42 - 15
resources/qml/ActionPanel/OutputProcessWidget.qml

@@ -40,8 +40,7 @@ Column
             anchors
             {
                 left: parent.left
-                right: printInformationPanel.left
-                rightMargin: printInformationPanel.visible ? UM.Theme.getSize("thin_margin").width : 0
+                right: parent.right
             }
 
             Cura.IconWithText
@@ -52,6 +51,14 @@ Column
                 text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long)
                 source: UM.Theme.getIcon("clock")
                 font: UM.Theme.getFont("large_bold")
+
+                PrintInformationWidget
+                {
+                    id: printInformationPanel
+                    visible: !preSlicedData
+                    anchors.left: parent.left
+                    anchors.leftMargin: parent.contentWidth + UM.Theme.getSize("default_margin").width
+                }
             }
 
             Cura.IconWithText
@@ -84,20 +91,43 @@ Column
                     return totalWeights + "g · " + totalLengths.toFixed(2) + "m"
                 }
                 source: UM.Theme.getIcon("spool")
-            }
-        }
 
-        PrintInformationWidget
-        {
-            id: printInformationPanel
-            visible: !preSlicedData
+                Item
+                {
+                    id: additionalComponents
+                    width: childrenRect.width
+                    anchors.right: parent.right
+                    height: parent.height
+                    Row
+                    {
+                        id: additionalComponentsRow
+                        anchors.right: parent.right
+                        anchors.bottom: parent.bottom
+                        spacing: UM.Theme.getSize("default_margin").width
+                    }
+                }
+                Component.onCompleted: addAdditionalComponents("saveButton")
 
-            anchors
-            {
-                right: parent.right
-                verticalCenter: timeAndCostsInformation.verticalCenter
+                Connections
+                {
+                    target: CuraApplication
+                    onAdditionalComponentsChanged: addAdditionalComponents("saveButton")
+                }
+
+                function addAdditionalComponents (areaId)
+                {
+                    if(areaId == "saveButton")
+                    {
+                        for (var component in CuraApplication.additionalComponents["saveButton"])
+                        {
+                            CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
+                        }
+                    }
+                }
             }
         }
+
+
     }
 
     Item
@@ -127,9 +157,6 @@ Column
 
             onClicked: UM.Controller.setActiveStage("PreviewStage")
             visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage"
-
-            shadowEnabled: true
-            shadowColor: UM.Theme.getColor("action_button_disabled_shadow")
         }
 
         Cura.OutputDevicesActionButton

Some files were not shown because too many files changed in this diff