mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge pull request #562 from Ultimaker/feature_ux2-1
Design rework for 2.1 release
This commit is contained in:
commit
e61d3e4f3e
25 changed files with 1159 additions and 4111 deletions
|
|
@ -134,11 +134,11 @@ class CuraEngineBackend(Backend):
|
|||
return #No slicing if we have error values since those are by definition illegal values.
|
||||
|
||||
self.processingProgress.emit(0.0)
|
||||
if not self._message:
|
||||
self._message = Message(catalog.i18nc("@info:status", "Slicing..."), 0, False, -1)
|
||||
self._message.show()
|
||||
else:
|
||||
if self._message:
|
||||
self._message.setProgress(-1)
|
||||
#else:
|
||||
# self._message = Message(catalog.i18nc("@info:status", "Slicing..."), 0, False, -1)
|
||||
# self._message.show()
|
||||
|
||||
self._scene.gcode_list = []
|
||||
self._slicing = True
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ import UM 1.0 as UM
|
|||
|
||||
Item
|
||||
{
|
||||
width: 250
|
||||
height: 250
|
||||
width: UM.Theme.sizes.button.width
|
||||
height: UM.Theme.sizes.slider_layerview_size.height
|
||||
|
||||
Slider
|
||||
{
|
||||
id: slider
|
||||
width: 10
|
||||
height: 250
|
||||
anchors.right : parent.right
|
||||
anchors.rightMargin: UM.Theme.sizes.slider_layerview_margin.width/2
|
||||
width: UM.Theme.sizes.slider_layerview_size.width
|
||||
height: UM.Theme.sizes.slider_layerview_size.height
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.sizes.slider_layerview_margin.width/2
|
||||
orientation: Qt.Vertical
|
||||
minimumValue: 0;
|
||||
maximumValue: UM.LayerView.numLayers;
|
||||
|
|
@ -31,15 +31,7 @@ Item
|
|||
style: UM.Theme.styles.layerViewSlider
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right
|
||||
y: -UM.Theme.sizes.slider_layerview_background_extension.height
|
||||
z: slider.z - 1
|
||||
width: UM.Theme.sizes.button.width
|
||||
height: UM.Theme.sizes.slider_layerview_background_extension.height
|
||||
color: UM.Theme.colors.slider_text_background
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right : parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
z: slider.z - 1
|
||||
width: UM.Theme.sizes.slider_layerview_background.width
|
||||
|
|
|
|||
|
|
@ -10,93 +10,53 @@ import UM 1.1 as UM
|
|||
|
||||
Item {
|
||||
id: base;
|
||||
property int currentIndex: UM.ActiveTool.properties.SelectedIndex;
|
||||
property string printSequence: UM.ActiveTool.properties.PrintSequence;
|
||||
|
||||
width: 0;
|
||||
height: 0;
|
||||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
|
||||
property variant position: mapToItem(null, 0, 0)
|
||||
Column {
|
||||
id: items
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left;
|
||||
|
||||
property real viewportWidth: UM.Application.mainWindow.width * UM.Application.mainWindow.viewportRect.width;
|
||||
property real viewportHeight: UM.Application.mainWindow.height * UM.Application.mainWindow.viewportRect.height;
|
||||
spacing: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
property int currentIndex;
|
||||
|
||||
Rectangle {
|
||||
id: settingsPanel;
|
||||
|
||||
z: 3;
|
||||
|
||||
width: UM.Theme.sizes.per_object_settings_panel.width;
|
||||
height: items.height + UM.Theme.sizes.default_margin.height * 2;
|
||||
|
||||
opacity: 0;
|
||||
Behavior on opacity { NumberAnimation { } }
|
||||
|
||||
border.width: UM.Theme.sizes.per_object_settings_panel_border.width;
|
||||
border.color: UM.Theme.colors.per_object_settings_panel_border;
|
||||
|
||||
color: UM.Theme.colors.per_object_settings_panel_background;
|
||||
|
||||
DropArea {
|
||||
anchors.fill: parent;
|
||||
Label {
|
||||
width: UM.Theme.sizes.setting.width;
|
||||
wrapMode: Text.Wrap;
|
||||
text: catalog.i18nc("@label", "Per Object Settings behavior may be unexpected when 'Print sequence' is set to 'All at Once'.")
|
||||
color: UM.Theme.colors.text;
|
||||
visible: base.printSequence == "all_at_once"
|
||||
}
|
||||
|
||||
Button {
|
||||
id: closeButton;
|
||||
width: UM.Theme.sizes.message_close.width;
|
||||
height: UM.Theme.sizes.message_close.height;
|
||||
anchors {
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.sizes.default_margin.width / 2;
|
||||
top: parent.top;
|
||||
topMargin: UM.Theme.sizes.default_margin.width / 2;
|
||||
}
|
||||
UM.RecolorImage {
|
||||
anchors.fill: parent;
|
||||
sourceSize.width: width
|
||||
sourceSize.height: width
|
||||
color: UM.Theme.colors.message_dismiss
|
||||
source: UM.Theme.icons.cross2;
|
||||
}
|
||||
UM.SettingItem {
|
||||
id: profileSelection
|
||||
|
||||
onClicked: settingsPanel.opacity = 0
|
||||
width: UM.Theme.sizes.setting.width;
|
||||
height: UM.Theme.sizes.setting.height;
|
||||
|
||||
style: ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: UM.Theme.colors.message_background
|
||||
}
|
||||
name: catalog.i18nc("@label", "Object profile")
|
||||
type: "enum"
|
||||
indent: false
|
||||
|
||||
style: UM.Theme.styles.setting_item;
|
||||
|
||||
options: UM.ProfilesModel { addUseGlobal: true }
|
||||
|
||||
value: UM.ActiveTool.properties.Model.getItem(base.currentIndex).profile
|
||||
|
||||
onItemValueChanged: {
|
||||
var item = UM.ActiveTool.properties.Model.getItem(base.currentIndex);
|
||||
UM.ActiveTool.properties.Model.setObjectProfile(item.id, value)
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: items
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
id: customisedSettings
|
||||
spacing: UM.Theme.sizes.default_lining.height;
|
||||
|
||||
UM.SettingItem {
|
||||
id: profileSelection
|
||||
|
||||
x: UM.Theme.sizes.per_object_settings_panel_border.width + 1
|
||||
|
||||
width: UM.Theme.sizes.setting.width;
|
||||
height: UM.Theme.sizes.setting.height;
|
||||
|
||||
name: catalog.i18nc("@label", "Profile")
|
||||
type: "enum"
|
||||
|
||||
style: UM.Theme.styles.setting_item;
|
||||
|
||||
options: UM.ProfilesModel { addUseGlobal: true }
|
||||
|
||||
value: UM.ActiveTool.properties.Model.getItem(base.currentIndex).profile
|
||||
|
||||
onItemValueChanged: {
|
||||
var item = UM.ActiveTool.properties.Model.getItem(base.currentIndex);
|
||||
UM.ActiveTool.properties.Model.setObjectProfile(item.id, value)
|
||||
}
|
||||
}
|
||||
width: UM.Theme.sizes.setting.width + UM.Theme.sizes.setting.height/2;
|
||||
|
||||
Repeater {
|
||||
id: settings;
|
||||
|
|
@ -106,7 +66,6 @@ Item {
|
|||
UM.SettingItem {
|
||||
width: UM.Theme.sizes.setting.width;
|
||||
height: UM.Theme.sizes.setting.height;
|
||||
x: UM.Theme.sizes.per_object_settings_panel_border.width + 1
|
||||
|
||||
name: model.label;
|
||||
type: model.type;
|
||||
|
|
@ -115,6 +74,7 @@ Item {
|
|||
unit: model.unit;
|
||||
valid: model.valid;
|
||||
options: model.options
|
||||
indent: false
|
||||
|
||||
style: UM.Theme.styles.setting_item;
|
||||
|
||||
|
|
@ -124,13 +84,11 @@ Item {
|
|||
|
||||
Button
|
||||
{
|
||||
anchors.left: parent.horizontalCenter;
|
||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||
anchors.left: parent.right;
|
||||
|
||||
width: UM.Theme.sizes.setting.height;
|
||||
height: UM.Theme.sizes.setting.height;
|
||||
|
||||
opacity: parent.hovered || hovered ? 1 : 0;
|
||||
onClicked: UM.ActiveTool.properties.Model.removeSettingOverride(UM.ActiveTool.properties.Model.getItem(base.currentIndex).id, model.key)
|
||||
|
||||
style: ButtonStyle
|
||||
|
|
@ -154,80 +112,16 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
height: UM.Theme.sizes.default_margin.height / 2
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: customise_settings_button;
|
||||
anchors.right: profileSelection.right;
|
||||
visible: parseInt(UM.Preferences.getValue("cura/active_mode")) == 1
|
||||
|
||||
text: catalog.i18nc("@action:button", "Customize Settings");
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
width: control.width;
|
||||
height: control.height;
|
||||
color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button;
|
||||
}
|
||||
label: Label
|
||||
{
|
||||
text: control.text;
|
||||
color: UM.Theme.colors.load_save_button_text;
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: settingPickDialog.visible = true;
|
||||
|
||||
Connections
|
||||
{
|
||||
target: UM.Preferences;
|
||||
|
||||
onPreferenceChanged:
|
||||
{
|
||||
customise_settings_button.visible = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "uranium"; }
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: customise_settings_button;
|
||||
anchors.right: profileSelection.right;
|
||||
height: UM.Theme.sizes.setting.height;
|
||||
visible: parseInt(UM.Preferences.getValue("cura/active_mode")) == 1
|
||||
|
||||
Repeater {
|
||||
model: UM.ActiveTool.properties.Model;
|
||||
delegate: Button {
|
||||
x: ((model.x + 1.0) / 2.0) * base.viewportWidth - base.position.x - width / 2
|
||||
y: -((model.y + 1.0) / 2.0) * base.viewportHeight + (base.viewportHeight - base.position.y) + height / 2
|
||||
|
||||
width: UM.Theme.sizes.per_object_settings_button.width
|
||||
height: UM.Theme.sizes.per_object_settings_button.height
|
||||
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Customise settings for this object");
|
||||
|
||||
checkable: true;
|
||||
onClicked: {
|
||||
if(settingsPanel.opacity < 0.5) //Per-object panel is not currently displayed.
|
||||
{
|
||||
base.currentIndex = index;
|
||||
|
||||
settingsPanel.anchors.left = right;
|
||||
settingsPanel.anchors.top = top;
|
||||
|
||||
settingsPanel.opacity = 1;
|
||||
}
|
||||
else //Per-object panel is already displayed. Deactivate it (same behaviour as the close button).
|
||||
{
|
||||
settingsPanel.opacity = 0;
|
||||
}
|
||||
}
|
||||
text: catalog.i18nc("@action:button", "Add Setting");
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
|
|
@ -235,20 +129,36 @@ Item {
|
|||
{
|
||||
width: control.width;
|
||||
height: control.height;
|
||||
|
||||
color: control.hovered ? UM.Theme.colors.button_active : UM.Theme.colors.button_hover;
|
||||
border.width: UM.Theme.sizes.default_lining.width;
|
||||
border.color: control.pressed ? UM.Theme.colors.action_button_active_border :
|
||||
control.hovered ? UM.Theme.colors.action_button_hovered_border : UM.Theme.colors.action_button_border
|
||||
color: control.pressed ? UM.Theme.colors.action_button_active :
|
||||
control.hovered ? UM.Theme.colors.action_button_hovered : UM.Theme.colors.action_button
|
||||
}
|
||||
label: Image {
|
||||
width: control.width;
|
||||
height: control.height;
|
||||
sourceSize.width: width;
|
||||
sourceSize.height: height;
|
||||
source: UM.Theme.icons.plus;
|
||||
label: Label
|
||||
{
|
||||
text: control.text;
|
||||
color: UM.Theme.colors.setting_control_text;
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: settingPickDialog.visible = true;
|
||||
|
||||
Connections
|
||||
{
|
||||
target: UM.Preferences;
|
||||
|
||||
onPreferenceChanged:
|
||||
{
|
||||
customise_settings_button.visible = parseInt(UM.Preferences.getValue("cura/active_mode"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "uranium"; }
|
||||
|
||||
UM.Dialog {
|
||||
id: settingPickDialog
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
# Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from UM.Tool import Tool
|
||||
from UM.Scene.Selection import Selection
|
||||
from UM.Application import Application
|
||||
|
||||
from . import PerObjectSettingsModel
|
||||
|
||||
|
|
@ -9,10 +11,19 @@ class PerObjectSettingsTool(Tool):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.setExposedProperties("Model")
|
||||
self.setExposedProperties("Model", "SelectedIndex", "PrintSequence")
|
||||
|
||||
def event(self, event):
|
||||
return False
|
||||
|
||||
def getModel(self):
|
||||
return PerObjectSettingsModel.PerObjectSettingsModel()
|
||||
|
||||
def getSelectedIndex(self):
|
||||
selected_object_id = id(Selection.getSelectedObject(0))
|
||||
index = self.getModel().find("id", selected_object_id)
|
||||
return index
|
||||
|
||||
def getPrintSequence(self):
|
||||
settings = Application.getInstance().getMachineManager().getActiveProfile()
|
||||
return settings.getSettingValue("print_sequence")
|
||||
|
|
@ -19,7 +19,8 @@ def getMetaData():
|
|||
"name": i18n_catalog.i18nc("@label", "Per Object Settings"),
|
||||
"description": i18n_catalog.i18nc("@info:tooltip", "Configure Per Object Settings"),
|
||||
"icon": "setting_per_object",
|
||||
"tool_panel": "PerObjectSettingsPanel.qml"
|
||||
"tool_panel": "PerObjectSettingsPanel.qml",
|
||||
"weight": 3
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue