Remove a number of unused variables

This commit is contained in:
Jaime van Kessel 2020-04-10 13:46:19 +02:00
parent 6a6ad6e815
commit fe27da5e8a
No known key found for this signature in database
GPG key ID: 3710727397403C91
8 changed files with 7 additions and 12 deletions

View file

@ -72,8 +72,6 @@ class DiscoveredPrinter(QObject):
# Human readable machine type string # Human readable machine type string
@pyqtProperty(str, notify = machineTypeChanged) @pyqtProperty(str, notify = machineTypeChanged)
def readableMachineType(self) -> str: def readableMachineType(self) -> str:
from cura.CuraApplication import CuraApplication
machine_manager = CuraApplication.getInstance().getMachineManager()
# In NetworkOutputDevice, when it updates a printer information, it updates the machine type using the field # In NetworkOutputDevice, when it updates a printer information, it updates the machine type using the field
# "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string # "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string
# like "Ultimaker 3". The code below handles this case. # like "Ultimaker 3". The code below handles this case.

View file

@ -111,7 +111,7 @@ class NetworkMJPGImage(QQuickPaintedItem):
if not self._image_reply.isFinished(): if not self._image_reply.isFinished():
self._image_reply.close() self._image_reply.close()
except Exception as e: # RuntimeError except Exception: # RuntimeError
pass # It can happen that the wrapped c++ object is already deleted. pass # It can happen that the wrapped c++ object is already deleted.
self._image_reply = None self._image_reply = None

View file

@ -79,7 +79,7 @@ class ModelChecker(QObject, Extension):
# This function can be triggered in the middle of a machine change, so do not proceed if the machine change # This function can be triggered in the middle of a machine change, so do not proceed if the machine change
# has not done yet. # has not done yet.
try: try:
extruder = global_container_stack.extruderList[int(node_extruder_position)] global_container_stack.extruderList[int(node_extruder_position)]
except IndexError: except IndexError:
Application.getInstance().callLater(lambda: self.onChanged.emit()) Application.getInstance().callLater(lambda: self.onChanged.emit())
return False return False

View file

@ -23,16 +23,13 @@ class BQ_PauseAtHeight(Script):
}""" }"""
def execute(self, data): def execute(self, data):
x = 0.
y = 0.
current_z = 0.
pause_z = self.getSettingValueByKey("pause_height") pause_z = self.getSettingValueByKey("pause_height")
for layer in data: for layer in data:
lines = layer.split("\n") lines = layer.split("\n")
for line in lines: for line in lines:
if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0: if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0:
current_z = self.getValue(line, 'Z') current_z = self.getValue(line, 'Z')
if current_z != None: if current_z is not None:
if current_z >= pause_z: if current_z >= pause_z:
prepend_gcode = ";TYPE:CUSTOM\n" prepend_gcode = ";TYPE:CUSTOM\n"
prepend_gcode += "; -- Pause at height (%.2f mm) --\n" % pause_z prepend_gcode += "; -- Pause at height (%.2f mm) --\n" % pause_z

View file

@ -49,7 +49,7 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
def performEjectDevice(self, device): def performEjectDevice(self, device):
p = subprocess.Popen(["diskutil", "eject", device.getId()], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE) p = subprocess.Popen(["diskutil", "eject", device.getId()], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
output = p.communicate() p.communicate()
return_code = p.wait() return_code = p.wait()
if return_code != 0: if return_code != 0:

View file

@ -299,7 +299,7 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
new_print_jobs = [] new_print_jobs = []
# Check which print jobs need to be created or updated. # Check which print jobs need to be created or updated.
for index, print_job_data in enumerate(remote_jobs): for print_job_data in remote_jobs:
print_job = next( print_job = next(
iter(print_job for print_job in self._print_jobs if print_job.key == print_job_data.uuid), None) iter(print_job for print_job in self._print_jobs if print_job.key == print_job_data.uuid), None)
if not print_job: if not print_job:

View file

@ -50,7 +50,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
# The method updates/reset the USB settings for all connected USB devices # The method updates/reset the USB settings for all connected USB devices
def updateUSBPrinterOutputDevices(self): def updateUSBPrinterOutputDevices(self):
for key, device in self._usb_output_devices.items(): for device in self._usb_output_devices.values():
if isinstance(device, USBPrinterOutputDevice.USBPrinterOutputDevice): if isinstance(device, USBPrinterOutputDevice.USBPrinterOutputDevice):
device.resetDeviceSettings() device.resetDeviceSettings()

View file

@ -108,9 +108,9 @@ def test_addMachineAction(machine_action_manager):
# Adding unknown action should not crash. # Adding unknown action should not crash.
machine_action_manager.addFirstStartAction(test_machine, "key_that_doesnt_exists") machine_action_manager.addFirstStartAction(test_machine, "key_that_doesnt_exists")
def test_removeMachineAction(machine_action_manager): def test_removeMachineAction(machine_action_manager):
test_action = MachineAction(key="test_action") test_action = MachineAction(key="test_action")
test_machine = Machine("test_machine")
machine_action_manager.addMachineAction(test_action) machine_action_manager.addMachineAction(test_action)
# Remove the machine action # Remove the machine action