mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Added preview image to print cluster monitor
CL-894
This commit is contained in:
parent
78ebdb13f4
commit
94b9782110
6 changed files with 84 additions and 3 deletions
27
cura/PrintJobPreviewImageProvider.py
Normal file
27
cura/PrintJobPreviewImageProvider.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from PyQt5.QtGui import QImage
|
||||
from PyQt5.QtQuick import QQuickImageProvider
|
||||
from PyQt5.QtCore import QSize
|
||||
|
||||
from UM.Application import Application
|
||||
|
||||
|
||||
class PrintJobPreviewImageProvider(QQuickImageProvider):
|
||||
def __init__(self):
|
||||
super().__init__(QQuickImageProvider.Image)
|
||||
|
||||
## Request a new image.
|
||||
def requestImage(self, id, size):
|
||||
# The id will have an uuid and an increment separated by a slash. As we don't care about the value of the
|
||||
# increment, we need to strip that first.
|
||||
uuid = id[id.find("/") + 1:]
|
||||
for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
|
||||
if not hasattr(output_device, "printJobs"):
|
||||
continue
|
||||
|
||||
for print_job in output_device.printJobs:
|
||||
if print_job.key == uuid:
|
||||
if print_job.getPreviewImage():
|
||||
return print_job.getPreviewImage(), QSize(15, 15)
|
||||
else:
|
||||
return QImage(), QSize(15, 15)
|
||||
return QImage(), QSize(15,15)
|
Loading…
Add table
Add a link
Reference in a new issue