From 18e0dacda490622631f70ad65841f37f8ef8b4e4 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Fri, 7 Sep 2018 14:11:37 +0200 Subject: [PATCH 1/2] Organize files better First things first... organize! --- plugins/UM3NetworkPrinting/__init__.py | 4 ++-- .../{ => resources/qml}/ClusterControlItem.qml | 17 ++++++++--------- .../{ => resources/qml}/ClusterMonitorItem.qml | 0 .../{ => resources/qml}/DiscoverUM3Action.qml | 0 .../{ => resources/qml}/MonitorItem.qml | 0 .../{ => resources/qml}/OpenPanelButton.qml | 0 .../qml}/PrintCoreConfiguration.qml | 0 .../{ => resources/qml}/PrintJobInfoBlock.qml | 2 +- .../{ => resources/qml}/PrintWindow.qml | 0 .../{ => resources/qml}/PrinterFamilyPill.qml | 0 .../{ => resources/qml}/PrinterInfoBlock.qml | 8 ++++---- .../{ => resources/qml}/PrinterTile.qml | 0 .../{ => resources/qml}/PrinterVideoStream.qml | 0 .../{ => resources/qml}/UM3InfoComponents.qml | 0 .../{ => resources/svg}/UM3-icon.svg | 0 .../{ => resources/svg}/UM3x-icon.svg | 0 .../{ => resources/svg}/UMs5-icon.svg | 0 .../{ => resources/svg}/aborted-icon.svg | 0 .../svg}/action-required-icon.svg | 0 .../{ => resources/svg}/approved-icon.svg | 0 .../{ => resources/svg}/blocked-icon.svg | 0 .../{ => resources/svg}/camera-icon.svg | 0 .../{ => resources/svg}/checkmark-icon.svg | 0 .../{ => resources/svg}/paused-icon.svg | 0 .../{ => resources/svg}/warning-icon.svg | 0 .../{ => src}/ClusterUM3OutputDevice.py | 6 +++--- .../ClusterUM3PrinterOutputController.py | 0 .../{ => src}/DiscoverUM3Action.py | 4 ++-- .../{ => src}/LegacyUM3OutputDevice.py | 2 +- .../LegacyUM3PrinterOutputController.py | 0 .../{ => src}/SendMaterialJob.py | 0 .../{ => src}/UM3OutputDevicePlugin.py | 0 32 files changed, 21 insertions(+), 22 deletions(-) rename plugins/UM3NetworkPrinting/{ => resources/qml}/ClusterControlItem.qml (98%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/ClusterMonitorItem.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/DiscoverUM3Action.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/MonitorItem.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/OpenPanelButton.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrintCoreConfiguration.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrintJobInfoBlock.qml (99%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrintWindow.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrinterFamilyPill.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrinterInfoBlock.qml (98%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrinterTile.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/PrinterVideoStream.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/qml}/UM3InfoComponents.qml (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/UM3-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/UM3x-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/UMs5-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/aborted-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/action-required-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/approved-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/blocked-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/camera-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/checkmark-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/paused-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => resources/svg}/warning-icon.svg (100%) rename plugins/UM3NetworkPrinting/{ => src}/ClusterUM3OutputDevice.py (99%) rename plugins/UM3NetworkPrinting/{ => src}/ClusterUM3PrinterOutputController.py (100%) rename plugins/UM3NetworkPrinting/{ => src}/DiscoverUM3Action.py (98%) rename plugins/UM3NetworkPrinting/{ => src}/LegacyUM3OutputDevice.py (99%) rename plugins/UM3NetworkPrinting/{ => src}/LegacyUM3PrinterOutputController.py (100%) rename plugins/UM3NetworkPrinting/{ => src}/SendMaterialJob.py (100%) rename plugins/UM3NetworkPrinting/{ => src}/UM3OutputDevicePlugin.py (100%) diff --git a/plugins/UM3NetworkPrinting/__init__.py b/plugins/UM3NetworkPrinting/__init__.py index b68086cb75..7f2b34223c 100644 --- a/plugins/UM3NetworkPrinting/__init__.py +++ b/plugins/UM3NetworkPrinting/__init__.py @@ -1,11 +1,11 @@ # Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from . import DiscoverUM3Action +from .src import DiscoverUM3Action from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") -from . import UM3OutputDevicePlugin +from .src import UM3OutputDevicePlugin def getMetaData(): return {} diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml similarity index 98% rename from plugins/UM3NetworkPrinting/ClusterControlItem.qml rename to plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml index be72d3c07a..1164e383db 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml @@ -16,7 +16,6 @@ Component id: base property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. - property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. visible: OutputDevice != null anchors.fill: parent @@ -154,11 +153,11 @@ Component switch(modelData.type) { case "Ultimaker 3": - return "UM3-icon.svg" + return "../svg/UM3-icon.svg" case "Ultimaker 3 Extended": - return "UM3x-icon.svg" + return "../svg/UM3x-icon.svg" case "Ultimaker S5": - return "UMs5-icon.svg" + return "../svg/UMs5-icon.svg" } } width: sourceSize.width @@ -563,15 +562,15 @@ Component switch(modelData.activePrintJob.state) { case "paused": - return "paused-icon.svg" + return "../svg/paused-icon.svg" case "wait_cleanup": if(modelData.activePrintJob.timeElapsed < modelData.activePrintJob.timeTotal) { - return "aborted-icon.svg" + return "../svg/aborted-icon.svg" } - return "approved-icon.svg" + return "../svg/approved-icon.svg" case "wait_user_action": - return "aborted-icon.svg" + return "../svg/aborted-icon.svg" default: return "" } @@ -599,7 +598,7 @@ Component height: width anchors.right: parent.right anchors.rightMargin: parent.rightMargin - source: "camera-icon.svg" + source: "../svg/camera-icon.svg" } MouseArea { diff --git a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml similarity index 100% rename from plugins/UM3NetworkPrinting/ClusterMonitorItem.qml rename to plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml similarity index 100% rename from plugins/UM3NetworkPrinting/DiscoverUM3Action.qml rename to plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml diff --git a/plugins/UM3NetworkPrinting/MonitorItem.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml similarity index 100% rename from plugins/UM3NetworkPrinting/MonitorItem.qml rename to plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml diff --git a/plugins/UM3NetworkPrinting/OpenPanelButton.qml b/plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml similarity index 100% rename from plugins/UM3NetworkPrinting/OpenPanelButton.qml rename to plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml diff --git a/plugins/UM3NetworkPrinting/PrintCoreConfiguration.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml similarity index 100% rename from plugins/UM3NetworkPrinting/PrintCoreConfiguration.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrintCoreConfiguration.qml diff --git a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml similarity index 99% rename from plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml index d50ee769d3..f39b430e19 100644 --- a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml @@ -93,7 +93,7 @@ Item { id: statusImage anchors.centerIn: printJobPreview - source: printJob.state == "error" ? "aborted-icon.svg" : "" + source: printJob.state == "error" ? "../svg/aborted-icon.svg" : "" visible: source != "" width: 0.5 * printJobPreview.width height: 0.5 * printJobPreview.height diff --git a/plugins/UM3NetworkPrinting/PrintWindow.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml similarity index 100% rename from plugins/UM3NetworkPrinting/PrintWindow.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml diff --git a/plugins/UM3NetworkPrinting/PrinterFamilyPill.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml similarity index 100% rename from plugins/UM3NetworkPrinting/PrinterFamilyPill.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrinterFamilyPill.qml diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml similarity index 98% rename from plugins/UM3NetworkPrinting/PrinterInfoBlock.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml index 0217767a40..832e65f18c 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml @@ -166,7 +166,7 @@ Rectangle height: width anchors.right: parent.right anchors.rightMargin: parent.rightMargin - source: "camera-icon.svg" + source: "../svg/camera-icon.svg" } } @@ -317,7 +317,7 @@ Rectangle source: { if (printer.state == "disabled") { - return "blocked-icon.svg"; + return "../svg/blocked-icon.svg"; } if (printer.state === "unreachable") @@ -329,11 +329,11 @@ Rectangle { if(printJob.state === "queued") { - return "action-required-icon.svg"; + return "../svg/action-required-icon.svg"; } else if (printJob.state === "wait_cleanup") { - return "checkmark-icon.svg"; + return "../svg/checkmark-icon.svg"; } } return ""; // We're not going to show it, so it will not be resolved as a url. diff --git a/plugins/UM3NetworkPrinting/PrinterTile.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml similarity index 100% rename from plugins/UM3NetworkPrinting/PrinterTile.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml diff --git a/plugins/UM3NetworkPrinting/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml similarity index 100% rename from plugins/UM3NetworkPrinting/PrinterVideoStream.qml rename to plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml diff --git a/plugins/UM3NetworkPrinting/UM3InfoComponents.qml b/plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml similarity index 100% rename from plugins/UM3NetworkPrinting/UM3InfoComponents.qml rename to plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml diff --git a/plugins/UM3NetworkPrinting/UM3-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/UM3-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/UM3-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/UM3-icon.svg diff --git a/plugins/UM3NetworkPrinting/UM3x-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/UM3x-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/UM3x-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/UM3x-icon.svg diff --git a/plugins/UM3NetworkPrinting/UMs5-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/UMs5-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/UMs5-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/UMs5-icon.svg diff --git a/plugins/UM3NetworkPrinting/aborted-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/aborted-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/aborted-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/aborted-icon.svg diff --git a/plugins/UM3NetworkPrinting/action-required-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/action-required-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/action-required-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/action-required-icon.svg diff --git a/plugins/UM3NetworkPrinting/approved-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/approved-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/approved-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/approved-icon.svg diff --git a/plugins/UM3NetworkPrinting/blocked-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/blocked-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/blocked-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/blocked-icon.svg diff --git a/plugins/UM3NetworkPrinting/camera-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/camera-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/camera-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/camera-icon.svg diff --git a/plugins/UM3NetworkPrinting/checkmark-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/checkmark-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/checkmark-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/checkmark-icon.svg diff --git a/plugins/UM3NetworkPrinting/paused-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/paused-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/paused-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/paused-icon.svg diff --git a/plugins/UM3NetworkPrinting/warning-icon.svg b/plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg similarity index 100% rename from plugins/UM3NetworkPrinting/warning-icon.svg rename to plugins/UM3NetworkPrinting/resources/svg/warning-icon.svg diff --git a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py similarity index 99% rename from plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py rename to plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 8345de049c..409ca7a84a 100644 --- a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -62,8 +62,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): self._print_jobs = [] # type: List[PrintJobOutputModel] - self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ClusterMonitorItem.qml") - self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ClusterControlItem.qml") + self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterMonitorItem.qml") + self._control_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/ClusterControlItem.qml") # See comments about this hack with the clusterPrintersChanged signal self.printersChanged.connect(self.clusterPrintersChanged) @@ -158,7 +158,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): def _spawnPrinterSelectionDialog(self): if self._printer_selection_dialog is None: - path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "PrintWindow.qml") + path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/PrintWindow.qml") self._printer_selection_dialog = CuraApplication.getInstance().createQmlComponent(path, {"OutputDevice": self}) if self._printer_selection_dialog is not None: self._printer_selection_dialog.show() diff --git a/plugins/UM3NetworkPrinting/ClusterUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py similarity index 100% rename from plugins/UM3NetworkPrinting/ClusterUM3PrinterOutputController.py rename to plugins/UM3NetworkPrinting/src/ClusterUM3PrinterOutputController.py diff --git a/plugins/UM3NetworkPrinting/DiscoverUM3Action.py b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py similarity index 98% rename from plugins/UM3NetworkPrinting/DiscoverUM3Action.py rename to plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py index c0a828ece9..ece23507e5 100644 --- a/plugins/UM3NetworkPrinting/DiscoverUM3Action.py +++ b/plugins/UM3NetworkPrinting/src/DiscoverUM3Action.py @@ -24,7 +24,7 @@ class DiscoverUM3Action(MachineAction): def __init__(self) -> None: super().__init__("DiscoverUM3Action", catalog.i18nc("@action","Connect via Network")) - self._qml_url = "DiscoverUM3Action.qml" + self._qml_url = "../resources/qml/DiscoverUM3Action.qml" self._network_plugin = None #type: Optional[UM3OutputDevicePlugin] @@ -174,7 +174,7 @@ class DiscoverUM3Action(MachineAction): plugin_path = PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting") if not plugin_path: return - path = os.path.join(plugin_path, "UM3InfoComponents.qml") + path = os.path.join(plugin_path, "resources/qml/UM3InfoComponents.qml") self.__additional_components_view = CuraApplication.getInstance().createQmlComponent(path, {"manager": self}) if not self.__additional_components_view: Logger.log("w", "Could not create ui components for UM3.") diff --git a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py similarity index 99% rename from plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py rename to plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py index 8617b5b2ff..fe94500aa1 100644 --- a/plugins/UM3NetworkPrinting/LegacyUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/LegacyUM3OutputDevice.py @@ -76,7 +76,7 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice): self.setIconName("print") - self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml") + self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../resources/qml/MonitorItem.qml") self._output_controller = LegacyUM3PrinterOutputController(self) diff --git a/plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py b/plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py similarity index 100% rename from plugins/UM3NetworkPrinting/LegacyUM3PrinterOutputController.py rename to plugins/UM3NetworkPrinting/src/LegacyUM3PrinterOutputController.py diff --git a/plugins/UM3NetworkPrinting/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/SendMaterialJob.py similarity index 100% rename from plugins/UM3NetworkPrinting/SendMaterialJob.py rename to plugins/UM3NetworkPrinting/src/SendMaterialJob.py diff --git a/plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py similarity index 100% rename from plugins/UM3NetworkPrinting/UM3OutputDevicePlugin.py rename to plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py From a9f151670e57328cf0f2045ff377269998b41a34 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 7 Sep 2018 14:31:53 +0200 Subject: [PATCH 2/2] Remove unused components. They are no longer used. --- .../resources/qml/OpenPanelButton.qml | 71 --- .../resources/qml/PrinterInfoBlock.qml | 431 ------------------ .../resources/qml/PrinterTile.qml | 54 --- 3 files changed, 556 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml delete mode 100644 plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml diff --git a/plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml b/plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml deleted file mode 100644 index 4bc1728f76..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml +++ /dev/null @@ -1,71 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -import UM 1.1 as UM - -Button { - objectName: "openPanelSaveAreaButton" - id: openPanelSaveAreaButton - - UM.I18nCatalog { id: catalog; name: "cura"; } - - height: UM.Theme.getSize("save_button_save_to_button").height - tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.") - text: catalog.i18nc("@action:button", "View print jobs") - - // FIXME: This button style is copied and duplicated from SaveButton.qml - style: ButtonStyle { - background: Rectangle - { - border.width: UM.Theme.getSize("default_lining").width - border.color: - { - if(!control.enabled) - return UM.Theme.getColor("action_button_disabled_border"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_pressed_border"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_hovered_border"); - else - return UM.Theme.getColor("print_button_ready_border"); - } - color: - { - if(!control.enabled) - return UM.Theme.getColor("action_button_disabled"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_pressed"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_hovered"); - else - return UM.Theme.getColor("print_button_ready"); - } - - Behavior on color { ColorAnimation { duration: 50; } } - - implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) - - Label { - id: actualLabel - anchors.centerIn: parent - color: - { - if(!control.enabled) - return UM.Theme.getColor("action_button_disabled_text"); - else if(control.pressed) - return UM.Theme.getColor("print_button_ready_text"); - else if(control.hovered) - return UM.Theme.getColor("print_button_ready_text"); - else - return UM.Theme.getColor("print_button_ready_text"); - } - font: UM.Theme.getFont("action_button") - text: control.text; - } - } - label: Item { } - } - - -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml deleted file mode 100644 index 832e65f18c..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml +++ /dev/null @@ -1,431 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -import UM 1.3 as UM - -Rectangle -{ - function strPadLeft(string, pad, length) - { - return (new Array(length + 1).join(pad) + string).slice(-length); - } - - function getPrettyTime(time) - { - return OutputDevice.formatDuration(time) - } - - function formatPrintJobPercent(printJob) - { - if (printJob == null) - { - return ""; - } - if (printJob.timeTotal === 0) - { - return ""; - } - return Math.min(100, Math.round(printJob.timeElapsed / printJob.timeTotal * 100)) + "%"; - } - - function printerStatusText(printer) - { - switch (printer.state) - { - case "pre_print": - return catalog.i18nc("@label:status", "Preparing to print") - case "printing": - return catalog.i18nc("@label:status", "Printing"); - case "idle": - return catalog.i18nc("@label:status", "Available"); - case "unreachable": - return catalog.i18nc("@label:status", "Lost connection with the printer"); - case "maintenance": - return catalog.i18nc("@label:status", "Unavailable"); - default: - return catalog.i18nc("@label:status", "Unknown"); - } - } - - id: printerDelegate - - property var printer: null - property var printJob: printer != null ? printer.activePrintJob: null - - border.width: UM.Theme.getSize("default_lining").width - border.color: mouse.containsMouse ? emphasisColor : lineColor - z: mouse.containsMouse ? 1 : 0 // Push this item up a bit on mouse over to ensure that the highlighted bottom border is visible. - - MouseArea - { - id: mouse - anchors.fill:parent - onClicked: OutputDevice.setActivePrinter(printer) - hoverEnabled: true; - - // Only clickable if no printer is selected - enabled: OutputDevice.activePrinter == null && printer.state !== "unreachable" - } - - Row - { - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("default_margin").width - - Rectangle - { - width: Math.round(parent.width / 3) - height: parent.height - - Label // Print job name - { - id: jobNameLabel - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - text: printJob != null ? printJob.name : "" - font: UM.Theme.getFont("default_bold") - elide: Text.ElideRight - - } - - Label - { - id: jobOwnerLabel - anchors.top: jobNameLabel.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: printJob != null ? printJob.owner : "" - opacity: 0.50 - elide: Text.ElideRight - } - - Label - { - id: totalTimeLabel - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: printJob != null ? getPrettyTime(printJob.timeTotal) : "" - opacity: 0.65 - font: UM.Theme.getFont("default") - elide: Text.ElideRight - } - } - - Rectangle - { - width: Math.round(parent.width / 3 * 2) - height: parent.height - - Label // Friendly machine name - { - id: printerNameLabel - anchors.top: parent.top - anchors.left: parent.left - width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width - showCameraIcon.width) - text: printer.name - font: UM.Theme.getFont("default_bold") - elide: Text.ElideRight - } - - Label // Machine variant - { - id: printerTypeLabel - anchors.top: printerNameLabel.bottom - width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width) - text: printer.type - anchors.left: parent.left - elide: Text.ElideRight - font: UM.Theme.getFont("very_small") - opacity: 0.50 - } - - Rectangle // Camera icon - { - id: showCameraIcon - width: 40 * screenScaleFactor - height: width - radius: width - anchors.right: printProgressArea.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - color: emphasisColor - opacity: printer != null && printer.state === "unreachable" ? 0.3 : 1 - - Image - { - width: parent.width - height: width - anchors.right: parent.right - anchors.rightMargin: parent.rightMargin - source: "../svg/camera-icon.svg" - } - } - - Row // PrintCore config - { - id: extruderInfo - anchors.bottom: parent.bottom - - width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width) - height: childrenRect.height - - spacing: UM.Theme.getSize("default_margin").width - - PrintCoreConfiguration - { - id: leftExtruderInfo - width: Math.round((parent.width - extruderSeperator.width) / 2) - printCoreConfiguration: printer.extruders[0] - } - - Rectangle - { - id: extruderSeperator - width: UM.Theme.getSize("default_lining").width - height: parent.height - color: lineColor - } - - PrintCoreConfiguration - { - id: rightExtruderInfo - width: Math.round((parent.width - extruderSeperator.width) / 2) - printCoreConfiguration: printer.extruders[1] - } - } - - Rectangle // Print progress - { - id: printProgressArea - anchors.right: parent.right - anchors.top: parent.top - height: showExtended ? parent.height: printProgressTitleBar.height - width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width) - border.width: UM.Theme.getSize("default_lining").width - border.color: lineColor - radius: cornerRadius - property var showExtended: { - if(printJob != null) - { - var extendStates = ["sent_to_printer", "wait_for_configuration", "printing", "pre_print", "post_print", "wait_cleanup", "queued"]; - return extendStates.indexOf(printJob.state) !== -1; - } - return printer.state == "disabled" - } - - Item // Status and Percent - { - id: printProgressTitleBar - - property var showPercent: { - return printJob != null && (["printing", "post_print", "pre_print", "sent_to_printer"].indexOf(printJob.state) !== -1); - } - - width: parent.width - //TODO: hardcoded value - height: 40 * screenScaleFactor - anchors.left: parent.left - - Label - { - id: statusText - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.right: progressText.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - text: { - if (printer.state == "disabled") - { - return catalog.i18nc("@label:status", "Disabled"); - } - - if (printer.state === "unreachable") - { - return printerStatusText(printer); - } - - if (printJob != null) - { - switch (printJob.state) - { - case "printing": - case "post_print": - return catalog.i18nc("@label:status", "Printing") - case "wait_for_configuration": - return catalog.i18nc("@label:status", "Reserved") - case "wait_cleanup": - case "wait_user_action": - return catalog.i18nc("@label:status", "Finished") - case "pre_print": - case "sent_to_printer": - return catalog.i18nc("@label", "Preparing to print") - case "queued": - return catalog.i18nc("@label:status", "Action required"); - case "pausing": - case "paused": - return catalog.i18nc("@label:status", "Paused"); - case "resuming": - return catalog.i18nc("@label:status", "Resuming"); - case "aborted": - return catalog.i18nc("@label:status", "Print aborted"); - default: - // If print job has unknown status show printer.status - return printerStatusText(printer); - } - } - return printerStatusText(printer); - } - - elide: Text.ElideRight - font: UM.Theme.getFont("small") - } - - Label - { - id: progressText - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.top: statusText.top - - text: formatPrintJobPercent(printJob) - visible: printProgressTitleBar.showPercent - //TODO: Hardcoded value - opacity: 0.65 - font: UM.Theme.getFont("very_small") - } - - Image - { - width: statusText.height - height: width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.top: statusText.top - - visible: !printProgressTitleBar.showPercent - - source: { - if (printer.state == "disabled") - { - return "../svg/blocked-icon.svg"; - } - - if (printer.state === "unreachable") - { - return ""; - } - - if (printJob != null) - { - if(printJob.state === "queued") - { - return "../svg/action-required-icon.svg"; - } - else if (printJob.state === "wait_cleanup") - { - return "../svg/checkmark-icon.svg"; - } - } - return ""; // We're not going to show it, so it will not be resolved as a url. - } - } - - Rectangle - { - //TODO: This will become a progress bar in the future - width: parent.width - height: UM.Theme.getSize("default_lining").height - anchors.bottom: parent.bottom - anchors.left: parent.left - visible: printProgressArea.showExtended - color: lineColor - } - } - - Column - { - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - anchors.top: printProgressTitleBar.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - - width: parent.width - 2 * UM.Theme.getSize("default_margin").width - - visible: printProgressArea.showExtended - - Label // Status detail - { - text: - { - if (printer.state == "disabled") - { - return catalog.i18nc("@label", "Not accepting print jobs"); - } - - if (printer.state === "unreachable") - { - return ""; - } - - if(printJob != null) - { - switch (printJob.state) - { - case "printing": - case "post_print": - return catalog.i18nc("@label", "Finishes at: ") + OutputDevice.getTimeCompleted(printJob.timeTotal - printJob.timeElapsed) - case "wait_cleanup": - return catalog.i18nc("@label", "Clear build plate") - case "sent_to_printer": - case "pre_print": - return catalog.i18nc("@label", "Preparing to print") - case "wait_for_configuration": - return catalog.i18nc("@label", "Not accepting print jobs") - case "queued": - return catalog.i18nc("@label", "Waiting for configuration change"); - default: - return ""; - } - } - return ""; - } - anchors.left: parent.left - anchors.right: parent.right - elide: Text.ElideRight - wrapMode: Text.Wrap - - font: UM.Theme.getFont("default") - } - - Label // Status 2nd row - { - text: { - if(printJob != null) - { - if(printJob.state == "printing" || printJob.state == "post_print") - { - return OutputDevice.getDateCompleted(printJob.timeTotal - printJob.timeElapsed) - } - } - return ""; - } - - elide: Text.ElideRight - font: UM.Theme.getFont("default") - } - } - } - } - } -} diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml b/plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml deleted file mode 100644 index 3d03e93688..0000000000 --- a/plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -import UM 1.3 as UM -import Cura 1.0 as Cura - -Rectangle -{ - id: base - width: 250 * screenScaleFactor - height: 250 * screenScaleFactor - signal clicked() - MouseArea - { - anchors.fill:parent - onClicked: base.clicked() - } - Rectangle - { - // TODO: Actually add UM icon / picture - width: 100 * screenScaleFactor - height: 100 * screenScaleFactor - border.width: UM.Theme.getSize("default_lining").width - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - } - Label - { - id: nameLabel - anchors.bottom: ipLabel.top - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: modelData.friendly_name.toString() - font: UM.Theme.getFont("large") - elide: Text.ElideMiddle; - height: UM.Theme.getSize("section").height; - } - Label - { - id: ipLabel - text: modelData.ip_address.toString() - anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - font: UM.Theme.getFont("default") - height:10 * screenScaleFactor - anchors.horizontalCenter: parent.horizontalCenter - } -} -