diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index fb15428cf1..2fef90ac86 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -242,7 +242,15 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._authentication_timer.stop() 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() def requestAuthentication(self, message_id = None, action_id = "Retry"): diff --git a/UM3InfoComponents.qml b/UM3InfoComponents.qml index 67e52aa3ab..686a13e2cb 100644 --- a/UM3InfoComponents.qml +++ b/UM3InfoComponents.qml @@ -13,6 +13,7 @@ Item property bool isUM3: Cura.MachineManager.activeDefinitionId == "ultimaker3" property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands + property bool authenticationRequested: printerConnected && Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 // AuthState.AuthenticationRequested Row { @@ -27,7 +28,7 @@ Item text: catalog.i18nc("@action:button", "Request Access") style: UM.Theme.styles.sidebar_action_button onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication() - visible: base.printerConnected && !base.printerAcceptsCommands + visible: !base.printerAcceptsCommands && !base.authenticationRequested } Button @@ -66,6 +67,14 @@ Item 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: !base.printerAcceptsCommands && !base.authenticationRequested + } + Row { 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") - 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 - } + tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura") + text: catalog.i18nc("@action:button", "Activate Configuration") + visible: base.printerConnected + onClicked: manager.loadConfigurationFromPrinter() } }