Refactor some code

CURA-5612
This commit is contained in:
Lipu Fei 2018-08-03 14:37:09 +02:00
parent 38ce73365a
commit 20806eeb72
2 changed files with 6 additions and 7 deletions

View file

@ -4,21 +4,20 @@ from PyQt5.QtCore import QSize
from UM.Application import Application
class CameraImageProvider(QQuickImageProvider):
def __init__(self):
QQuickImageProvider.__init__(self, QQuickImageProvider.Image)
super().__init__(QQuickImageProvider.Image)
## Request a new image.
def requestImage(self, id, size):
for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
try:
image = output_device.activePrinter.camera.getImage()
if image.isNull():
return QImage(), QSize(15, 15)
image = QImage()
return image, QSize(15, 15)
except AttributeError:
pass
return QImage(), QSize(15, 15)
return QImage(), QSize(15, 15)