mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Refactor some code
CURA-5612
This commit is contained in:
parent
38ce73365a
commit
20806eeb72
2 changed files with 6 additions and 7 deletions
|
@ -4,19 +4,18 @@ from PyQt5.QtCore import QSize
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
|
||||||
|
|
||||||
class CameraImageProvider(QQuickImageProvider):
|
class CameraImageProvider(QQuickImageProvider):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QQuickImageProvider.__init__(self, QQuickImageProvider.Image)
|
super().__init__(QQuickImageProvider.Image)
|
||||||
|
|
||||||
## Request a new image.
|
## Request a new image.
|
||||||
def requestImage(self, id, size):
|
def requestImage(self, id, size):
|
||||||
for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
|
for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
|
||||||
try:
|
try:
|
||||||
|
|
||||||
image = output_device.activePrinter.camera.getImage()
|
image = output_device.activePrinter.camera.getImage()
|
||||||
|
|
||||||
if image.isNull():
|
if image.isNull():
|
||||||
return QImage(), QSize(15, 15)
|
image = QImage()
|
||||||
|
|
||||||
return image, QSize(15, 15)
|
return image, QSize(15, 15)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
@ -9,7 +9,7 @@ Component
|
||||||
{
|
{
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: rectangle
|
id: monitorFrame
|
||||||
width: maximumWidth
|
width: maximumWidth
|
||||||
height: maximumHeight
|
height: maximumHeight
|
||||||
color: UM.Theme.getColor("viewport_background")
|
color: UM.Theme.getColor("viewport_background")
|
||||||
|
@ -107,7 +107,7 @@ Component
|
||||||
|
|
||||||
onVisibleChanged:
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
if(rectangle != null && !rectangle.visible)
|
if (!monitorFrame.visible)
|
||||||
{
|
{
|
||||||
// After switching the Tab ensure that active printer is Null, the video stream image
|
// After switching the Tab ensure that active printer is Null, the video stream image
|
||||||
// might be active
|
// might be active
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue