diff options
25 files changed, 287 insertions, 103 deletions
diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9ec2435f0b..4d1c530237 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -51,7 +51,7 @@ from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob from cura.Arranging.ShapeArray import ShapeArray from cura.MultiplyObjectsJob import MultiplyObjectsJob -from cura.PrintersModel import PrintersModel +from cura.GlobalStacksModel import GlobalStacksModel from cura.Scene.ConvexHullDecorator import ConvexHullDecorator from cura.Operations.SetParentOperation import SetParentOperation from cura.Scene.SliceableObjectDecorator import SliceableObjectDecorator @@ -499,7 +499,8 @@ 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("view/settings_list_height", 600) + preferences.addPreference("view/settings_visible", False) preferences.addPreference("cura/currency", "€") preferences.addPreference("cura/material_settings", "{}") @@ -971,7 +972,7 @@ class CuraApplication(QtApplication): qmlRegisterType(MultiBuildPlateModel, "Cura", 1, 0, "MultiBuildPlateModel") qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") - qmlRegisterType(PrintersModel, "Cura", 1, 0, "PrintersModel") + qmlRegisterType(GlobalStacksModel, "Cura", 1, 0, "GlobalStacksModel") qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel") qmlRegisterType(GenericMaterialsModel, "Cura", 1, 0, "GenericMaterialsModel") diff --git a/cura/PrintersModel.py b/cura/GlobalStacksModel.py index 8b5d2f6cc9..939809151d 100644 --- a/cura/PrintersModel.py +++ b/cura/GlobalStacksModel.py @@ -12,7 +12,8 @@ from cura.PrinterOutputDevice import ConnectionType from cura.Settings.GlobalStack import GlobalStack -class PrintersModel(ListModel): + +class GlobalStacksModel(ListModel): NameRole = Qt.UserRole + 1 IdRole = Qt.UserRole + 2 HasRemoteConnectionRole = Qt.UserRole + 3 @@ -41,21 +42,14 @@ class PrintersModel(ListModel): if isinstance(container, GlobalStack): self._update() - ## Handler for container name change events. - def _onContainerNameChanged(self): - self._update() - def _update(self) -> None: items = [] - for container in self._container_stacks: - container.nameChanged.disconnect(self._onContainerNameChanged) container_stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") for container_stack in container_stacks: - connection_type = container_stack.getMetaDataEntry("connection_type") + connection_type = int(container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value)) has_remote_connection = connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] - if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: continue diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index aeeb0381b2..99e8835c2f 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -36,7 +36,7 @@ class ConnectionState(IntEnum): class ConnectionType(IntEnum): - Unknown = 0 + NotConnected = 0 UsbConnection = 1 NetworkConnection = 2 CloudConnection = 3 @@ -74,7 +74,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # Signal to indicate that the configuration of one of the printers has changed. uniqueConfigurationsChanged = pyqtSignal() - def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.Unknown, parent: QObject = None) -> None: + def __init__(self, device_id: str, connection_type: "ConnectionType" = ConnectionType.NotConnected, parent: QObject = None) -> None: super().__init__(device_id = device_id, parent = parent) # type: ignore # MyPy complains with the multiple inheritance self._printers = [] # type: List[PrinterOutputModel] diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 2185bbce9d..32b83ead28 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -527,7 +527,7 @@ class MachineManager(QObject): @pyqtProperty(bool, notify = printerConnectedStatusChanged) def activeMachineHasRemoteConnection(self) -> bool: if self._global_container_stack: - connection_type = self._global_container_stack.getMetaDataEntry("connection_type") + connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value)) return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value] return False diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 15030c7f1d..d5fe618b2d 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -484,7 +484,7 @@ UM.Dialog onClicked: dialog.accept() } - Button + Cura.SecondaryButton { objectName: "postProcessingSaveAreaButton" visible: activeScriptsList.count > 0 @@ -492,41 +492,7 @@ UM.Dialog width: height tooltip: catalog.i18nc("@info:tooltip", "Change active post-processing scripts") onClicked: dialog.show() - - style: ButtonStyle - { - background: Rectangle - { - id: deviceSelectionIcon - border.width: UM.Theme.getSize("default_lining").width - border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : - control.pressed ? UM.Theme.getColor("action_button_active_border") : - control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") - color: !control.enabled ? UM.Theme.getColor("action_button_disabled") : - control.pressed ? UM.Theme.getColor("action_button_active") : - control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") - Behavior on color { ColorAnimation { duration: 50; } } - - anchors.left: parent.left - anchors.leftMargin: Math.round(UM.Theme.getSize("save_button_text_margin").width / 2) - - width: parent.height - height: parent.height - - UM.RecolorImage - { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: Math.round(parent.width / 2) - height: Math.round(parent.height / 2) - sourceSize.height: height - color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : - control.pressed ? UM.Theme.getColor("action_button_active_text") : - control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text") - source: "postprocessing.svg" - } - } - label: Label { } - } + iconSource: "postprocessing.svg" + fixedWidthMode: true } }
\ No newline at end of file diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 42b8cf0ba0..88f298d1f5 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -163,9 +163,9 @@ Item id: rangleHandleLabel height: sliderRoot.handleSize + UM.Theme.getSize("default_margin").height - x: parent.x + parent.width + UM.Theme.getSize("default_margin").width + x: parent.x - width - UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - target: Qt.point(sliderRoot.width + width, y + height / 2) + target: Qt.point(sliderRoot.width, y + height / 2) visible: sliderRoot.activeHandle == parent // custom properties diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index bebccc54e3..5e8aaa9fa9 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -620,8 +620,9 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): if material_group_list is None: material_name = i18n_catalog.i18nc("@label:material", "Empty") if len(material_data.get("guid", "")) == 0 \ else i18n_catalog.i18nc("@label:material", "Unknown") + return MaterialOutputModel(guid = material_data.get("guid", ""), - type = material_data.get("type", ""), + type = material_data.get("material", ""), color = material_data.get("color", ""), brand = material_data.get("brand", ""), name = material_data.get("name", material_name) diff --git a/resources/qml/ActionPanel/ActionPanelWidget.qml b/resources/qml/ActionPanel/ActionPanelWidget.qml index a1cd81e9e9..1d9ee95548 100644 --- a/resources/qml/ActionPanel/ActionPanelWidget.qml +++ b/resources/qml/ActionPanel/ActionPanelWidget.qml @@ -23,6 +23,7 @@ Rectangle border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") radius: UM.Theme.getSize("default_radius").width + z: 10 property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled diff --git a/resources/qml/ActionPanel/OutputDevicesActionButton.qml b/resources/qml/ActionPanel/OutputDevicesActionButton.qml index fc0f9b8303..3bfaab0fc1 100644 --- a/resources/qml/ActionPanel/OutputDevicesActionButton.qml +++ b/resources/qml/ActionPanel/OutputDevicesActionButton.qml @@ -93,7 +93,6 @@ Item onClicked: { UM.OutputDeviceManager.setActiveDevice(model.id) - widget.requestWriteToDevice() popup.close() } } diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 223ddacb31..15214f212c 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -40,8 +40,7 @@ Column anchors { left: parent.left - right: printInformationPanel.left - rightMargin: printInformationPanel.visible ? UM.Theme.getSize("thin_margin").width : 0 + right: parent.right } Cura.IconWithText @@ -52,6 +51,14 @@ Column text: preSlicedData ? catalog.i18nc("@label", "No time estimation available") : PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") font: UM.Theme.getFont("large_bold") + + PrintInformationWidget + { + id: printInformationPanel + visible: !preSlicedData + anchors.left: parent.left + anchors.leftMargin: parent.contentWidth + UM.Theme.getSize("default_margin").width + } } Cura.IconWithText @@ -84,20 +91,43 @@ Column return totalWeights + "g · " + totalLengths.toFixed(2) + "m" } source: UM.Theme.getIcon("spool") - } - } - PrintInformationWidget - { - id: printInformationPanel - visible: !preSlicedData + Item + { + id: additionalComponents + width: childrenRect.width + anchors.right: parent.right + height: parent.height + Row + { + id: additionalComponentsRow + anchors.right: parent.right + anchors.bottom: parent.bottom + spacing: UM.Theme.getSize("default_margin").width + } + } + Component.onCompleted: addAdditionalComponents("saveButton") - anchors - { - right: parent.right - verticalCenter: timeAndCostsInformation.verticalCenter + Connections + { + target: CuraApplication + onAdditionalComponentsChanged: addAdditionalComponents("saveButton") + } + + function addAdditionalComponents (areaId) + { + if(areaId == "saveButton") + { + for (var component in CuraApplication.additionalComponents["saveButton"]) + { + CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow + } + } + } } } + + } Item @@ -127,9 +157,6 @@ Column onClicked: UM.Controller.setActiveStage("PreviewStage") visible: UM.Controller.activeStage != null && UM.Controller.activeStage.stageId != "PreviewStage" - - shadowEnabled: true - shadowColor: UM.Theme.getColor("action_button_disabled_shadow") } Cura.OutputDevicesActionButton diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 51c5e4cac7..1695be8748 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -107,7 +107,13 @@ Column { id: sliceButton fixedWidthMode: true - anchors.fill: parent + + height: parent.height + + anchors.right: additionalComponents.left + anchors.rightMargin: additionalComponents.width != 0 ? UM.Theme.getSize("default_margin").width : 0 + anchors.left: parent.left + text: catalog.i18nc("@button", "Slice") tooltip: catalog.i18nc("@label", "Start the slicing process") enabled: widget.backendState != UM.Backend.Error @@ -119,12 +125,48 @@ Column { id: cancelButton fixedWidthMode: true - anchors.fill: parent + height: parent.height + anchors.left: parent.left + + anchors.right: additionalComponents.left + anchors.rightMargin: additionalComponents.width != 0 ? UM.Theme.getSize("default_margin").width : 0 text: catalog.i18nc("@button", "Cancel") enabled: sliceButton.enabled visible: !sliceButton.visible onClicked: sliceOrStopSlicing() } + + Item + { + id: additionalComponents + width: childrenRect.width + anchors.right: parent.right + height: parent.height + Row + { + id: additionalComponentsRow + anchors.verticalCenter: parent.verticalCenter + spacing: UM.Theme.getSize("default_margin").width + } + } + Component.onCompleted: prepareButtons.addAdditionalComponents("saveButton") + + Connections + { + target: CuraApplication + onAdditionalComponentsChanged: prepareButtons.addAdditionalComponents("saveButton") + } + + function addAdditionalComponents (areaId) + { + if(areaId == "saveButton") + { + for (var component in CuraApplication.additionalComponents["saveButton"]) + { + CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow + } + } + } } diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index afe15bcb1d..025c63d754 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -64,7 +64,7 @@ Item property alias iconSize: collapseButton.height // Is the "drawer" open? - readonly property alias expanded: contentContainer.visible + property alias expanded: contentContainer.visible // What should the radius of the header be. This is also influenced by the headerCornerSide property alias headerRadius: background.radius diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 04c068cb54..a694b8e403 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -85,14 +85,6 @@ Item Menu { - id: plugin_menu - title: catalog.i18nc("@title:menu menubar:toplevel", "&Marketplace") - - MenuItem { action: Cura.Actions.browsePackages } - } - - Menu - { id: preferencesMenu title: catalog.i18nc("@title:menu menubar:toplevel", "P&references") diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 337de806b7..058c1ff4c2 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -12,7 +12,23 @@ Button id: configurationItem property var configuration: null - hoverEnabled: true + hoverEnabled: isValidMaterial + + property bool isValidMaterial: + { + var extruderConfigurations = configuration.extruderConfigurations + + for (var index in extruderConfigurations) + { + var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" + + if (name == "" || name == "Unknown") + { + return false + } + } + return true + } background: Rectangle { @@ -40,17 +56,104 @@ Button right: parent.right rightMargin: UM.Theme.getSize("wide_margin").width } - + height: childrenRect.height spacing: UM.Theme.getSize("default_margin").width Repeater { id: repeater model: configuration.extruderConfigurations + delegate: PrintCoreConfiguration { width: Math.round(parent.width / 2) printCoreConfiguration: modelData + visible: configurationItem.isValidMaterial + } + } + + // Unknown material + Item + { + id: unknownMaterial + height: unknownMaterialMessage.height + UM.Theme.getSize("thin_margin").width / 2 + width: parent.width + + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("thin_margin").width / 2 + + visible: !configurationItem.isValidMaterial + + UM.RecolorImage + { + id: icon + anchors.verticalCenter: unknownMaterialMessage.verticalCenter + + source: UM.Theme.getIcon("warning") + color: UM.Theme.getColor("warning") + width: UM.Theme.getSize("section_icon").width + height: width + } + + Label + { + id: unknownMaterialMessage + text: + { + var extruderConfigurations = configuration.extruderConfigurations + var unknownMaterials = [] + for (var index in extruderConfigurations) + { + var name = extruderConfigurations[index].material ? extruderConfigurations[index].material.name : "" + if (name == "" || name == "Unknown") + { + var materialType = extruderConfigurations[index].material.type + if (extruderConfigurations[index].material.type == "") + { + materialType = "Unknown" + } + + var brand = extruderConfigurations[index].material.brand + if (brand == "") + { + brand = "Unknown" + } + + name = materialType + " (" + brand + ")" + unknownMaterials.push(name) + } + } + + unknownMaterials = "<b>" + unknownMaterials + "</b>" + var draftResult = catalog.i18nc("@label", "This configuration is not available because %1 is not recognized. Please visit %2 to download the correct material profile."); + var result = draftResult.arg(unknownMaterials).arg("<a href=' '>" + catalog.i18nc("@label","Marketplace") + "</a> ") + + return result + } + width: extruderRow.width + + anchors.left: icon.right + anchors.right: unknownMaterial.right + anchors.leftMargin: UM.Theme.getSize("wide_margin").height + anchors.top: unknownMaterial.top + + wrapMode: Text.WordWrap + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignVCenter + linkColor: UM.Theme.getColor("text_link") + + onLinkActivated: + { + Cura.Actions.browsePackages.trigger() + } + } + + MouseArea + { + anchors.fill: parent + cursorShape: unknownMaterialMessage.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.NoButton } } } @@ -84,7 +187,7 @@ Button rightMargin: UM.Theme.getSize("wide_margin").width } height: childrenRect.height - visible: configuration.buildplateConfiguration != "" + visible: configuration.buildplateConfiguration != "" && false //Buildplate is disabled as long as we have no printers that properly support buildplate swapping (so we can't test). // Show the type of buildplate. The first letter is capitalized Cura.IconWithText @@ -113,6 +216,9 @@ Button onClicked: { - Cura.MachineManager.applyRemoteConfiguration(configuration) + if(isValidMaterial) + { + Cura.MachineManager.applyRemoteConfiguration(configuration); + } } } diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml index 684e575bfd..e57b21cb78 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml @@ -51,7 +51,7 @@ Item anchors.left: icon.right anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.") + text: catalog.i18nc("@label", "Downloading the configurations from the remote printer") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") renderType: Text.NativeRendering diff --git a/resources/qml/Menus/LocalPrinterMenu.qml b/resources/qml/Menus/LocalPrinterMenu.qml index e7c5037814..4da1de2abf 100644 --- a/resources/qml/Menus/LocalPrinterMenu.qml +++ b/resources/qml/Menus/LocalPrinterMenu.qml @@ -9,7 +9,7 @@ import Cura 1.0 as Cura Instantiator { - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} MenuItem { diff --git a/resources/qml/Menus/NetworkPrinterMenu.qml b/resources/qml/Menus/NetworkPrinterMenu.qml index 8c607bc5ae..3cb0aae016 100644 --- a/resources/qml/Menus/NetworkPrinterMenu.qml +++ b/resources/qml/Menus/NetworkPrinterMenu.qml @@ -9,7 +9,7 @@ import Cura 1.0 as Cura Instantiator { - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} MenuItem { text: model.metadata["connect_group_name"] diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 93f01c7c9f..d9b679e344 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -408,7 +408,7 @@ Item { anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_lining").width - text: section == "true" ? catalog.i18nc("@label", "Protected profiles") : catalog.i18nc("@label", "Custom profiles") + text: section == "true" ? catalog.i18nc("@label", "Default profiles") : catalog.i18nc("@label", "Custom profiles") font.bold: true } } diff --git a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml index 51eb14a441..98bb5c0405 100644 --- a/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml @@ -11,7 +11,6 @@ import Cura 1.0 as Cura Item { id: customPrintSetup - height: childrenRect.height + padding property real padding: UM.Theme.getSize("default_margin").width property bool multipleExtruders: extrudersModel.count > 1 @@ -98,15 +97,15 @@ Item Rectangle { - height: UM.Theme.getSize("print_setup_widget").height anchors { top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom + topMargin: -UM.Theme.getSize("default_lining").width left: parent.left leftMargin: parent.padding right: parent.right rightMargin: parent.padding - topMargin: -UM.Theme.getSize("default_lining").width + bottom: parent.bottom } z: tabBar.z - 1 // Don't show the border when only one extruder diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml index 2d4d7f6cf1..48ac07679d 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelector.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelector.qml @@ -29,4 +29,7 @@ Cura.ExpandableComponent property var extrudersModel: CuraApplication.getExtrudersModel() contentItem: PrintSetupSelectorContents {} + + onExpandedChanged: UM.Preferences.setValue("view/settings_visible", expanded) + Component.onCompleted: expanded = UM.Preferences.getValue("view/settings_visible") }
\ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 6c678f7ce5..35c5f008b6 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -15,7 +15,7 @@ Item id: content width: UM.Theme.getSize("print_setup_widget").width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + height: contents.height + buttonRow.height enum Mode { @@ -71,6 +71,15 @@ Item right: parent.right top: parent.top } + height: UM.Preferences.getValue("view/settings_list_height") - UM.Theme.getSize("default_margin").height + Connections + { + target: UM.Preferences + onPreferenceChanged: + { + customPrintSetup.height = UM.Preferences.getValue("view/settings_list_height"); + } + } visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom } } @@ -94,13 +103,14 @@ Item anchors { - top: buttonsSeparator.bottom + bottom: parent.bottom left: parent.left right: parent.right } Cura.SecondaryButton { + id: recommendedButton anchors.top: parent.top anchors.left: parent.left anchors.margins: parent.padding @@ -125,5 +135,47 @@ Item visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Custom } + + //Invisible area at the bottom with which you can resize the panel. + MouseArea + { + anchors + { + left: parent.left + right: parent.right + bottom: parent.bottom + top: recommendedButton.bottom + topMargin: UM.Theme.getSize("default_lining").height + } + cursorShape: Qt.SplitVCursor + visible: currentModeIndex == PrintSetupSelectorContents.Mode.Custom + drag + { + target: parent + axis: Drag.YAxis + } + onMouseYChanged: + { + if(drag.active) + { + // position of mouse relative to dropdown align vertical centre of mouse area to cursor + // v------------------------------v v------------v + var h = mouseY + buttonRow.y + content.y - height / 2 | 0; + if(h < 200 * screenScaleFactor) //Enforce a minimum size. + { + h = 200 * screenScaleFactor; + } + + //Absolute mouse Y position in the window, to prevent it from going outside the window. + var mouse_absolute_y = mapToGlobal(mouseX, mouseY).y - UM.Preferences.getValue("general/window_top"); + if(mouse_absolute_y > base.height) + { + h -= mouse_absolute_y - base.height; + } + + UM.Preferences.setValue("view/settings_list_height", h); + } + } + } } }
\ No newline at end of file diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 28e01c7ae9..9f0d3b4ac6 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -93,14 +93,16 @@ Cura.ExpandablePopup width: scroll.width - scroll.leftPadding - scroll.rightPadding property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height - onHeightChanged: + // We use an extra property here, since we only want to to be informed about the content size changes. + onContentHeightChanged: { - scroll.height = Math.min(height, maximumHeight) + scroll.height = Math.min(contentHeight, maximumHeight) popup.height = scroll.height + buttonRow.height } + Component.onCompleted: { - scroll.height = Math.min(height, maximumHeight) + scroll.height = Math.min(contentHeight, maximumHeight) popup.height = scroll.height + buttonRow.height } diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index ea8068fa95..b9c20d0de1 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -10,15 +10,15 @@ import Cura 1.0 as Cura ListView { id: listView - height: childrenRect.height - model: Cura.PrintersModel {} + model: Cura.GlobalStacksModel {} section.property: "hasRemoteConnection" + property real contentHeight: childrenRect.height section.delegate: Label { text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") width: parent.width - height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width renderType: Text.NativeRendering font: UM.Theme.getFont("medium") diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index d7d084557b..4361c3ae2b 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -256,7 +256,7 @@ QtObject source: control.iconSource width: Theme.getSize("button_icon").width height: Theme.getSize("button_icon").height - color: Theme.getColor("toolbar_button_text") + color: Theme.getColor("icon") sourceSize: Theme.getSize("button_icon") } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e0a1c0f9bd..42ef632673 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -113,7 +113,6 @@ "warning": [245, 166, 35, 255], "disabled": [229, 229, 229, 255], - "toolbar_button_text": [8, 7, 63, 255], "toolbar_button_hover": [232, 242, 252, 255], "toolbar_button_active": [232, 242, 252, 255], "toolbar_button_active_hover": [232, 242, 252, 255], |