mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Remove trailing whitespace from Python files
This commit is contained in:
parent
1e33360c35
commit
89f0970a88
157 changed files with 562 additions and 562 deletions
|
@ -32,7 +32,7 @@ class ClusterApiClient:
|
|||
|
||||
def __init__(self, address: str, on_error: Callable) -> None:
|
||||
"""Initializes a new cluster API client.
|
||||
|
||||
|
||||
:param address: The network address of the cluster to call.
|
||||
:param on_error: The callback to be called whenever we receive errors from the server.
|
||||
"""
|
||||
|
@ -43,7 +43,7 @@ class ClusterApiClient:
|
|||
|
||||
def getSystem(self, on_finished: Callable) -> None:
|
||||
"""Get printer system information.
|
||||
|
||||
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
"""
|
||||
url = "{}/system".format(self.PRINTER_API_PREFIX)
|
||||
|
@ -52,7 +52,7 @@ class ClusterApiClient:
|
|||
|
||||
def getMaterials(self, on_finished: Callable[[List[ClusterMaterial]], Any]) -> None:
|
||||
"""Get the installed materials on the printer.
|
||||
|
||||
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
"""
|
||||
url = "{}/materials".format(self.CLUSTER_API_PREFIX)
|
||||
|
@ -61,7 +61,7 @@ class ClusterApiClient:
|
|||
|
||||
def getPrinters(self, on_finished: Callable[[List[ClusterPrinterStatus]], Any]) -> None:
|
||||
"""Get the printers in the cluster.
|
||||
|
||||
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
"""
|
||||
url = "{}/printers".format(self.CLUSTER_API_PREFIX)
|
||||
|
@ -70,7 +70,7 @@ class ClusterApiClient:
|
|||
|
||||
def getPrintJobs(self, on_finished: Callable[[List[ClusterPrintJobStatus]], Any]) -> None:
|
||||
"""Get the print jobs in the cluster.
|
||||
|
||||
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
"""
|
||||
url = "{}/print_jobs".format(self.CLUSTER_API_PREFIX)
|
||||
|
@ -112,7 +112,7 @@ class ClusterApiClient:
|
|||
|
||||
def _createEmptyRequest(self, path: str, content_type: Optional[str] = "application/json") -> QNetworkRequest:
|
||||
"""We override _createEmptyRequest in order to add the user credentials.
|
||||
|
||||
|
||||
:param url: The URL to request
|
||||
:param content_type: The type of the body contents.
|
||||
"""
|
||||
|
@ -126,7 +126,7 @@ class ClusterApiClient:
|
|||
@staticmethod
|
||||
def _parseReply(reply: QNetworkReply) -> Tuple[int, Dict[str, Any]]:
|
||||
"""Parses the given JSON network reply into a status code and a dictionary, handling unexpected errors as well.
|
||||
|
||||
|
||||
:param reply: The reply from the server.
|
||||
:return: A tuple with a status code and a dictionary.
|
||||
"""
|
||||
|
@ -141,7 +141,7 @@ class ClusterApiClient:
|
|||
def _parseModels(self, response: Dict[str, Any], on_finished: Union[Callable[[ClusterApiClientModel], Any],
|
||||
Callable[[List[ClusterApiClientModel]], Any]], model_class: Type[ClusterApiClientModel]) -> None:
|
||||
"""Parses the given models and calls the correct callback depending on the result.
|
||||
|
||||
|
||||
:param response: The response from the server, after being converted to a dict.
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
:param model_class: The type of the model to convert the response to. It may either be a single record or a list.
|
||||
|
@ -163,7 +163,7 @@ class ClusterApiClient:
|
|||
Callable[[List[ClusterApiClientModel]], Any]], model: Type[ClusterApiClientModel] = None,
|
||||
) -> None:
|
||||
"""Creates a callback function so that it includes the parsing of the response into the correct model.
|
||||
|
||||
|
||||
The callback is added to the 'finished' signal of the reply.
|
||||
:param reply: The reply that should be listened to.
|
||||
:param on_finished: The callback in case the response is successful.
|
||||
|
|
|
@ -98,7 +98,7 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
|
||||
def setJobState(self, print_job_uuid: str, action: str) -> None:
|
||||
"""Set the remote print job state.
|
||||
|
||||
|
||||
:param print_job_uuid: The UUID of the print job to set the state for.
|
||||
:param action: The action to undertake ('pause', 'resume', 'abort').
|
||||
"""
|
||||
|
@ -118,7 +118,7 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
|
||||
def sendMaterialProfiles(self) -> None:
|
||||
"""Sync the material profiles in Cura with the printer.
|
||||
|
||||
|
||||
This gets called when connecting to a printer as well as when sending a print.
|
||||
"""
|
||||
job = SendMaterialJob(device = self)
|
||||
|
@ -143,14 +143,14 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
@pyqtSlot(str, name="selectTargetPrinter")
|
||||
def selectTargetPrinter(self, unique_name: str = "") -> None:
|
||||
"""Allows the user to choose a printer to print with from the printer selection dialogue.
|
||||
|
||||
|
||||
:param unique_name: The unique name of the printer to target.
|
||||
"""
|
||||
self._startPrintJobUpload(unique_name if unique_name != "" else None)
|
||||
|
||||
def _onPrintJobCreated(self, job: ExportFileJob) -> None:
|
||||
"""Handler for when the print job was created locally.
|
||||
|
||||
|
||||
It can now be sent over the network.
|
||||
"""
|
||||
|
||||
|
@ -208,7 +208,7 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
|
||||
def _onUploadError(self, message: str = None) -> None:
|
||||
"""Displays the given message if uploading the mesh has failed
|
||||
|
||||
|
||||
:param message: The message to display.
|
||||
"""
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class SendMaterialJob(Job):
|
||||
"""Asynchronous job to send material profiles to the printer.
|
||||
|
||||
|
||||
This way it won't freeze up the interface while sending those materials.
|
||||
"""
|
||||
|
||||
|
@ -40,7 +40,7 @@ class SendMaterialJob(Job):
|
|||
|
||||
def _sendMissingMaterials(self, remote_materials_by_guid: Dict[str, ClusterMaterial]) -> None:
|
||||
"""Determine which materials should be updated and send them to the printer.
|
||||
|
||||
|
||||
:param remote_materials_by_guid: The remote materials by GUID.
|
||||
"""
|
||||
local_materials_by_guid = self._getLocalMaterials()
|
||||
|
@ -57,7 +57,7 @@ class SendMaterialJob(Job):
|
|||
def _determineMaterialsToSend(local_materials: Dict[str, LocalMaterial],
|
||||
remote_materials: Dict[str, ClusterMaterial]) -> Set[str]:
|
||||
"""From the local and remote materials, determine which ones should be synchronized.
|
||||
|
||||
|
||||
Makes a Set of id's containing only the id's of the materials that are not on the printer yet or the ones that
|
||||
are newer in Cura.
|
||||
:param local_materials: The local materials by GUID.
|
||||
|
@ -72,7 +72,7 @@ class SendMaterialJob(Job):
|
|||
|
||||
def _sendMaterials(self, materials_to_send: Set[str]) -> None:
|
||||
"""Send the materials to the printer.
|
||||
|
||||
|
||||
The given materials will be loaded from disk en sent to to printer.
|
||||
The given id's will be matched with filenames of the locally stored materials.
|
||||
:param materials_to_send: A set with id's of materials that must be sent.
|
||||
|
@ -97,7 +97,7 @@ class SendMaterialJob(Job):
|
|||
|
||||
def _sendMaterialFile(self, file_path: str, file_name: str, material_id: str) -> None:
|
||||
"""Send a single material file to the printer.
|
||||
|
||||
|
||||
Also add the material signature file if that is available.
|
||||
:param file_path: The path of the material file.
|
||||
:param file_name: The name of the material file.
|
||||
|
@ -143,7 +143,7 @@ class SendMaterialJob(Job):
|
|||
@staticmethod
|
||||
def _getLocalMaterials() -> Dict[str, LocalMaterial]:
|
||||
"""Retrieves a list of local materials
|
||||
|
||||
|
||||
Only the new newest version of the local materials is returned
|
||||
:return: a dictionary of LocalMaterial objects by GUID
|
||||
"""
|
||||
|
|
|
@ -14,7 +14,7 @@ from cura.CuraApplication import CuraApplication
|
|||
|
||||
class ZeroConfClient:
|
||||
"""The ZeroConfClient handles all network discovery logic.
|
||||
|
||||
|
||||
It emits signals when new network services were found or disappeared.
|
||||
"""
|
||||
|
||||
|
@ -34,7 +34,7 @@ class ZeroConfClient:
|
|||
|
||||
def start(self) -> None:
|
||||
"""The ZeroConf service changed requests are handled in a separate thread so we don't block the UI.
|
||||
|
||||
|
||||
We can also re-schedule the requests when they fail to get detailed service info.
|
||||
Any new or re-reschedule requests will be appended to the request queue and the thread will process them.
|
||||
"""
|
||||
|
@ -108,7 +108,7 @@ class ZeroConfClient:
|
|||
def _onServiceChanged(self, zero_conf: Zeroconf, service_type: str, name: str,
|
||||
state_change: ServiceStateChange) -> bool:
|
||||
"""Handler for zeroConf detection.
|
||||
|
||||
|
||||
Return True or False indicating if the process succeeded.
|
||||
Note that this function can take over 3 seconds to complete. Be careful calling it from the main thread.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue