Просмотр исходного кода

- 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

Marius Stanciu 7 лет назад
Родитель
Сommit
1839843fad

+ 7 - 4
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()")
 

+ 4 - 4
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)
 

+ 3 - 0
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
 

+ 7 - 4
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")
 

+ 7 - 4
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")
 

+ 7 - 4
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")
 

+ 7 - 4
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")
 

+ 7 - 4
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")
 

+ 7 - 4
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")

+ 7 - 4
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")
 

+ 7 - 4
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")
 

+ 4 - 1
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()

+ 7 - 3
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):

+ 7 - 4
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")