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

added drop models to buildplate as a right click option
Also shortcut: ctrl+B

CURA-10542

Saumya Jain 1 год назад
Родитель
Сommit
1338a562ef

+ 3 - 3
cura/CuraApplication.py

@@ -1085,9 +1085,9 @@ class CuraApplication(QtApplication):
     def getTextManager(self, *args) -> "TextManager":
         return self._text_manager
 
-    @pyqtSlot(bool)
-    def getWorkplaceDropToBuildplate(self, drop_to_build_plate: bool) ->None:
-        return self._physics.setAppPerModelDropDown(drop_to_build_plate)
+    @pyqtSlot()
+    def setWorkplaceDropToBuildplate(self):
+        return self._physics.setAppPerModelDropDown()
 
     def getCuraFormulaFunctions(self, *args) -> "CuraFormulaFunctions":
         if self._cura_formula_functions is None:

+ 4 - 12
cura/PlatformPhysics.py

@@ -41,11 +41,9 @@ class PlatformPhysics:
         Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down", True)
         self._app_per_model_drop = None
 
-    def getAppPerModelDropDown(self):
-        return self._app_per_model_drop
-
-    def setAppPerModelDropDown(self, drop_to_buildplate):
-        self._app_per_model_drop = drop_to_buildplate
+    def setAppPerModelDropDown(self):
+        self._app_per_model_drop = True
+        self._onChangeTimerFinished()
 
     def _onSceneChanged(self, source):
         if not source.callDecoration("isSliceable"):
@@ -79,13 +77,7 @@ class PlatformPhysics:
         # By shuffling the order of the nodes, this might happen a few times, but at some point it will resolve.
         random.shuffle(nodes)
         drop_down = False
-        # drop down in case nodes are asked to drop down from the user from workspaceDialog while opening 3mf
-        if self._app_per_model_drop and (self._app_per_model_drop != app_automatic_drop_down):
-            drop_down = True
-        # drop down in case the user has selected automated drop down preference for 3mf opening
-        if self._app_per_model_drop and app_automatic_drop_down:
-            drop_down= True
-
+        if self._app_per_model_drop == True: drop_down = True
 
         for node in nodes:
             if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None:

+ 0 - 5
plugins/3MFReader/WorkspaceDialog.py

@@ -353,11 +353,6 @@ class WorkspaceDialog(QObject):
 
         Application.getInstance().getBackend().close()
 
-    @pyqtSlot(bool)
-    def setDropToBuildPlateForModel(self, drop_to_buildplate: bool) -> None:
-        CuraApplication.getInstance().getWorkplaceDropToBuildplate(drop_to_buildplate)
-
-
     def setMaterialConflict(self, material_conflict: bool) -> None:
         if self._has_material_conflict != material_conflict:
             self._has_material_conflict = material_conflict

+ 0 - 21
plugins/3MFReader/WorkspaceDialog.qml

@@ -351,26 +351,6 @@ UM.Dialog
                     }
                 }
 
-                Row
-                {
-                    id: dropToBuildPlate
-                    width: parent.width
-                    height: childrenRect.height
-                    spacing: UM.Theme.getSize("default_margin").width
-                    UM.CheckBox
-                    {
-                        id: checkDropModels
-                        text: catalog.i18nc("@text:window", "Drop models to buildplate")
-                        checked: UM.Preferences.getValue("physics/automatic_drop_down")
-                        onCheckedChanged: manager.setDropToBuildPlateForModel(checked)
-                    }
-                    function reloadValue()
-                    {
-                        manager.setDropToBuildPlateForModel(checkDropModels.checked)
-                        checkDropModels.checked = UM.Preferences.getValue("physics/automatic_drop_down")
-                    }
-                }
-
                 Row
                 {
                     id: clearBuildPlateWarning
@@ -493,7 +473,6 @@ UM.Dialog
             materialSection.reloadValues()
             profileSection.reloadValues()
             printerSection.reloadValues()
-            dropToBuildPlate.reloadValue()
         }
     }
 }

+ 9 - 1
resources/qml/Actions.qml

@@ -39,7 +39,7 @@ Item
     property alias printObjectAfterNext: printObjectAfterNextAction
 
     property alias multiplyObject: multiplyObjectAction
-
+    property alias dropAll: dropAllAction
     property alias selectAll: selectAllAction
     property alias deleteAll: deleteAllAction
     property alias reloadAll: reloadAllAction
@@ -490,6 +490,14 @@ Item
         shortcut: "Shift+Ctrl+R"
     }
 
+    Action
+    {
+        id: dropAllAction
+        text: catalog.i18nc("@action:inmenu menubar:edit","Drop All Models to buildplate")
+        shortcut: "Ctrl+B"
+        onTriggered: CuraApplication.setWorkplaceDropToBuildplate()
+    }
+
     Action
     {
         id: resetAllTranslationAction

+ 1 - 0
resources/qml/Menus/ContextMenu.qml

@@ -71,6 +71,7 @@ Cura.Menu
     Cura.MenuItem { action: Cura.Actions.reloadAll }
     Cura.MenuItem { action: Cura.Actions.resetAllTranslation }
     Cura.MenuItem { action: Cura.Actions.resetAll }
+    Cura.MenuItem { action: Cura.Actions.dropAll }
 
     // Group actions
     Cura.MenuSeparator {}

+ 1 - 0
resources/qml/Menus/EditMenu.qml

@@ -21,6 +21,7 @@ Cura.Menu
     Cura.MenuItem { action: Cura.Actions.deleteAll }
     Cura.MenuItem { action: Cura.Actions.resetAllTranslation }
     Cura.MenuItem { action: Cura.Actions.resetAll }
+    Cura.MenuItem { action: Cura.Actions.dropAll }
     Cura.MenuSeparator { }
     Cura.MenuItem { action: Cura.Actions.groupObjects }
     Cura.MenuItem { action: Cura.Actions.mergeObjects }

+ 0 - 1
resources/qml/Preferences/GeneralPage.qml

@@ -513,7 +513,6 @@ UM.PreferencesPage
                     onCheckedChanged:
                     {
                         UM.Preferences.setValue("physics/automatic_drop_down", checked)
-                        CuraApplication.getWorkplaceDropToBuildplate(checked)
                     }
                 }
             }