Lipu Fei 5 лет назад
Родитель
Сommit
4f91389941

+ 1 - 1
plugins/SliceInfoPlugin/MoreInfoWindow.qml

@@ -88,7 +88,7 @@ Window
                     right: parent.right
                 }
 
-                textArea.text: manager.getExampleData()
+                textArea.text: (manager === null) ? "" : manager.getExampleData()
                 textArea.textFormat: Text.RichText
                 textArea.wrapMode: Text.Wrap
                 textArea.readOnly: true

+ 2 - 2
resources/qml/JobSpecs.qml

@@ -14,7 +14,7 @@ Item
     id: base
 
     property bool activity: CuraApplication.platformActivity
-    property string fileBaseName: PrintInformation.baseName
+    property string fileBaseName: (PrintInformation === null) ? "" : PrintInformation.baseName
 
     UM.I18nCatalog
     {
@@ -80,7 +80,7 @@ Item
             height: UM.Theme.getSize("jobspecs_line").height
             width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
             maximumLength: 120
-            text: PrintInformation.jobName
+            text: (PrintInformation === null) ? "" : PrintInformation.jobName
             horizontalAlignment: TextInput.AlignLeft
 
             property string textBeforeEdit: ""

+ 12 - 4
resources/qml/Menus/MaterialMenu.qml

@@ -13,11 +13,19 @@ Menu
     title: catalog.i18nc("@label:category menu label", "Material")
 
     property int extruderIndex: 0
-    property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
-    property var activeExtruder: Cura.MachineManager.activeMachine.extruderList[extruderIndex]
-    property bool isActiveExtruderEnabled: activeExtruder === undefined ? false : activeExtruder.isEnabled
+    property string currentRootMaterialId:
+    {
+        var value = Cura.MachineManager.currentRootMaterialId[extruderIndex]
+        return (value === undefined) ? "" : value
+    }
+    property var activeExtruder:
+    {
+        var activeMachine = Cura.MachineManager.activeMachine
+        return (activeMachine === null) ? null : activeMachine.extruderList[extruderIndex]
+    }
+    property bool isActiveExtruderEnabled: activeExtruder === null ? false : activeExtruder.isEnabled
 
-    property string activeMaterialId: activeExtruder === undefined ? false : activeExtruder.material.id
+    property string activeMaterialId: activeExtruder === null ? false : activeExtruder.material.id
 
     property bool updateModels: true
     Cura.FavoriteMaterialsModel

+ 10 - 0
resources/qml/Menus/NozzleMenu.qml

@@ -28,12 +28,22 @@ Menu
             text: model.hotend_name
             checkable: true
             checked: {
+                var activeMachine = Cura.MachineManager.activeMachine
+                if (activeMachine === null)
+                {
+                    return false
+                }
                 var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
                 return (extruder === undefined) ? false : (extruder.variant.name == model.hotend_name)
             }
             exclusiveGroup: group
             enabled:
             {
+                var activeMachine = Cura.MachineManager.activeMachine
+                if (activeMachine === null)
+                {
+                    return false
+                }
                 var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
                 return (extruder === undefined) ? false : extruder.isEnabled
             }

+ 1 - 1
resources/qml/Menus/SettingsMenu.qml

@@ -22,7 +22,7 @@ Menu
         Menu
         {
             title: modelData.name
-            property var extruder: Cura.MachineManager.activeMachine.extruderList[model.index]
+            property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index]
             NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.activeMachine.hasVariants; extruderIndex: index }
             MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.activeMachine.hasMaterials; extruderIndex: index }