diff --git a/cura/ObjectsModel.py b/cura/ObjectsModel.py index 8129475c10..86a3467819 100644 --- a/cura/ObjectsModel.py +++ b/cura/ObjectsModel.py @@ -29,7 +29,7 @@ class ObjectsModel(ListModel): self.addRoleName(self.SelectedRole, "selected") self.addRoleName(self.OutsideAreaRole, "outside_build_area") self.addRoleName(self.BuilplateNumberRole, "buildplate_number") - self.addRoleName(self.SelectedRole, "node") + self.addRoleName(self.NodeRole, "node") Application.getInstance().getController().getScene().sceneChanged.connect(self._updateDelayed) Application.getInstance().getPreferences().preferenceChanged.connect(self._updateDelayed) diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index 9d1ff81fd7..d8953d7661 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -24,14 +24,14 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: loader.width + itemRow.width + UM.Theme.getSize("default_margin").width + width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height RowLayout { id: itemRow - anchors.left: loader.right + anchors.left: openFileButton.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: Math.round(0.9 * prepareMenu.width) @@ -58,6 +58,7 @@ Item Cura.ConfigurationMenu { + id: printerSetup Layout.fillHeight: true Layout.fillWidth: true Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width @@ -82,72 +83,52 @@ Item } } - Loader - { - id: loader - sourceComponent: UM.Preferences.getValue("cura/show_list_of_files") ? objectSelector : openFileButton - } - - Component - { - id: objectSelector - - Cura.ObjectSelector - { - height: UM.Theme.getSize("stage_menu").height - width: 1.5 * UM.Theme.getSize("stage_menu").height | 0 - } - } - - Component + Button { id: openFileButton - Button + height: UM.Theme.getSize("stage_menu").height + width: UM.Theme.getSize("stage_menu").height + onClicked: Cura.Actions.open.trigger() + hoverEnabled: true + + contentItem: Item { + anchors.fill: parent + UM.RecolorImage + { + id: buttonIcon + anchors.centerIn: parent + source: UM.Theme.getIcon("load") + width: UM.Theme.getSize("button_icon").width + height: UM.Theme.getSize("button_icon").height + color: UM.Theme.getColor("icon") + + sourceSize.height: height + } + } + + background: Rectangle + { + id: background height: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height - onClicked: Cura.Actions.open.trigger() - hoverEnabled: true - contentItem: Item - { - anchors.fill: parent - UM.RecolorImage - { - id: buttonIcon - anchors.centerIn: parent - source: UM.Theme.getIcon("load") - width: UM.Theme.getSize("button_icon").width - height: UM.Theme.getSize("button_icon").height - color: UM.Theme.getColor("icon") + radius: UM.Theme.getSize("default_radius").width + color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + } - sourceSize.height: height - } - } - - background: Rectangle - { - id: background - height: UM.Theme.getSize("stage_menu").height - width: UM.Theme.getSize("stage_menu").height - - radius: UM.Theme.getSize("default_radius").width - color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - } - - DropShadow - { - id: shadow - // Don't blur the shadow - radius: 0 - anchors.fill: background - source: background - verticalOffset: 2 - visible: true - color: UM.Theme.getColor("action_button_shadow") - // Should always be drawn behind the background. - z: background.z - 1 - } + DropShadow + { + id: shadow + // Don't blur the shadow + radius: 0 + anchors.fill: background + source: background + verticalOffset: 2 + visible: true + color: UM.Theme.getColor("action_button_shadow") + // Should always be drawn behind the background. + z: background.z - 1 } } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 44ff31ef31..0d668f14d0 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -209,15 +209,17 @@ UM.MainWindow visible: CuraApplication.platformActivity && !PrintInformation.preSliced } - ObjectsList + ObjectSelector { - id: objectsList - visible: UM.Preferences.getValue("cura/use_multi_build_plate") + id: objectSelector + visible: CuraApplication.platformActivity anchors { - bottom: viewOrientationControls.top + bottom: jobSpecs.top left: toolbar.right - margins: UM.Theme.getSize("default_margin").width + leftMargin: UM.Theme.getSize("default_margin").width + rightMargin: UM.Theme.getSize("default_margin").width + bottomMargin: UM.Theme.getSize("thin_margin").width } } @@ -227,10 +229,12 @@ UM.MainWindow visible: CuraApplication.platformActivity anchors { - left: parent.left + left: toolbar.right bottom: viewOrientationControls.top - margins: UM.Theme.getSize("default_margin").width + leftMargin: UM.Theme.getSize("default_margin").width + rightMargin: UM.Theme.getSize("default_margin").width bottomMargin: UM.Theme.getSize("thin_margin").width + topMargin: UM.Theme.getSize("thin_margin").width } } @@ -240,7 +244,7 @@ UM.MainWindow anchors { - left: parent.left + left: toolbar.right bottom: parent.bottom margins: UM.Theme.getSize("default_margin").width } diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 44bdf469e3..82b02012e8 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -13,8 +13,8 @@ Button width: parent.width height: UM.Theme.getSize("action_button").height - leftPadding: UM.Theme.getSize("thick_margin").width - rightPadding: UM.Theme.getSize("thick_margin").width + leftPadding: UM.Theme.getSize("thin_margin").width + rightPadding: UM.Theme.getSize("thin_margin").width checkable: true hoverEnabled: true @@ -29,12 +29,12 @@ Button anchors { left: parent.left - right: printerTypes.left + right: parent.right verticalCenter: parent.verticalCenter } text: objectItemButton.text - color: UM.Theme.getColor("text") - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text_scene") visible: text != "" renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index 87e42bd94a..e13b6eea26 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -7,34 +7,51 @@ import QtQuick.Controls 2.3 import UM 1.2 as UM import Cura 1.0 as Cura -Cura.ExpandableComponent +Item { - id: base + id: objectSelector + width: UM.Theme.getSize("objects_menu_size").width +// height: childrenRect.height + property bool opened: UM.Preferences.getValue("cura/show_list_of_files") - headerCornerSide: Cura.RoundedRectangle.Direction.All - contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft - contentHeaderTitle: catalog.i18nc("@label", "Object list") - - headerItem: Item + Button { - anchors.fill: parent - UM.RecolorImage - { - id: buttonIcon - anchors.centerIn: parent - source: UM.Theme.getIcon("load") - width: UM.Theme.getSize("button_icon").width - height: UM.Theme.getSize("button_icon").height - color: UM.Theme.getColor("icon") + id: openCloseButton + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + hoverEnabled: true - sourceSize.height: height + anchors + { + bottom: contents.top + horizontalCenter: parent.horizontalCenter + } + + contentItem: UM.RecolorImage + { + anchors.fill: parent + sourceSize.width: width + color: openCloseButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") + source: objectSelector.opened ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_top") + } + + background: Item {} + + onClicked: + { + UM.Preferences.setValue("cura/show_list_of_files", !objectSelector.opened) + objectSelector.opened = UM.Preferences.getValue("cura/show_list_of_files") } } - contentItem: Item + Item { - id: popup - width: UM.Theme.getSize("machine_selector_widget_content").width + id: contents + width: parent.width + visible: objectSelector.opened + height: visible ? scroll.height : 0 + + anchors.bottom: parent.bottom ScrollView { @@ -44,25 +61,23 @@ Cura.ExpandableComponent leftPadding: UM.Theme.getSize("default_lining").width rightPadding: UM.Theme.getSize("default_lining").width - ListView + contentItem: ListView { id: listView // Can't use parent.width since the parent is the flickable component and not the ScrollView width: scroll.width - scroll.leftPadding - scroll.rightPadding - property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height + property real maximumHeight: UM.Theme.getSize("objects_menu_size").height // We use an extra property here, since we only want to to be informed about the content size changes. onContentHeightChanged: { scroll.height = Math.min(contentHeight, maximumHeight) - popup.height = scroll.height + buttonRow.height } Component.onCompleted: { scroll.height = Math.min(contentHeight, maximumHeight) - popup.height = scroll.height + buttonRow.height } model: Cura.ObjectsModel {} @@ -75,34 +90,5 @@ Cura.ExpandableComponent } } } - - Rectangle - { - id: separator - - anchors.top: scroll.bottom - width: parent.width - height: UM.Theme.getSize("default_lining").height - color: UM.Theme.getColor("lining") - } - - Row - { - id: buttonRow - - // The separator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar. - anchors.top: separator.top - anchors.horizontalCenter: parent.horizontalCenter - padding: UM.Theme.getSize("default_margin").width - spacing: UM.Theme.getSize("default_margin").width - - Cura.SecondaryButton - { - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@button", "Add file") - onClicked: Cura.Actions.open.trigger() - } - } } } diff --git a/resources/qml/ObjectsList.qml b/resources/qml/ObjectsList.qml deleted file mode 100644 index fd5175fce2..0000000000 --- a/resources/qml/ObjectsList.qml +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 - -import UM 1.3 as UM -import Cura 1.0 as Cura - -import "Menus" - -Rectangle -{ - id: base; - - color: UM.Theme.getColor("tool_panel_background") - - width: UM.Theme.getSize("objects_menu_size").width - height: { - if (collapsed) { - return UM.Theme.getSize("objects_menu_size_collapsed").height; - } else { - return UM.Theme.getSize("objects_menu_size").height; - } - } - Behavior on height { NumberAnimation { duration: 100 } } - - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("lining") - - property bool collapsed: true - - property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel() - - SystemPalette { id: palette } - - Button { - id: collapseButton - anchors.top: parent.top - anchors.topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2) - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - - onClicked: collapsed = !collapsed - - style: ButtonStyle - { - background: UM.RecolorImage - { - width: control.width - height: control.height - sourceSize.height: width - color: UM.Theme.getColor("setting_control_text") - source: collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom") - } - label: Label{ } - } - } - - Component { - id: buildPlateDelegate - Rectangle - { - height: childrenRect.height - color: multiBuildPlateModel.getItem(index).buildPlateNumber == multiBuildPlateModel.activeBuildPlate ? palette.highlight : index % 2 ? palette.base : palette.alternateBase - width: parent.width - Label - { - id: buildPlateNameLabel - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: parent.width - 2 * UM.Theme.getSize("default_margin").width - 30 - text: multiBuildPlateModel.getItem(index) ? multiBuildPlateModel.getItem(index).name : ""; - color: multiBuildPlateModel.activeBuildPlate == index ? palette.highlightedText : palette.text - elide: Text.ElideRight - } - - MouseArea - { - anchors.fill: parent; - onClicked: - { - Cura.SceneController.setActiveBuildPlate(index); - } - } - } - } - - ScrollView - { - id: buildPlateSelection - frameVisible: true - height: UM.Theme.getSize("build_plate_selection_size").height - width: parent.width - 2 * UM.Theme.getSize("default_margin").height - style: UM.Theme.styles.scrollview - - anchors - { - top: collapseButton.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").height; - bottomMargin: UM.Theme.getSize("default_margin").height; - } - - Rectangle - { - parent: viewport - anchors.fill: parent - color: palette.light - } - - ListView - { - id: buildPlateListView - model: multiBuildPlateModel - width: parent.width - delegate: buildPlateDelegate - } - } - - Component { - id: objectDelegate - Rectangle - { - height: childrenRect.height - color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlight : index % 2 ? palette.base : palette.alternateBase - width: parent.width - Label - { - id: nodeNameLabel - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: parent.width - 2 * UM.Theme.getSize("default_margin").width - 30 - text: (index >= 0) && Cura.ObjectsModel.getItem(index) ? Cura.ObjectsModel.getItem(index).name : ""; - color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlightedText : (Cura.ObjectsModel.getItem(index).isOutsideBuildArea ? palette.mid : palette.text) - elide: Text.ElideRight - } - - Label - { - id: buildPlateNumberLabel - width: 20 - anchors.left: nodeNameLabel.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: parent.right - text: Cura.ObjectsModel.getItem(index).buildPlateNumber != -1 ? Cura.ObjectsModel.getItem(index).buildPlateNumber + 1 : ""; - color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlightedText : palette.text - elide: Text.ElideRight - } - - MouseArea - { - anchors.fill: parent; - onClicked: - { - Cura.SceneController.changeSelection(index); - } - } - } - } - - // list all the scene nodes - ScrollView - { - id: objectsList - frameVisible: true - visible: !collapsed - width: parent.width - 2 * UM.Theme.getSize("default_margin").height - - anchors - { - top: buildPlateSelection.bottom; - topMargin: UM.Theme.getSize("default_margin").height; - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").height; - bottom: filterBuildPlateCheckbox.top; - bottomMargin: UM.Theme.getSize("default_margin").height; - } - - Rectangle - { - parent: viewport - anchors.fill: parent - color: palette.light - } - - ListView - { - id: listview - model: Cura.ObjectsModel - width: parent.width - delegate: objectDelegate - } - } - - CheckBox - { - id: filterBuildPlateCheckbox - visible: !collapsed - checked: UM.Preferences.getValue("view/filter_current_build_plate") - onClicked: UM.Preferences.setValue("view/filter_current_build_plate", checked) - - text: catalog.i18nc("@option:check","See only current build plate"); - style: UM.Theme.styles.checkbox; - - anchors - { - left: parent.left; - topMargin: UM.Theme.getSize("default_margin").height; - bottomMargin: UM.Theme.getSize("default_margin").height; - leftMargin: UM.Theme.getSize("default_margin").height; - bottom: arrangeAllBuildPlatesButton.top; - } - } - - Button - { - id: arrangeAllBuildPlatesButton; - text: catalog.i18nc("@action:button","Arrange to all build plates"); - style: UM.Theme.styles.print_setup_action_button - height: UM.Theme.getSize("objects_menu_button").height; - tooltip: ''; - anchors - { - topMargin: UM.Theme.getSize("default_margin").height; - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").height; - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").height; - bottom: arrangeBuildPlateButton.top; - bottomMargin: UM.Theme.getSize("default_margin").height; - } - action: Cura.Actions.arrangeAllBuildPlates; - } - - Button - { - id: arrangeBuildPlateButton; - text: catalog.i18nc("@action:button","Arrange current build plate"); - style: UM.Theme.styles.print_setup_action_button - height: UM.Theme.getSize("objects_menu_button").height; - tooltip: ''; - anchors - { - topMargin: UM.Theme.getSize("default_margin").height; - left: parent.left; - leftMargin: UM.Theme.getSize("default_margin").height; - right: parent.right; - rightMargin: UM.Theme.getSize("default_margin").height; - bottom: parent.bottom; - bottomMargin: UM.Theme.getSize("default_margin").height; - } - action: Cura.Actions.arrangeAll; - } -} diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 35108a88bf..e8519c6abf 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -101,24 +101,10 @@ UM.PreferencesPage UM.Preferences.resetPreference("cura/choice_on_open_project") setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project")) - if (pluginExistsAndEnabled("SliceInfoPlugin")) { - UM.Preferences.resetPreference("info/send_slice_info") - sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info")) - } - if (pluginExistsAndEnabled("UpdateChecker")) { - UM.Preferences.resetPreference("info/automatic_update_check") - checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check")) - } - } - - function pluginExistsAndEnabled(pluginName) - { - var pluginItem = plugins.find("id", pluginName) - if (pluginItem > -1) - { - return plugins.getItem(pluginItem).enabled - } - return false + UM.Preferences.resetPreference("info/send_slice_info") + sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info")) + UM.Preferences.resetPreference("info/automatic_update_check") + checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check")) } ScrollView @@ -130,8 +116,6 @@ UM.PreferencesPage Column { - //: Model used to check if a plugin exists - UM.PluginsModel { id: plugins } //: Language selection label UM.I18nCatalog{id: catalog; name: "cura"} @@ -672,7 +656,6 @@ UM.PreferencesPage UM.TooltipArea { - visible: pluginExistsAndEnabled("UpdateChecker") width: childrenRect.width height: visible ? childrenRect.height : 0 text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?") @@ -688,7 +671,6 @@ UM.PreferencesPage UM.TooltipArea { - visible: pluginExistsAndEnabled("SliceInfoPlugin") width: childrenRect.width height: visible ? childrenRect.height : 0 text: catalog.i18nc("@info:tooltip","Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.") @@ -741,21 +723,6 @@ UM.PreferencesPage } } - UM.TooltipArea - { - width: childrenRect.width - height: childrenRect.height - text: catalog.i18nc("@info:tooltip", "This option enables a panel showing the list of loaded models") - - CheckBox - { - id: showListOfFilesCheckbox - text: catalog.i18nc("@option:check", "Show list of loaded models") - checked: boolCheck(UM.Preferences.getValue("cura/show_list_of_files")) - onCheckedChanged: UM.Preferences.setValue("cura/show_list_of_files", checked) - } - } - Connections { target: UM.Preferences diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 01b0b295d8..62997cc27a 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -1,7 +1,6 @@ module Cura MachineSelector 1.0 MachineSelector.qml -objectSelector 1.0 objectSelector.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml ActionButton 1.0 ActionButton.qml diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index a942ef9149..5933972475 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -568,7 +568,7 @@ "jobspecs_line": [2.0, 2.0], - "objects_menu_size": [20, 40], + "objects_menu_size": [18, 18], "objects_menu_size_collapsed": [20, 17], "build_plate_selection_size": [15, 5], "objects_menu_button": [0.3, 2.7],