mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Organize files better
First things first... organize!
This commit is contained in:
parent
49d72f5855
commit
18e0dacda4
32 changed files with 21 additions and 22 deletions
717
plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
Normal file
717
plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml
Normal file
|
@ -0,0 +1,717 @@
|
|||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import QtQuick.Controls 2.0 as Controls2
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
|
||||
Component
|
||||
{
|
||||
Rectangle
|
||||
{
|
||||
id: base
|
||||
property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
|
||||
|
||||
property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
|
||||
visible: OutputDevice != null
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printingLabel
|
||||
font: UM.Theme.getFont("large")
|
||||
anchors
|
||||
{
|
||||
margins: 2 * UM.Theme.getSize("default_margin").width
|
||||
leftMargin: 4 * UM.Theme.getSize("default_margin").width
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
text: catalog.i18nc("@label", "Printing")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: managePrintersLabel
|
||||
anchors.rightMargin: 4 * UM.Theme.getSize("default_margin").width
|
||||
anchors.right: printerScrollView.right
|
||||
anchors.bottom: printingLabel.bottom
|
||||
text: catalog.i18nc("@label link to connect manager", "Manage printers")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("primary")
|
||||
linkColor: UM.Theme.getColor("primary")
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: managePrintersLabel
|
||||
hoverEnabled: true
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel()
|
||||
onEntered: managePrintersLabel.font.underline = true
|
||||
onExited: managePrintersLabel.font.underline = false
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: printerScrollView
|
||||
anchors
|
||||
{
|
||||
top: printingLabel.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
bottom: parent.bottom
|
||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.scrollview
|
||||
|
||||
ListView
|
||||
{
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||
rightMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
spacing: UM.Theme.getSize("default_margin").height -10
|
||||
model: OutputDevice.printers
|
||||
|
||||
delegate: Item
|
||||
{
|
||||
width: parent.width
|
||||
height: base.height + 2 * base.shadowRadius // To ensure that the shadow doesn't get cut off.
|
||||
Rectangle
|
||||
{
|
||||
width: parent.width - 2 * shadowRadius
|
||||
height: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
id: base
|
||||
property var shadowRadius: 5
|
||||
property var collapsed: true
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow
|
||||
{
|
||||
radius: base.shadowRadius
|
||||
verticalOffset: 2
|
||||
color: "#3F000000" // 25% shadow
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: printerInfo
|
||||
height: machineIcon.height
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: base.collapsed = !base.collapsed
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: machineIcon
|
||||
// Yeah, this is hardcoded now, but I can't think of a good way to fix this.
|
||||
// The UI is going to get another update soon, so it's probably not worth the effort...
|
||||
width: 58
|
||||
height: 58
|
||||
anchors.top: parent.top
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.left: parent.left
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
source:
|
||||
{
|
||||
switch(modelData.type)
|
||||
{
|
||||
case "Ultimaker 3":
|
||||
return "../svg/UM3-icon.svg"
|
||||
case "Ultimaker 3 Extended":
|
||||
return "../svg/UM3x-icon.svg"
|
||||
case "Ultimaker S5":
|
||||
return "../svg/UMs5-icon.svg"
|
||||
}
|
||||
}
|
||||
width: sourceSize.width
|
||||
height: sourceSize.height
|
||||
|
||||
color:
|
||||
{
|
||||
if(modelData.state == "disabled")
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
}
|
||||
|
||||
if(modelData.activePrintJob != undefined)
|
||||
{
|
||||
return UM.Theme.getColor("primary")
|
||||
}
|
||||
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
Item
|
||||
{
|
||||
height: childrenRect.height
|
||||
anchors
|
||||
{
|
||||
right: collapseIcon.left
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
left: machineIcon.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
verticalCenter: machineIcon.verticalCenter
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: machineNameLabel
|
||||
text: modelData.name
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: activeJobLabel
|
||||
text:
|
||||
{
|
||||
if (modelData.state == "disabled")
|
||||
{
|
||||
return catalog.i18nc("@label", "Not available")
|
||||
} else if (modelData.state == "unreachable")
|
||||
{
|
||||
return catalog.i18nc("@label", "Unreachable")
|
||||
}
|
||||
if (modelData.activePrintJob != null)
|
||||
{
|
||||
return modelData.activePrintJob.name
|
||||
}
|
||||
return catalog.i18nc("@label", "Available")
|
||||
}
|
||||
anchors.top: machineNameLabel.bottom
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
opacity: 0.6
|
||||
}
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: collapseIcon
|
||||
width: 15
|
||||
height: 15
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
source: base.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
color: "black"
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: detailedInfo
|
||||
property var printJob: modelData.activePrintJob
|
||||
visible: height == childrenRect.height
|
||||
anchors.top: printerInfo.bottom
|
||||
width: parent.width
|
||||
height: !base.collapsed ? childrenRect.height : 0
|
||||
opacity: visible ? 1 : 0
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
Rectangle
|
||||
{
|
||||
id: topSpacer
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
height: 2
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: UM.Theme.getSize("default_margin").width
|
||||
top: parent.top
|
||||
topMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
PrinterFamilyPill
|
||||
{
|
||||
id: printerFamilyPill
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
anchors.top: topSpacer.bottom
|
||||
anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||
text: modelData.type
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
padding: 3
|
||||
}
|
||||
Row
|
||||
{
|
||||
id: extrudersInfo
|
||||
anchors.top: printerFamilyPill.bottom
|
||||
anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||
height: childrenRect.height
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: leftExtruderInfo
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: modelData.printerConfiguration.extruderConfigurations[0]
|
||||
}
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: rightExtruderInfo
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: modelData.printerConfiguration.extruderConfigurations[1]
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: jobSpacer
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
height: 2
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: UM.Theme.getSize("default_margin").width
|
||||
top: extrudersInfo.bottom
|
||||
topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: jobInfo
|
||||
property var showJobInfo: modelData.activePrintJob != null && modelData.activePrintJob.state != "queued"
|
||||
|
||||
anchors.top: jobSpacer.bottom
|
||||
anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
anchors.leftMargin: 2 * UM.Theme.getSize("default_margin").width
|
||||
height: showJobInfo ? childrenRect.height + 2 * UM.Theme.getSize("default_margin").height: 0
|
||||
visible: showJobInfo
|
||||
Label
|
||||
{
|
||||
id: printJobName
|
||||
text: modelData.activePrintJob != null ? modelData.activePrintJob.name : ""
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
anchors.left: parent.left
|
||||
anchors.right: contextButton.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: ownerName
|
||||
anchors.top: printJobName.bottom
|
||||
text: modelData.activePrintJob != null ? modelData.activePrintJob.owner : ""
|
||||
font: UM.Theme.getFont("default")
|
||||
opacity: 0.6
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
function switchPopupState()
|
||||
{
|
||||
if (popup.visible)
|
||||
{
|
||||
popup.close()
|
||||
}
|
||||
else
|
||||
{
|
||||
popup.open()
|
||||
}
|
||||
}
|
||||
|
||||
Controls2.Button
|
||||
{
|
||||
id: contextButton
|
||||
text: "\u22EE" //Unicode; Three stacked points.
|
||||
font.pixelSize: 25
|
||||
width: 35
|
||||
height: width
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
}
|
||||
hoverEnabled: true
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: contextButton.down || contextButton.hovered ? 1 : 0
|
||||
width: contextButton.width
|
||||
height: contextButton.height
|
||||
radius: 0.5 * width
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
|
||||
onClicked: parent.switchPopupState()
|
||||
}
|
||||
|
||||
Controls2.Popup
|
||||
{
|
||||
// TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
|
||||
id: popup
|
||||
clip: true
|
||||
closePolicy: Controls2.Popup.CloseOnPressOutsideParent
|
||||
x: parent.width - width
|
||||
y: contextButton.height
|
||||
width: 160
|
||||
height: contentItem.height + 2 * padding
|
||||
visible: false
|
||||
|
||||
transformOrigin: Controls2.Popup.Top
|
||||
contentItem: Item
|
||||
{
|
||||
width: popup.width - 2 * popup.padding
|
||||
height: childrenRect.height + 15
|
||||
Controls2.Button
|
||||
{
|
||||
id: pauseButton
|
||||
text: modelData.activePrintJob != null && modelData.activePrintJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause")
|
||||
onClicked:
|
||||
{
|
||||
if(modelData.activePrintJob.state == "paused")
|
||||
{
|
||||
modelData.activePrintJob.setState("print")
|
||||
}
|
||||
else if(modelData.activePrintJob.state == "printing")
|
||||
{
|
||||
modelData.activePrintJob.setState("pause")
|
||||
}
|
||||
popup.close()
|
||||
}
|
||||
width: parent.width
|
||||
enabled: modelData.activePrintJob != null && ["paused", "printing"].indexOf(modelData.activePrintJob.state) >= 0
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
hoverEnabled: true
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: pauseButton.down || pauseButton.hovered ? 1 : 0
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
}
|
||||
|
||||
Controls2.Button
|
||||
{
|
||||
id: abortButton
|
||||
text: catalog.i18nc("@label", "Abort")
|
||||
onClicked:
|
||||
{
|
||||
modelData.activePrintJob.setState("abort")
|
||||
popup.close()
|
||||
}
|
||||
width: parent.width
|
||||
anchors.top: pauseButton.bottom
|
||||
hoverEnabled: true
|
||||
enabled: modelData.activePrintJob != null && ["paused", "printing", "pre_print"].indexOf(modelData.activePrintJob.state) >= 0
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: abortButton.down || abortButton.hovered ? 1 : 0
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Item
|
||||
{
|
||||
width: popup.width
|
||||
height: popup.height
|
||||
|
||||
DropShadow
|
||||
{
|
||||
anchors.fill: pointedRectangle
|
||||
radius: 5
|
||||
color: "#3F000000" // 25% shadow
|
||||
source: pointedRectangle
|
||||
transparentBorder: true
|
||||
verticalOffset: 2
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: pointedRectangle
|
||||
width: parent.width -10
|
||||
height: parent.height -10
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: point
|
||||
height: 13
|
||||
width: 13
|
||||
color: UM.Theme.getColor("setting_control")
|
||||
transform: Rotation { angle: 45}
|
||||
anchors.right: bloop.right
|
||||
y: 1
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: bloop
|
||||
color: UM.Theme.getColor("setting_control")
|
||||
width: parent.width
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition
|
||||
{
|
||||
// This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||
NumberAnimation { property: "visible"; duration: 75; }
|
||||
}
|
||||
enter: Transition
|
||||
{
|
||||
// This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||
NumberAnimation { property: "visible"; duration: 75; }
|
||||
}
|
||||
|
||||
onClosed: visible = false
|
||||
onOpened: visible = true
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: printJobPreview
|
||||
source: modelData.activePrintJob != null ? modelData.activePrintJob.previewImageUrl : ""
|
||||
anchors.top: ownerName.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width / 2
|
||||
height: width
|
||||
opacity:
|
||||
{
|
||||
if(modelData.activePrintJob == null)
|
||||
{
|
||||
return 1.0
|
||||
}
|
||||
|
||||
switch(modelData.activePrintJob.state)
|
||||
{
|
||||
case "wait_cleanup":
|
||||
case "wait_user_action":
|
||||
case "paused":
|
||||
return 0.5
|
||||
default:
|
||||
return 1.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: statusImage
|
||||
anchors.centerIn: printJobPreview
|
||||
source:
|
||||
{
|
||||
if(modelData.activePrintJob == null)
|
||||
{
|
||||
return ""
|
||||
}
|
||||
switch(modelData.activePrintJob.state)
|
||||
{
|
||||
case "paused":
|
||||
return "../svg/paused-icon.svg"
|
||||
case "wait_cleanup":
|
||||
if(modelData.activePrintJob.timeElapsed < modelData.activePrintJob.timeTotal)
|
||||
{
|
||||
return "../svg/aborted-icon.svg"
|
||||
}
|
||||
return "../svg/approved-icon.svg"
|
||||
case "wait_user_action":
|
||||
return "../svg/aborted-icon.svg"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
visible: source != ""
|
||||
width: 0.5 * printJobPreview.width
|
||||
height: 0.5 * printJobPreview.height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: "black"
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: showCameraIcon
|
||||
width: 35 * screenScaleFactor
|
||||
height: width
|
||||
radius: 0.5 * width
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: printJobPreview.bottom
|
||||
color: UM.Theme.getColor("setting_control_border_highlight")
|
||||
Image
|
||||
{
|
||||
width: parent.width
|
||||
height: width
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: parent.rightMargin
|
||||
source: "../svg/camera-icon.svg"
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill:parent
|
||||
onClicked:
|
||||
{
|
||||
OutputDevice.setActiveCamera(modelData.camera)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar
|
||||
{
|
||||
property var progress:
|
||||
{
|
||||
if(modelData.activePrintJob == null)
|
||||
{
|
||||
return 0
|
||||
}
|
||||
var result = modelData.activePrintJob.timeElapsed / modelData.activePrintJob.timeTotal
|
||||
if(result > 1.0)
|
||||
{
|
||||
result = 1.0
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
id: jobProgressBar
|
||||
width: parent.width
|
||||
value: progress
|
||||
anchors.top: detailedInfo.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
|
||||
visible: modelData.activePrintJob != null && modelData.activePrintJob != undefined
|
||||
|
||||
style: ProgressBarStyle
|
||||
{
|
||||
property var progressText:
|
||||
{
|
||||
if(modelData.activePrintJob == null)
|
||||
{
|
||||
return ""
|
||||
}
|
||||
|
||||
switch(modelData.activePrintJob.state)
|
||||
{
|
||||
case "wait_cleanup":
|
||||
if(modelData.activePrintJob.timeTotal > modelData.activePrintJob.timeElapsed)
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Aborted")
|
||||
}
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
case "pre_print":
|
||||
case "sent_to_printer":
|
||||
return catalog.i18nc("@label:status", "Preparing")
|
||||
case "aborted":
|
||||
case "wait_user_action":
|
||||
return catalog.i18nc("@label:status", "Aborted")
|
||||
case "pausing":
|
||||
return catalog.i18nc("@label:status", "Pausing")
|
||||
case "paused":
|
||||
return catalog.i18nc("@label:status", "Paused")
|
||||
case "resuming":
|
||||
return catalog.i18nc("@label:status", "Resuming")
|
||||
case "queued":
|
||||
return catalog.i18nc("@label:status", "Action required")
|
||||
default:
|
||||
OutputDevice.formatDuration(modelData.activePrintJob.timeTotal - modelData.activePrintJob.timeElapsed)
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
implicitWidth: 100
|
||||
implicitHeight: visible ? 24 : 0
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
|
||||
progress: Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("primary")
|
||||
id: progressItem
|
||||
function getTextOffset()
|
||||
{
|
||||
if(progressItem.width + progressLabel.width < control.width)
|
||||
{
|
||||
return progressItem.width + UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
else
|
||||
{
|
||||
return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: progressLabel
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: getTextOffset()
|
||||
text: progressText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: progressItem.width + progressLabel.width < control.width ? "black" : "white"
|
||||
width: contentWidth
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
108
plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
Normal file
108
plugins/UM3NetworkPrinting/resources/qml/ClusterMonitorItem.qml
Normal file
|
@ -0,0 +1,108 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Component
|
||||
{
|
||||
Rectangle
|
||||
{
|
||||
id: monitorFrame
|
||||
width: maximumWidth
|
||||
height: maximumHeight
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight")
|
||||
property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
|
||||
property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: manageQueueLabel
|
||||
anchors.rightMargin: 4 * UM.Theme.getSize("default_margin").width
|
||||
anchors.right: queuedPrintJobs.right
|
||||
anchors.bottom: queuedLabel.bottom
|
||||
text: catalog.i18nc("@label link to connect manager", "Manage queue")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("primary")
|
||||
linkColor: UM.Theme.getColor("primary")
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: manageQueueLabel
|
||||
hoverEnabled: true
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel()
|
||||
onEntered: manageQueueLabel.font.underline = true
|
||||
onExited: manageQueueLabel.font.underline = false
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: queuedLabel
|
||||
anchors.left: queuedPrintJobs.left
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
|
||||
anchors.leftMargin: 3 * UM.Theme.getSize("default_margin").width
|
||||
text: catalog.i18nc("@label", "Queued")
|
||||
font: UM.Theme.getFont("large")
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: queuedPrintJobs
|
||||
|
||||
anchors
|
||||
{
|
||||
top: queuedLabel.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottomMargin: 0
|
||||
bottom: parent.bottom
|
||||
}
|
||||
style: UM.Theme.styles.scrollview
|
||||
width: Math.min(800 * screenScaleFactor, maximumWidth)
|
||||
ListView
|
||||
{
|
||||
anchors.fill: parent
|
||||
//anchors.margins: UM.Theme.getSize("default_margin").height
|
||||
spacing: UM.Theme.getSize("default_margin").height - 10 // 2x the shadow radius
|
||||
|
||||
model: OutputDevice.queuedPrintJobs
|
||||
|
||||
delegate: PrintJobInfoBlock
|
||||
{
|
||||
printJob: modelData
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").height
|
||||
height: 175 * screenScaleFactor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PrinterVideoStream
|
||||
{
|
||||
visible: OutputDevice.activeCamera != null
|
||||
anchors.fill: parent
|
||||
camera: OutputDevice.activeCamera
|
||||
}
|
||||
|
||||
onVisibleChanged:
|
||||
{
|
||||
if (monitorFrame != null && !monitorFrame.visible)
|
||||
{
|
||||
OutputDevice.setActiveCamera(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
398
plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml
Normal file
398
plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml
Normal file
|
@ -0,0 +1,398 @@
|
|||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
Cura.MachineAction
|
||||
{
|
||||
id: base
|
||||
anchors.fill: parent;
|
||||
property var selectedDevice: null
|
||||
property bool completeProperties: true
|
||||
|
||||
function connectToPrinter()
|
||||
{
|
||||
if(base.selectedDevice && base.completeProperties)
|
||||
{
|
||||
var printerKey = base.selectedDevice.key
|
||||
var printerName = base.selectedDevice.name // TODO To change when the groups have a name
|
||||
if (manager.getStoredKey() != printerKey)
|
||||
{
|
||||
// Check if there is another instance with the same key
|
||||
if (!manager.existsKey(printerKey))
|
||||
{
|
||||
manager.setKey(printerKey)
|
||||
manager.setGroupName(printerName) // TODO To change when the groups have a name
|
||||
completed()
|
||||
}
|
||||
else
|
||||
{
|
||||
existingConnectionDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: existingConnectionDialog
|
||||
title: catalog.i18nc("@window:title", "Existing Connection")
|
||||
icon: StandardIcon.Information
|
||||
text: catalog.i18nc("@message:text", "This printer/group is already added to Cura. Please select another printer/group.")
|
||||
standardButtons: StandardButton.Ok
|
||||
modality: Qt.ApplicationModal
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
anchors.fill: parent;
|
||||
id: discoverUM3Action
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
SystemPalette { id: palette }
|
||||
UM.I18nCatalog { id: catalog; name:"cura" }
|
||||
Label
|
||||
{
|
||||
id: pageTitle
|
||||
width: parent.width
|
||||
text: catalog.i18nc("@title:window", "Connect to Networked Printer")
|
||||
wrapMode: Text.WordWrap
|
||||
font.pointSize: 18
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: pageDescription
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "To print directly to your printer over the network, please make sure your printer is connected to the network using a network cable or by connecting your printer to your WIFI network. If you don't connect Cura with your printer, you can still use a USB drive to transfer g-code files to your printer.\n\nSelect your printer from the list below:")
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
spacing: UM.Theme.getSize("default_lining").width
|
||||
|
||||
Button
|
||||
{
|
||||
id: addButton
|
||||
text: catalog.i18nc("@action:button", "Add");
|
||||
onClicked:
|
||||
{
|
||||
manualPrinterDialog.showDialog("", "");
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: editButton
|
||||
text: catalog.i18nc("@action:button", "Edit")
|
||||
enabled: base.selectedDevice != null && base.selectedDevice.getProperty("manual") == "true"
|
||||
onClicked:
|
||||
{
|
||||
manualPrinterDialog.showDialog(base.selectedDevice.key, base.selectedDevice.ipAddress);
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: removeButton
|
||||
text: catalog.i18nc("@action:button", "Remove")
|
||||
enabled: base.selectedDevice != null && base.selectedDevice.getProperty("manual") == "true"
|
||||
onClicked: manager.removeManualDevice(base.selectedDevice.key, base.selectedDevice.ipAddress)
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: rediscoverButton
|
||||
text: catalog.i18nc("@action:button", "Refresh")
|
||||
onClicked: manager.restartDiscovery()
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
id: contentRow
|
||||
width: parent.width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Column
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: objectListContainer
|
||||
frameVisible: true
|
||||
width: parent.width
|
||||
height: base.height - contentRow.y - discoveryTip.height
|
||||
|
||||
Rectangle
|
||||
{
|
||||
parent: viewport
|
||||
anchors.fill: parent
|
||||
color: palette.light
|
||||
}
|
||||
|
||||
ListView
|
||||
{
|
||||
id: listview
|
||||
model: manager.foundDevices
|
||||
onModelChanged:
|
||||
{
|
||||
var selectedKey = manager.getLastManualEntryKey()
|
||||
// If there is no last manual entry key, then we select the stored key (if any)
|
||||
if (selectedKey == "")
|
||||
selectedKey = manager.getStoredKey()
|
||||
for(var i = 0; i < model.length; i++) {
|
||||
if(model[i].key == selectedKey)
|
||||
{
|
||||
currentIndex = i;
|
||||
return
|
||||
}
|
||||
}
|
||||
currentIndex = -1;
|
||||
}
|
||||
width: parent.width
|
||||
currentIndex: -1
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
base.selectedDevice = listview.model[currentIndex];
|
||||
// Only allow connecting if the printer has responded to API query since the last refresh
|
||||
base.completeProperties = base.selectedDevice != null && base.selectedDevice.getProperty("incomplete") != "true";
|
||||
}
|
||||
Component.onCompleted: manager.startDiscovery()
|
||||
delegate: Rectangle
|
||||
{
|
||||
height: childrenRect.height
|
||||
color: ListView.isCurrentItem ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
|
||||
width: parent.width
|
||||
Label
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: parent.right
|
||||
text: listview.model[index].name
|
||||
color: parent.ListView.isCurrentItem ? palette.highlightedText : palette.text
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent;
|
||||
onClicked:
|
||||
{
|
||||
if(!parent.ListView.isCurrentItem)
|
||||
{
|
||||
parent.ListView.view.currentIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: discoveryTip
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "If your printer is not listed, read the <a href='%1'>network printing troubleshooting guide</a>").arg("https://ultimaker.com/en/troubleshooting");
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
}
|
||||
Column
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
visible: base.selectedDevice ? true : false
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedDevice ? base.selectedDevice.name : ""
|
||||
font: UM.Theme.getFont("large")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Grid
|
||||
{
|
||||
visible: base.completeProperties
|
||||
width: parent.width
|
||||
columns: 2
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Type")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text:
|
||||
{
|
||||
if(base.selectedDevice)
|
||||
{
|
||||
if (base.selectedDevice.printerType == "ultimaker3")
|
||||
{
|
||||
return "Ultimaker 3";
|
||||
}
|
||||
else if (base.selectedDevice.printerType == "ultimaker3_extended")
|
||||
{
|
||||
return "Ultimaker 3 Extended";
|
||||
}
|
||||
else if (base.selectedDevice.printerType == "ultimaker_s5")
|
||||
{
|
||||
return "Ultimaker S5";
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label", "Unknown") // We have no idea what type it is. Should not happen 'in the field'
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Firmware version")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedDevice ? base.selectedDevice.firmwareVersion : ""
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Address")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.round(parent.width * 0.5)
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.selectedDevice ? base.selectedDevice.ipAddress : ""
|
||||
}
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text:{
|
||||
// The property cluster size does not exist for older UM3 devices.
|
||||
if(!base.selectedDevice || base.selectedDevice.clusterSize == null || base.selectedDevice.clusterSize == 1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else if (base.selectedDevice.clusterSize === 0)
|
||||
{
|
||||
return catalog.i18nc("@label", "This printer is not set up to host a group of printers.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label", "This printer is the host for a group of %1 printers.".arg(base.selectedDevice.clusterSize));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
visible: base.selectedDevice != null && !base.completeProperties
|
||||
text: catalog.i18nc("@label", "The printer at this address has not yet responded." )
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Connect")
|
||||
enabled: (base.selectedDevice && base.completeProperties && base.selectedDevice.clusterSize > 0) ? true : false
|
||||
onClicked: connectToPrinter()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: manualPrinterDialog
|
||||
property string printerKey
|
||||
property alias addressText: addressField.text
|
||||
|
||||
title: catalog.i18nc("@title:window", "Printer Address")
|
||||
|
||||
minimumWidth: 400 * screenScaleFactor
|
||||
minimumHeight: 130 * screenScaleFactor
|
||||
width: minimumWidth
|
||||
height: minimumHeight
|
||||
|
||||
signal showDialog(string key, string address)
|
||||
onShowDialog:
|
||||
{
|
||||
printerKey = key;
|
||||
addressText = address;
|
||||
manualPrinterDialog.show();
|
||||
addressField.selectAll();
|
||||
addressField.focus = true;
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@alabel","Enter the IP address or hostname of your printer on the network.")
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
TextField
|
||||
{
|
||||
id: addressField
|
||||
width: parent.width
|
||||
validator: RegExpValidator
|
||||
{
|
||||
regExp: /[a-zA-Z0-9\.\-\_]*/
|
||||
}
|
||||
|
||||
onAccepted: btnOk.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
rightButtons: [
|
||||
Button {
|
||||
text: catalog.i18nc("@action:button","Cancel")
|
||||
onClicked:
|
||||
{
|
||||
manualPrinterDialog.reject()
|
||||
manualPrinterDialog.hide()
|
||||
}
|
||||
},
|
||||
Button {
|
||||
id: btnOk
|
||||
text: catalog.i18nc("@action:button", "OK")
|
||||
onClicked:
|
||||
{
|
||||
manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText)
|
||||
manualPrinterDialog.hide()
|
||||
}
|
||||
enabled: manualPrinterDialog.addressText.trim() != ""
|
||||
isDefault: true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
54
plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
Normal file
54
plugins/UM3NetworkPrinting/resources/qml/MonitorItem.qml
Normal file
|
@ -0,0 +1,54 @@
|
|||
import QtQuick 2.2
|
||||
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Component
|
||||
{
|
||||
Item
|
||||
{
|
||||
width: maximumWidth
|
||||
height: maximumHeight
|
||||
Image
|
||||
{
|
||||
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()
|
||||
}
|
||||
}
|
||||
onVisibleChanged:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return OutputDevice.activePrinter.camera.latestImage;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml
Normal file
71
plugins/UM3NetworkPrinting/resources/qml/OpenPanelButton.qml
Normal file
|
@ -0,0 +1,71 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
|
||||
import UM 1.1 as UM
|
||||
|
||||
Button {
|
||||
objectName: "openPanelSaveAreaButton"
|
||||
id: openPanelSaveAreaButton
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.")
|
||||
text: catalog.i18nc("@action:button", "View print jobs")
|
||||
|
||||
// FIXME: This button style is copied and duplicated from SaveButton.qml
|
||||
style: ButtonStyle {
|
||||
background: Rectangle
|
||||
{
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_border");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("print_button_ready_pressed_border");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("print_button_ready_hovered_border");
|
||||
else
|
||||
return UM.Theme.getColor("print_button_ready_border");
|
||||
}
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("print_button_ready_pressed");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("print_button_ready_hovered");
|
||||
else
|
||||
return UM.Theme.getColor("print_button_ready");
|
||||
}
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
|
||||
|
||||
Label {
|
||||
id: actualLabel
|
||||
anchors.centerIn: parent
|
||||
color:
|
||||
{
|
||||
if(!control.enabled)
|
||||
return UM.Theme.getColor("action_button_disabled_text");
|
||||
else if(control.pressed)
|
||||
return UM.Theme.getColor("print_button_ready_text");
|
||||
else if(control.hovered)
|
||||
return UM.Theme.getColor("print_button_ready_text");
|
||||
else
|
||||
return UM.Theme.getColor("print_button_ready_text");
|
||||
}
|
||||
font: UM.Theme.getFont("action_button")
|
||||
text: control.text;
|
||||
}
|
||||
}
|
||||
label: Item { }
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
id: extruderInfo
|
||||
property var printCoreConfiguration
|
||||
|
||||
width: Math.round(parent.width / 2)
|
||||
height: childrenRect.height
|
||||
|
||||
Item
|
||||
{
|
||||
id: extruderCircle
|
||||
width: 30
|
||||
height: 30
|
||||
|
||||
anchors.verticalCenter: printAndMaterialLabel.verticalCenter
|
||||
opacity:
|
||||
{
|
||||
if(printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null)
|
||||
{
|
||||
return 0.5
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
radius: Math.round(width / 2)
|
||||
border.width: 2
|
||||
border.color: "black"
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.centerIn: parent
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
text: printCoreConfiguration.position + 1
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: printAndMaterialLabel
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
left: extruderCircle.right
|
||||
margins: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
height: childrenRect.height
|
||||
|
||||
Label
|
||||
{
|
||||
id: materialLabel
|
||||
text:
|
||||
{
|
||||
if(printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined)
|
||||
{
|
||||
return printCoreConfiguration.activeMaterial.name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printCoreLabel
|
||||
text:
|
||||
{
|
||||
if(printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined)
|
||||
{
|
||||
return printCoreConfiguration.hotendID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
anchors.top: materialLabel.bottom
|
||||
elide: Text.ElideRight
|
||||
width: parent.width
|
||||
opacity: 0.6
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
}
|
||||
}
|
378
plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
Normal file
378
plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml
Normal file
|
@ -0,0 +1,378 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import UM 1.3 as UM
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
property var printJob: null
|
||||
property var shadowRadius: 5
|
||||
function getPrettyTime(time)
|
||||
{
|
||||
return OutputDevice.formatDuration(time)
|
||||
}
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: background
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
topMargin: 3
|
||||
left: parent.left
|
||||
leftMargin: base.shadowRadius
|
||||
rightMargin: base.shadowRadius
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottomMargin: base.shadowRadius
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow
|
||||
{
|
||||
radius: base.shadowRadius
|
||||
verticalOffset: 2
|
||||
color: "#3F000000" // 25% shadow
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
// Content on the left of the infobox
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.horizontalCenter
|
||||
margins: 2 * UM.Theme.getSize("default_margin").width
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printJobName
|
||||
text: printJob.name
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: ownerName
|
||||
anchors.top: printJobName.bottom
|
||||
text: printJob.owner
|
||||
font: UM.Theme.getFont("default")
|
||||
opacity: 0.6
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: printJobPreview
|
||||
source: printJob.previewImageUrl
|
||||
anchors.top: ownerName.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: totalTimeLabel.bottom
|
||||
width: height
|
||||
opacity: printJob.state == "error" ? 0.5 : 1.0
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: statusImage
|
||||
anchors.centerIn: printJobPreview
|
||||
source: printJob.state == "error" ? "../svg/aborted-icon.svg" : ""
|
||||
visible: source != ""
|
||||
width: 0.5 * printJobPreview.width
|
||||
height: 0.5 * printJobPreview.height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: "black"
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: totalTimeLabel
|
||||
opacity: 0.6
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
font: UM.Theme.getFont("default")
|
||||
text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
// Content on the right side of the infobox.
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.horizontalCenter
|
||||
right: parent.right
|
||||
margins: 2 * UM.Theme.getSize("default_margin").width
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: targetPrinterLabel
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
text:
|
||||
{
|
||||
if(printJob.assignedPrinter == null)
|
||||
{
|
||||
if(printJob.state == "error")
|
||||
{
|
||||
return catalog.i18nc("@label", "Waiting for: Unavailable printer")
|
||||
}
|
||||
return catalog.i18nc("@label", "Waiting for: First available")
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label", "Waiting for: ") + printJob.assignedPrinter.name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: contextButton.left
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function switchPopupState()
|
||||
{
|
||||
popup.visible ? popup.close() : popup.open()
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: contextButton
|
||||
text: "\u22EE" //Unicode; Three stacked points.
|
||||
font.pixelSize: 25
|
||||
width: 35
|
||||
height: width
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
}
|
||||
hoverEnabled: true
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: contextButton.down || contextButton.hovered ? 1 : 0
|
||||
width: contextButton.width
|
||||
height: contextButton.height
|
||||
radius: 0.5 * width
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
|
||||
onClicked: parent.switchPopupState()
|
||||
}
|
||||
|
||||
Popup
|
||||
{
|
||||
// TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property
|
||||
id: popup
|
||||
clip: true
|
||||
closePolicy: Popup.CloseOnPressOutsideParent
|
||||
x: parent.width - width
|
||||
y: contextButton.height
|
||||
width: 160
|
||||
height: contentItem.height + 2 * padding
|
||||
visible: false
|
||||
|
||||
transformOrigin: Popup.Top
|
||||
contentItem: Item
|
||||
{
|
||||
width: popup.width - 2 * popup.padding
|
||||
height: childrenRect.height + 15
|
||||
Button
|
||||
{
|
||||
id: sendToTopButton
|
||||
text: catalog.i18nc("@label", "Move to top")
|
||||
onClicked:
|
||||
{
|
||||
OutputDevice.sendJobToTop(printJob.key)
|
||||
popup.close()
|
||||
}
|
||||
width: parent.width
|
||||
enabled: OutputDevice.queuedPrintJobs[0].key != printJob.key
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
hoverEnabled: true
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: sendToTopButton.down || sendToTopButton.hovered ? 1 : 0
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: deleteButton
|
||||
text: catalog.i18nc("@label", "Delete")
|
||||
onClicked:
|
||||
{
|
||||
OutputDevice.deleteJobFromQueue(printJob.key)
|
||||
popup.close()
|
||||
}
|
||||
width: parent.width
|
||||
anchors.top: sendToTopButton.bottom
|
||||
hoverEnabled: true
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: deleteButton.down || deleteButton.hovered ? 1 : 0
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Item
|
||||
{
|
||||
width: popup.width
|
||||
height: popup.height
|
||||
|
||||
DropShadow
|
||||
{
|
||||
anchors.fill: pointedRectangle
|
||||
radius: 5
|
||||
color: "#3F000000" // 25% shadow
|
||||
source: pointedRectangle
|
||||
transparentBorder: true
|
||||
verticalOffset: 2
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: pointedRectangle
|
||||
width: parent.width -10
|
||||
height: parent.height -10
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: point
|
||||
height: 13
|
||||
width: 13
|
||||
color: UM.Theme.getColor("setting_control")
|
||||
transform: Rotation { angle: 45}
|
||||
anchors.right: bloop.right
|
||||
y: 1
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: bloop
|
||||
color: UM.Theme.getColor("setting_control")
|
||||
width: parent.width
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition
|
||||
{
|
||||
// This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||
NumberAnimation { property: "visible"; duration: 75; }
|
||||
}
|
||||
enter: Transition
|
||||
{
|
||||
// This applies a default NumberAnimation to any changes a state change makes to x or y properties
|
||||
NumberAnimation { property: "visible"; duration: 75; }
|
||||
}
|
||||
|
||||
onClosed: visible = false
|
||||
onOpened: visible = true
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
id: printerFamilyPills
|
||||
spacing: 0.5 * UM.Theme.getSize("default_margin").width
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: extrudersInfo.top
|
||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
height: childrenRect.height
|
||||
Repeater
|
||||
{
|
||||
model: printJob.compatibleMachineFamilies
|
||||
|
||||
delegate: PrinterFamilyPill
|
||||
{
|
||||
text: modelData
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
padding: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
// PrintCore && Material config
|
||||
Row
|
||||
{
|
||||
id: extrudersInfo
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: childrenRect.height
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: leftExtruderInfo
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: printJob.configuration.extruderConfigurations[0]
|
||||
}
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: rightExtruderInfo
|
||||
width: Math.round(parent.width / 2)
|
||||
printCoreConfiguration: printJob.configuration.extruderConfigurations[1]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
color: UM.Theme.getColor("viewport_background")
|
||||
width: 2
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: UM.Theme.getSize("default_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
115
plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml
Normal file
115
plugins/UM3NetworkPrinting/resources/qml/PrintWindow.qml
Normal file
|
@ -0,0 +1,115 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
|
||||
import UM 1.1 as UM
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: base;
|
||||
|
||||
minimumWidth: 500 * screenScaleFactor
|
||||
minimumHeight: 140 * screenScaleFactor
|
||||
maximumWidth: minimumWidth
|
||||
maximumHeight: minimumHeight
|
||||
width: minimumWidth
|
||||
height: minimumHeight
|
||||
|
||||
visible: true
|
||||
modality: Qt.ApplicationModal
|
||||
onVisibleChanged:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
resetPrintersModel()
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDevice.cancelPrintSelection()
|
||||
}
|
||||
}
|
||||
title: catalog.i18nc("@title:window", "Print over network")
|
||||
|
||||
property var printersModel: ListModel{}
|
||||
function resetPrintersModel() {
|
||||
printersModel.clear()
|
||||
printersModel.append({ name: "Automatic", key: ""})
|
||||
|
||||
for (var index in OutputDevice.printers)
|
||||
{
|
||||
printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key})
|
||||
}
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
id: printerSelection
|
||||
anchors.fill: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
height: 50 * screenScaleFactor
|
||||
Label
|
||||
{
|
||||
id: manualPrinterSelectionLabel
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
right: parent.right
|
||||
}
|
||||
text: catalog.i18nc("@label", "Printer selection")
|
||||
wrapMode: Text.Wrap
|
||||
height: 20 * screenScaleFactor
|
||||
}
|
||||
|
||||
ComboBox
|
||||
{
|
||||
id: printerSelectionCombobox
|
||||
model: base.printersModel
|
||||
textRole: "name"
|
||||
|
||||
width: parent.width
|
||||
height: 40 * screenScaleFactor
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
}
|
||||
|
||||
SystemPalette
|
||||
{
|
||||
id: palette
|
||||
}
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
}
|
||||
|
||||
leftButtons: [
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button","Cancel")
|
||||
enabled: true
|
||||
onClicked: {
|
||||
base.visible = false;
|
||||
printerSelectionCombobox.currentIndex = 0
|
||||
OutputDevice.cancelPrintSelection()
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
rightButtons: [
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button","Print")
|
||||
enabled: true
|
||||
onClicked: {
|
||||
base.visible = false;
|
||||
OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key)
|
||||
// reset to defaults
|
||||
printerSelectionCombobox.currentIndex = 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import UM 1.2 as UM
|
||||
|
||||
Item
|
||||
{
|
||||
property alias color: background.color
|
||||
property alias text: familyNameLabel.text
|
||||
property var padding: 0
|
||||
implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom.
|
||||
implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off.
|
||||
Rectangle
|
||||
{
|
||||
id: background
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
color: parent.color
|
||||
anchors.right: parent.right
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
radius: 0.5 * height
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: familyNameLabel
|
||||
anchors.centerIn: parent
|
||||
text: ""
|
||||
}
|
||||
}
|
431
plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
Normal file
431
plugins/UM3NetworkPrinting/resources/qml/PrinterInfoBlock.qml
Normal file
|
@ -0,0 +1,431 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.3 as UM
|
||||
|
||||
Rectangle
|
||||
{
|
||||
function strPadLeft(string, pad, length)
|
||||
{
|
||||
return (new Array(length + 1).join(pad) + string).slice(-length);
|
||||
}
|
||||
|
||||
function getPrettyTime(time)
|
||||
{
|
||||
return OutputDevice.formatDuration(time)
|
||||
}
|
||||
|
||||
function formatPrintJobPercent(printJob)
|
||||
{
|
||||
if (printJob == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (printJob.timeTotal === 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return Math.min(100, Math.round(printJob.timeElapsed / printJob.timeTotal * 100)) + "%";
|
||||
}
|
||||
|
||||
function printerStatusText(printer)
|
||||
{
|
||||
switch (printer.state)
|
||||
{
|
||||
case "pre_print":
|
||||
return catalog.i18nc("@label:status", "Preparing to print")
|
||||
case "printing":
|
||||
return catalog.i18nc("@label:status", "Printing");
|
||||
case "idle":
|
||||
return catalog.i18nc("@label:status", "Available");
|
||||
case "unreachable":
|
||||
return catalog.i18nc("@label:status", "Lost connection with the printer");
|
||||
case "maintenance":
|
||||
return catalog.i18nc("@label:status", "Unavailable");
|
||||
default:
|
||||
return catalog.i18nc("@label:status", "Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
id: printerDelegate
|
||||
|
||||
property var printer: null
|
||||
property var printJob: printer != null ? printer.activePrintJob: null
|
||||
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: mouse.containsMouse ? emphasisColor : lineColor
|
||||
z: mouse.containsMouse ? 1 : 0 // Push this item up a bit on mouse over to ensure that the highlighted bottom border is visible.
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: mouse
|
||||
anchors.fill:parent
|
||||
onClicked: OutputDevice.setActivePrinter(printer)
|
||||
hoverEnabled: true;
|
||||
|
||||
// Only clickable if no printer is selected
|
||||
enabled: OutputDevice.activePrinter == null && printer.state !== "unreachable"
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Rectangle
|
||||
{
|
||||
width: Math.round(parent.width / 3)
|
||||
height: parent.height
|
||||
|
||||
Label // Print job name
|
||||
{
|
||||
id: jobNameLabel
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
text: printJob != null ? printJob.name : ""
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
elide: Text.ElideRight
|
||||
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: jobOwnerLabel
|
||||
anchors.top: jobNameLabel.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
text: printJob != null ? printJob.owner : ""
|
||||
opacity: 0.50
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: totalTimeLabel
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
|
||||
opacity: 0.65
|
||||
font: UM.Theme.getFont("default")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
width: Math.round(parent.width / 3 * 2)
|
||||
height: parent.height
|
||||
|
||||
Label // Friendly machine name
|
||||
{
|
||||
id: printerNameLabel
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width - showCameraIcon.width)
|
||||
text: printer.name
|
||||
font: UM.Theme.getFont("default_bold")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Label // Machine variant
|
||||
{
|
||||
id: printerTypeLabel
|
||||
anchors.top: printerNameLabel.bottom
|
||||
width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width)
|
||||
text: printer.type
|
||||
anchors.left: parent.left
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("very_small")
|
||||
opacity: 0.50
|
||||
}
|
||||
|
||||
Rectangle // Camera icon
|
||||
{
|
||||
id: showCameraIcon
|
||||
width: 40 * screenScaleFactor
|
||||
height: width
|
||||
radius: width
|
||||
anchors.right: printProgressArea.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
color: emphasisColor
|
||||
opacity: printer != null && printer.state === "unreachable" ? 0.3 : 1
|
||||
|
||||
Image
|
||||
{
|
||||
width: parent.width
|
||||
height: width
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: parent.rightMargin
|
||||
source: "../svg/camera-icon.svg"
|
||||
}
|
||||
}
|
||||
|
||||
Row // PrintCore config
|
||||
{
|
||||
id: extruderInfo
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width)
|
||||
height: childrenRect.height
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: leftExtruderInfo
|
||||
width: Math.round((parent.width - extruderSeperator.width) / 2)
|
||||
printCoreConfiguration: printer.extruders[0]
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: extruderSeperator
|
||||
width: UM.Theme.getSize("default_lining").width
|
||||
height: parent.height
|
||||
color: lineColor
|
||||
}
|
||||
|
||||
PrintCoreConfiguration
|
||||
{
|
||||
id: rightExtruderInfo
|
||||
width: Math.round((parent.width - extruderSeperator.width) / 2)
|
||||
printCoreConfiguration: printer.extruders[1]
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle // Print progress
|
||||
{
|
||||
id: printProgressArea
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: showExtended ? parent.height: printProgressTitleBar.height
|
||||
width: Math.round(parent.width / 2 - UM.Theme.getSize("default_margin").width)
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: lineColor
|
||||
radius: cornerRadius
|
||||
property var showExtended: {
|
||||
if(printJob != null)
|
||||
{
|
||||
var extendStates = ["sent_to_printer", "wait_for_configuration", "printing", "pre_print", "post_print", "wait_cleanup", "queued"];
|
||||
return extendStates.indexOf(printJob.state) !== -1;
|
||||
}
|
||||
return printer.state == "disabled"
|
||||
}
|
||||
|
||||
Item // Status and Percent
|
||||
{
|
||||
id: printProgressTitleBar
|
||||
|
||||
property var showPercent: {
|
||||
return printJob != null && (["printing", "post_print", "pre_print", "sent_to_printer"].indexOf(printJob.state) !== -1);
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
//TODO: hardcoded value
|
||||
height: 40 * screenScaleFactor
|
||||
anchors.left: parent.left
|
||||
|
||||
Label
|
||||
{
|
||||
id: statusText
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: progressText.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: {
|
||||
if (printer.state == "disabled")
|
||||
{
|
||||
return catalog.i18nc("@label:status", "Disabled");
|
||||
}
|
||||
|
||||
if (printer.state === "unreachable")
|
||||
{
|
||||
return printerStatusText(printer);
|
||||
}
|
||||
|
||||
if (printJob != null)
|
||||
{
|
||||
switch (printJob.state)
|
||||
{
|
||||
case "printing":
|
||||
case "post_print":
|
||||
return catalog.i18nc("@label:status", "Printing")
|
||||
case "wait_for_configuration":
|
||||
return catalog.i18nc("@label:status", "Reserved")
|
||||
case "wait_cleanup":
|
||||
case "wait_user_action":
|
||||
return catalog.i18nc("@label:status", "Finished")
|
||||
case "pre_print":
|
||||
case "sent_to_printer":
|
||||
return catalog.i18nc("@label", "Preparing to print")
|
||||
case "queued":
|
||||
return catalog.i18nc("@label:status", "Action required");
|
||||
case "pausing":
|
||||
case "paused":
|
||||
return catalog.i18nc("@label:status", "Paused");
|
||||
case "resuming":
|
||||
return catalog.i18nc("@label:status", "Resuming");
|
||||
case "aborted":
|
||||
return catalog.i18nc("@label:status", "Print aborted");
|
||||
default:
|
||||
// If print job has unknown status show printer.status
|
||||
return printerStatusText(printer);
|
||||
}
|
||||
}
|
||||
return printerStatusText(printer);
|
||||
}
|
||||
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("small")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: progressText
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.top: statusText.top
|
||||
|
||||
text: formatPrintJobPercent(printJob)
|
||||
visible: printProgressTitleBar.showPercent
|
||||
//TODO: Hardcoded value
|
||||
opacity: 0.65
|
||||
font: UM.Theme.getFont("very_small")
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
width: statusText.height
|
||||
height: width
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.top: statusText.top
|
||||
|
||||
visible: !printProgressTitleBar.showPercent
|
||||
|
||||
source: {
|
||||
if (printer.state == "disabled")
|
||||
{
|
||||
return "../svg/blocked-icon.svg";
|
||||
}
|
||||
|
||||
if (printer.state === "unreachable")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if (printJob != null)
|
||||
{
|
||||
if(printJob.state === "queued")
|
||||
{
|
||||
return "../svg/action-required-icon.svg";
|
||||
}
|
||||
else if (printJob.state === "wait_cleanup")
|
||||
{
|
||||
return "../svg/checkmark-icon.svg";
|
||||
}
|
||||
}
|
||||
return ""; // We're not going to show it, so it will not be resolved as a url.
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
{
|
||||
//TODO: This will become a progress bar in the future
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
visible: printProgressArea.showExtended
|
||||
color: lineColor
|
||||
}
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
anchors.top: printProgressTitleBar.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
|
||||
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||
|
||||
visible: printProgressArea.showExtended
|
||||
|
||||
Label // Status detail
|
||||
{
|
||||
text:
|
||||
{
|
||||
if (printer.state == "disabled")
|
||||
{
|
||||
return catalog.i18nc("@label", "Not accepting print jobs");
|
||||
}
|
||||
|
||||
if (printer.state === "unreachable")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
if(printJob != null)
|
||||
{
|
||||
switch (printJob.state)
|
||||
{
|
||||
case "printing":
|
||||
case "post_print":
|
||||
return catalog.i18nc("@label", "Finishes at: ") + OutputDevice.getTimeCompleted(printJob.timeTotal - printJob.timeElapsed)
|
||||
case "wait_cleanup":
|
||||
return catalog.i18nc("@label", "Clear build plate")
|
||||
case "sent_to_printer":
|
||||
case "pre_print":
|
||||
return catalog.i18nc("@label", "Preparing to print")
|
||||
case "wait_for_configuration":
|
||||
return catalog.i18nc("@label", "Not accepting print jobs")
|
||||
case "queued":
|
||||
return catalog.i18nc("@label", "Waiting for configuration change");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
|
||||
Label // Status 2nd row
|
||||
{
|
||||
text: {
|
||||
if(printJob != null)
|
||||
{
|
||||
if(printJob.state == "printing" || printJob.state == "post_print")
|
||||
{
|
||||
return OutputDevice.getDateCompleted(printJob.timeTotal - printJob.timeElapsed)
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
elide: Text.ElideRight
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
54
plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml
Normal file
54
plugins/UM3NetworkPrinting/resources/qml/PrinterTile.qml
Normal file
|
@ -0,0 +1,54 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: base
|
||||
width: 250 * screenScaleFactor
|
||||
height: 250 * screenScaleFactor
|
||||
signal clicked()
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill:parent
|
||||
onClicked: base.clicked()
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
// TODO: Actually add UM icon / picture
|
||||
width: 100 * screenScaleFactor
|
||||
height: 100 * screenScaleFactor
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: nameLabel
|
||||
anchors.bottom: ipLabel.top
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
text: modelData.friendly_name.toString()
|
||||
font: UM.Theme.getFont("large")
|
||||
elide: Text.ElideMiddle;
|
||||
height: UM.Theme.getSize("section").height;
|
||||
}
|
||||
Label
|
||||
{
|
||||
id: ipLabel
|
||||
text: modelData.ip_address.toString()
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
font: UM.Theme.getFont("default")
|
||||
height:10 * screenScaleFactor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
102
plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
Normal file
102
plugins/UM3NetworkPrinting/resources/qml/PrinterVideoStream.qml
Normal file
|
@ -0,0 +1,102 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.3 as UM
|
||||
|
||||
|
||||
Item
|
||||
{
|
||||
property var camera: null
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill:parent
|
||||
color: UM.Theme.getColor("viewport_overlay")
|
||||
opacity: 0.5
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: OutputDevice.setActiveCamera(null)
|
||||
z: 0
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: backButton
|
||||
anchors.bottom: cameraImage.top
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.right: cameraImage.right
|
||||
|
||||
// TODO: Hardcoded sizes
|
||||
width: 20 * screenScaleFactor
|
||||
height: 20 * screenScaleFactor
|
||||
|
||||
onClicked: OutputDevice.setActiveCamera(null)
|
||||
|
||||
style: ButtonStyle
|
||||
{
|
||||
label: Item
|
||||
{
|
||||
UM.RecolorImage
|
||||
{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: control.width
|
||||
height: control.height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: width
|
||||
source: UM.Theme.getIcon("cross1")
|
||||
}
|
||||
}
|
||||
background: Item {}
|
||||
}
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: cameraImage
|
||||
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth)
|
||||
height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
z: 1
|
||||
onVisibleChanged:
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
if(camera != null)
|
||||
{
|
||||
camera.start()
|
||||
}
|
||||
} else
|
||||
{
|
||||
if(camera != null)
|
||||
{
|
||||
camera.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source:
|
||||
{
|
||||
if(camera != null && camera.latestImage != null)
|
||||
{
|
||||
return camera.latestImage;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: cameraImage
|
||||
onClicked:
|
||||
{
|
||||
OutputDevice.setActiveCamera(null)
|
||||
}
|
||||
z: 1
|
||||
}
|
||||
}
|
125
plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
Normal file
125
plugins/UM3NetworkPrinting/resources/qml/UM3InfoComponents.qml
Normal file
|
@ -0,0 +1,125 @@
|
|||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId
|
||||
property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null
|
||||
property bool printerConnected: Cura.MachineManager.printerConnected
|
||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||
property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5) // AuthState.AuthenticationRequested or AuthenticationReceived.
|
||||
|
||||
Row
|
||||
{
|
||||
objectName: "networkPrinterConnectButton"
|
||||
visible: isUM3
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Button
|
||||
{
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
|
||||
text: catalog.i18nc("@action:button", "Request Access")
|
||||
style: UM.Theme.styles.sidebar_action_button
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
|
||||
visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer")
|
||||
text: catalog.i18nc("@action:button", "Connect")
|
||||
style: UM.Theme.styles.sidebar_action_button
|
||||
onClicked: connectActionDialog.show()
|
||||
visible: !printerConnected
|
||||
}
|
||||
}
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: connectActionDialog
|
||||
Loader
|
||||
{
|
||||
anchors.fill: parent
|
||||
source: "DiscoverUM3Action.qml"
|
||||
}
|
||||
rightButtons: Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Close")
|
||||
iconName: "dialog-close"
|
||||
onClicked: connectActionDialog.reject()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Column
|
||||
{
|
||||
objectName: "networkPrinterConnectionInfo"
|
||||
visible: isUM3
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
anchors.fill: parent
|
||||
|
||||
Button
|
||||
{
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
|
||||
text: catalog.i18nc("@action:button", "Request Access")
|
||||
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
|
||||
visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
visible: printerConnected
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: childrenRect.height
|
||||
|
||||
Column
|
||||
{
|
||||
Repeater
|
||||
{
|
||||
model: Cura.ExtrudersModel { simpleNames: true }
|
||||
Label { text: model.name }
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
Repeater
|
||||
{
|
||||
id: nozzleColumn
|
||||
model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null
|
||||
Label { text: nozzleColumn.model[index] }
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
Repeater
|
||||
{
|
||||
id: materialColumn
|
||||
model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null
|
||||
Label { text: materialColumn.model[index] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
|
||||
text: catalog.i18nc("@action:button", "Activate Configuration")
|
||||
visible: false // printerConnected && !isClusterPrinter()
|
||||
onClicked: manager.loadConfigurationFromPrinter()
|
||||
}
|
||||
}
|
||||
|
||||
UM.I18nCatalog{id: catalog; name:"cura"}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue