Merge branch '15.06'

* 15.06:
  Fix poor visibility of MessageStack against grid
  Fix USB printer detection and reconnect after firmware update on MacOSX
  Correct the icon for the Cura .desktop file
  Bump version
  support defaults to ZigZag instead of Lines
  Fix the platform activity check
This commit is contained in:
Arjen Hiemstra 2015-08-18 17:59:16 +02:00
commit a425036c4c
3 changed files with 58 additions and 26 deletions

View file

@ -79,6 +79,7 @@ class CuraApplication(QtApplication):
self._platform_activity = False self._platform_activity = False
self.activeMachineChanged.connect(self._onActiveMachineChanged) self.activeMachineChanged.connect(self._onActiveMachineChanged)
self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
Preferences.getInstance().addPreference("cura/active_machine", "") Preferences.getInstance().addPreference("cura/active_machine", "")
Preferences.getInstance().addPreference("cura/active_mode", "simple") Preferences.getInstance().addPreference("cura/active_mode", "simple")
@ -214,24 +215,15 @@ class CuraApplication(QtApplication):
def getPlatformActivity(self): def getPlatformActivity(self):
return self._platform_activity return self._platform_activity
@pyqtSlot(bool) def updatePlatformActivity(self, node = None):
def setPlatformActivity(self, activity): count = 0
##Sets the _platform_activity variable on true or false depending on whether there is a mesh on the platform
if activity == True:
self._platform_activity = activity
elif activity == False:
nodes = []
for node in DepthFirstIterator(self.getController().getScene().getRoot()): for node in DepthFirstIterator(self.getController().getScene().getRoot()):
if type(node) is not SceneNode or not node.getMeshData(): if type(node) is not SceneNode or not node.getMeshData():
continue continue
nodes.append(node)
i = 0 count += 1
for node in nodes:
if not node.getMeshData(): self._platform_activity = True if count > 0 else False
continue
i += 1
if i <= 1: ## i == 0 when the meshes are removed using the deleteAll function; i == 1 when the last remaining mesh is removed using the deleteObject function
self._platform_activity = activity
self.activityChanged.emit() self.activityChanged.emit()
## Remove an object from the scene ## Remove an object from the scene
@ -252,7 +244,6 @@ class CuraApplication(QtApplication):
group_node = group_node.getParent() group_node = group_node.getParent()
op = RemoveSceneNodeOperation(group_node) op = RemoveSceneNodeOperation(group_node)
op.push() op.push()
self.setPlatformActivity(False)
## Create a number of copies of existing object. ## Create a number of copies of existing object.
@pyqtSlot("quint64", int) @pyqtSlot("quint64", int)
@ -300,7 +291,6 @@ class CuraApplication(QtApplication):
op.addOperation(RemoveSceneNodeOperation(node)) op.addOperation(RemoveSceneNodeOperation(node))
op.push() op.push()
self.setPlatformActivity(False)
## Reset all translation on nodes with mesh data. ## Reset all translation on nodes with mesh data.
@pyqtSlot() @pyqtSlot()

View file

@ -60,7 +60,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._listen_thread.daemon = True self._listen_thread.daemon = True
self._update_firmware_thread = threading.Thread(target= self._updateFirmware) self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
self._update_firmware_thread.demon = True self._update_firmware_thread.deamon = True
self._heatup_wait_start_time = time.time() self._heatup_wait_start_time = time.time()
@ -105,6 +105,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._firmware_file_name = None self._firmware_file_name = None
<<<<<<< HEAD
self._control_view = None self._control_view = None
onError = pyqtSignal() onError = pyqtSignal()
@ -128,6 +129,12 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
def error(self): def error(self):
return self._error_state return self._error_state
=======
self.firmwareUpdateComplete.connect(self._onFirmwareUpdateComplete)
firmwareUpdateComplete = Signal()
>>>>>>> 15.06
# TODO: Might need to add check that extruders can not be changed when it started printing or loading these settings from settings object # TODO: Might need to add check that extruders can not be changed when it started printing or loading these settings from settings object
def setNumExtuders(self, num): def setNumExtuders(self, num):
self._extruder_count = num self._extruder_count = num
@ -209,6 +216,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self.setProgress(100, 100) self.setProgress(100, 100)
self.firmwareUpdateComplete.emit()
## Upload new firmware to machine ## Upload new firmware to machine
# \param filename full path of firmware file to be uploaded # \param filename full path of firmware file to be uploaded
def updateFirmware(self, file_name): def updateFirmware(self, file_name):
@ -233,9 +242,18 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._is_connecting = False self._is_connecting = False
Logger.log("i", "Could not establish connection on %s, unknown reasons.", self._serial_port) Logger.log("i", "Could not establish connection on %s, unknown reasons.", self._serial_port)
return return
<<<<<<< HEAD
# If the programmer connected, we know its an atmega based version. Not all that usefull, but it does give some debugging information. # If the programmer connected, we know its an atmega based version. Not all that usefull, but it does give some debugging information.
for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect) for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect)
=======
Logger.log("d", "Starting baud rate detection...")
# If the programmer connected, we know its an atmega based version. Not all that usefull, but it does give some debugging information.
for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect)
Logger.log("d", "Trying baud rate %s", baud_rate)
>>>>>>> 15.06
if self._serial is None: if self._serial is None:
try: try:
self._serial = serial.Serial(str(self._serial_port), baud_rate, timeout = 3, writeTimeout = 10000) self._serial = serial.Serial(str(self._serial_port), baud_rate, timeout = 3, writeTimeout = 10000)
@ -255,9 +273,12 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
if line is None: if line is None:
self.setIsConnected(False) # Something went wrong with reading, could be that close was called. self.setIsConnected(False) # Something went wrong with reading, could be that close was called.
return return
<<<<<<< HEAD
=======
>>>>>>> 15.06
if b"T:" in line: if b"T:" in line:
self._serial.timeout = 0.5 self._serial.timeout = 0.5
self._sendCommand("M105")
sucesfull_responses += 1 sucesfull_responses += 1
if sucesfull_responses >= self._required_responses_auto_baud: if sucesfull_responses >= self._required_responses_auto_baud:
self._serial.timeout = 2 #Reset serial timeout self._serial.timeout = 2 #Reset serial timeout
@ -265,6 +286,8 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
Logger.log("i", "Established printer connection on port %s" % self._serial_port) Logger.log("i", "Established printer connection on port %s" % self._serial_port)
return return
self._sendCommand("M105") # Send M105 as long as we are listening, otherwise we end up in an undefined state
Logger.log("e", "Baud rate detection for %s failed", self._serial_port) Logger.log("e", "Baud rate detection for %s failed", self._serial_port)
self.close() # Unable to connect, wrap up. self.close() # Unable to connect, wrap up.
self.setIsConnected(False) self.setIsConnected(False)
@ -294,9 +317,17 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
if self._connect_thread.isAlive(): if self._connect_thread.isAlive():
try: try:
self._connect_thread.join() self._connect_thread.join()
<<<<<<< HEAD
except Exception as e: except Exception as e:
pass # This should work, but it does fail sometimes for some reason pass # This should work, but it does fail sometimes for some reason
=======
except:
pass
self._connect_thread = threading.Thread(target=self._connect)
self._connect_thread.daemon = True
>>>>>>> 15.06
if self._serial is not None: if self._serial is not None:
self.setIsConnected(False) self.setIsConnected(False)
try: try:
@ -305,6 +336,11 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
pass pass
self._serial.close() self._serial.close()
<<<<<<< HEAD
=======
self._listen_thread = threading.Thread(target=self._listen)
self._listen_thread.daemon = True
>>>>>>> 15.06
self._serial = None self._serial = None
def isConnected(self): def isConnected(self):
@ -540,3 +576,10 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
def _getBaudrateList(self): def _getBaudrateList(self):
ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600] ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
return ret return ret
def _onFirmwareUpdateComplete(self):
self._update_firmware_thread.join()
self._update_firmware_thread = threading.Thread(target= self._updateFirmware)
self._update_firmware_thread.deamon = True
self.connect()

View file

@ -481,7 +481,6 @@ UM.MainWindow {
onAccepted: onAccepted:
{ {
UM.MeshFileHandler.readLocalFile(fileUrl) UM.MeshFileHandler.readLocalFile(fileUrl)
Printer.setPlatformActivity(true)
} }
} }