CURA-4525 Added an option to turn on the UI elements of multi build plate

This commit is contained in:
Jack Ha 2017-11-15 17:00:19 +01:00
parent 864f417723
commit e2a663992c
5 changed files with 34 additions and 9 deletions

View File

@ -311,6 +311,7 @@ class CuraApplication(QtApplication):
preferences.addPreference("cura/choice_on_profile_override", "always_ask") preferences.addPreference("cura/choice_on_profile_override", "always_ask")
preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/choice_on_open_project", "always_ask")
preferences.addPreference("cura/arrange_objects_on_load", True) preferences.addPreference("cura/arrange_objects_on_load", True)
preferences.addPreference("cura/use_multi_build_plate", False)
preferences.addPreference("cura/currency", "") preferences.addPreference("cura/currency", "")
preferences.addPreference("cura/material_settings", "{}") preferences.addPreference("cura/material_settings", "{}")
@ -1427,7 +1428,9 @@ class CuraApplication(QtApplication):
min_offset = 8 min_offset = 8
self.fileLoaded.emit(filename) self.fileLoaded.emit(filename)
arrange_objects_on_load = Preferences.getInstance().getValue("cura/arrange_objects_on_load") arrange_objects_on_load = (
not Preferences.getInstance().getValue("cura/use_multi_build_plate") or
Preferences.getInstance().getValue("cura/arrange_objects_on_load"))
target_build_plate = self.getBuildPlateModel().activeBuildPlate if arrange_objects_on_load else -1 target_build_plate = self.getBuildPlateModel().activeBuildPlate if arrange_objects_on_load else -1
for original_node in nodes: for original_node in nodes:

View File

@ -324,10 +324,10 @@ UM.MainWindow
} }
} }
/*
Button Button
{ {
id: openFileButton; id: openFileButton;
visible: !UM.Preferences.getValue("cura/use_multi_build_plate")
text: catalog.i18nc("@action:button","Open File"); text: catalog.i18nc("@action:button","Open File");
iconSource: UM.Theme.getIcon("load") iconSource: UM.Theme.getIcon("load")
style: UM.Theme.styles.tool_button style: UM.Theme.styles.tool_button
@ -340,12 +340,13 @@ UM.MainWindow
} }
action: Cura.Actions.open; action: Cura.Actions.open;
} }
*/
Button Button
{ {
id: objectsButton; id: objectsButton;
text: catalog.i18nc("@action:button","Objects"); visible: UM.Preferences.getValue("cura/use_multi_build_plate")
text: catalog.i18nc("@action:button","Objects list");
iconSource: UM.Theme.getIcon("plus") iconSource: UM.Theme.getIcon("plus")
style: UM.Theme.styles.tool_button style: UM.Theme.styles.tool_button
tooltip: ''; tooltip: '';

View File

@ -39,7 +39,9 @@ Menu
onObjectRemoved: base.removeItem(object) onObjectRemoved: base.removeItem(object)
} }
MenuSeparator {} MenuSeparator {
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
}
Instantiator Instantiator
{ {
model: Cura.BuildPlateModel model: Cura.BuildPlateModel
@ -48,15 +50,17 @@ Menu
onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.getItem(index).buildPlateNumber); onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.getItem(index).buildPlateNumber);
checkable: true checkable: true
checked: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate checked: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
} }
onObjectAdded: base.insertItem(index, object); onObjectAdded: base.insertItem(index, object);
onObjectRemoved: base.removeItem(object) onObjectRemoved: base.removeItem(object);
} }
MenuItem { MenuItem {
text: "New build plate"; text: "New build plate";
onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.maxBuildPlate + 1); onTriggered: CuraActions.setBuildPlateForSelection(Cura.BuildPlateModel.maxBuildPlate + 1);
checkable: true checkable: true
checked: false checked: false
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
} }
// Global actions // Global actions

View File

@ -31,7 +31,9 @@ Menu
MenuSeparator {} MenuSeparator {}
MenuItem { action: Cura.Actions.homeCamera; } MenuItem { action: Cura.Actions.homeCamera; }
MenuSeparator {} MenuSeparator {
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
}
Instantiator Instantiator
{ {
model: Cura.BuildPlateModel model: Cura.BuildPlateModel
@ -41,6 +43,7 @@ Menu
checkable: true; checkable: true;
checked: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate; checked: Cura.BuildPlateModel.getItem(index).buildPlateNumber == Cura.BuildPlateModel.activeBuildPlate;
exclusiveGroup: buildPlateGroup; exclusiveGroup: buildPlateGroup;
visible: UM.Preferences.getValue("cura/use_multi_build_plate")
} }
onObjectAdded: base.insertItem(index, object); onObjectAdded: base.insertItem(index, object);
onObjectRemoved: base.removeItem(object) onObjectRemoved: base.removeItem(object)

View File

@ -454,12 +454,26 @@ UM.PreferencesPage
UM.TooltipArea { UM.TooltipArea {
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height
text: catalog.i18nc("@info:tooltip","Should newly loaded models be arranged on the build palte?") text: catalog.i18nc("@info:tooltip","Use multi build plate functionality (EXPERIMENTAL)")
CheckBox
{
id: useMultiBuildPlateCheckbox
text: catalog.i18nc("@option:check","Use multi build plate functionality (EXPERIMENTAL, restart)")
checked: boolCheck(UM.Preferences.getValue("cura/use_multi_build_plate"))
onCheckedChanged: UM.Preferences.setValue("cura/use_multi_build_plate", checked)
}
}
UM.TooltipArea {
width: childrenRect.width
height: childrenRect.height
text: catalog.i18nc("@info:tooltip","Should newly loaded models be arranged on the build plate? Used in conjunction with multi build plate (EXPERIMENTAL)")
CheckBox CheckBox
{ {
id: arrangeOnLoadCheckbox id: arrangeOnLoadCheckbox
text: catalog.i18nc("@option:check","Arrange objects on load") text: catalog.i18nc("@option:check","Arrange objects on load (EXPERIMENTAL)")
checked: boolCheck(UM.Preferences.getValue("cura/arrange_objects_on_load")) checked: boolCheck(UM.Preferences.getValue("cura/arrange_objects_on_load"))
onCheckedChanged: UM.Preferences.setValue("cura/arrange_objects_on_load", checked) onCheckedChanged: UM.Preferences.setValue("cura/arrange_objects_on_load", checked)
} }