- reverted changes in Tools regarding the toggle effect - now they work as expected

This commit is contained in:
Marius Stanciu 2019-03-11 22:58:27 +02:00
parent 255254a292
commit 090a3ff8f8
13 changed files with 95 additions and 26 deletions

View File

@ -71,9 +71,9 @@ class FlatCAMTool(QtWidgets.QWidget):
if separator is True:
pos.addSeparator()
self.menuAction.triggered.connect(lambda: self.run(toggle=True))
self.menuAction.triggered.connect(self.run)
def run(self, toggle=True):
def run(self):
if self.app.tool_tab_locked is True:
return
@ -86,17 +86,6 @@ class FlatCAMTool(QtWidgets.QWidget):
# Switch notebook to tool page
self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab)
if toggle:
# 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:
try:
if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName:
self.app.ui.splitter.setSizes([0, 1])
except AttributeError:
pass
# Set the tool name as the widget object name
self.app.ui.tool_scroll_area.widget().setObjectName(self.toolName)

View File

@ -20,7 +20,7 @@ CAD program, and create G-Code for Isolation routing.
- another changes to the final_save() function
- some strings were left outside the translation formatting - fixed
- finished the replacement of '_' symbols throughout the app which conflicted with the _() function used by the i18n
- reverted changes in Tools regarding the toggle effect - now they work as expected
10.03.2019

View File

@ -235,11 +235,18 @@ class ToolCalculator(FlatCAMTool):
self.calculate_plate_button.clicked.connect(self.on_calculate_eplate)
def run(self, toggle=True):
self.app.report_usage("ToolCalculators()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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()

View File

@ -282,7 +282,15 @@ class CutOut(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolCutOut()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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

@ -272,7 +272,15 @@ class DblSidedTool(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("Tool2Sided()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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

@ -183,7 +183,15 @@ class Film(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolFilm()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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()

View File

@ -150,7 +150,15 @@ class ToolImage(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolImage()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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

@ -262,7 +262,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
def run(self, toggle=True):
self.app.report_usage("ToolNonCopperClear()")
FlatCAMTool.run(self, toggle=toggle)
FlatCAMTool.run(self)
self.set_tool_ui()
self.build_ui()

View File

@ -320,7 +320,15 @@ class ToolPaint(FlatCAMTool, Gerber):
def run(self, toggle=True):
self.app.report_usage("ToolPaint()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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

@ -216,7 +216,15 @@ class Panelize(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolPanelize()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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

@ -69,9 +69,18 @@ class Properties(FlatCAMTool):
if self.app.tool_tab_locked is True:
return
if toggle:
# 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()
FlatCAMTool.run(self, toggle=toggle)
self.properties()
def install(self, icon=None, separator=None, **kwargs):

View File

@ -429,7 +429,15 @@ class SolderPaste(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolSolderPaste()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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()

View File

@ -378,7 +378,15 @@ class ToolTransform(FlatCAMTool):
def run(self, toggle=True):
self.app.report_usage("ToolTransform()")
FlatCAMTool.run(self, toggle=toggle)
if toggle:
# 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"))