Merge branch '15.10'

* 15.10: (39 commits)
  Remove unused import in StartSliceJob
  conforming to code style
  fix typo's..
  Adjust initial view to be slightly from the side
  uses a different method to check whether a machine name excists
  Sets the languageComboBox to the default language
  Remove per-group settings for now
  Make sure to send all settings when an object overrides the profile
  Properly emit writeStarted in RemovableDriveOutputDevice
  Add xy_offset setting to list of settings that trigger a disallowed area update
  Properly trigger a reslice when the active instance is changed
  Wizardpages without hack
  Only hides the window when there are no more pages
  Only add layer data node after all processing
  Also account for "xy_offset" setting for the disallowed areas
  JSON: workaround for stutter in spiralize vase: set travel speed to printing speed
  Adds a color for the error-messages
  Shows an error message when a user tries to add a printer with a name that already excists.
  JSON: support bottom stair step height defaults changed so that the bottom distance to the model isn't violated too much
  Try to use Protobuf CPP implementation if it is available
  ...
This commit is contained in:
Arjen Hiemstra 2015-11-13 11:31:29 +01:00
commit 751f58fb02
24 changed files with 593 additions and 263 deletions

View file

@ -45,7 +45,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._connect_thread.daemon = True
self._end_stop_thread = threading.Thread(target = self._pollEndStop)
self._end_stop_thread.deamon = True
self._end_stop_thread.daemon = True
self._poll_endstop = -1
# Printer is connected
@ -65,6 +65,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
self._update_firmware_thread.daemon = True
self.firmwareUpdateComplete.connect(self._onFirmwareUpdateComplete)
self._heatup_wait_start_time = time.time()
@ -197,6 +198,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
## Private fuction (threaded) that actually uploads the firmware.
def _updateFirmware(self):
self.setProgress(0, 100)
if self._is_connecting or self._is_connected:
self.close()
hex_file = intelHex.readHex(self._firmware_file_name)
@ -207,7 +210,11 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
programmer = stk500v2.Stk500v2()
programmer.progressCallback = self.setProgress
programmer.connect(self._serial_port)
try:
programmer.connect(self._serial_port)
except Exception:
pass
time.sleep(1) # Give programmer some time to connect. Might need more in some cases, but this worked in all tested cases.
@ -336,8 +343,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._connect_thread = threading.Thread(target=self._connect)
self._connect_thread.daemon = True
self.setIsConnected(False)
if self._serial is not None:
self.setIsConnected(False)
try:
self._listen_thread.join()
except:

View file

@ -11,6 +11,7 @@ from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
from UM.Qt.ListModel import ListModel
from UM.Message import Message
from cura.CuraApplication import CuraApplication
@ -95,6 +96,10 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
@pyqtSlot()
def updateAllFirmware(self):
if not self._printer_connections:
Message("Cannot update firmware, there were no connected printers found.").show()
return
self.spawnFirmwareInterface("")
for printer_connection in self._printer_connections:
try:
@ -159,6 +164,16 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
continue
self._serial_port_list = list(serial_ports)
connections_to_remove = []
for port, connection in self._printer_connections.items():
if port not in self._serial_port_list:
connection.close()
connections_to_remove.append(port)
for port in connections_to_remove:
del self._printer_connections[port]
## Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
def addConnection(self, serial_port):
connection = PrinterConnection.PrinterConnection(serial_port)

View file

@ -58,7 +58,7 @@ class IspBase():
raise IspError("Called undefined verifyFlash")
class IspError(BaseException):
class IspError(Exception):
def __init__(self, value):
self.value = value