From 86c7d3e5ab9f1efb6859613dd1345356bc336d93 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 15 Feb 2019 17:50:52 +0100 Subject: [PATCH 1/7] Add a object list panel instead of the open file button --- cura/CuraApplication.py | 4 +- cura/ObjectsModel.py | 28 +++-- plugins/PrepareStage/PrepareMenu.qml | 99 ++++++++-------- resources/qml/ObjectItemButton.qml | 58 ++++++++++ resources/qml/ObjectSelector.qml | 108 ++++++++++++++++++ .../qml/PrinterSelector/MachineSelector.qml | 1 - resources/qml/qmldir | 1 + 7 files changed, 240 insertions(+), 59 deletions(-) create mode 100644 resources/qml/ObjectItemButton.qml create mode 100644 resources/qml/ObjectSelector.qml diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index b8656565a8..655126471d 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -864,7 +864,7 @@ class CuraApplication(QtApplication): def getObjectsModel(self, *args): if self._object_manager is None: - self._object_manager = ObjectsModel.createObjectsModel() + self._object_manager = ObjectsModel(self) return self._object_manager @pyqtSlot(result = QObject) @@ -967,7 +967,7 @@ class CuraApplication(QtApplication): qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") - qmlRegisterSingletonType(ObjectsModel, "Cura", 1, 0, "ObjectsModel", self.getObjectsModel) + qmlRegisterType(ObjectsModel, "Cura", 1, 0, "ObjectsModel") qmlRegisterType(BuildPlateModel, "Cura", 1, 0, "BuildPlateModel") qmlRegisterType(MultiBuildPlateModel, "Cura", 1, 0, "MultiBuildPlateModel") qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") diff --git a/cura/ObjectsModel.py b/cura/ObjectsModel.py index 8354540783..8129475c10 100644 --- a/cura/ObjectsModel.py +++ b/cura/ObjectsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import QTimer +from PyQt5.QtCore import QTimer, Qt from UM.Application import Application from UM.Qt.ListModel import ListModel @@ -16,8 +16,20 @@ catalog = i18nCatalog("cura") ## Keep track of all objects in the project class ObjectsModel(ListModel): - def __init__(self): - super().__init__() + NameRole = Qt.UserRole + 1 + SelectedRole = Qt.UserRole + 2 + OutsideAreaRole = Qt.UserRole + 3 + BuilplateNumberRole = Qt.UserRole + 4 + NodeRole = Qt.UserRole + 5 + + def __init__(self, parent = None): + super().__init__(parent) + + self.addRoleName(self.NameRole, "name") + self.addRoleName(self.SelectedRole, "selected") + self.addRoleName(self.OutsideAreaRole, "outside_build_area") + self.addRoleName(self.BuilplateNumberRole, "buildplate_number") + self.addRoleName(self.SelectedRole, "node") Application.getInstance().getController().getScene().sceneChanged.connect(self._updateDelayed) Application.getInstance().getPreferences().preferenceChanged.connect(self._updateDelayed) @@ -78,9 +90,9 @@ class ObjectsModel(ListModel): nodes.append({ "name": name, - "isSelected": Selection.isSelected(node), - "isOutsideBuildArea": is_outside_build_area, - "buildPlateNumber": node_build_plate_number, + "selected": Selection.isSelected(node), + "outside_build_area": is_outside_build_area, + "buildplate_number": node_build_plate_number, "node": node }) @@ -88,7 +100,3 @@ class ObjectsModel(ListModel): self.setItems(nodes) self.itemsChanged.emit() - - @staticmethod - def createObjectsModel(): - return ObjectsModel() diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index b62d65254d..f571143384 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -24,14 +24,14 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width + width: objectSelector.width + itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height RowLayout { id: itemRow - anchors.left: openFileButton.right + anchors.left: objectSelector.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: Math.round(0.9 * prepareMenu.width) @@ -82,53 +82,60 @@ Item } } - Button + Cura.ObjectSelector { - id: openFileButton + id: objectSelector 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 - - 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 - } } + +// Button +// { +// id: openFileButton +// 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 +// +// 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 +// } +// } } } diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml new file mode 100644 index 0000000000..8b1a7036bd --- /dev/null +++ b/resources/qml/ObjectItemButton.qml @@ -0,0 +1,58 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.1 + +import UM 1.1 as UM +import Cura 1.0 as Cura + +Button +{ + id: objectItemButton + + width: parent.width + height: UM.Theme.getSize("action_button").height + leftPadding: UM.Theme.getSize("thick_margin").width + rightPadding: UM.Theme.getSize("thick_margin").width + checkable: true + hoverEnabled: true + + contentItem: Item + { + width: objectItemButton.width - objectItemButton.leftPadding + height: UM.Theme.getSize("action_button").height + + Label + { + id: buttonText + anchors + { + left: parent.left + right: printerTypes.left + verticalCenter: parent.verticalCenter + } + text: { + print("HOLAAAAAAAA", objectItemButton.text) + return objectItemButton.text + } + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("medium") + visible: text != "" + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + } + + background: Rectangle + { + id: backgroundRect + color: objectItemButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent" + radius: UM.Theme.getSize("action_button_radius").width + border.width: UM.Theme.getSize("default_lining").width + border.color: objectItemButton.checked ? UM.Theme.getColor("primary") : "transparent" + } + + onClicked: Cura.SceneController.changeSelection(index) +} diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml new file mode 100644 index 0000000000..87e42bd94a --- /dev/null +++ b/resources/qml/ObjectSelector.qml @@ -0,0 +1,108 @@ +// Copyright (c) 2019 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.3 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Cura.ExpandableComponent +{ + id: base + + headerCornerSide: Cura.RoundedRectangle.Direction.All + contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft + contentHeaderTitle: catalog.i18nc("@label", "Object list") + + headerItem: 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 + } + } + + contentItem: Item + { + id: popup + width: UM.Theme.getSize("machine_selector_widget_content").width + + ScrollView + { + id: scroll + width: parent.width + clip: true + leftPadding: UM.Theme.getSize("default_lining").width + rightPadding: UM.Theme.getSize("default_lining").width + + 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 + + // 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 {} + + delegate: ObjectItemButton + { + text: model.name + width: listView.width + + checked: model.selected + } + } + } + + 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/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index e9452f4d35..629d3fdba3 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -130,7 +130,6 @@ Cura.ExpandablePopup scroll.height = Math.min(contentHeight, maximumHeight) popup.height = scroll.height + buttonRow.height } - } } diff --git a/resources/qml/qmldir b/resources/qml/qmldir index 62997cc27a..01b0b295d8 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -1,6 +1,7 @@ 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 From 3829eb09056e3e29fafc19fa94dc798acf6cafc7 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 17 Feb 2019 19:22:54 +0100 Subject: [PATCH 2/7] Add a preference check to enable or disable the experimental feature --- cura/CuraApplication.py | 1 + plugins/PrepareStage/PrepareMenu.qml | 121 ++++++++++++---------- resources/qml/ObjectItemButton.qml | 5 +- resources/qml/Preferences/GeneralPage.qml | 15 +++ 4 files changed, 84 insertions(+), 58 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 655126471d..bbb4f15445 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -499,6 +499,7 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/choice_on_profile_override", "always_ask") preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/use_multi_build_plate", False) + preferences.addPreference("cura/show_list_of_files", False) preferences.addPreference("view/settings_list_height", 400) preferences.addPreference("view/settings_visible", False) preferences.addPreference("cura/currency", "€") diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index f571143384..9d1ff81fd7 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -24,14 +24,14 @@ Item Item { anchors.horizontalCenter: parent.horizontalCenter - width: objectSelector.width + itemRow.width + UM.Theme.getSize("default_margin").width + width: loader.width + itemRow.width + UM.Theme.getSize("default_margin").width height: parent.height RowLayout { id: itemRow - anchors.left: objectSelector.right + anchors.left: loader.right anchors.leftMargin: UM.Theme.getSize("default_margin").width width: Math.round(0.9 * prepareMenu.width) @@ -82,60 +82,73 @@ Item } } - Cura.ObjectSelector + Loader { - id: objectSelector - height: UM.Theme.getSize("stage_menu").height - width: UM.Theme.getSize("stage_menu").height + id: loader + sourceComponent: UM.Preferences.getValue("cura/show_list_of_files") ? objectSelector : openFileButton } -// Button -// { -// id: openFileButton -// 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 -// -// 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 -// } -// } + Component + { + id: objectSelector + + Cura.ObjectSelector + { + height: UM.Theme.getSize("stage_menu").height + width: 1.5 * UM.Theme.getSize("stage_menu").height | 0 + } + } + + Component + { + 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 + + 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 + } + } + } } } diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 8b1a7036bd..44bdf469e3 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -32,10 +32,7 @@ Button right: printerTypes.left verticalCenter: parent.verticalCenter } - text: { - print("HOLAAAAAAAA", objectItemButton.text) - return objectItemButton.text - } + text: objectItemButton.text color: UM.Theme.getColor("text") font: UM.Theme.getFont("medium") visible: text != "" diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 0dd6c6313a..35108a88bf 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -741,6 +741,21 @@ 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 From 7b030a8235ef78c3bada5a53cf137319ae7ce4b8 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 3 Mar 2019 20:10:14 +0100 Subject: [PATCH 3/7] Move the objectsList to the bottom Now it appears as a panel that you can expand/collapse. For now the background is transparent waiting for the designs to be clear. --- cura/ObjectsModel.py | 2 +- plugins/PrepareStage/PrepareMenu.qml | 103 ++++----- resources/qml/Cura.qml | 20 +- resources/qml/ObjectItemButton.qml | 10 +- resources/qml/ObjectSelector.qml | 92 ++++---- resources/qml/ObjectsList.qml | 262 ---------------------- resources/qml/Preferences/GeneralPage.qml | 41 +--- resources/qml/qmldir | 1 - resources/themes/cura-light/theme.json | 2 +- 9 files changed, 104 insertions(+), 429 deletions(-) delete mode 100644 resources/qml/ObjectsList.qml 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], From 8e3fb6196d06ef4d4fa22081ee94f7dc8e113d34 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Sun, 3 Mar 2019 21:18:34 +0100 Subject: [PATCH 4/7] Add animation when expand/collapse panel --- resources/qml/ObjectSelector.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index e13b6eea26..266293a0af 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -11,7 +11,6 @@ Item { id: objectSelector width: UM.Theme.getSize("objects_menu_size").width -// height: childrenRect.height property bool opened: UM.Preferences.getValue("cura/show_list_of_files") Button @@ -51,6 +50,8 @@ Item visible: objectSelector.opened height: visible ? scroll.height : 0 + Behavior on height { NumberAnimation { duration: 100 } } + anchors.bottom: parent.bottom ScrollView From ad65fd6381a517758f230785e15637f6af9df899 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 5 Mar 2019 10:33:27 +0100 Subject: [PATCH 5/7] Modify style of the ObjectSelector I got input from our designer to do it. When it's closed the panel is not intrusive, but when opened it shows a background color to make it readable. --- resources/qml/JobSpecs.qml | 2 +- resources/qml/ObjectSelector.qml | 48 +++++++++++++++++++------- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 144616c22d..63ccbc336a 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -65,7 +65,7 @@ Item height: UM.Theme.getSize("save_button_specs_icons").height sourceSize.width: width sourceSize.height: width - color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene") + color: control.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") source: UM.Theme.getIcon("pencil") } } diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index 266293a0af..3d4d32821c 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -16,9 +16,10 @@ Item Button { id: openCloseButton - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + width: parent.width + height: contentItem.height hoverEnabled: true + padding: 0 anchors { @@ -26,12 +27,33 @@ Item horizontalCenter: parent.horizontalCenter } - contentItem: UM.RecolorImage + contentItem: Item { - 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") + width: parent.width + height: label.height + + UM.RecolorImage + { + id: openCloseIcon + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + anchors.left: parent.left + 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") + } + + Label + { + id: label + anchors.left: openCloseIcon.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@label", "Object list") + font: UM.Theme.getFont("default") + color: openCloseButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text") + renderType: Text.NativeRendering + elide: Text.ElideRight + } } background: Item {} @@ -43,12 +65,15 @@ Item } } - Item + Rectangle { id: contents width: parent.width visible: objectSelector.opened height: visible ? scroll.height : 0 + color: UM.Theme.getColor("main_background") + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") Behavior on height { NumberAnimation { duration: 100 } } @@ -59,8 +84,7 @@ Item id: scroll width: parent.width clip: true - leftPadding: UM.Theme.getSize("default_lining").width - rightPadding: UM.Theme.getSize("default_lining").width + padding: UM.Theme.getSize("default_lining").width contentItem: ListView { @@ -73,12 +97,12 @@ Item // 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) + scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding } Component.onCompleted: { - scroll.height = Math.min(contentHeight, maximumHeight) + scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding } model: Cura.ObjectsModel {} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 1b81d41413..76a0a5e8e0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -569,7 +569,7 @@ "jobspecs_line": [2.0, 2.0], - "objects_menu_size": [18, 18], + "objects_menu_size": [15, 15], "objects_menu_size_collapsed": [20, 17], "build_plate_selection_size": [15, 5], "objects_menu_button": [0.3, 2.7], From 730564345b0797b541888899493f17e7d4c3ba44 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 6 Mar 2019 10:38:18 +0100 Subject: [PATCH 6/7] Add a small padding at the bottom Otherwise the button is very close to the list of objects. --- resources/qml/Cura.qml | 2 +- resources/qml/ObjectSelector.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 0d668f14d0..da0708b1d2 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -219,7 +219,7 @@ UM.MainWindow left: toolbar.right leftMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width - bottomMargin: UM.Theme.getSize("thin_margin").width + bottomMargin: UM.Theme.getSize("narrow_margin").height } } diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index 3d4d32821c..82bbec7f78 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -17,9 +17,10 @@ Item { id: openCloseButton width: parent.width - height: contentItem.height + height: contentItem.height + bottomPadding hoverEnabled: true padding: 0 + bottomPadding: UM.Theme.getSize("narrow_margin").height / 2 | 0 anchors { From 961f6403adb9c8ec034460e404ca7ed991b929b0 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 16 May 2019 15:49:08 +0200 Subject: [PATCH 7/7] Change preference key to cura/show_list_of_objects --- cura/CuraApplication.py | 2 +- resources/qml/ObjectItemButton.qml | 4 ++-- resources/qml/ObjectSelector.qml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 706e136d53..2b0c75bc6c 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -523,7 +523,7 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/choice_on_profile_override", "always_ask") preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/use_multi_build_plate", False) - preferences.addPreference("cura/show_list_of_files", False) + preferences.addPreference("cura/show_list_of_objects", False) preferences.addPreference("view/settings_list_height", 400) preferences.addPreference("view/settings_visible", False) preferences.addPreference("view/settings_xpos", 0) diff --git a/resources/qml/ObjectItemButton.qml b/resources/qml/ObjectItemButton.qml index 82b02012e8..683d0ed52b 100644 --- a/resources/qml/ObjectItemButton.qml +++ b/resources/qml/ObjectItemButton.qml @@ -1,8 +1,8 @@ // Copyright (c) 2018 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 -import QtQuick.Controls 2.1 +import QtQuick 2.10 +import QtQuick.Controls 2.3 import UM 1.1 as UM import Cura 1.0 as Cura diff --git a/resources/qml/ObjectSelector.qml b/resources/qml/ObjectSelector.qml index 82bbec7f78..3b7f3455b3 100644 --- a/resources/qml/ObjectSelector.qml +++ b/resources/qml/ObjectSelector.qml @@ -1,7 +1,7 @@ // Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 import QtQuick.Controls 2.3 import UM 1.2 as UM @@ -11,7 +11,7 @@ Item { id: objectSelector width: UM.Theme.getSize("objects_menu_size").width - property bool opened: UM.Preferences.getValue("cura/show_list_of_files") + property bool opened: UM.Preferences.getValue("cura/show_list_of_objects") Button { @@ -61,8 +61,8 @@ Item onClicked: { - UM.Preferences.setValue("cura/show_list_of_files", !objectSelector.opened) - objectSelector.opened = UM.Preferences.getValue("cura/show_list_of_files") + UM.Preferences.setValue("cura/show_list_of_objects", !objectSelector.opened) + objectSelector.opened = UM.Preferences.getValue("cura/show_list_of_objects") } }