From c016c23d10fe8c6429eef8c8c817997d9d257e35 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Mon, 22 Aug 2022 16:26:02 +0200 Subject: [PATCH 01/21] Create model from abstract machine list CURA-9514 --- cura/Machines/Models/AbstractStacksModel.py | 103 ++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 cura/Machines/Models/AbstractStacksModel.py diff --git a/cura/Machines/Models/AbstractStacksModel.py b/cura/Machines/Models/AbstractStacksModel.py new file mode 100644 index 0000000000..96360a978c --- /dev/null +++ b/cura/Machines/Models/AbstractStacksModel.py @@ -0,0 +1,103 @@ +# Copyright (c) 2022 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from PyQt6.QtCore import Qt, QTimer +from typing import Optional, Dict + +from UM.Qt.ListModel import ListModel +from UM.i18n import i18nCatalog +from UM.Util import parseBool + +from cura.PrinterOutput.PrinterOutputDevice import ConnectionType +from cura.Settings.CuraContainerRegistry import CuraContainerRegistry +from cura.Settings.GlobalStack import GlobalStack + +class AbstractStacksModel(ListModel): + NameRole = Qt.ItemDataRole.UserRole + 1 + IdRole = Qt.ItemDataRole.UserRole + 2 + HasRemoteConnectionRole = Qt.ItemDataRole.UserRole + 3 + ConnectionTypeRole = Qt.ItemDataRole.UserRole + 4 + MetaDataRole = Qt.ItemDataRole.UserRole + 5 + DiscoverySourceRole = Qt.ItemDataRole.UserRole + 6 + RemovalWarningRole = Qt.ItemDataRole.UserRole + 7 + IsOnlineRole = Qt.ItemDataRole.UserRole + 8 + MachineTypeRole = Qt.ItemDataRole.UserRole + 9 + + def __init__(self, parent=None) -> None: + super().__init__(parent) + + self._catalog = i18nCatalog("cura") + + self.addRoleName(self.NameRole, "name") + self.addRoleName(self.IdRole, "id") + self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") + self.addRoleName(self.MetaDataRole, "metadata") + self.addRoleName(self.DiscoverySourceRole, "discoverySource") + self.addRoleName(self.IsOnlineRole, "isOnline") + self.addRoleName(self.MachineTypeRole, "machineType") + + self._change_timer = QTimer() + self._change_timer.setInterval(200) + self._change_timer.setSingleShot(True) + self._change_timer.timeout.connect(self._update) + + # Listen to changes + CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged) + CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged) + CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged) + self._updateDelayed() + + def _onContainerChanged(self, container) -> None: + """Handler for container added/removed events from registry""" + + # We only need to update when the added / removed container GlobalStack + if isinstance(container, GlobalStack): + self._updateDelayed() + + def _updateDelayed(self) -> None: + self._change_timer.start() + + def _update(self) -> None: + items = [] + + abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type="abstract_machine") + + for abstract_machine in abstract_machine_stacks: + machine_stacks = container_stacks # FIXME: This should point to abstract_machine.getPrinters() + + # Create item for abstract printer + items.append(self.createItem(abstract_machine)) + + # Create list of printers that are children of the abstract printer + for stack in machine_stacks: + item = self.createItem(stack) + if item: + items.append(item) + + self.setItems(items) + + def createItem(self, container_stack: GlobalStack) -> Optional[Dict]: + if parseBool(container_stack.getMetaDataEntry("hidden", False)): + return + + has_remote_connection = False + + for connection_type in container_stack.configuredConnectionTypes: + has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, + ConnectionType.CloudConnection.value] + + device_name = container_stack.getMetaDataEntry("group_name", container_stack.getName()) + default_removal_warning = self._catalog.i18nc( + "@label {0} is the name of a printer that's about to be deleted.", + "Are you sure you wish to remove {0}? This cannot be undone!", device_name + ) + + return {"name": device_name, + "id": container_stack.getId(), + "hasRemoteConnection": has_remote_connection, + "metadata": container_stack.getMetaData().copy(), + "section": self._catalog.i18nc("@label", "Connected printers"), + "removalWarning": container_stack.getMetaDataEntry("removal_warning", default_removal_warning), + "isOnline": container_stack.getMetaDataEntry("is_online", False), + "machineType": container_stack.getMetaDataEntry("type"), + } From 7ffa770fb47c2a4acbb0700378ef0b96ea519523 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 10:35:00 +0200 Subject: [PATCH 02/21] Searching container registry returns ContainerStacks. Made typing more generic to work with an ContainerStack to compensate. Made AbstractMachine getMachines a classmethod so it can be called with ContainerStacks. CURA-9514 --- cura/CuraApplication.py | 2 ++ cura/Machines/Models/AbstractStacksModel.py | 9 +++++++-- cura/Settings/AbstractMachine.py | 15 ++++++++++++--- .../qml/PrinterSelector/MachineSelectorList.qml | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f701c94797..2afbfbd3e8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -115,6 +115,7 @@ from . import CuraActions from . import PlatformPhysics from . import PrintJobPreviewImageProvider from .AutoSave import AutoSave +from .Machines.Models.AbstractStacksModel import AbstractStacksModel from .Machines.Models.ActiveIntentQualitiesModel import ActiveIntentQualitiesModel from .Machines.Models.IntentSelectionModel import IntentSelectionModel from .SingleInstance import SingleInstance @@ -1194,6 +1195,7 @@ class CuraApplication(QtApplication): qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") qmlRegisterType(GlobalStacksModel, "Cura", 1, 0, "GlobalStacksModel") + qmlRegisterType(AbstractStacksModel, "Cura", 1, 0, "AbstractStacksModel") self.processEvents() qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel") diff --git a/cura/Machines/Models/AbstractStacksModel.py b/cura/Machines/Models/AbstractStacksModel.py index 96360a978c..e9b991962b 100644 --- a/cura/Machines/Models/AbstractStacksModel.py +++ b/cura/Machines/Models/AbstractStacksModel.py @@ -5,10 +5,12 @@ from PyQt6.QtCore import Qt, QTimer from typing import Optional, Dict from UM.Qt.ListModel import ListModel +from UM.Settings.ContainerStack import ContainerStack from UM.i18n import i18nCatalog from UM.Util import parseBool from cura.PrinterOutput.PrinterOutputDevice import ConnectionType +from cura.Settings.AbstractMachine import AbstractMachine from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.GlobalStack import GlobalStack @@ -62,8 +64,11 @@ class AbstractStacksModel(ListModel): abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type="abstract_machine") + abstract_machine_stacks.sort(key=lambda machine: machine.getName(), reverse=True) + for abstract_machine in abstract_machine_stacks: - machine_stacks = container_stacks # FIXME: This should point to abstract_machine.getPrinters() + machine_stacks = AbstractMachine.getMachines(abstract_machine) + # Create item for abstract printer items.append(self.createItem(abstract_machine)) @@ -76,7 +81,7 @@ class AbstractStacksModel(ListModel): self.setItems(items) - def createItem(self, container_stack: GlobalStack) -> Optional[Dict]: + def createItem(self, container_stack: ContainerStack) -> Optional[Dict]: if parseBool(container_stack.getMetaDataEntry("hidden", False)): return diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py index a89201a294..a904058290 100644 --- a/cura/Settings/AbstractMachine.py +++ b/cura/Settings/AbstractMachine.py @@ -14,13 +14,22 @@ class AbstractMachine(GlobalStack): super().__init__(container_id) self.setMetaDataEntry("type", "abstract_machine") - def getMachines(self) -> List[ContainerStack]: - from cura.CuraApplication import CuraApplication + @classmethod + def getMachines(cls, abstract_machine: ContainerStack) -> List[ContainerStack]: + """ Fetches containers for all machines that match definition with an abstract machine. + :param abstractMachine: The abstract machine stack. + :return: A list of Containers or an empty list if stack is not an "abstract_machine" + """ + if not abstract_machine.getMetaDataEntry("type") == "abstract_machine": + return [] + + from cura.CuraApplication import CuraApplication # In function to avoid circular import application = CuraApplication.getInstance() registry = application.getContainerRegistry() - printer_type = self.definition.getId() + printer_type = abstract_machine.definition.getId() + return [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes] diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index ae2706f9ab..822bdad3c5 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura ListView { id: listView - model: Cura.GlobalStacksModel {} + model: Cura.AbstractStacksModel {} section.property: "hasRemoteConnection" property real contentHeight: childrenRect.height From bedb76d516e4a58058010f7d9a9612d6eee75227 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 13:11:17 +0200 Subject: [PATCH 03/21] Update comment CURA-9514 --- cura/Settings/AbstractMachine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py index a904058290..a760421c60 100644 --- a/cura/Settings/AbstractMachine.py +++ b/cura/Settings/AbstractMachine.py @@ -16,10 +16,10 @@ class AbstractMachine(GlobalStack): @classmethod def getMachines(cls, abstract_machine: ContainerStack) -> List[ContainerStack]: - """ Fetches containers for all machines that match definition with an abstract machine. + """ Fetches all container stacks that match definition_id with an abstract machine. :param abstractMachine: The abstract machine stack. - :return: A list of Containers or an empty list if stack is not an "abstract_machine" + :return: A list of Containers or an empty list if abstract_machine is not an "abstract_machine" """ if not abstract_machine.getMetaDataEntry("type") == "abstract_machine": return [] From b18080c332ed945a55d301da6354a9f6820b5ad2 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 14:29:05 +0200 Subject: [PATCH 04/21] Rename AbstractStacksModel.py -> MachineListModel.py since this model includes both abstract machine stacks and regular machines Add machineCount for displaying the number of machines of a type. MachineSelectorButton is in use in other places, swapped it out for a new Component MachineListButton. CURA-9514 --- cura/CuraApplication.py | 4 +- ...ractStacksModel.py => MachineListModel.py} | 10 ++- .../qml/PrinterSelector/MachineListButton.qml | 88 +++++++++++++++++++ .../PrinterSelector/MachineSelectorList.qml | 9 +- resources/qml/qmldir | 1 + resources/themes/cura-light/theme.json | 3 + 6 files changed, 104 insertions(+), 11 deletions(-) rename cura/Machines/Models/{AbstractStacksModel.py => MachineListModel.py} (92%) create mode 100644 resources/qml/PrinterSelector/MachineListButton.qml diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2afbfbd3e8..3cd0ecbf97 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -115,7 +115,7 @@ from . import CuraActions from . import PlatformPhysics from . import PrintJobPreviewImageProvider from .AutoSave import AutoSave -from .Machines.Models.AbstractStacksModel import AbstractStacksModel +from .Machines.Models.MachineListModel import MachineListModel from .Machines.Models.ActiveIntentQualitiesModel import ActiveIntentQualitiesModel from .Machines.Models.IntentSelectionModel import IntentSelectionModel from .SingleInstance import SingleInstance @@ -1195,7 +1195,7 @@ class CuraApplication(QtApplication): qmlRegisterType(InstanceContainer, "Cura", 1, 0, "InstanceContainer") qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") qmlRegisterType(GlobalStacksModel, "Cura", 1, 0, "GlobalStacksModel") - qmlRegisterType(AbstractStacksModel, "Cura", 1, 0, "AbstractStacksModel") + qmlRegisterType(MachineListModel, "Cura", 1, 0, "MachineListModel") self.processEvents() qmlRegisterType(FavoriteMaterialsModel, "Cura", 1, 0, "FavoriteMaterialsModel") diff --git a/cura/Machines/Models/AbstractStacksModel.py b/cura/Machines/Models/MachineListModel.py similarity index 92% rename from cura/Machines/Models/AbstractStacksModel.py rename to cura/Machines/Models/MachineListModel.py index e9b991962b..1f9b3d9eba 100644 --- a/cura/Machines/Models/AbstractStacksModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -14,7 +14,8 @@ from cura.Settings.AbstractMachine import AbstractMachine from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.GlobalStack import GlobalStack -class AbstractStacksModel(ListModel): + +class MachineListModel(ListModel): NameRole = Qt.ItemDataRole.UserRole + 1 IdRole = Qt.ItemDataRole.UserRole + 2 HasRemoteConnectionRole = Qt.ItemDataRole.UserRole + 3 @@ -24,6 +25,7 @@ class AbstractStacksModel(ListModel): RemovalWarningRole = Qt.ItemDataRole.UserRole + 7 IsOnlineRole = Qt.ItemDataRole.UserRole + 8 MachineTypeRole = Qt.ItemDataRole.UserRole + 9 + MachineCountRole = Qt.ItemDataRole.UserRole + 10 def __init__(self, parent=None) -> None: super().__init__(parent) @@ -37,6 +39,7 @@ class AbstractStacksModel(ListModel): self.addRoleName(self.DiscoverySourceRole, "discoverySource") self.addRoleName(self.IsOnlineRole, "isOnline") self.addRoleName(self.MachineTypeRole, "machineType") + self.addRoleName(self.MachineCountRole, "machineCount") self._change_timer = QTimer() self._change_timer.setInterval(200) @@ -71,7 +74,7 @@ class AbstractStacksModel(ListModel): # Create item for abstract printer - items.append(self.createItem(abstract_machine)) + items.append(self.createItem(abstract_machine, len(machine_stacks))) # Create list of printers that are children of the abstract printer for stack in machine_stacks: @@ -81,7 +84,7 @@ class AbstractStacksModel(ListModel): self.setItems(items) - def createItem(self, container_stack: ContainerStack) -> Optional[Dict]: + def createItem(self, container_stack: ContainerStack, machine_count: int = 0) -> Optional[Dict]: if parseBool(container_stack.getMetaDataEntry("hidden", False)): return @@ -105,4 +108,5 @@ class AbstractStacksModel(ListModel): "removalWarning": container_stack.getMetaDataEntry("removal_warning", default_removal_warning), "isOnline": container_stack.getMetaDataEntry("is_online", False), "machineType": container_stack.getMetaDataEntry("type"), + "machineCount": machine_count, } diff --git a/resources/qml/PrinterSelector/MachineListButton.qml b/resources/qml/PrinterSelector/MachineListButton.qml new file mode 100644 index 0000000000..b6b7f4c1dd --- /dev/null +++ b/resources/qml/PrinterSelector/MachineListButton.qml @@ -0,0 +1,88 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.5 as UM +import Cura 1.0 as Cura + + +Button +{ + id: machineListButton + + width: parent.width + height: UM.Theme.getSize("large_button").height + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("default_margin").width + checkable: true + hoverEnabled: true + + contentItem: Item + { + width: machineListButton.width - machineListButton.leftPadding - machineListButton.rightPadding + height: UM.Theme.getSize("action_button").height + + UM.ColorImage + { + id: printerIcon + height: UM.Theme.getSize("medium_button").height + width: UM.Theme.getSize("medium_button").width + color: UM.Theme.getColor("machine_selector_printer_icon") + visible: model.machineType == "abstract_machine" + source: model.machineType == "abstract_machine" ? UM.Theme.getIcon("PrinterTriple", "medium") : UM.Theme.getIcon("Printer", "medium") + + anchors + { + left: parent.left + verticalCenter: parent.verticalCenter + } + } + + UM.Label + { + id: buttonText + anchors + { + left: printerIcon.right + right: printerCount.left + verticalCenter: parent.verticalCenter + leftMargin: UM.Theme.getSize("default_margin").width + } + text: machineListButton.text + font: model.machineType == "abstract_machine" ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium") + visible: text != "" + elide: Text.ElideRight + } + + Rectangle + { + id: printerCount + color: UM.Theme.getColor("background_2") + radius: height + width: height + anchors + { + right: parent.right + top: buttonText.top + bottom: buttonText.bottom + verticalCenter: parent.verticalCenter + } + visible: model.machineType == "abstract_machine" + + UM.Label + { + text: model.machineCount + anchors.centerIn: parent + font: UM.Theme.getFont("default_bold") + } + } + } + + background: Rectangle + { + id: backgroundRect + color: machineListButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent" + } +} diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 822bdad3c5..de14846fb7 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -10,8 +10,8 @@ import Cura 1.0 as Cura ListView { id: listView - model: Cura.AbstractStacksModel {} - section.property: "hasRemoteConnection" + model: Cura.MachineListModel {} + section.property: "section" property real contentHeight: childrenRect.height ScrollBar.vertical: UM.ScrollBar @@ -29,13 +29,10 @@ ListView color: UM.Theme.getColor("text_medium") } - delegate: MachineSelectorButton + delegate: MachineListButton { text: model.name ? model.name : "" width: listView.width - scrollBar.width - outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - - checked: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.id == model.id : false onClicked: { diff --git a/resources/qml/qmldir b/resources/qml/qmldir index a47d85545b..6ec3ca91c8 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -2,6 +2,7 @@ module Cura MachineSelector 1.0 MachineSelector.qml MachineSelectorButton 1.0 MachineSelectorButton.qml +MachineListButton 1.0 MachineListButton.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml ProfileOverview 1.6 ProfileOverview.qml diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index e7622bc685..84dfdd5fc2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -564,6 +564,9 @@ "medium_button": [2.5, 2.5], "medium_button_icon": [2, 2], + "large_button": [3.5, 3.5], + "large_button_icon": [2.8, 2.8], + "context_menu": [20, 2], "icon_indicator": [1, 1], From 93e2bef30342c62ddd074e4dac7998c1dbae133d Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 15:44:16 +0200 Subject: [PATCH 05/21] Group printers by section (Connected Printers/Other Printers) Cleanup redundant code. CURA-9514 --- cura/Machines/Models/MachineListModel.py | 69 +++++++------------ cura/Settings/AbstractMachine.py | 10 ++- .../qml/PrinterSelector/MachineListButton.qml | 1 - .../PrinterSelector/MachineSelectorList.qml | 4 +- 4 files changed, 35 insertions(+), 49 deletions(-) diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 1f9b3d9eba..4df38090d8 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -2,14 +2,12 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt6.QtCore import Qt, QTimer -from typing import Optional, Dict from UM.Qt.ListModel import ListModel from UM.Settings.ContainerStack import ContainerStack from UM.i18n import i18nCatalog from UM.Util import parseBool -from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.AbstractMachine import AbstractMachine from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.GlobalStack import GlobalStack @@ -19,13 +17,10 @@ class MachineListModel(ListModel): NameRole = Qt.ItemDataRole.UserRole + 1 IdRole = Qt.ItemDataRole.UserRole + 2 HasRemoteConnectionRole = Qt.ItemDataRole.UserRole + 3 - ConnectionTypeRole = Qt.ItemDataRole.UserRole + 4 - MetaDataRole = Qt.ItemDataRole.UserRole + 5 - DiscoverySourceRole = Qt.ItemDataRole.UserRole + 6 - RemovalWarningRole = Qt.ItemDataRole.UserRole + 7 - IsOnlineRole = Qt.ItemDataRole.UserRole + 8 - MachineTypeRole = Qt.ItemDataRole.UserRole + 9 - MachineCountRole = Qt.ItemDataRole.UserRole + 10 + MetaDataRole = Qt.ItemDataRole.UserRole + 4 + IsOnlineRole = Qt.ItemDataRole.UserRole + 5 + MachineTypeRole = Qt.ItemDataRole.UserRole + 6 + MachineCountRole = Qt.ItemDataRole.UserRole + 7 def __init__(self, parent=None) -> None: super().__init__(parent) @@ -36,7 +31,6 @@ class MachineListModel(ListModel): self.addRoleName(self.IdRole, "id") self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection") self.addRoleName(self.MetaDataRole, "metadata") - self.addRoleName(self.DiscoverySourceRole, "discoverySource") self.addRoleName(self.IsOnlineRole, "isOnline") self.addRoleName(self.MachineTypeRole, "machineType") self.addRoleName(self.MachineCountRole, "machineCount") @@ -63,50 +57,37 @@ class MachineListModel(ListModel): self._change_timer.start() def _update(self) -> None: - items = [] + self.setItems([]) # Clear items - abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type="abstract_machine") - - abstract_machine_stacks.sort(key=lambda machine: machine.getName(), reverse=True) + abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "abstract_machine") + abstract_machine_stacks.sort(key = lambda machine: machine.getName(), reverse = True) for abstract_machine in abstract_machine_stacks: - machine_stacks = AbstractMachine.getMachines(abstract_machine) - + online_machine_stacks = AbstractMachine.getMachines(abstract_machine, online_only = True) # Create item for abstract printer - items.append(self.createItem(abstract_machine, len(machine_stacks))) + self.addItem(abstract_machine, len(online_machine_stacks)) # Create list of printers that are children of the abstract printer - for stack in machine_stacks: - item = self.createItem(stack) - if item: - items.append(item) + for stack in online_machine_stacks: + self.addItem(stack) - self.setItems(items) + offline_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", is_online = "False") + for stack in offline_machine_stacks: + self.addItem(stack) - def createItem(self, container_stack: ContainerStack, machine_count: int = 0) -> Optional[Dict]: + def addItem(self, container_stack: ContainerStack, machine_count: int = 0) -> None: if parseBool(container_stack.getMetaDataEntry("hidden", False)): return - has_remote_connection = False + isOnline = parseBool(container_stack.getMetaDataEntry("is_online", False)) + if container_stack.getMetaDataEntry("type") == "abstract_machine": + isOnline = True - for connection_type in container_stack.configuredConnectionTypes: - has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, - ConnectionType.CloudConnection.value] - - device_name = container_stack.getMetaDataEntry("group_name", container_stack.getName()) - default_removal_warning = self._catalog.i18nc( - "@label {0} is the name of a printer that's about to be deleted.", - "Are you sure you wish to remove {0}? This cannot be undone!", device_name - ) - - return {"name": device_name, - "id": container_stack.getId(), - "hasRemoteConnection": has_remote_connection, - "metadata": container_stack.getMetaData().copy(), - "section": self._catalog.i18nc("@label", "Connected printers"), - "removalWarning": container_stack.getMetaDataEntry("removal_warning", default_removal_warning), - "isOnline": container_stack.getMetaDataEntry("is_online", False), - "machineType": container_stack.getMetaDataEntry("type"), - "machineCount": machine_count, - } + self.appendItem({"name": container_stack.getName(), + "id": container_stack.getId(), + "metadata": container_stack.getMetaData().copy(), + "isOnline": isOnline, + "machineType": container_stack.getMetaDataEntry("type"), + "machineCount": machine_count, + }) diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py index a760421c60..2f4a50da4f 100644 --- a/cura/Settings/AbstractMachine.py +++ b/cura/Settings/AbstractMachine.py @@ -1,6 +1,7 @@ from typing import List from UM.Settings.ContainerStack import ContainerStack +from UM.Util import parseBool from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.Settings.GlobalStack import GlobalStack from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase @@ -15,7 +16,7 @@ class AbstractMachine(GlobalStack): self.setMetaDataEntry("type", "abstract_machine") @classmethod - def getMachines(cls, abstract_machine: ContainerStack) -> List[ContainerStack]: + def getMachines(cls, abstract_machine: ContainerStack, online_only = False) -> List[ContainerStack]: """ Fetches all container stacks that match definition_id with an abstract machine. :param abstractMachine: The abstract machine stack. @@ -30,7 +31,12 @@ class AbstractMachine(GlobalStack): printer_type = abstract_machine.definition.getId() - return [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes] + machines = [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes] + + if online_only: + machines = [machine for machine in machines if parseBool(machine.getMetaDataEntry("is_online", False))] + + return machines ## private: diff --git a/resources/qml/PrinterSelector/MachineListButton.qml b/resources/qml/PrinterSelector/MachineListButton.qml index b6b7f4c1dd..c3257cfa15 100644 --- a/resources/qml/PrinterSelector/MachineListButton.qml +++ b/resources/qml/PrinterSelector/MachineListButton.qml @@ -67,7 +67,6 @@ Button right: parent.right top: buttonText.top bottom: buttonText.bottom - verticalCenter: parent.verticalCenter } visible: model.machineType == "abstract_machine" diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index de14846fb7..06c2fdb40c 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -11,7 +11,7 @@ ListView { id: listView model: Cura.MachineListModel {} - section.property: "section" + section.property: "isOnline" property real contentHeight: childrenRect.height ScrollBar.vertical: UM.ScrollBar @@ -21,7 +21,7 @@ ListView section.delegate: UM.Label { - text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers") + text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Other printers") width: parent.width - scrollBar.width height: UM.Theme.getSize("action_button").height leftPadding: UM.Theme.getSize("default_margin").width From 035fb27ab07079e6996171db2d0c387c0babb2f1 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 15:44:42 +0200 Subject: [PATCH 06/21] Code style CURA-9514 --- cura/Machines/Models/MachineListModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 4df38090d8..4b58ca7bef 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -80,14 +80,14 @@ class MachineListModel(ListModel): if parseBool(container_stack.getMetaDataEntry("hidden", False)): return - isOnline = parseBool(container_stack.getMetaDataEntry("is_online", False)) + is_online = parseBool(container_stack.getMetaDataEntry("is_online", False)) if container_stack.getMetaDataEntry("type") == "abstract_machine": - isOnline = True + is_online = True self.appendItem({"name": container_stack.getName(), "id": container_stack.getId(), "metadata": container_stack.getMetaData().copy(), - "isOnline": isOnline, + "isOnline": is_online, "machineType": container_stack.getMetaDataEntry("type"), "machineCount": machine_count, }) From e541890c07eaae7dd6d3cf5fbf358b0225526b3f Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 15:56:50 +0200 Subject: [PATCH 07/21] Fix drop down not dynamically resizing width CURA-9514 --- resources/qml/PrinterSelector/MachineSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 77cd2be409..09ca1316be 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -192,7 +192,7 @@ Cura.ExpandablePopup contentItem: Item { id: popup - implicitWidth: UM.Theme.getSize("machine_selector_widget_content").width + implicitWidth: machineSelector.width implicitHeight: Math.min(machineSelectorList.contentHeight + separator.height + buttonRow.height, UM.Theme.getSize("machine_selector_widget_content").height) //Maximum height is the theme entry. MachineSelectorList { From 790c373b38546df9f3a046772ad910c330b6e97f Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 15:57:40 +0200 Subject: [PATCH 08/21] Show icon for offline printers CURA-9514 --- resources/qml/PrinterSelector/MachineListButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineListButton.qml b/resources/qml/PrinterSelector/MachineListButton.qml index c3257cfa15..03999c4d17 100644 --- a/resources/qml/PrinterSelector/MachineListButton.qml +++ b/resources/qml/PrinterSelector/MachineListButton.qml @@ -30,7 +30,7 @@ Button height: UM.Theme.getSize("medium_button").height width: UM.Theme.getSize("medium_button").width color: UM.Theme.getColor("machine_selector_printer_icon") - visible: model.machineType == "abstract_machine" + visible: model.machineType == "abstract_machine" || !model.isOnline source: model.machineType == "abstract_machine" ? UM.Theme.getIcon("PrinterTriple", "medium") : UM.Theme.getIcon("Printer", "medium") anchors From 90f53bbdc1564cd66f95f7f4a14a15831fd13bcb Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 16:01:30 +0200 Subject: [PATCH 09/21] Adjust large button size CURA-9514 --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 84dfdd5fc2..809bcfdee8 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -564,7 +564,7 @@ "medium_button": [2.5, 2.5], "medium_button_icon": [2, 2], - "large_button": [3.5, 3.5], + "large_button": [3.0, 3.0], "large_button_icon": [2.8, 2.8], "context_menu": [20, 2], From db0b6687392a0d88bbdae37aa5a7f035bffba3a8 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 16:17:36 +0200 Subject: [PATCH 10/21] Adjust button size according to width CURA-9514 --- resources/qml/PrinterSelector/MachineSelector.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 09ca1316be..8c5ed98887 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -224,6 +224,9 @@ Cura.ExpandablePopup anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter + anchors.left: parent.left + anchors.right: parent.right + padding: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width @@ -236,7 +239,7 @@ Cura.ExpandablePopup // The maximum width of the button is half of the total space, minus the padding of the parent, the left // padding of the component and half the spacing because of the space between buttons. fixedWidthMode: true - width: UM.Theme.getSize("machine_selector_widget_content").width / 2 - leftPadding + width: buttonRow.width / 2 - leftPadding * 1.5 onClicked: { toggleContent() @@ -253,7 +256,7 @@ Cura.ExpandablePopup fixedWidthMode: true // The maximum width of the button is half of the total space, minus the padding of the parent, the right // padding of the component and half the spacing because of the space between buttons. - width: UM.Theme.getSize("machine_selector_widget_content").width / 2 - leftPadding + width: buttonRow.width / 2 - rightPadding * 1.5 onClicked: { toggleContent() From eea89357419ac12839d62ed8cb9bee4b570b3d40 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Tue, 23 Aug 2022 16:20:04 +0200 Subject: [PATCH 11/21] Set minimum width, so that drop down is still readable on small screens CURA-9514 --- cura/Settings/MachineManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 64d34d6c3e..5be72b76aa 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -333,6 +333,7 @@ class MachineManager(QObject): extruder_manager.fixSingleExtrusionMachineExtruderDefinition(global_stack) if not global_stack.isValid(): # Mark global stack as invalid + print("C") ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) return # We're done here From 721f63b0d1b920b0363bf694d708de8fc0ae053d Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:06:03 +0200 Subject: [PATCH 12/21] Give machine selector minimum width so it displays correctly on smaller screens. CURA-9514 --- resources/qml/PrinterSelector/MachineSelector.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 8c5ed98887..869d536a00 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -192,7 +192,7 @@ Cura.ExpandablePopup contentItem: Item { id: popup - implicitWidth: machineSelector.width + implicitWidth: Math.max(machineSelector.width, UM.Theme.getSize("machine_selector_widget_content").width) implicitHeight: Math.min(machineSelectorList.contentHeight + separator.height + buttonRow.height, UM.Theme.getSize("machine_selector_widget_content").height) //Maximum height is the theme entry. MachineSelectorList { From 52b2a8322c6cc676625cd905d2ed219250449c9a Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:06:51 +0200 Subject: [PATCH 13/21] Include LAN printers in abstract printers list Make filtering clearer by splitting it up into multiple lines. CURA-9514 --- cura/Settings/AbstractMachine.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cura/Settings/AbstractMachine.py b/cura/Settings/AbstractMachine.py index 2f4a50da4f..86909b6e29 100644 --- a/cura/Settings/AbstractMachine.py +++ b/cura/Settings/AbstractMachine.py @@ -29,14 +29,16 @@ class AbstractMachine(GlobalStack): application = CuraApplication.getInstance() registry = application.getContainerRegistry() - printer_type = abstract_machine.definition.getId() - - machines = [machine for machine in registry.findContainerStacks(type="machine") if machine.definition.id == printer_type and ConnectionType.CloudConnection in machine.configuredConnectionTypes] - + machines = registry.findContainerStacks(type="machine") + # Filter machines that match definition + machines = filter(lambda machine: machine.definition.id == abstract_machine.definition.getId(), machines) + # Filter only LAN and Cloud printers + machines = filter(lambda machine: ConnectionType.CloudConnection in machine.configuredConnectionTypes or ConnectionType.NetworkConnection in machine.configuredConnectionTypes, machines) if online_only: - machines = [machine for machine in machines if parseBool(machine.getMetaDataEntry("is_online", False))] + # LAN printers have is_online = False but should still be included + machines = filter(lambda machine: parseBool(machine.getMetaDataEntry("is_online", False) or ConnectionType.NetworkConnection in machine.configuredConnectionTypes), machines) - return machines + return list(machines) ## private: From 17e6bccf5106d2a26947f511d2cf11b7ad4bd6fb Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:07:17 +0200 Subject: [PATCH 14/21] Create abstract printers when adding lan printers. CURA-9514 --- .../src/Network/LocalClusterOutputDeviceManager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index 0cd5304cf9..bddd383b23 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -232,6 +232,9 @@ class LocalClusterOutputDeviceManager: self._connectToOutputDevice(device, new_machine) self._showCloudFlowMessage(device) + _abstract_machine = CuraStackBuilder.createAbstractMachine(device.printerType) + + def _storeManualAddress(self, address: str) -> None: """Add an address to the stored preferences.""" From 91b8c97daed32da95ee8afd962ddcc582f8e6828 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:09:45 +0200 Subject: [PATCH 15/21] Subtract online printers from list of all printers instead of searching for offline printers. This prevents printers without "is_online" in the metadata from being left out, and is generally more defensive for uncertain states. CURA-9514 --- cura/Machines/Models/MachineListModel.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 4b58ca7bef..5a7dc77673 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -59,21 +59,28 @@ class MachineListModel(ListModel): def _update(self) -> None: self.setItems([]) # Clear items + other_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type="machine") + abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "abstract_machine") abstract_machine_stacks.sort(key = lambda machine: machine.getName(), reverse = True) for abstract_machine in abstract_machine_stacks: online_machine_stacks = AbstractMachine.getMachines(abstract_machine, online_only = True) - # Create item for abstract printer + # Create a list item for abstract machine self.addItem(abstract_machine, len(online_machine_stacks)) - # Create list of printers that are children of the abstract printer + # Create list of machines that are children of the abstract machine for stack in online_machine_stacks: self.addItem(stack) + # Remove this machine from the other stack list + other_machine_stacks.remove(stack) - offline_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", is_online = "False") - for stack in offline_machine_stacks: + + # Filtering must be done like this because searching with findContainerStacks(is_online = "True") does not return + # stacks that don't have is_online in their metadata. We still want to show these printers. + # offline_machine_stacks = [stack for stack in offline_machine_stacks if parseBool(stack.getMetaDataEntry("is_online", False))] + for stack in other_machine_stacks: self.addItem(stack) def addItem(self, container_stack: ContainerStack, machine_count: int = 0) -> None: From 1e898ff9305a6bdfa702200d813d6b86caa03974 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:23:35 +0200 Subject: [PATCH 16/21] Remove redundant comment CURA-9514 --- cura/Machines/Models/MachineListModel.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 5a7dc77673..716238efc4 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -76,10 +76,6 @@ class MachineListModel(ListModel): # Remove this machine from the other stack list other_machine_stacks.remove(stack) - - # Filtering must be done like this because searching with findContainerStacks(is_online = "True") does not return - # stacks that don't have is_online in their metadata. We still want to show these printers. - # offline_machine_stacks = [stack for stack in offline_machine_stacks if parseBool(stack.getMetaDataEntry("is_online", False))] for stack in other_machine_stacks: self.addItem(stack) From b4e5fd8526c02e979e6d2fda83099f36a1d03d1f Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 10:24:53 +0200 Subject: [PATCH 17/21] Remove debug statement CURA-9514 --- cura/Settings/MachineManager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 5be72b76aa..64d34d6c3e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -333,7 +333,6 @@ class MachineManager(QObject): extruder_manager.fixSingleExtrusionMachineExtruderDefinition(global_stack) if not global_stack.isValid(): # Mark global stack as invalid - print("C") ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) return # We're done here From 2013ad6baf7d77601087b6dcc6ba35c9e7f4f6cc Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 24 Aug 2022 14:22:17 +0200 Subject: [PATCH 18/21] Update resources/qml/PrinterSelector/MachineListButton.qml Co-authored-by: Casper Lamboo --- resources/qml/PrinterSelector/MachineListButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrinterSelector/MachineListButton.qml b/resources/qml/PrinterSelector/MachineListButton.qml index 03999c4d17..4511c72b4c 100644 --- a/resources/qml/PrinterSelector/MachineListButton.qml +++ b/resources/qml/PrinterSelector/MachineListButton.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2022 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 From 04580b8fdc2fc8acaf75f0c8d02c37759cafc631 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 24 Aug 2022 14:33:04 +0200 Subject: [PATCH 19/21] Simplify logic by having abstract printers always be online. CURA-9221 --- cura/Machines/Models/MachineListModel.py | 6 +----- cura/Settings/CuraStackBuilder.py | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 716238efc4..f3781cfd60 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -83,14 +83,10 @@ class MachineListModel(ListModel): if parseBool(container_stack.getMetaDataEntry("hidden", False)): return - is_online = parseBool(container_stack.getMetaDataEntry("is_online", False)) - if container_stack.getMetaDataEntry("type") == "abstract_machine": - is_online = True - self.appendItem({"name": container_stack.getName(), "id": container_stack.getId(), "metadata": container_stack.getMetaData().copy(), - "isOnline": is_online, + "isOnline": parseBool(container_stack.getMetaDataEntry("is_online", False)), "machineType": container_stack.getMetaDataEntry("type"), "machineCount": machine_count, }) diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index 7eff275457..d711a61243 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -297,6 +297,7 @@ class CuraStackBuilder: name = machine_definition.getName() stack = AbstractMachine(abstract_machine_id) + stack.setMetaDataEntry("is_online", True) stack.setDefinition(machine_definition) cls.createUserContainer( name, From 72e67de9786fce46d3c81fc1978377511ecaa957 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 24 Aug 2022 16:21:02 +0200 Subject: [PATCH 20/21] Fix github workflow for packages on 'modern linux'. --- .github/workflows/conan-package-create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan-package-create.yml b/.github/workflows/conan-package-create.yml index 3e5f3dbe1c..b61d4a4d88 100644 --- a/.github/workflows/conan-package-create.yml +++ b/.github/workflows/conan-package-create.yml @@ -109,7 +109,7 @@ jobs: sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev pkg-config -y - name: Install GCC-12 on ubuntu-22.04 - if: ${{ matrix.os == 'ubuntu-22.04' }} + if: ${{ startsWith(matrix.os, 'ubuntu-22.04') }} run: | sudo apt install g++-12 gcc-12 -y sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 From 0063867b4bedd385e8154c8cdbb462b258bb89e1 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 24 Aug 2022 16:42:40 +0200 Subject: [PATCH 21/21] Fix github workflow for packages on 'modern linux'. --- .github/workflows/conan-package-create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conan-package-create.yml b/.github/workflows/conan-package-create.yml index b61d4a4d88..4af608b7ac 100644 --- a/.github/workflows/conan-package-create.yml +++ b/.github/workflows/conan-package-create.yml @@ -109,7 +109,7 @@ jobs: sudo apt install build-essential checkinstall libegl-dev zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev libxkbcommon-x11-dev pkg-config -y - name: Install GCC-12 on ubuntu-22.04 - if: ${{ startsWith(matrix.os, 'ubuntu-22.04') }} + if: ${{ startsWith(inputs.runs_on, 'ubuntu-22.04') }} run: | sudo apt install g++-12 gcc-12 -y sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12