Fixed camera for legacy UM3 printer again

CL-541
This commit is contained in:
Jaime van Kessel 2017-12-08 14:59:14 +01:00
parent 9ccd643f64
commit ae629e2968
4 changed files with 30 additions and 21 deletions

View file

@ -6,37 +6,49 @@ import Cura 1.0 as Cura
Component
{
Image
Item
{
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
onVisibleChanged:
width: maximumWidth
height: maximumHeight
Image
{
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)
{
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:
{
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
source:
{
return OutputDevice.activePrinter.camera.latestImage;
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
{
return OutputDevice.activePrinter.camera.latestImage;
}
return "";
}
return "";
}
}
}