From 260694f2334e1e5cc5fa102cb61583f0b0d85ed9 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 09:58:40 +0200 Subject: [PATCH 1/6] Code style, typos and minute style tweak CURA-336 --- DiscoverUM3Action.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/DiscoverUM3Action.qml b/DiscoverUM3Action.qml index fdb986394e..cf0262abf0 100644 --- a/DiscoverUM3Action.qml +++ b/DiscoverUM3Action.qml @@ -31,7 +31,7 @@ Cura.MachineAction id: pageDescription width: parent.width wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "To print directly to your Ultimaker 3 printer over the network, please make sure your ptiner is connected to the network using a network cable of by connecting your printer to your WIFI network. \n\n If you don't want to connect Cura with your Ultimaker 3 now, you can always use a USB drive to transfer g-code files to your Printer.\n\n Select your Ultimaker 3 from the list below:") + text: catalog.i18nc("@label", "To print directly to your Ultimaker 3 printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. \n\nIf you don't want to connect Cura with your Ultimaker 3 now, you can always use a USB drive to transfer g-code files to your printer.\n\nSelect your Ultimaker 3 from the list below:") } Row @@ -61,15 +61,16 @@ Cura.MachineAction onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex] delegate: Rectangle { - height: childrenRect.height; + height: childrenRect.height color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase width: parent.width Label { - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("default_margin").width; - anchors.right: parent.right; + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.right: parent.right text: listview.model[index].name + color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text elide: Text.ElideRight } From 0860fc6cf57e529b259056058705249bafe4d834 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 10:32:56 +0200 Subject: [PATCH 2/6] Automatically start discovery CURA-336 --- DiscoverUM3Action.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/DiscoverUM3Action.qml b/DiscoverUM3Action.qml index cf0262abf0..9b1046b445 100644 --- a/DiscoverUM3Action.qml +++ b/DiscoverUM3Action.qml @@ -59,6 +59,7 @@ Cura.MachineAction height: 500 currentIndex: activeIndex onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex] + Component.onCompleted: manager.startDiscovery() delegate: Rectangle { height: childrenRect.height @@ -142,11 +143,6 @@ Cura.MachineAction } } } - Button - { - text: catalog.i18nc("@label","Start looking!") - onClicked: manager.startDiscovery() - } } Button { From 7af7748fff323449f5b48758c462c206757efeb8 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 14:40:07 +0200 Subject: [PATCH 3/6] Make machine action button translatable CURA-336 --- DiscoverUM3Action.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DiscoverUM3Action.py b/DiscoverUM3Action.py index b492b79d8b..2ee14b4b9d 100644 --- a/DiscoverUM3Action.py +++ b/DiscoverUM3Action.py @@ -4,9 +4,12 @@ from UM.Application import Application from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + class DiscoverUM3Action(MachineAction): def __init__(self): - super().__init__("DiscoverUM3Action", "Discover printers") + super().__init__("DiscoverUM3Action", catalog.i18nc("@action","Connect via Network")) self._qml_url = "DiscoverUM3Action.qml" self._network_plugin = None From 8deb0dc2743d1d85899cb636b88ed831c05838a9 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 14:40:07 +0200 Subject: [PATCH 4/6] Make machine action button translatable CURA-336 --- DiscoverUM3Action.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DiscoverUM3Action.py b/DiscoverUM3Action.py index b492b79d8b..2ee14b4b9d 100644 --- a/DiscoverUM3Action.py +++ b/DiscoverUM3Action.py @@ -4,9 +4,12 @@ from UM.Application import Application from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + class DiscoverUM3Action(MachineAction): def __init__(self): - super().__init__("DiscoverUM3Action", "Discover printers") + super().__init__("DiscoverUM3Action", catalog.i18nc("@action","Connect via Network")) self._qml_url = "DiscoverUM3Action.qml" self._network_plugin = None From 53c1c738d539b85256e670d80443cfcb1a82c74f Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 16:51:29 +0200 Subject: [PATCH 5/6] Fix error CURA-49 --- NetworkPrinterOutputDevice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index 8ddf318be6..72dff3e275 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -257,13 +257,13 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if progress == 0: progress += 0.001 self.setProgress(progress) - self._updateJobState(json_data["state"]) + self._setJobState(json_data["state"]) self.setTimeElapsed(json_data["time_elapsed"]) self.setTimeTotal(json_data["time_total"]) self.setJobName(json_data["name"]) elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 404: self.setProgress(0) # No print job found, so there can't be progress! - self._updateJobState("") + self._setJobState("") elif "snapshot" in reply.url().toString(): # Status update from image: if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: self._camera_image.loadFromData(reply.readAll()) From b8fddf6527d4096d8b43784a86c2bb99ab1115f5 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Mon, 27 Jun 2016 17:49:47 +0200 Subject: [PATCH 6/6] Tweak codestyle and styling CURA-336 --- DiscoverUM3Action.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/DiscoverUM3Action.qml b/DiscoverUM3Action.qml index 9b1046b445..d74a39ade7 100644 --- a/DiscoverUM3Action.qml +++ b/DiscoverUM3Action.qml @@ -16,14 +16,14 @@ Cura.MachineAction anchors.fill: parent; id: discoverUM3Action SystemPalette { id: palette } - UM.I18nCatalog { id: catalog; name:"cura"} + UM.I18nCatalog { id: catalog; name:"cura" } Label { id: pageTitle width: parent.width text: catalog.i18nc("@title", "Connect to Networked Printer") wrapMode: Text.WordWrap - font.pointSize: 18; + font.pointSize: 18 } Label @@ -41,8 +41,9 @@ Cura.MachineAction ScrollView { id: objectListContainer - frameVisible: true; + frameVisible: true width: parent.width * 0.5 + height: base.height - parent.y Rectangle { @@ -56,7 +57,6 @@ Cura.MachineAction id: listview model: manager.foundDevices width: parent.width - height: 500 currentIndex: activeIndex onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex] Component.onCompleted: manager.startDiscovery() @@ -98,7 +98,8 @@ Cura.MachineAction width: parent.width wrapMode: Text.WordWrap text: base.selectedPrinter ? base.selectedPrinter.name : "" - font.pointSize: 16; + font: UM.Theme.getFont("large") + elide: Text.ElideRight } Grid {