mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fixed camera for legacy UM3 printer again
CL-541
This commit is contained in:
parent
9ccd643f64
commit
ae629e2968
4 changed files with 30 additions and 21 deletions
|
@ -59,7 +59,6 @@ class NetworkCamera(QObject):
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
||||||
self._stream_buffer = b""
|
self._stream_buffer = b""
|
||||||
self._stream_buffer_start_index = -1
|
self._stream_buffer_start_index = -1
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# create the item (and fail) every time.
|
# create the item (and fail) every time.
|
||||||
if not self._monitor_component:
|
if not self._monitor_component:
|
||||||
self._createMonitorViewFromQML()
|
self._createMonitorViewFromQML()
|
||||||
|
|
||||||
return self._monitor_item
|
return self._monitor_item
|
||||||
|
|
||||||
@pyqtProperty(QObject, constant=True)
|
@pyqtProperty(QObject, constant=True)
|
||||||
|
|
|
@ -74,7 +74,6 @@ class LegacyUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
|
self._monitor_view_qml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "MonitorItem.qml")
|
||||||
|
|
||||||
|
|
||||||
self._output_controller = LegacyUM3PrinterOutputController(self)
|
self._output_controller = LegacyUM3PrinterOutputController(self)
|
||||||
|
|
||||||
def _onAuthenticationStateChanged(self):
|
def _onAuthenticationStateChanged(self):
|
||||||
|
|
|
@ -6,37 +6,49 @@ import Cura 1.0 as Cura
|
||||||
|
|
||||||
Component
|
Component
|
||||||
{
|
{
|
||||||
Image
|
Item
|
||||||
{
|
{
|
||||||
id: cameraImage
|
width: maximumWidth
|
||||||
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
|
height: maximumHeight
|
||||||
height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width)
|
Image
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
z: 1
|
|
||||||
onVisibleChanged:
|
|
||||||
{
|
{
|
||||||
if(visible)
|
id: cameraImage
|
||||||
|
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
|
||||||
|
height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width)
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
z: 1
|
||||||
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
|
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
|
||||||
{
|
{
|
||||||
OutputDevice.activePrinter.camera.start()
|
OutputDevice.activePrinter.camera.start()
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
|
if(visible)
|
||||||
{
|
{
|
||||||
OutputDevice.activePrinter.camera.stop()
|
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
|
||||||
|
{
|
||||||
|
OutputDevice.activePrinter.camera.start()
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
|
||||||
|
{
|
||||||
|
OutputDevice.activePrinter.camera.stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
source:
|
||||||
source:
|
|
||||||
{
|
|
||||||
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
|
|
||||||
{
|
{
|
||||||
return OutputDevice.activePrinter.camera.latestImage;
|
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
|
||||||
|
{
|
||||||
|
return OutputDevice.activePrinter.camera.latestImage;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue