diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 89a7b098..8ce79210 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -4510,6 +4510,13 @@ class App(QtCore.QObject): self.ui.show() def on_select_tab(self, name): + # if the splitter is hidden, display it, else hide it but only if the current widget is the same + if self.ui.splitter.sizes()[0] == 0: + self.ui.splitter.setSizes([1, 1]) + else: + if self.ui.notebook.currentWidget().objectName() == name + '_tab': + self.ui.splitter.setSizes([0, 1]) + if name == 'project': self.ui.notebook.setCurrentWidget(self.ui.project_tab) elif name == 'selected': @@ -4517,10 +4524,6 @@ class App(QtCore.QObject): elif name == 'tool': self.ui.notebook.setCurrentWidget(self.ui.tool_tab) - # if the splitter us hidden, display it - if self.ui.splitter.sizes()[0] == 0: - self.ui.splitter.setSizes([1, 1]) - def on_copy_name(self): self.report_usage("on_copy_name()") diff --git a/FlatCAMObj.py b/FlatCAMObj.py index fb98c596..aff321be 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -708,8 +708,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber): break if self.ui.apertures_table.cellWidget(check_row, 5).isChecked(): - # self.plot_apertures(color='#FF0000BF', marked_aperture=aperture, visible=True) - self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True) + # self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True) + self.plot_apertures(color='#FD6A02', marked_aperture=aperture, visible=True) self.mark_shapes.redraw() @@ -739,8 +739,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber): mark_cb.setChecked(False) for aperture in self.apertures: if mark_all: - # self.plot_apertures(color='#FF0000BF', marked_aperture=aperture, visible=True) - self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True) + # self.plot_apertures(color='#2d4606bf', marked_aperture=aperture, visible=True) + self.plot_apertures(color='#FD6A02', marked_aperture=aperture, visible=True) else: self.mark_shapes.clear(update=True) diff --git a/README.md b/README.md index f8104de9..c81f3ef9 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ CAD program, and create G-Code for Isolation routing. - made the Custom ToolChange Text area in CNCJob Selected Tab depend on the status of the ToolChange Enable Checkbox even in the init stage. - added some parameters throughout camlib gcode generation functions; handled some possible errors (e.g like when attempting to use an empty Custom GCode Toolchange) +- added toggle effect for the tools in the toolbar. +- enhanced the toggle effect for the tools in the Tools Toolbar and also for Notebook Tab selection: if the current tool is activated it will toggle the notebook side but only if the installed widget is itself. If coming from another tool, the notebook will stay visible +- 26.02.2019 diff --git a/flatcamTools/ToolCalculators.py b/flatcamTools/ToolCalculators.py index 60c5a3e1..5743d88a 100644 --- a/flatcamTools/ToolCalculators.py +++ b/flatcamTools/ToolCalculators.py @@ -225,12 +225,15 @@ class ToolCalculator(FlatCAMTool): def run(self): self.app.report_usage("ToolCalculators()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Calc. Tool") diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py index 593368cc..10340ced 100644 --- a/flatcamTools/ToolCutOut.py +++ b/flatcamTools/ToolCutOut.py @@ -196,12 +196,15 @@ class CutOut(FlatCAMTool): def run(self): self.app.report_usage("ToolCutOut()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Cutout Tool") diff --git a/flatcamTools/ToolDblSided.py b/flatcamTools/ToolDblSided.py index 2e1db762..acfb6444 100644 --- a/flatcamTools/ToolDblSided.py +++ b/flatcamTools/ToolDblSided.py @@ -264,12 +264,15 @@ class DblSidedTool(FlatCAMTool): def run(self): self.app.report_usage("Tool2Sided()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "2-Sided Tool") diff --git a/flatcamTools/ToolFilm.py b/flatcamTools/ToolFilm.py index 6129b8d4..8dc9dd02 100644 --- a/flatcamTools/ToolFilm.py +++ b/flatcamTools/ToolFilm.py @@ -166,12 +166,15 @@ class Film(FlatCAMTool): def run(self): self.app.report_usage("ToolFilm()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Film Tool") diff --git a/flatcamTools/ToolImage.py b/flatcamTools/ToolImage.py index e681dc8e..53feb6a6 100644 --- a/flatcamTools/ToolImage.py +++ b/flatcamTools/ToolImage.py @@ -134,12 +134,15 @@ class ToolImage(FlatCAMTool): def run(self): self.app.report_usage("ToolImage()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Image Tool") diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py index e995480b..75a3e8e8 100644 --- a/flatcamTools/ToolNonCopperClear.py +++ b/flatcamTools/ToolNonCopperClear.py @@ -246,12 +246,15 @@ class NonCopperClear(FlatCAMTool, Gerber): def run(self): self.app.report_usage("ToolNonCopperClear()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.build_ui() self.app.ui.notebook.setTabText(2, "NCC Tool") diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index 464bb531..6222ca77 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -304,12 +304,15 @@ class ToolPaint(FlatCAMTool, Gerber): def run(self): self.app.report_usage("ToolPaint()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Paint Tool") diff --git a/flatcamTools/ToolPanelize.py b/flatcamTools/ToolPanelize.py index 8cfef018..e4c4aa72 100644 --- a/flatcamTools/ToolPanelize.py +++ b/flatcamTools/ToolPanelize.py @@ -200,12 +200,15 @@ class Panelize(FlatCAMTool): def run(self): self.app.report_usage("ToolPanelize()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Panel. Tool") diff --git a/flatcamTools/ToolProperties.py b/flatcamTools/ToolProperties.py index a6f9437c..65e13dd7 100644 --- a/flatcamTools/ToolProperties.py +++ b/flatcamTools/ToolProperties.py @@ -55,9 +55,12 @@ class Properties(FlatCAMTool): return self.set_tool_ui() - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) FlatCAMTool.run(self) self.properties() diff --git a/flatcamTools/ToolSolderPaste.py b/flatcamTools/ToolSolderPaste.py index 4258b376..08160c02 100644 --- a/flatcamTools/ToolSolderPaste.py +++ b/flatcamTools/ToolSolderPaste.py @@ -414,13 +414,17 @@ class SolderPaste(FlatCAMTool): def run(self): self.app.report_usage("ToolSolderPaste()") + # if the splitter is hidden, display it, else hide it but only if the current widget is the same + if self.app.ui.splitter.sizes()[0] == 0: + self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + FlatCAMTool.run(self) self.set_tool_ui() self.build_ui() - # if the splitter us hidden, display it - if self.app.ui.splitter.sizes()[0] == 0: - self.app.ui.splitter.setSizes([1, 1]) self.app.ui.notebook.setTabText(2, "SolderPaste Tool") def install(self, icon=None, separator=None, **kwargs): diff --git a/flatcamTools/ToolTransform.py b/flatcamTools/ToolTransform.py index 2540f9bb..08628531 100644 --- a/flatcamTools/ToolTransform.py +++ b/flatcamTools/ToolTransform.py @@ -365,12 +365,15 @@ class ToolTransform(FlatCAMTool): def run(self): self.app.report_usage("ToolTransform()") - FlatCAMTool.run(self) - self.set_tool_ui() - - # if the splitter us hidden, display it + # if the splitter is hidden, display it, else hide it but only if the current widget is the same if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + else: + if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: + self.app.ui.splitter.setSizes([0, 1]) + + FlatCAMTool.run(self) + self.set_tool_ui() self.app.ui.notebook.setTabText(2, "Transform Tool")