diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f6d41a51c8..55e1e466a4 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -162,6 +162,7 @@ class CuraApplication(QtApplication): for file in self.getCommandLineOption("file", []): job = ReadMeshJob(os.path.abspath(file)) + job.finished.connect(self._onFileLoaded) job.start() self.exec_() @@ -447,3 +448,15 @@ class CuraApplication(QtApplication): def _onMessageActionTriggered(self, message, action): if action == "eject": self.getStorageDevice("LocalFileStorage").ejectRemovableDrive(message._sdcard) + + def _onFileLoaded(self, job): + mesh = job.getResult() + if mesh != None: + node = SceneNode() + + node.setSelectable(True) + node.setMeshData(mesh) + node.setName(os.path.basename(job.getFileName())) + + op = AddSceneNodeOperation(node, self.getController().getScene().getRoot()) + op.push() diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 50ad534b09..a7caca6a4f 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -8,6 +8,8 @@ from UM.Resources import Resources from UM.Event import Event, KeyEvent from UM.Signal import Signal from . import LayerViewProxy +from UM.Scene.Selection import Selection +from UM.Math.Color import Color ## View used to display g-code paths. class LayerView(View): @@ -34,17 +36,20 @@ class LayerView(View): scene = self.getController().getScene() renderer = self.getRenderer() renderer.setRenderSelection(False) - - ## Recalculate num max layers - #self.calculateMaxLayers() if not self._material: self._material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "vertexcolor.frag")) self._material.setUniformValue("u_color", [1.0, 0.0, 0.0, 1.0]) + self._selection_material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "color.frag")) + self._selection_material.setUniformValue("u_color", Color(35, 35, 35, 128)) + for node in DepthFirstIterator(scene.getRoot()): if not node.render(renderer): if node.getMeshData() and node.isVisible(): + if Selection.isSelected(node): + renderer.queueNode(node, material = self._selection_material, transparent = True) + try: layer_data = node.getMeshData().layerData except AttributeError: diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py index ad231f5207..19c5b5c07a 100644 --- a/plugins/USBPrinting/PrinterConnection.py +++ b/plugins/USBPrinting/PrinterConnection.py @@ -244,7 +244,10 @@ class PrinterConnection(SignalEmitter): self._connect_thread.join() if self._serial is not None: self.setIsConnected(False) - self._listen_thread.join() + try: + self._listen_thread.join() + except: + pass self._serial.close() self._serial = None diff --git a/plugins/USBPrinting/USBPrinterManager.py b/plugins/USBPrinting/USBPrinterManager.py index ba515594ae..27ff31647b 100644 --- a/plugins/USBPrinting/USBPrinterManager.py +++ b/plugins/USBPrinting/USBPrinterManager.py @@ -40,7 +40,8 @@ class USBPrinterManager(QObject, SignalEmitter, Extension): self._error_message = "" ## Add menu item to top menu of the application. - self.addMenuItem(i18n_catalog.i18n("Update Firmware"), self.updateAllFirmware) + self.setMenuName("Firmware") + self.addMenuItem(i18n_catalog.i18n("Update"), self.updateAllFirmware) pyqtError = pyqtSignal(str, arguments = ["amount"]) processingProgress = pyqtSignal(float, arguments = ["amount"])