Hide "Request Access" buttons when access request is active

CURA-2277 & CURA-2276
This commit is contained in:
fieldOfView 2016-09-14 16:40:20 +02:00
parent f11308e74e
commit 20f76b62fe
2 changed files with 24 additions and 18 deletions

View file

@ -242,7 +242,15 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._authentication_timer.stop()
self._authentication_counter = 0
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"):

View file

@ -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,8 +112,6 @@ Item
}
}
Row
{
Button
{
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura")
@ -112,15 +119,6 @@ Item
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
}
}
}
UM.I18nCatalog{id: catalog; name:"cura"}