diff --git a/PrinterConnection.py b/PrinterConnection.py index 28630dc0c5..a2021ca67d 100644 --- a/PrinterConnection.py +++ b/PrinterConnection.py @@ -149,8 +149,7 @@ class PrinterConnection(SignalEmitter): def updateFirmware(self, file_name): self._firmware_file_name = file_name self._update_firmware_thread.start() - - + ## Private connect function run by thread. Can be started by calling connect. def _connect(self): self._is_connecting = True @@ -378,6 +377,7 @@ class PrinterConnection(SignalEmitter): self.sendCommand("M105 T%d" % self._temperature_requested_extruder_index) else: self.sendCommand("M105") + ## Send next Gcode in the gcode list def _sendNextGcodeLine(self): if self._gcode_position >= len(self._gcode): diff --git a/USBPrinterManager.py b/USBPrinterManager.py index 8f2ba5e90a..300f6e7ef6 100644 --- a/USBPrinterManager.py +++ b/USBPrinterManager.py @@ -19,6 +19,7 @@ from UM.i18n import i18nCatalog i18n_catalog = i18nCatalog('plugins') + class USBPrinterManager(QObject, SignalEmitter, Extension): def __init__(self, parent = None): super().__init__(parent) @@ -48,26 +49,25 @@ class USBPrinterManager(QObject, SignalEmitter, Extension): self._firmware_view.show() - def spawnControlInterface(self,serial_port): + def spawnControlInterface(self, serial_port): if self._control_view is None: self._control_view = QQuickView() self._control_view.engine().rootContext().setContextProperty('manager',self) self._control_view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml")) self._control_view.show() - - + processingProgress = pyqtSignal(float, arguments = ['amount']) - @pyqtProperty(float,notify = processingProgress) + @pyqtProperty(float, notify=processingProgress) def progress(self): return self._progress - + pyqtExtruderTemperature = pyqtSignal(float, arguments = ['amount']) - @pyqtProperty(float,notify = pyqtExtruderTemperature) + @pyqtProperty(float, notify=pyqtExtruderTemperature) def extruderTemperature(self): return self._extruder_temp pyqtBedTemperature = pyqtSignal(float, arguments = ['amount']) - @pyqtProperty(float,notify = pyqtBedTemperature) + @pyqtProperty(float, notify=pyqtBedTemperature) def bedTemperature(self): return self._bed_temp @@ -268,15 +268,15 @@ class USBPrinterManager(QObject, SignalEmitter, Extension): i=0 while True: values = winreg.EnumValue(key, i) - if not base_list or 'USBSER' in values[0]: - base_list+=[values[1]] + if 'USBSER' in values[0]: + base_list += [values[1]] i+=1 except: pass if base_list: base_list = base_list + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.usb*") - base_list = filter(lambda s: not 'Bluetooth' in s, base_list) #Filter because mac sometimes puts them in the list + base_list = filter(lambda s: 'Bluetooth' not in s, base_list) #Filter because mac sometimes puts them in the list #prev = profile.getMachineSetting('serial_port_auto') #if prev in base_list: # base_list.remove(prev) diff --git a/avr_isp/ispBase.py b/avr_isp/ispBase.py index bfed45f0ac..1ba1317f91 100644 --- a/avr_isp/ispBase.py +++ b/avr_isp/ispBase.py @@ -57,8 +57,10 @@ class IspBase(): """ raise IspError("Called undefined verifyFlash") + class IspError(BaseException): def __init__(self, value): self.value = value + def __str__(self): return repr(self.value) diff --git a/avr_isp/stk500v2.py b/avr_isp/stk500v2.py index 1af5416a40..c0e3b0ec89 100644 --- a/avr_isp/stk500v2.py +++ b/avr_isp/stk500v2.py @@ -3,7 +3,10 @@ STK500v2 protocol implementation for programming AVR chips. The STK500v2 protocol is used by the ArduinoMega2560 and a few other Arduino platforms to load firmware. This is a python 3 conversion of the code created by David Braam for the Cura project. """ -import os, struct, sys, time +import os +import struct +import sys +import time from serial import Serial from serial import SerialException @@ -11,6 +14,7 @@ from serial import SerialTimeoutException from . import ispBase, intelHex + class Stk500v2(ispBase.IspBase): def __init__(self): self.serial = None @@ -55,8 +59,8 @@ class Stk500v2(ispBase.IspBase): self.serial.close() self.serial = None - #Leave ISP does not reset the serial port, only resets the device, and returns the serial port after disconnecting it from the programming interface. - # This allows you to use the serial port without opening it again. + #Leave ISP does not reset the serial port, only resets the device, and returns the serial port after disconnecting it from the programming interface. + # This allows you to use the serial port without opening it again. def leaveISP(self): if self.serial is not None: if self.sendMessage([0x11]) != [0x11, 0x00]: