From e795aaa45a20577416e942dd6af53bbd9e30de77 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Jun 2015 17:10:35 +0200 Subject: [PATCH] Remember the previuos active tool on selection change This prevents issues where activating a tool before selecting something would change to the translate tool. Fixes #53 --- cura/CuraApplication.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index cde470e075..488fa3404e 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -68,6 +68,7 @@ class CuraApplication(QtApplication): self._output_devices = {} self._print_information = None self._i18n_catalog = None + self._previous_active_tool = None self.activeMachineChanged.connect(self._onActiveMachineChanged) @@ -191,14 +192,21 @@ class CuraApplication(QtApplication): def onSelectionChanged(self): if Selection.hasSelection(): if not self.getController().getActiveTool(): - self.getController().setActiveTool("TranslateTool") + if self._previous_active_tool: + self.getController().setActiveTool(self._previous_active_tool) + self._previous_active_tool = None + else: + self.getController().setActiveTool("TranslateTool") self._camera_animation.setStart(self.getController().getTool("CameraTool").getOrigin()) self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition()) self._camera_animation.start() else: if self.getController().getActiveTool(): + self._previous_active_tool = self.getController().getActiveTool().getPluginId() self.getController().setActiveTool(None) + else: + self._previous_active_tool = None requestAddPrinter = pyqtSignal()