mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Hide "Request Access" buttons when access request is active
CURA-2277 & CURA-2276
This commit is contained in:
parent
f11308e74e
commit
20f76b62fe
2 changed files with 24 additions and 18 deletions
|
@ -242,7 +242,15 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._authentication_timer.stop()
|
self._authentication_timer.stop()
|
||||||
self._authentication_counter = 0
|
self._authentication_counter = 0
|
||||||
|
|
||||||
self._authentication_state = auth_state
|
if auth_state != self._authentication_state:
|
||||||
|
self._authentication_state = auth_state
|
||||||
|
self.authenticationStateChanged.emit()
|
||||||
|
|
||||||
|
authenticationStateChanged = pyqtSignal()
|
||||||
|
|
||||||
|
@pyqtProperty(int, notify = authenticationStateChanged)
|
||||||
|
def authenticationState(self):
|
||||||
|
return self._authentication_state
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def requestAuthentication(self, message_id = None, action_id = "Retry"):
|
def requestAuthentication(self, message_id = None, action_id = "Retry"):
|
||||||
|
|
|
@ -13,6 +13,7 @@ Item
|
||||||
property bool isUM3: Cura.MachineManager.activeDefinitionId == "ultimaker3"
|
property bool isUM3: Cura.MachineManager.activeDefinitionId == "ultimaker3"
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
|
property bool authenticationRequested: printerConnected && Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 // AuthState.AuthenticationRequested
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
|
@ -27,7 +28,7 @@ Item
|
||||||
text: catalog.i18nc("@action:button", "Request Access")
|
text: catalog.i18nc("@action:button", "Request Access")
|
||||||
style: UM.Theme.styles.sidebar_action_button
|
style: UM.Theme.styles.sidebar_action_button
|
||||||
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
|
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
|
||||||
visible: base.printerConnected && !base.printerAcceptsCommands
|
visible: !base.printerAcceptsCommands && !base.authenticationRequested
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
|
@ -66,6 +67,14 @@ Item
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
anchors.fill: parent
|
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: !base.printerAcceptsCommands && !base.authenticationRequested
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
visible: base.printerConnected
|
visible: base.printerConnected
|
||||||
|
@ -103,23 +112,12 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row
|
Button
|
||||||
{
|
{
|
||||||
Button
|
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
|
||||||
{
|
text: catalog.i18nc("@action:button", "Activate Configuration")
|
||||||
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
|
visible: base.printerConnected
|
||||||
text: catalog.i18nc("@action:button", "Activate Configuration")
|
onClicked: manager.loadConfigurationFromPrinter()
|
||||||
visible: base.printerConnected
|
|
||||||
onClicked: manager.loadConfigurationFromPrinter()
|
|
||||||
}
|
|
||||||
|
|
||||||
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: base.printerConnected && !base.printerAcceptsCommands
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue