Browse Source

Resolve merge conflicts with master

Lipu Fei 5 years ago
parent
commit
7c36b6a8ba

+ 12 - 10
cura/ApplicationMetadata.py

@@ -9,7 +9,11 @@ DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"
 DEFAULT_CURA_VERSION = "master"
 DEFAULT_CURA_BUILD_TYPE = ""
 DEFAULT_CURA_DEBUG_MODE = False
-DEFAULT_CURA_SDK_VERSION = "7.0.0"
+
+# Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for
+# example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the
+# CuraVersion.py.in template.
+CuraSDKVersion = "7.0.0"
 
 try:
     from cura.CuraVersion import CuraAppName  # type: ignore
@@ -32,6 +36,9 @@ try:
 except ImportError:
     CuraVersion = DEFAULT_CURA_VERSION  # [CodeStyle: Reflecting imported value]
 
+# CURA-6569
+# This string indicates what type of version it is. For example, "enterprise". By default it's empty which indicates
+# a default/normal Cura build.
 try:
     from cura.CuraVersion import CuraBuildType  # type: ignore
 except ImportError:
@@ -42,12 +49,7 @@ try:
 except ImportError:
     CuraDebugMode = DEFAULT_CURA_DEBUG_MODE
 
-try:
-    from cura.CuraVersion import CuraIsSecuredVersion  # type: ignore
-except ImportError:
-    CuraIsSecuredVersion = (CuraBuildType.lower() in ["essentials", "enterprise", "assured", "secure", "secured"])
-
-# Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for
-# example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the
-# CuraVersion.py.in template.
-CuraSDKVersion = "7.0.0"
+# CURA-6569
+# Various convenience flags indicating what kind of Cura build it is.
+__ENTERPRISE_VERSION_TYPE = "enterprise"
+IsEnterpriseVersion = CuraBuildType.lower() == __ENTERPRISE_VERSION_TYPE

+ 1 - 1
cura/CuraApplication.py

@@ -720,7 +720,7 @@ class CuraApplication(QtApplication):
     ##  Handle loading of all plugin types (and the backend explicitly)
     #   \sa PluginRegistry
     def _loadPlugins(self) -> None:
-        self._plugin_registry.setCheckIfTrusted(ApplicationMetadata.CuraIsSecuredVersion)
+        self._plugin_registry.setCheckIfTrusted(ApplicationMetadata.IsEnterpriseVersion)
 
         self._plugin_registry.addType("profile_reader", self._addProfileReader)
         self._plugin_registry.addType("profile_writer", self._addProfileWriter)

+ 4 - 24
cura/Machines/Models/IntentCategoryModel.py

@@ -2,8 +2,8 @@
 #Cura is released under the terms of the LGPLv3 or higher.
 
 from PyQt5.QtCore import Qt, QTimer
-import collections
 from typing import TYPE_CHECKING, Optional, Dict
+from cura.Machines.Models.IntentTranslations import intent_translations
 
 from cura.Machines.Models.IntentModel import IntentModel
 from cura.Settings.IntentManager import IntentManager
@@ -29,26 +29,6 @@ class IntentCategoryModel(ListModel):
 
     modelUpdated = pyqtSignal()
 
-    # Translations to user-visible string. Ordered by weight.
-    # TODO: Create a solution for this name and weight to be used dynamically.
-    _translations = collections.OrderedDict()  # type: "collections.OrderedDict[str,Dict[str,Optional[str]]]"
-    _translations["default"] = {
-        "name": catalog.i18nc("@label", "Default")
-    }
-    _translations["visual"] = {
-        "name": catalog.i18nc("@label", "Visual"),
-        "description": catalog.i18nc("@text", "Optimized for appearance")
-    }
-    _translations["engineering"] = {
-        "name": catalog.i18nc("@label", "Engineering"),
-        "description": catalog.i18nc("@text", "Optimized for higher accuracy")
-    }
-    _translations["quick"] = {
-        "name": catalog.i18nc("@label", "Draft"),
-        "description": catalog.i18nc("@text", "Optimized for fast results")
-    }
-
-
     ##  Creates a new model for a certain intent category.
     #   \param The category to list the intent profiles for.
     def __init__(self, intent_category: str) -> None:
@@ -99,15 +79,15 @@ class IntentCategoryModel(ListModel):
                 "name": IntentCategoryModel.translation(category, "name", catalog.i18nc("@label", "Unknown")),
                 "description": IntentCategoryModel.translation(category, "description", None),
                 "intent_category": category,
-                "weight": list(self._translations.keys()).index(category),
+                "weight": list(intent_translations).index(category),
                 "qualities": qualities
             })
         result.sort(key = lambda k: k["weight"])
         self.setItems(result)
 
-    ##  Get a display value for a category. See IntenCategoryModel._translations
+    ##  Get a display value for a category.
     ##  for categories and keys
     @staticmethod
     def translation(category: str, key: str, default: Optional[str] = None):
-        display_strings = IntentCategoryModel._translations.get(category, {})
+        display_strings = intent_translations.get(category, {})
         return display_strings.get(key, default)

+ 20 - 0
cura/Machines/Models/IntentTranslations.py

@@ -0,0 +1,20 @@
+import collections
+from UM.i18n import i18nCatalog
+catalog = i18nCatalog("cura")
+
+intent_translations = collections.OrderedDict()  # type: "collections.OrderedDict[str, Dict[str, Optional[str]]]"
+intent_translations["default"] = {
+    "name": catalog.i18nc("@label", "Default")
+}
+intent_translations["visual"] = {
+    "name": catalog.i18nc("@label", "Visual"),
+    "description": catalog.i18nc("@text", "The visual profile is designed to print visual prototypes and models with the intent of high visual and surface quality.")
+}
+intent_translations["engineering"] = {
+    "name": catalog.i18nc("@label", "Engineering"),
+    "description": catalog.i18nc("@text", "The engineering profile is designed to print functional prototypes and end-use parts with the intent of better accuracy and for closer tolerances.")
+}
+intent_translations["quick"] = {
+    "name": catalog.i18nc("@label", "Draft"),
+    "description": catalog.i18nc("@text", "The draft profile is designed to print initial prototypes and concept validation with the intent of significant print time reduction.")
+}

+ 4 - 2
cura/Machines/Models/QualityManagementModel.py

@@ -14,6 +14,7 @@ from cura.Machines.ContainerTree import ContainerTree
 from cura.Settings.cura_empty_instance_containers import empty_quality_changes_container
 from cura.Settings.IntentManager import IntentManager
 from cura.Machines.Models.MachineModelUtils import fetchLayerHeight
+from cura.Machines.Models.IntentTranslations import intent_translations
 
 from UM.i18n import i18nCatalog
 catalog = i18nCatalog("cura")
@@ -336,10 +337,11 @@ class QualityManagementModel(ListModel):
                 "quality_type": quality_type,
                 "quality_changes_group": None,
                 "intent_category": intent_category,
-                "section_name": catalog.i18nc("@label", intent_category.capitalize()),
+                "section_name": catalog.i18nc("@label", intent_translations.get(intent_category, {}).get("name", catalog.i18nc("@label", "Unknown"))),
             })
         # Sort by quality_type for each intent category
-        result = sorted(result, key = lambda x: (x["intent_category"], x["quality_type"]))
+
+        result = sorted(result, key = lambda x: (list(intent_translations).index(x["intent_category"]), x["quality_type"]))
         item_list += result
 
         # Create quality_changes group items

+ 11 - 1
cura/Machines/VariantNode.py

@@ -85,10 +85,20 @@ class VariantNode(ContainerNode):
         for base_material, material_node in self.materials.items():
             if self.machine.preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
                 return material_node
-        # First fallback: Choose any material with matching diameter.
+            
+        # First fallback: Check if we should be checking for the 175 variant.
+        if approximate_diameter == 2:
+            preferred_material = self.machine.preferred_material + "_175"
+            for base_material, material_node in self.materials.items():
+                if preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
+                    return material_node
+        
+        # Second fallback: Choose any material with matching diameter.
         for material_node in self.materials.values():
             if material_node.getMetaDataEntry("approximate_diameter") and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
+                Logger.log("w", "Could not find preferred material %s, falling back to whatever works", self.machine.preferred_material)
                 return material_node
+
         fallback = next(iter(self.materials.values()))  # Should only happen with empty material node.
         Logger.log("w", "Could not find preferred material {preferred_material} with diameter {diameter} for variant {variant_id}, falling back to {fallback}.".format(
             preferred_material = self.machine.preferred_material,

+ 4 - 4
cura/UI/CuraSplashScreen.py

@@ -56,11 +56,11 @@ class CuraSplashScreen(QSplashScreen):
         if buildtype:
             version[0] += " (%s)" % buildtype
 
-        # draw version text
+        # Draw version text
         font = QFont()  # Using system-default font here
         font.setPixelSize(37)
         painter.setFont(font)
-        painter.drawText(215, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0])
+        painter.drawText(60, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0])
         if len(version) > 1:
             font.setPixelSize(16)
             painter.setFont(font)
@@ -68,14 +68,14 @@ class CuraSplashScreen(QSplashScreen):
             painter.drawText(247, 105, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[1])
         painter.setPen(QColor(255, 255, 255, 255))
 
