Merge branch 'master' of github.com:Ultimaker/JediWifiPrintingPlugin

This commit is contained in:
Jaime van Kessel 2016-06-28 11:53:11 +02:00
commit 804ff66c9a
3 changed files with 19 additions and 18 deletions

View File

@ -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

View File

@ -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
@ -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
@ -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,20 +57,21 @@ Cura.MachineAction
id: listview
model: manager.foundDevices
width: parent.width
height: 500
currentIndex: activeIndex
onCurrentIndexChanged: base.selectedPrinter = listview.model[currentIndex]
Component.onCompleted: manager.startDiscovery()
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
}
@ -96,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
{
@ -141,11 +144,6 @@ Cura.MachineAction
}
}
}
Button
{
text: catalog.i18nc("@label","Start looking!")
onClicked: manager.startDiscovery()
}
}
Button
{

View File

@ -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())