- 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
This commit is contained in:
Marius Stanciu 2019-02-27 17:32:52 +02:00 committed by Marius
parent fb6edfc394
commit 1839843fad
14 changed files with 88 additions and 48 deletions

View File

@ -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()")

View File

@ -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)

View File

@ -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

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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()

View File

@ -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):

View File

@ -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")