mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Codestyle fixes
CL-894
This commit is contained in:
parent
01b9ba03d4
commit
d4aaa73928
3 changed files with 40 additions and 34 deletions
|
@ -33,6 +33,10 @@ class ExtruderConfigurationModel(QObject):
|
||||||
def activeMaterial(self) -> MaterialOutputModel:
|
def activeMaterial(self) -> MaterialOutputModel:
|
||||||
return self._material
|
return self._material
|
||||||
|
|
||||||
|
@pyqtProperty(QObject, fset=setMaterial, notify=extruderConfigurationChanged)
|
||||||
|
def material(self) -> MaterialOutputModel:
|
||||||
|
return self._material
|
||||||
|
|
||||||
def setHotendID(self, hotend_id: Optional[str]) -> None:
|
def setHotendID(self, hotend_id: Optional[str]) -> None:
|
||||||
if self._hotend_id != hotend_id:
|
if self._hotend_id != hotend_id:
|
||||||
self._hotend_id = hotend_id
|
self._hotend_id = hotend_id
|
||||||
|
|
|
@ -9,7 +9,7 @@ from UM.FileHandler.WriteFileJob import WriteFileJob #To call the file writer as
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
from UM.Mesh.MeshWriter import MeshWriter # For typing
|
|
||||||
from UM.Message import Message
|
from UM.Message import Message
|
||||||
from UM.Qt.Duration import Duration, DurationFormat
|
from UM.Qt.Duration import Duration, DurationFormat
|
||||||
from UM.OutputDevice import OutputDeviceError # To show that something went wrong when writing.
|
from UM.OutputDevice import OutputDeviceError # To show that something went wrong when writing.
|
||||||
|
@ -34,7 +34,7 @@ from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QObject
|
||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Dict, List, Set
|
from typing import Optional, Dict, List
|
||||||
|
|
||||||
import io # To create the correct buffers for sending data to the printer.
|
import io # To create the correct buffers for sending data to the printer.
|
||||||
import json
|
import json
|
||||||
|
@ -91,9 +91,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
self._finished_jobs = [] # type: List[PrintJobOutputModel]
|
self._finished_jobs = [] # type: List[PrintJobOutputModel]
|
||||||
|
|
||||||
self._cluster_size = int(properties.get(b"cluster_size", 0))
|
self._cluster_size = int(properties.get(b"cluster_size", 0)) # type: int
|
||||||
|
|
||||||
self._latest_reply_handler = None # type: Optional[QNetworkReply]
|
self._latest_reply_handler = None # type: Optional[QNetworkReply]
|
||||||
|
self._sending_job = None
|
||||||
|
|
||||||
def requestWrite(self, nodes: List[SceneNode], file_name: Optional[str] = None, limit_mimetypes: bool = False, file_handler: Optional[FileHandler] = None, **kwargs: str) -> None:
|
def requestWrite(self, nodes: List[SceneNode], file_name: Optional[str] = None, limit_mimetypes: bool = False, file_handler: Optional[FileHandler] = None, **kwargs: str) -> None:
|
||||||
self.writeStarted.emit(self)
|
self.writeStarted.emit(self)
|
||||||
|
@ -159,7 +160,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
self._printer_selection_dialog.show()
|
self._printer_selection_dialog.show()
|
||||||
|
|
||||||
@pyqtProperty(int, constant=True)
|
@pyqtProperty(int, constant=True)
|
||||||
def clusterSize(self):
|
def clusterSize(self) -> int:
|
||||||
return self._cluster_size
|
return self._cluster_size
|
||||||
|
|
||||||
## Allows the user to choose a printer to print with from the printer
|
## Allows the user to choose a printer to print with from the printer
|
||||||
|
@ -281,8 +282,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
# If successfully sent:
|
# If successfully sent:
|
||||||
if bytes_sent == bytes_total:
|
if bytes_sent == bytes_total:
|
||||||
# Show a confirmation to the user so they know the job was sucessful and provide the option to switch to the
|
# Show a confirmation to the user so they know the job was sucessful and provide the option to switch to
|
||||||
# monitor tab.
|
# the monitor tab.
|
||||||
self._success_message = Message(
|
self._success_message = Message(
|
||||||
i18n_catalog.i18nc("@info:status", "Print job was successfully sent to the printer."),
|
i18n_catalog.i18nc("@info:status", "Print job was successfully sent to the printer."),
|
||||||
lifetime=5, dismissable=True,
|
lifetime=5, dismissable=True,
|
||||||
|
@ -412,7 +413,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
image.loadFromData(reply.readAll())
|
image.loadFromData(reply.readAll())
|
||||||
print_job.updatePreviewImage(image)
|
print_job.updatePreviewImage(image)
|
||||||
|
|
||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
super()._update()
|
super()._update()
|
||||||
self.get("printers/", on_finished = self._onGetPrintersDataFinished)
|
self.get("printers/", on_finished = self._onGetPrintersDataFinished)
|
||||||
|
@ -615,6 +615,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
job = SendMaterialJob(device = self)
|
job = SendMaterialJob(device = self)
|
||||||
job.run()
|
job.run()
|
||||||
|
|
||||||
|
|
||||||
def loadJsonFromReply(reply: QNetworkReply) -> Optional[List[Dict[str, Any]]]:
|
def loadJsonFromReply(reply: QNetworkReply) -> Optional[List[Dict[str, Any]]]:
|
||||||
try:
|
try:
|
||||||
result = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
result = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
||||||
|
@ -633,8 +634,8 @@ def checkValidGetReply(reply: QNetworkReply) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def findByKey(list: List[Union[PrintJobOutputModel, PrinterOutputModel]], key: str) -> Optional[PrintJobOutputModel]:
|
def findByKey(lst: List[Union[PrintJobOutputModel, PrinterOutputModel]], key: str) -> Optional[PrintJobOutputModel]:
|
||||||
for item in list:
|
for item in lst:
|
||||||
if item.key == key:
|
if item.key == key:
|
||||||
return item
|
return item
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -148,6 +148,7 @@ Item
|
||||||
text: "Send to top"
|
text: "Send to top"
|
||||||
onClicked: OutputDevice.sendJobToTop(printJob.key)
|
onClicked: OutputDevice.sendJobToTop(printJob.key)
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
enabled: OutputDevice.printJobs[0].key != printJob.key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue