mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Some style fixing, and added a test script to test for the major style violations.
This commit is contained in:
parent
4a965e04b4
commit
83c367cdf4
4 changed files with 21 additions and 15 deletions
|
@ -150,7 +150,6 @@ class PrinterConnection(SignalEmitter):
|
||||||
self._firmware_file_name = file_name
|
self._firmware_file_name = file_name
|
||||||
self._update_firmware_thread.start()
|
self._update_firmware_thread.start()
|
||||||
|
|
||||||
|
|
||||||
## Private connect function run by thread. Can be started by calling connect.
|
## Private connect function run by thread. Can be started by calling connect.
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
self._is_connecting = True
|
self._is_connecting = True
|
||||||
|
@ -378,6 +377,7 @@ class PrinterConnection(SignalEmitter):
|
||||||
self.sendCommand("M105 T%d" % self._temperature_requested_extruder_index)
|
self.sendCommand("M105 T%d" % self._temperature_requested_extruder_index)
|
||||||
else:
|
else:
|
||||||
self.sendCommand("M105")
|
self.sendCommand("M105")
|
||||||
|
|
||||||
## Send next Gcode in the gcode list
|
## Send next Gcode in the gcode list
|
||||||
def _sendNextGcodeLine(self):
|
def _sendNextGcodeLine(self):
|
||||||
if self._gcode_position >= len(self._gcode):
|
if self._gcode_position >= len(self._gcode):
|
||||||
|
|
|
@ -19,6 +19,7 @@ from UM.i18n import i18nCatalog
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog('plugins')
|
i18n_catalog = i18nCatalog('plugins')
|
||||||
|
|
||||||
|
|
||||||
class USBPrinterManager(QObject, SignalEmitter, Extension):
|
class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -48,26 +49,25 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
self._firmware_view.show()
|
self._firmware_view.show()
|
||||||
|
|
||||||
|
|
||||||
def spawnControlInterface(self,serial_port):
|
def spawnControlInterface(self, serial_port):
|
||||||
if self._control_view is None:
|
if self._control_view is None:
|
||||||
self._control_view = QQuickView()
|
self._control_view = QQuickView()
|
||||||
self._control_view.engine().rootContext().setContextProperty('manager',self)
|
self._control_view.engine().rootContext().setContextProperty('manager',self)
|
||||||
self._control_view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
|
self._control_view.setSource(QUrl("plugins/USBPrinting/ControlWindow.qml"))
|
||||||
self._control_view.show()
|
self._control_view.show()
|
||||||
|
|
||||||
|
|
||||||
processingProgress = pyqtSignal(float, arguments = ['amount'])
|
processingProgress = pyqtSignal(float, arguments = ['amount'])
|
||||||
@pyqtProperty(float,notify = processingProgress)
|
@pyqtProperty(float, notify=processingProgress)
|
||||||
def progress(self):
|
def progress(self):
|
||||||
return self._progress
|
return self._progress
|
||||||
|
|
||||||
pyqtExtruderTemperature = pyqtSignal(float, arguments = ['amount'])
|
pyqtExtruderTemperature = pyqtSignal(float, arguments = ['amount'])
|
||||||
@pyqtProperty(float,notify = pyqtExtruderTemperature)
|
@pyqtProperty(float, notify=pyqtExtruderTemperature)
|
||||||
def extruderTemperature(self):
|
def extruderTemperature(self):
|
||||||
return self._extruder_temp
|
return self._extruder_temp
|
||||||
|
|
||||||
pyqtBedTemperature = pyqtSignal(float, arguments = ['amount'])
|
pyqtBedTemperature = pyqtSignal(float, arguments = ['amount'])
|
||||||
@pyqtProperty(float,notify = pyqtBedTemperature)
|
@pyqtProperty(float, notify=pyqtBedTemperature)
|
||||||
def bedTemperature(self):
|
def bedTemperature(self):
|
||||||
return self._bed_temp
|
return self._bed_temp
|
||||||
|
|
||||||
|
@ -268,15 +268,15 @@ class USBPrinterManager(QObject, SignalEmitter, Extension):
|
||||||
i=0
|
i=0
|
||||||
while True:
|
while True:
|
||||||
values = winreg.EnumValue(key, i)
|
values = winreg.EnumValue(key, i)
|
||||||
if not base_list or 'USBSER' in values[0]:
|
if 'USBSER' in values[0]:
|
||||||
base_list+=[values[1]]
|
base_list += [values[1]]
|
||||||
i+=1
|
i+=1
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if base_list:
|
if base_list:
|
||||||
base_list = base_list + glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') + glob.glob("/dev/cu.usb*")
|
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')
|
#prev = profile.getMachineSetting('serial_port_auto')
|
||||||
#if prev in base_list:
|
#if prev in base_list:
|
||||||
# base_list.remove(prev)
|
# base_list.remove(prev)
|
||||||
|
|
|
@ -57,8 +57,10 @@ class IspBase():
|
||||||
"""
|
"""
|
||||||
raise IspError("Called undefined verifyFlash")
|
raise IspError("Called undefined verifyFlash")
|
||||||
|
|
||||||
|
|
||||||
class IspError(BaseException):
|
class IspError(BaseException):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.value)
|
return repr(self.value)
|
||||||
|
|
|
@ -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.
|
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.
|
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 Serial
|
||||||
from serial import SerialException
|
from serial import SerialException
|
||||||
|
@ -11,6 +14,7 @@ from serial import SerialTimeoutException
|
||||||
|
|
||||||
from . import ispBase, intelHex
|
from . import ispBase, intelHex
|
||||||
|
|
||||||
|
|
||||||
class Stk500v2(ispBase.IspBase):
|
class Stk500v2(ispBase.IspBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.serial = None
|
self.serial = None
|
||||||
|
@ -55,8 +59,8 @@ class Stk500v2(ispBase.IspBase):
|
||||||
self.serial.close()
|
self.serial.close()
|
||||||
self.serial = None
|
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.
|
#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.
|
# This allows you to use the serial port without opening it again.
|
||||||
def leaveISP(self):
|
def leaveISP(self):
|
||||||
if self.serial is not None:
|
if self.serial is not None:
|
||||||
if self.sendMessage([0x11]) != [0x11, 0x00]:
|
if self.sendMessage([0x11]) != [0x11, 0x00]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue