mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-11 05:39:01 +08:00
Merge pull request #2541 from Ultimaker/CL-228-authorization
CL-228 CL-229 authorization and fixup state display
This commit is contained in:
commit
91c5515d4e
@ -389,4 +389,4 @@ Cura.MachineAction
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ from PyQt5.QtGui import QDesktopServices
|
|||||||
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply
|
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply
|
||||||
from PyQt5.QtQml import QQmlComponent, QQmlContext
|
from PyQt5.QtQml import QQmlComponent, QQmlContext
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
from UM.Decorators import override
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Message import Message
|
from UM.Message import Message
|
||||||
from UM.OutputDevice import OutputDeviceError
|
from UM.OutputDevice import OutputDeviceError
|
||||||
@ -45,6 +46,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||||||
else:
|
else:
|
||||||
name = key
|
name = key
|
||||||
|
|
||||||
|
self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated
|
||||||
self._plugin_path = plugin_path
|
self._plugin_path = plugin_path
|
||||||
|
|
||||||
self.setName(name)
|
self.setName(name)
|
||||||
@ -111,6 +113,20 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||||||
temporary_translation3 = i18n_catalog.i18n("{printer_name} has finished printing '{job_name}'. Please collect the print and confirm clearing the build plate.") #When finished.
|
temporary_translation3 = i18n_catalog.i18n("{printer_name} has finished printing '{job_name}'. Please collect the print and confirm clearing the build plate.") #When finished.
|
||||||
temporary_translation4 = i18n_catalog.i18n("{printer_name} is reserved to print '{job_name}'. Please change the printer's configuration to match the job, for it to start printing.") #When configuration changed.
|
temporary_translation4 = i18n_catalog.i18n("{printer_name} is reserved to print '{job_name}'. Please change the printer's configuration to match the job, for it to start printing.") #When configuration changed.
|
||||||
|
|
||||||
|
## No authentication, so requestAuthentication should do exactly nothing
|
||||||
|
@pyqtSlot()
|
||||||
|
def requestAuthentication(self, message_id = None, action_id = "Retry"):
|
||||||
|
pass # Cura Connect doesn't do any authorization
|
||||||
|
|
||||||
|
def setAuthenticationState(self, auth_state):
|
||||||
|
self._authentication_state = NetworkPrinterOutputDevice.AuthState.Authenticated # The printer is always authenticated
|
||||||
|
|
||||||
|
def _verifyAuthentication(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _checkAuthentication(self):
|
||||||
|
Logger.log("d", "_checkAuthentication Cura Connect - nothing to be done")
|
||||||
|
|
||||||
@pyqtProperty(QObject, notify=selectedPrinterChanged)
|
@pyqtProperty(QObject, notify=selectedPrinterChanged)
|
||||||
def controlItem(self):
|
def controlItem(self):
|
||||||
# TODO: Probably not the nicest way to do this. This needs to be done better at some point in time.
|
# TODO: Probably not the nicest way to do this. This needs to be done better at some point in time.
|
||||||
|
@ -30,6 +30,23 @@ Rectangle
|
|||||||
return Math.min(100, Math.round(printJob.time_elapsed / printJob.time_total * 100)) + "%";
|
return Math.min(100, Math.round(printJob.time_elapsed / printJob.time_total * 100)) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function printerStatusText(printer)
|
||||||
|
{
|
||||||
|
switch (printer.status)
|
||||||
|
{
|
||||||
|
case "pre_print":
|
||||||
|
return catalog.i18nc("@label", "Preparing to print")
|
||||||
|
case "printing":
|
||||||
|
return catalog.i18nc("@label:status", "Printing");
|
||||||
|
case "idle":
|
||||||
|
return catalog.i18nc("@label:status", "Available");
|
||||||
|
case "unreachable": // TODO: new string
|
||||||
|
case "maintenance": // TODO: new string
|
||||||
|
case "unknown":
|
||||||
|
default:
|
||||||
|
return catalog.i18nc("@label", "Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
id: printerDelegate
|
id: printerDelegate
|
||||||
property var printer
|
property var printer
|
||||||
@ -228,7 +245,7 @@ Rectangle
|
|||||||
return catalog.i18nc("@label:status", "Disabled");
|
return catalog.i18nc("@label:status", "Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(printJob != null)
|
if ((printJob != null) && ((printer.status === "pre_print") || (printer.status === "printing")))
|
||||||
{
|
{
|
||||||
switch (printJob.status)
|
switch (printJob.status)
|
||||||
{
|
{
|
||||||
@ -259,14 +276,10 @@ Rectangle
|
|||||||
case "aborted":
|
case "aborted":
|
||||||
return catalog.i18nc("@label:status", "Print aborted");
|
return catalog.i18nc("@label:status", "Print aborted");
|
||||||
default:
|
default:
|
||||||
return "";
|
return printerStatusText(printer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (printer.status == "printing")
|
return printerStatusText(printer);
|
||||||
{
|
|
||||||
return catalog.i18nc("@label:status", "Printing")
|
|
||||||
}
|
|
||||||
return catalog.i18nc("@label:status", "Available");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
@ -121,4 +121,4 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
UM.I18nCatalog{id: catalog; name:"cura"}
|
UM.I18nCatalog{id: catalog; name:"cura"}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user