Remove hardcoded references to Ultimaker machines in QML

We shouldn't hardocode machines in QML in any case. It also created issues
for other monitor / connection flows.
This commit is contained in:
Jaime van Kessel 2019-05-03 14:10:21 +02:00
parent 2e90078ec7
commit e363f1af94
5 changed files with 22 additions and 30 deletions

View file

@ -76,6 +76,10 @@ class GlobalStack(CuraContainerStack):
def maxExtruderCount(self): def maxExtruderCount(self):
return len(self.getMetaDataEntry("machine_extruder_trains")) return len(self.getMetaDataEntry("machine_extruder_trains"))
@pyqtProperty(bool, notify=configuredConnectionTypesChanged)
def supportsNetworkConnection(self):
return self.getMetaDataEntry("supports_network_connection", False)
@classmethod @classmethod
def getLoadingPriority(cls) -> int: def getLoadingPriority(cls) -> int:
return 2 return 2

View file

@ -12,7 +12,15 @@ Rectangle
id: viewportOverlay id: viewportOverlay
property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection
property bool isNetworkConfigurable: ["Ultimaker 3", "Ultimaker 3 Extended", "Ultimaker S5"].indexOf(Cura.MachineManager.activeMachineDefinitionName) > -1 property bool isNetworkConfigurable:
{
if(Cura.MachineManager.activeMachine === null)
{
return false
}
return Cura.MachineManager.activeMachine.supportsNetworkConnection
}
property bool isNetworkConfigured: property bool isNetworkConfigured:
{ {
// Readability: // Readability:
@ -98,7 +106,6 @@ Rectangle
width: contentWidth width: contentWidth
} }
// CASE 3: CAN NOT MONITOR
Label Label
{ {
id: noNetworkLabel id: noNetworkLabel
@ -106,24 +113,8 @@ Rectangle
{ {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
visible: !isNetworkConfigured
text: catalog.i18nc("@info", "Please select a network connected printer to monitor.")
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("monitor_text_primary")
wrapMode: Text.WordWrap
width: contentWidth
lineHeight: UM.Theme.getSize("monitor_text_line_large").height
lineHeightMode: Text.FixedHeight
}
Label
{
id: noNetworkUltimakerLabel
anchors
{
horizontalCenter: parent.horizontalCenter
}
visible: !isNetworkConfigured && isNetworkConfigurable visible: !isNetworkConfigured && isNetworkConfigurable
text: catalog.i18nc("@info", "Please connect your Ultimaker printer to your local network.") text: catalog.i18nc("@info", "Please connect your printer to the network.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("monitor_text_primary") color: UM.Theme.getColor("monitor_text_primary")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -135,7 +126,7 @@ Rectangle
{ {
anchors anchors
{ {
left: noNetworkUltimakerLabel.left left: noNetworkLabel.left
} }
visible: !isNetworkConfigured && isNetworkConfigurable visible: !isNetworkConfigured && isNetworkConfigurable
height: UM.Theme.getSize("monitor_text_line").height height: UM.Theme.getSize("monitor_text_line").height
@ -160,7 +151,7 @@ Rectangle
verticalCenter: externalLinkIcon.verticalCenter verticalCenter: externalLinkIcon.verticalCenter
} }
color: UM.Theme.getColor("monitor_text_link") color: UM.Theme.getColor("monitor_text_link")
font: UM.Theme.getFont("medium") // 14pt, regular font: UM.Theme.getFont("medium")
linkColor: UM.Theme.getColor("monitor_text_link") linkColor: UM.Theme.getColor("monitor_text_link")
text: catalog.i18nc("@label link to technical assistance", "View user manuals online") text: catalog.i18nc("@label link to technical assistance", "View user manuals online")
renderType: Text.NativeRendering renderType: Text.NativeRendering
@ -170,14 +161,8 @@ Rectangle
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: Qt.openUrlExternally("https://ultimaker.com/en/resources/manuals/ultimaker-3d-printers") onClicked: Qt.openUrlExternally("https://ultimaker.com/en/resources/manuals/ultimaker-3d-printers")
onEntered: onEntered: manageQueueText.font.underline = true
{ onExited: manageQueueText.font.underline = false
manageQueueText.font.underline = true
}
onExited:
{
manageQueueText.font.underline = false
}
} }
} }
} }

View file

@ -17,7 +17,8 @@
{ {
"0": "fdmextruder" "0": "fdmextruder"
}, },
"supports_usb_connection": true "supports_usb_connection": true,
"supports_network_connection": false
}, },
"settings": "settings":
{ {

View file

@ -26,6 +26,7 @@
"first_start_actions": [ "DiscoverUM3Action" ], "first_start_actions": [ "DiscoverUM3Action" ],
"supported_actions": [ "DiscoverUM3Action" ], "supported_actions": [ "DiscoverUM3Action" ],
"supports_usb_connection": false, "supports_usb_connection": false,
"supports_network_connection": true,
"firmware_update_info": { "firmware_update_info": {
"id": 9066, "id": 9066,
"check_urls": "check_urls":

View file

@ -30,6 +30,7 @@
"first_start_actions": [ "DiscoverUM3Action" ], "first_start_actions": [ "DiscoverUM3Action" ],
"supported_actions": [ "DiscoverUM3Action" ], "supported_actions": [ "DiscoverUM3Action" ],
"supports_usb_connection": false, "supports_usb_connection": false,
"supports_network_connection": true,
"weight": -1, "weight": -1,
"firmware_update_info": { "firmware_update_info": {
"id": 9051, "id": 9051,