Skip to content

Commit

Permalink
Rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
loociano committed Jun 9, 2020
1 parent b0e8099 commit 61c008e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/MPSM2NetworkedPrinterOutputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, device_id: str, address: str, parent=None) -> None:
connection_type=ConnectionType.NetworkConnection,
parent=parent)
self._printer_output_controller = MPSM2OutputController(self)
self._is_busy = False
self._is_uploading = False
self._requested_start_print = False
self._requested_pause_print = False
self._requested_cancel_print = False
Expand Down Expand Up @@ -152,7 +152,7 @@ def isUploading(self) -> bool:
Returns:
true if user is uploading a model to the printer.
"""
return self._is_busy
return self._is_uploading

@pyqtProperty(bool, notify=startPrintRequestChanged)
def has_start_print_request_in_progress(self) -> bool:
Expand Down Expand Up @@ -353,12 +353,12 @@ def update_printer_status(self, response: str) -> None:
self._on_printer_status_changed(response)
self.printerStatusChanged.emit()

def is_busy(self) -> bool:
def is_uploading(self) -> bool:
"""
Returns:
true if the printer is uploading a job.
"""
return self._is_busy
return self._is_uploading

def _on_print_job_created(self, job: GCodeWriteFileJob) -> None:
"""Called when a print job starts to upload.
Expand All @@ -370,7 +370,7 @@ def _on_print_job_created(self, job: GCodeWriteFileJob) -> None:
Logger.log('e', 'No active exported job to upload!')
return
self.onPrinterUpload.emit(True)
self._is_busy = True
self._is_uploading = True
self._job_upload_message.show()
self._api_client.upload_print(job.getFileName(), job.get_gcode_output(),
self._on_print_job_upload_completed,
Expand All @@ -379,7 +379,7 @@ def _on_print_job_created(self, job: GCodeWriteFileJob) -> None:

def _on_print_upload_cancelled(self) -> None:
"""Called when the user cancels the print upload."""
self._is_busy = False
self._is_uploading = False
self._job_upload_message.hide()
self._api_client.cancel_upload_print()
self._api_client.cancel_print() # force cancel
Expand All @@ -389,8 +389,8 @@ def _on_print_upload_cancelled(self) -> None:

def _on_print_job_upload_error(self) -> None:
"""Called if there was an error uploading the model."""
if self._is_busy:
self._is_busy = False
if self._is_uploading:
self._is_uploading = False
self._job_upload_message.hide()
self._api_client.cancel_upload_print()
self._api_client.cancel_print() # force cancel
Expand All @@ -405,7 +405,7 @@ def _on_print_job_upload_completed(self, response: str) -> None:
response: HTTP body response from upload request.
"""
if response.upper() == 'OK':
self._is_busy = False
self._is_uploading = False
self._job_upload_message.hide()
PrintJobUploadSuccessMessage().show()
self._api_client.start_print() # force start
Expand Down
2 changes: 1 addition & 1 deletion src/network/DeviceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def _on_printer_heartbeat(self, address: str, response: str) -> None:
MPSM2NetworkedPrinterOutputDevice,
self._discovered_devices.get(DeviceManager._get_device_id(address)))
if response == 'timeout':
if device and device.isConnected() and not device.is_busy() and \
if device and device.isConnected() and not device.is_uploading() and \
not self._add_manual_device_in_progress:
# Request timeout is expected during job upload.
Logger.log('d', 'Discovered device timed out. Stopping device.')
Expand Down

0 comments on commit 61c008e

Please sign in to comment.