mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Fix string formatting
This commit is contained in:
parent
b7dfa11e69
commit
c1b5cce064
6 changed files with 16 additions and 15 deletions
|
@ -41,7 +41,7 @@ Item
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: ultiBotImage
|
id: ultiBotImage
|
||||||
|
|
||||||
anchors.centerIn: printJobPreview
|
anchors.centerIn: printJobPreview
|
||||||
color: UM.Theme.getColor("monitor_placeholder_image")
|
color: UM.Theme.getColor("monitor_placeholder_image")
|
||||||
height: printJobPreview.height
|
height: printJobPreview.height
|
||||||
|
@ -98,4 +98,4 @@ Item
|
||||||
visible: source != ""
|
visible: source != ""
|
||||||
width: 0.5 * printJobPreview.width
|
width: 0.5 * printJobPreview.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,8 +168,9 @@ class CloudOutputDeviceManager:
|
||||||
if not device:
|
if not device:
|
||||||
return
|
return
|
||||||
Logger.log("i", "Found cluster %s with network key %s", device, local_network_key)
|
Logger.log("i", "Found cluster %s with network key %s", device, local_network_key)
|
||||||
active_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
# TODO: fix this
|
||||||
self._connectToOutputDevice(device, active_machine)
|
# active_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
|
||||||
|
# self._connectToOutputDevice(device, active_machine)
|
||||||
|
|
||||||
## Connects to an output device and makes sure it is registered in the output device manager.
|
## Connects to an output device and makes sure it is registered in the output device manager.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ExportFileJob(WriteFileJob):
|
||||||
# Determine the filename.
|
# Determine the filename.
|
||||||
job_name = CuraApplication.getInstance().getPrintInformation().jobName
|
job_name = CuraApplication.getInstance().getPrintInformation().jobName
|
||||||
extension = self._mesh_format_handler.preferred_format.get("extension", "")
|
extension = self._mesh_format_handler.preferred_format.get("extension", "")
|
||||||
self.setFileName(f"{job_name}.{extension}")
|
self.setFileName("{}.{}".format(job_name, extension))
|
||||||
|
|
||||||
## Get the mime type of the selected export file type.
|
## Get the mime type of the selected export file type.
|
||||||
def getMimeType(self) -> str:
|
def getMimeType(self) -> str:
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ClusterPrinterStatus(BaseModel):
|
||||||
model.updateType(self.machine_variant)
|
model.updateType(self.machine_variant)
|
||||||
model.updateState(self.status if self.enabled else "disabled")
|
model.updateState(self.status if self.enabled else "disabled")
|
||||||
model.updateBuildplate(self.build_plate.type if self.build_plate else "glass")
|
model.updateBuildplate(self.build_plate.type if self.build_plate else "glass")
|
||||||
model.setCameraUrl(QUrl(f"http://{self.ip_address}:8080/?action=stream"))
|
model.setCameraUrl(QUrl("http://{}:8080/?action=stream".format(self.ip_address)))
|
||||||
|
|
||||||
for configuration, extruder_output, extruder_config in \
|
for configuration, extruder_output, extruder_config in \
|
||||||
zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations):
|
zip(self.configuration, model.extruders, model.printerConfiguration.extruderConfigurations):
|
||||||
|
|
|
@ -42,43 +42,43 @@ class ClusterApiClient:
|
||||||
## Get printer system information.
|
## Get printer system information.
|
||||||
# \param on_finished: The callback in case the response is successful.
|
# \param on_finished: The callback in case the response is successful.
|
||||||
def getSystem(self, on_finished: Callable) -> None:
|
def getSystem(self, on_finished: Callable) -> None:
|
||||||
url = f"{self.PRINTER_API_PREFIX}/system/"
|
url = "{}/system/".format(self.PRINTER_API_PREFIX)
|
||||||
self._manager.get(self._createEmptyRequest(url))
|
self._manager.get(self._createEmptyRequest(url))
|
||||||
|
|
||||||
## Get the printers in the cluster.
|
## Get the printers in the cluster.
|
||||||
# \param on_finished: The callback in case the response is successful.
|
# \param on_finished: The callback in case the response is successful.
|
||||||
def getPrinters(self, on_finished: Callable[[List[ClusterPrinterStatus]], Any]) -> None:
|
def getPrinters(self, on_finished: Callable[[List[ClusterPrinterStatus]], Any]) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/printers/"
|
url = "{}/printers/".format(self.CLUSTER_API_PREFIX)
|
||||||
reply = self._manager.get(self._createEmptyRequest(url))
|
reply = self._manager.get(self._createEmptyRequest(url))
|
||||||
self._addCallback(reply, on_finished, ClusterPrinterStatus)
|
self._addCallback(reply, on_finished, ClusterPrinterStatus)
|
||||||
|
|
||||||
## Get the print jobs in the cluster.
|
## Get the print jobs in the cluster.
|
||||||
# \param on_finished: The callback in case the response is successful.
|
# \param on_finished: The callback in case the response is successful.
|
||||||
def getPrintJobs(self, on_finished: Callable[[List[ClusterPrintJobStatus]], Any]) -> None:
|
def getPrintJobs(self, on_finished: Callable[[List[ClusterPrintJobStatus]], Any]) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/print_jobs/"
|
url = "{}/print_jobs/".format(self.CLUSTER_API_PREFIX)
|
||||||
reply = self._manager.get(self._createEmptyRequest(url))
|
reply = self._manager.get(self._createEmptyRequest(url))
|
||||||
self._addCallback(reply, on_finished, ClusterPrintJobStatus)
|
self._addCallback(reply, on_finished, ClusterPrintJobStatus)
|
||||||
|
|
||||||
## Move a print job to the top of the queue.
|
## Move a print job to the top of the queue.
|
||||||
def movePrintJobToTop(self, print_job_uuid: str) -> None:
|
def movePrintJobToTop(self, print_job_uuid: str) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/print_jobs/{print_job_uuid}/action/move"
|
url = "{}/print_jobs/{}/action/move".format(self.CLUSTER_API_PREFIX, print_job_uuid)
|
||||||
self._manager.post(self._createEmptyRequest(url), json.dumps({"to_position": 0, "list": "queued"}).encode())
|
self._manager.post(self._createEmptyRequest(url), json.dumps({"to_position": 0, "list": "queued"}).encode())
|
||||||
|
|
||||||
## Delete a print job from the queue.
|
## Delete a print job from the queue.
|
||||||
def deletePrintJob(self, print_job_uuid: str) -> None:
|
def deletePrintJob(self, print_job_uuid: str) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/print_jobs/{print_job_uuid}"
|
url = "{}/print_jobs/{}".format(self.CLUSTER_API_PREFIX, print_job_uuid)
|
||||||
self._manager.deleteResource(self._createEmptyRequest(url))
|
self._manager.deleteResource(self._createEmptyRequest(url))
|
||||||
|
|
||||||
## Set the state of a print job.
|
## Set the state of a print job.
|
||||||
def setPrintJobState(self, print_job_uuid: str, state: str) -> None:
|
def setPrintJobState(self, print_job_uuid: str, state: str) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/print_jobs/{print_job_uuid}/action"
|
url = "{}/print_jobs/{}/action".format(self.CLUSTER_API_PREFIX, print_job_uuid)
|
||||||
# We rewrite 'resume' to 'print' here because we are using the old print job action endpoints.
|
# We rewrite 'resume' to 'print' here because we are using the old print job action endpoints.
|
||||||
action = "print" if state == "resume" else state
|
action = "print" if state == "resume" else state
|
||||||
self._manager.put(self._createEmptyRequest(url), json.dumps({"action": action}).encode())
|
self._manager.put(self._createEmptyRequest(url), json.dumps({"action": action}).encode())
|
||||||
|
|
||||||
## Get the preview image data of a print job.
|
## Get the preview image data of a print job.
|
||||||
def getPrintJobPreviewImage(self, print_job_uuid: str, on_finished: Callable) -> None:
|
def getPrintJobPreviewImage(self, print_job_uuid: str, on_finished: Callable) -> None:
|
||||||
url = f"{self.CLUSTER_API_PREFIX}/print_jobs/{print_job_uuid}/preview_image"
|
url = "{}/print_jobs/{}/preview_image".format(self.CLUSTER_API_PREFIX, print_job_uuid)
|
||||||
reply = self._manager.get(self._createEmptyRequest(url))
|
reply = self._manager.get(self._createEmptyRequest(url))
|
||||||
self._addCallback(reply, on_finished)
|
self._addCallback(reply, on_finished)
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class NetworkOutputDeviceManager:
|
||||||
new_manual_devices = ",".join(self._manual_instances.keys())
|
new_manual_devices = ",".join(self._manual_instances.keys())
|
||||||
CuraApplication.getInstance().getPreferences().setValue(self.MANUAL_DEVICES_PREFERENCE_KEY, new_manual_devices)
|
CuraApplication.getInstance().getPreferences().setValue(self.MANUAL_DEVICES_PREFERENCE_KEY, new_manual_devices)
|
||||||
|
|
||||||
device_id = f"manual:{address}"
|
device_id = "manual:{}".format(address)
|
||||||
if device_id not in self._discovered_devices:
|
if device_id not in self._discovered_devices:
|
||||||
self._onDeviceDiscovered(device_id, address, {
|
self._onDeviceDiscovered(device_id, address, {
|
||||||
b"name": address.encode("utf-8"),
|
b"name": address.encode("utf-8"),
|
||||||
|
@ -79,7 +79,7 @@ class NetworkOutputDeviceManager:
|
||||||
## Remove a manually added networked printer.
|
## Remove a manually added networked printer.
|
||||||
def removeManualDevice(self, device_id: str, address: Optional[str] = None) -> None:
|
def removeManualDevice(self, device_id: str, address: Optional[str] = None) -> None:
|
||||||
if device_id not in self._discovered_devices and address is not None:
|
if device_id not in self._discovered_devices and address is not None:
|
||||||
device_id = f"manual:{address}"
|
device_id = "manual:{}".format(address)
|
||||||
|
|
||||||
if device_id in self._discovered_devices:
|
if device_id in self._discovered_devices:
|
||||||
address = address or self._discovered_devices[device_id].ipAddress
|
address = address or self._discovered_devices[device_id].ipAddress
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue