Merge branch 'CURA-5143_3.3_send_gz' into 3.3

This commit is contained in:
Ghostkeeper 2018-04-24 10:48:31 +02:00
commit 403051e0b2
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
3 changed files with 25 additions and 10 deletions

View file

@ -50,6 +50,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._number_of_extruders = 2
self._dummy_lambdas = set()
self._print_jobs = []
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ClusterMonitorItem.qml")
@ -64,6 +66,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._authentication_state = AuthState.Authenticated
self._error_message = None
self._write_job_progress_message = None
self._progress_message = None
self._active_printer = None # type: Optional[PrinterOutputModel]
@ -179,16 +182,33 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
job = WriteFileJob(writer, stream, nodes, preferred_format["mode"])
self._write_job_progress_message = Message(i18n_catalog.i18nc("@info:status", "Sending data to printer"), lifetime = 0, dismissable = False, progress = -1,
title = i18n_catalog.i18nc("@info:title", "Sending Data"), use_inactivity_timer = False)
self._write_job_progress_message.show()
self._dummy_lambdas = (target_printer, preferred_format, stream)
job.finished.connect(self._sendPrintJobWaitOnWriteJobFinished)
job.start()
yield True #Return that we had success!
yield #To prevent having to catch the StopIteration exception.
from cura.Utils.Threading import call_on_qt_thread
def _sendPrintJobWaitOnWriteJobFinished(self, job):
self._write_job_progress_message.hide()
self._progress_message = Message(i18n_catalog.i18nc("@info:status", "Sending data to printer"), lifetime = 0, dismissable = False, progress = -1,
title = i18n_catalog.i18nc("@info:title", "Sending Data"))
self._progress_message.addAction("Abort", i18n_catalog.i18nc("@action:button", "Cancel"), icon = None, description = "")
self._progress_message.actionTriggered.connect(self._progressMessageActionTriggered)
self._progress_message.show()
job.start()
parts = []
target_printer, preferred_format, stream = self._dummy_lambdas
# If a specific printer was selected, it should be printed with that machine.
if target_printer:
target_printer = self._printer_uuid_to_unique_name_mapping[target_printer]
@ -199,8 +219,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
file_name = Application.getInstance().getPrintInformation().jobName + "." + preferred_format["extension"]
while not job.isFinished():
sleep(0.1)
output = stream.getvalue() #Either str or bytes depending on the output mode.
if isinstance(stream, io.StringIO):
output = output.encode("utf-8")
@ -209,9 +227,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._latest_reply_handler = self.postFormWithParts("print_jobs/", parts, onFinished=self._onPostPrintJobFinished, onProgress=self._onUploadPrintJobProgress)
yield True #Return that we had success!
yield #To prevent having to catch the StopIteration exception.
@pyqtProperty(QObject, notify=activePrinterChanged)
def activePrinter(self) -> Optional[PrinterOutputModel]:
return self._active_printer

View file

@ -1,4 +1,4 @@
// Copyright (c) 2015 Ultimaker B.V.
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -48,7 +48,7 @@ UM.Dialog
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.rightMargin: UM.Theme.getSize("default_margin").width
height: 50 * screenScaleFactord
height: 50 * screenScaleFactor
Label
{
id: manualPrinterSelectionLabel

View file

@ -6,7 +6,7 @@
"author": "Ultimaker",
"manufacturer": "Ultimaker B.V.",
"visible": true,
"file_formats": "text/x-gcode;application/gzip",
"file_formats": "application/gzip;text/x-gcode",
"platform": "ultimaker3_platform.obj",
"platform_texture": "Ultimaker3backplate.png",
"platform_offset": [0, 0, 0],