mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 14:19:37 +08:00
18 lines
639 B
Python
18 lines
639 B
Python
from PyQt5.QtGui import QImage
|
|
from PyQt5.QtQuick import QQuickImageProvider
|
|
from PyQt5.QtCore import QSize
|
|
|
|
from UM.Application import Application
|
|
|
|
class CameraImageProvider(QQuickImageProvider):
|
|
def __init__(self):
|
|
QQuickImageProvider.__init__(self, QQuickImageProvider.Image)
|
|
|
|
## Request a new image.
|
|
def requestImage(self, id, size):
|
|
for output_device in Application.getInstance().getOutputDeviceManager().getOutputDevices():
|
|
try:
|
|
return output_device.getCameraImage(), QSize(15, 15)
|
|
except AttributeError:
|
|
pass
|
|
return QImage(), QSize(15, 15) |