Просмотр исходного кода

Make build plate shapes translatable

fieldOfView 8 лет назад
Родитель
Сommit
dc33d96e8c
2 измененных файлов с 15 добавлено и 5 удалено
  1. 3 2
      cura/BuildVolume.py
  2. 12 3
      plugins/MachineSettingsAction/MachineSettingsAction.qml

+ 3 - 2
cura/BuildVolume.py

@@ -183,7 +183,7 @@ class BuildVolume(SceneNode):
         min_d = -self._depth / 2
         max_d = self._depth / 2
 
-        if self._shape.lower() != "elliptic":
+        if self._shape != "elliptic":
             # Outline 'cube' of the build volume
             mb = MeshBuilder()
             mb.addLine(Vector(min_w, min_h, min_d), Vector(max_w, min_h, min_d), color = self.VolumeOutlineColor)
@@ -614,7 +614,8 @@ class BuildVolume(SceneNode):
                 bottom_unreachable_border = max(bottom_unreachable_border, other_offset_y - offset_y)
             half_machine_width = self._global_container_stack.getProperty("machine_width", "value") / 2
             half_machine_depth = self._global_container_stack.getProperty("machine_depth", "value") / 2
-            if self._shape.lower() != "elliptic":
+
+            if self._shape != "elliptic":
                 if border_size - left_unreachable_border > 0:
                     result[extruder_id].append(Polygon(numpy.array([
                         [-half_machine_width, -half_machine_depth],

+ 12 - 3
plugins/MachineSettingsAction/MachineSettingsAction.qml

@@ -131,11 +131,20 @@ Cura.MachineAction
 
                             ComboBox
                             {
-                                model: ["Rectangular", "Elliptic"]
-                                currentIndex: machineShapeProvider.properties.value.toLowerCase() != model[1].toLowerCase() ? 0 : 1
+                                id: shapeComboBox
+                                model: ListModel
+                                {
+                                    id: shapesModel
+                                    Component.onCompleted:
+                                    {
+                                        shapesModel.append({ text: catalog.i18nc("@option:build plate shape", "Rectangular"), value: "rectangular" });
+                                        shapesModel.append({ text: catalog.i18nc("@option:build plate shape", "Elliptic"), value: "elliptic" });
+                                        shapeComboBox.currentIndex = machineShapeProvider.properties.value != shapesModel.get(1).value ? 0 : 1
+                                    }
+                                }
                                 onActivated:
                                 {
-                                    machineShapeProvider.setPropertyValue("value", model[index]);
+                                    machineShapeProvider.setPropertyValue("value", shapesModel.get(index).value);
                                     manager.forceUpdate();
                                 }
                             }