mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Added CameraImageProvider & camera handling
CURA-1036 and CURA-338
This commit is contained in:
parent
8160f8d5e6
commit
3a46bb8d8a
3 changed files with 23 additions and 3 deletions
18
cura/CameraImageProvider.py
Normal file
18
cura/CameraImageProvider.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue