mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Added status icon
This commit is contained in:
parent
4c7ec3920d
commit
ffccdd99c0
4 changed files with 26 additions and 10 deletions
|
@ -469,6 +469,12 @@ class MachineManager(QObject):
|
|||
return self._global_container_stack.getId()
|
||||
return ""
|
||||
|
||||
@pyqtProperty(str, notify = globalContainerChanged)
|
||||
def activeMachineNetworkKey(self) -> str:
|
||||
if self._global_container_stack:
|
||||
return self._global_container_stack.getMetaDataEntry("um_network_key")
|
||||
return ""
|
||||
|
||||
@pyqtProperty(QObject, notify = globalContainerChanged)
|
||||
def activeMachine(self) -> Optional["GlobalStack"]:
|
||||
return self._global_container_stack
|
||||
|
|
|
@ -11,7 +11,8 @@ import Cura 1.0 as Cura
|
|||
import "Menus"
|
||||
|
||||
ToolButton {
|
||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property var isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey ? true : false
|
||||
property var printerStatus: Cura.MachineManager.printerOutputDevices.length != 0 ? "connected" : "unknown"
|
||||
text: Cura.MachineManager.activeMachineName
|
||||
|
||||
tooltip: Cura.MachineManager.activeMachineName
|
||||
|
@ -45,7 +46,8 @@ ToolButton {
|
|||
}
|
||||
|
||||
PrinterStatusIcon {
|
||||
visible: printerConnected
|
||||
visible: isNetworkPrinter
|
||||
status: printerStatus
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
|
@ -59,7 +61,7 @@ ToolButton {
|
|||
text: control.text;
|
||||
elide: Text.ElideRight;
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: printerConnected ? UM.Theme.getSize("default_margin").width * 3 : UM.Theme.getSize("default_margin").width * 2
|
||||
anchors.leftMargin: isNetworkPrinter ? UM.Theme.getSize("default_margin").width * 3 : UM.Theme.getSize("default_margin").width * 2
|
||||
anchors.right: downArrow.left;
|
||||
anchors.rightMargin: control.rightMargin;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
|
|
@ -10,16 +10,17 @@ import UM 1.2 as UM
|
|||
import Cura 1.0 as Cura
|
||||
|
||||
Item {
|
||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||
property var status: "unknown"
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
Image {
|
||||
UM.RecolorImage {
|
||||
id: statusIcon
|
||||
width: UM.Theme.getSize("status_icon").width
|
||||
height: UM.Theme.getSize("status_icon").height
|
||||
width: UM.Theme.getSize("printer_status_icon").width
|
||||
height: UM.Theme.getSize("printer_status_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: width
|
||||
source: printerConnected ? UM.Theme.getIcon("tab_status_connected") : UM.Theme.getIcon("tab_status_busy")
|
||||
color: UM.Theme.getColor("tab_status_" + parent.status )
|
||||
source: UM.Theme.getIcon("tab_status_" + parent.status )
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,14 @@
|
|||
"configuration_item_text_active": [0, 0, 0, 255],
|
||||
"configuration_item_border": [127, 127, 127, 255],
|
||||
"configuration_item_border_active": [12, 169, 227, 32],
|
||||
"configuration_item_border_hover": [12, 169, 227, 255]
|
||||
"configuration_item_border_hover": [12, 169, 227, 255],
|
||||
|
||||
"tab_status_busy": [255, 255, 255, 255],
|
||||
"tab_status_connected": [12, 169, 227, 255],
|
||||
"tab_status_finished": [255, 255, 255, 255],
|
||||
"tab_status_paused": [255, 255, 255, 255],
|
||||
"tab_status_stopped": [255, 255, 255, 255],
|
||||
"tab_status_unknown": [200, 200, 200, 255]
|
||||
},
|
||||
|
||||
"sizes": {
|
||||
|
@ -360,7 +367,7 @@
|
|||
"small_button": [2, 2],
|
||||
"small_button_icon": [1.5, 1.5],
|
||||
|
||||
"status_icon": [1.0, 1.0],
|
||||
"printer_status_icon": [1.0, 1.0],
|
||||
|
||||
"topbar_logo_right_margin": [3, 0],
|
||||
"topbar_button": [8, 4],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue