mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06:00
CURA-4525 change active build plate if that build plate does not exist anymore; disable context menu items for build plates when no selection
This commit is contained in:
parent
86eb9c73ba
commit
164e5fdc8e
2 changed files with 9 additions and 0 deletions
|
@ -41,6 +41,13 @@ class CuraSceneController(QObject):
|
|||
self._build_plate_model.setMaxBuildPlate(self._max_build_plate)
|
||||
build_plates = [{"name": "Build Plate %d" % (i + 1), "buildPlateNumber": i} for i in range(self._max_build_plate + 1)]
|
||||
self._build_plate_model.setItems(build_plates)
|
||||
if self._active_build_plate > self._max_build_plate:
|
||||
build_plate_number = 0
|
||||
if self._last_selected_index >= 0: # go to the buildplate of the item you last selected
|
||||
item = self._objects_model.getItem(self._last_selected_index)
|
||||
node = item["node"]
|
||||
build_plate_number = node.callDecoration("getBuildPlateNumber")
|
||||
self.setActiveBuildPlate(build_plate_number)
|
||||
# self.buildPlateItemsChanged.emit() # TODO: necessary after setItems?
|
||||
|
||||
def _calcMaxBuildPlate(self):
|
||||
|
|
|
@ -47,6 +47,7 @@ Menu
|
|||
{
|
||||
model: Cura.BuildPlateModel
|
||||
MenuItem {
|
||||
enabled: UM.Selection.hasSelection
|
||||
text: Cura.BuildPlateModel.getItem(index).name;
|
||||
onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.getItem(index).buildPlateNumber);
|
||||
checkable: true
|
||||
|
@ -58,6 +59,7 @@ Menu
|
|||
}
|
||||
|
||||
MenuItem {
|
||||
enabled: UM.Selection.hasSelection
|
||||
text: "New build plate";
|
||||
onTriggered: {
|
||||
CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.maxBuildPlate + 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue