added drop models to buildplate as a right click option

Also shortcut: ctrl+B

CURA-10542
This commit is contained in:
Saumya Jain 2024-02-27 13:45:10 +01:00
parent 86bf94cc31
commit 1338a562ef
8 changed files with 18 additions and 43 deletions

View File

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

View File

@ -41,11 +41,9 @@ class PlatformPhysics:
Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down", True) Application.getInstance().getPreferences().addPreference("physics/automatic_drop_down", True)
self._app_per_model_drop = None self._app_per_model_drop = None
def getAppPerModelDropDown(self): def setAppPerModelDropDown(self):
return self._app_per_model_drop self._app_per_model_drop = True
self._onChangeTimerFinished()
def setAppPerModelDropDown(self, drop_to_buildplate):
self._app_per_model_drop = drop_to_buildplate
def _onSceneChanged(self, source): def _onSceneChanged(self, source):
if not source.callDecoration("isSliceable"): 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. # By shuffling the order of the nodes, this might happen a few times, but at some point it will resolve.
random.shuffle(nodes) random.shuffle(nodes)
drop_down = False 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 == True: drop_down = True
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
for node in nodes: for node in nodes:
if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None: if node is root or not isinstance(node, SceneNode) or node.getBoundingBox() is None:

View File

@ -353,11 +353,6 @@ class WorkspaceDialog(QObject):
Application.getInstance().getBackend().close() 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: def setMaterialConflict(self, material_conflict: bool) -> None:
if self._has_material_conflict != material_conflict: if self._has_material_conflict != material_conflict:
self._has_material_conflict = material_conflict self._has_material_conflict = material_conflict

View File

@ -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 Row
{ {
id: clearBuildPlateWarning id: clearBuildPlateWarning
@ -493,7 +473,6 @@ UM.Dialog
materialSection.reloadValues() materialSection.reloadValues()
profileSection.reloadValues() profileSection.reloadValues()
printerSection.reloadValues() printerSection.reloadValues()
dropToBuildPlate.reloadValue()
} }
} }
} }

View File

@ -39,7 +39,7 @@ Item
property alias printObjectAfterNext: printObjectAfterNextAction property alias printObjectAfterNext: printObjectAfterNextAction
property alias multiplyObject: multiplyObjectAction property alias multiplyObject: multiplyObjectAction
property alias dropAll: dropAllAction
property alias selectAll: selectAllAction property alias selectAll: selectAllAction
property alias deleteAll: deleteAllAction property alias deleteAll: deleteAllAction
property alias reloadAll: reloadAllAction property alias reloadAll: reloadAllAction
@ -490,6 +490,14 @@ Item
shortcut: "Shift+Ctrl+R" 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 Action
{ {
id: resetAllTranslationAction id: resetAllTranslationAction

View File

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

View File

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

View File

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