-        # draw the loading image
+        # Draw the loading image
         pen = QPen()
         pen.setWidth(6 * self._scale)
         pen.setColor(QColor(32, 166, 219, 255))
         painter.setPen(pen)
         painter.drawArc(60, 150, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16)
 
-        # draw message text
+        # Draw message text
         if self._current_message:
             font = QFont()  # Using system-default font here
             font.setPixelSize(13)

+ 16 - 0
plugins/MachineSettingsAction/MachineSettingsAction.qml

@@ -87,9 +87,25 @@ Cura.MachineAction
             }
         }
     }
+
+    Label
+    {
+        id: machineNameLabel
+        anchors.top: parent.top
+        anchors.left: parent.left
+        anchors.leftMargin: UM.Theme.getSize("default_margin").width
+        text: Cura.MachineManager.activeMachine.name
+        horizontalAlignment: Text.AlignHCenter
+        font: UM.Theme.getFont("large_bold")
+        color: UM.Theme.getColor("text")
+        renderType: Text.NativeRendering
+    }
+
     UM.TabRow
     {
         id: tabBar
+        anchors.top: machineNameLabel.bottom
+        anchors.topMargin: UM.Theme.getSize("default_margin").height
         width: parent.width
         Repeater
         {

+ 6 - 2
plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py

@@ -48,9 +48,13 @@ class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
         drives = {}
 
         bitmask = ctypes.windll.kernel32.GetLogicalDrives()
-        # Check possible drive letters, from A to Z
+        # Check possible drive letters, from C to Z
         # Note: using ascii_uppercase because we do not want this to change with locale!
-        for letter in string.ascii_uppercase:
+        # Skip A and B, since those drives are typically reserved for floppy disks.
+        # Those drives can theoretically be reassigned but it's safer to not check them for removable drives.
+        # Windows will also behave weirdly even with some of its internal functions if you do this (e.g. search indexing doesn't search it).
+        # Users that have removable drives in A or B will just have to save to file and select the drive there.
+        for letter in string.ascii_uppercase[2:]:
             drive = "{0}:/".format(letter)
 
             # Do we really want to skip A and B?

+ 18 - 28
plugins/SimulationView/LayerSlider.qml

@@ -155,25 +155,13 @@ Item
             }
 
             onPositionChanged: parent.onHandleDragged()
-            onPressed: sliderRoot.setActiveHandle(rangeHandle)
+            onPressed:
+            {
+                sliderRoot.setActiveHandle(rangeHandle)
+                sliderRoot.forceActiveFocus()
+            }
         }
 
-        SimulationSliderLabel
-        {
-            id: rangleHandleLabel
-
-            height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
-            x: parent.x - width - UM.Theme.getSize("default_margin").width
-            anchors.verticalCenter: parent.verticalCenter
-            target: Qt.point(sliderRoot.width, y + height / 2)
-            visible: sliderRoot.activeHandle == parent
-
-            // custom properties
-            maximumValue: sliderRoot.maximumValue
-            value: sliderRoot.upperValue
-            busy: UM.SimulationView.busy
-            setValue: rangeHandle.setValueManually // connect callback functions
-        }
     }
 
     onHeightChanged : {
@@ -275,11 +263,12 @@ Item
         {
             id: upperHandleLabel
 
-            height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
-            x: parent.x - parent.width - width
-            anchors.verticalCenter: parent.verticalCenter
-            target: Qt.point(sliderRoot.width, y + height / 2)
-            visible: sliderRoot.activeHandle == parent
+            height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height
+            anchors.bottom: parent.top
+            anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
+            anchors.horizontalCenter: parent.horizontalCenter
+            target: Qt.point(parent.width / 2, parent.top)
+            visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
 
             // custom properties
             maximumValue: sliderRoot.maximumValue
@@ -384,11 +373,12 @@ Item
         {
             id: lowerHandleLabel
 
-            height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height
-            x: parent.x - parent.width - width
-            anchors.verticalCenter: parent.verticalCenter
-            target: Qt.point(sliderRoot.width + width, y + height / 2)
-            visible: sliderRoot.activeHandle == parent
+            height: sliderRoot.handleSize + UM.Theme.getSize("small_margin").height
+            anchors.top: parent.bottom
+            anchors.topMargin: UM.Theme.getSize("narrow_margin").height
+            anchors.horizontalCenter: parent.horizontalCenter
+            target: Qt.point(parent.width / 2, parent.bottom)
+            visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
 
             // custom properties
             maximumValue: sliderRoot.maximumValue
@@ -397,4 +387,4 @@ Item
             setValue: lowerHandle.setValueManually // connect callback functions
         }
     }
-}
+}

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