mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 11:56:05 +08:00
Merge branch '3.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
b5ce439c96
@ -354,11 +354,14 @@ class MachineManager(QObject):
|
|||||||
if containers:
|
if containers:
|
||||||
Application.getInstance().setGlobalContainerStack(containers[0])
|
Application.getInstance().setGlobalContainerStack(containers[0])
|
||||||
|
|
||||||
|
self.__onInstanceContainersChanged()
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
@pyqtSlot(str, str)
|
||||||
def addMachine(self, name: str, definition_id: str) -> None:
|
def addMachine(self, name: str, definition_id: str) -> None:
|
||||||
new_stack = CuraStackBuilder.createMachine(name, definition_id)
|
new_stack = CuraStackBuilder.createMachine(name, definition_id)
|
||||||
if new_stack:
|
if new_stack:
|
||||||
Application.getInstance().setGlobalContainerStack(new_stack)
|
# Instead of setting the global container stack here, we set the active machine and so the signals are emitted
|
||||||
|
self.setActiveMachine(new_stack.getId())
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "Failed creating a new machine!")
|
Logger.log("w", "Failed creating a new machine!")
|
||||||
|
|
||||||
|
@ -413,6 +413,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||||||
self._print_jobs = print_jobs
|
self._print_jobs = print_jobs
|
||||||
|
|
||||||
self._notifyFinishedPrintJobs(old_print_jobs, print_jobs)
|
self._notifyFinishedPrintJobs(old_print_jobs, print_jobs)
|
||||||
|
self._notifyConfigurationChangeRequired(old_print_jobs, print_jobs)
|
||||||
|
|
||||||
# Yes, this is a hacky way of doing it, but it's quick and the API doesn't give the print job per printer
|
# Yes, this is a hacky way of doing it, but it's quick and the API doesn't give the print job per printer
|
||||||
# for some reason. ugh.
|
# for some reason. ugh.
|
||||||
@ -460,7 +461,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||||||
|
|
||||||
printer_name = self.__getPrinterNameFromUuid(print_job["printer_uuid"])
|
printer_name = self.__getPrinterNameFromUuid(print_job["printer_uuid"])
|
||||||
if printer_name is None:
|
if printer_name is None:
|
||||||
printer_name = i18n_catalog.i18nc("@info:status", "Unknown printer")
|
printer_name = i18n_catalog.i18nc("@label", "Unknown")
|
||||||
|
|
||||||
message_text = (i18n_catalog.i18nc("@info:status",
|
message_text = (i18n_catalog.i18nc("@info:status",
|
||||||
"Printer '{printer_name}' has finished printing '{job_name}'.")
|
"Printer '{printer_name}' has finished printing '{job_name}'.")
|
||||||
@ -475,6 +476,38 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
|
|||||||
username = self.__get_username()
|
username = self.__get_username()
|
||||||
return [print_job for print_job in print_jobs if print_job["owner"] == username]
|
return [print_job for print_job in print_jobs if print_job["owner"] == username]
|
||||||
|
|
||||||
|
def _notifyConfigurationChangeRequired(self, old_print_jobs, new_print_jobs):
|
||||||
|
if old_print_jobs is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
old_change_required_print_jobs = self.__filterConfigChangePrintJobs(self.__filterOurPrintJobs(old_print_jobs))
|
||||||
|
new_change_required_print_jobs = self.__filterConfigChangePrintJobs(self.__filterOurPrintJobs(new_print_jobs))
|
||||||
|
old_change_required_print_job_uuids = set([pj["uuid"] for pj in old_change_required_print_jobs])
|
||||||
|
|
||||||
|
for print_job in new_change_required_print_jobs:
|
||||||
|
if print_job["uuid"] not in old_change_required_print_job_uuids:
|
||||||
|
|
||||||
|
printer_name = self.__getPrinterNameFromUuid(print_job["assigned_to"])
|
||||||
|
if printer_name is None:
|
||||||
|
printer_name = i18n_catalog.i18nc("@info:status", "Unknown printer")
|
||||||
|
|
||||||
|
message_text = (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.")
|
||||||
|
.format(printer_name=printer_name, job_name=print_job["name"]))
|
||||||
|
message = Message(text=message_text, title=i18n_catalog.i18nc("@label:status", "Action required"))
|
||||||
|
Application.getInstance().showMessage(message)
|
||||||
|
Application.getInstance().showToastMessage(
|
||||||
|
i18n_catalog.i18nc("@label:status", "Action required"),
|
||||||
|
message_text)
|
||||||
|
|
||||||
|
def __filterConfigChangePrintJobs(self, print_jobs):
|
||||||
|
return filter(self.__isConfigurationChangeRequiredPrintJob, print_jobs)
|
||||||
|
|
||||||
|
def __isConfigurationChangeRequiredPrintJob(self, print_job):
|
||||||
|
if print_job["status"] == "queued":
|
||||||
|
changes_required = print_job.get("configuration_changes_required", [])
|
||||||
|
return len(changes_required) != 0
|
||||||
|
return False
|
||||||
|
|
||||||
def __getPrinterNameFromUuid(self, printer_uuid):
|
def __getPrinterNameFromUuid(self, printer_uuid):
|
||||||
for printer in self._printers:
|
for printer in self._printers:
|
||||||
if printer["uuid"] == printer_uuid:
|
if printer["uuid"] == printer_uuid:
|
||||||
|
@ -67,6 +67,7 @@ Item
|
|||||||
target: Cura.MachineManager
|
target: Cura.MachineManager
|
||||||
onActiveQualityChanged: qualityModel.update()
|
onActiveQualityChanged: qualityModel.update()
|
||||||
onActiveMaterialChanged: qualityModel.update()
|
onActiveMaterialChanged: qualityModel.update()
|
||||||
|
onActiveVariantChanged: qualityModel.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel
|
ListModel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user