diff --git a/CHANGELOG.md b/CHANGELOG.md index b171fa51..c569621c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,17 @@ CHANGELOG for FlatCAM beta ================================================= +20.11.2020 + +- fixed the Distance adn Minimal Distance Tools not showing +- in Geometry Editor and in the Gerber Editor made sure that for the sub-tools that open in the Tool Tab, if the tab is closed then the Select Tool is automatically selected. And also trying to open that sub-tool again will open a new tab. + 19.11.2020 - cleaned up the Geometry Properties UI - in Geometry Properties UI restored the plot functionality - in Tool Cutout fixed issues when using a negative value for the Margin parameter when the cutout object is a Gerber object - fixed the Gerber parser such that when it encounter an aperture with size 0.0 it will replace it with the smallest number that is still displayed which is (10 ** -self.decimals); previously it replaced with a too small number (1e-12) -- fixed the Distance adn Minimal Distance Tools not showing 17.11.2020 diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index a0116d13..da2679c7 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -132,8 +132,26 @@ class BufferSelectionTool(AppTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + # if the Tool Tab is hidden display it, else hide it but only if the objectName is the same + found_idx = None + for idx in range(self.app.ui.notebook.count()): + if self.app.ui.notebook.widget(idx).objectName() == "tool_tab": + found_idx = idx + break + # show the Tab + if not found_idx: + self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Tool")) + # focus on Tool Tab + self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab) + + self.app.ui.notebook.callback_on_close = self.on_tab_close + self.app.ui.notebook.setTabText(2, _("Buffer Tool")) + def on_tab_close(self): + self.draw_app.select_tool("select") + self.app.ui.notebook.callback_on_close = lambda: None + def on_buffer(self): try: buffer_distance = float(self.buffer_distance_entry.get_value()) @@ -197,10 +215,11 @@ class TextInputTool(AppTool): toolName = _("Text Input Tool") - def __init__(self, app): + def __init__(self, app, draw_app): AppTool.__init__(self, app) self.app = app + self.draw_app = draw_app self.text_path = [] self.decimals = self.app.decimals @@ -350,8 +369,26 @@ class TextInputTool(AppTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + # if the Tool Tab is hidden display it, else hide it but only if the objectName is the same + found_idx = None + for idx in range(self.app.ui.notebook.count()): + if self.app.ui.notebook.widget(idx).objectName() == "tool_tab": + found_idx = idx + break + # show the Tab + if not found_idx: + self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Tool")) + # focus on Tool Tab + self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab) + + self.app.ui.notebook.callback_on_close = self.on_tab_close + self.app.ui.notebook.setTabText(2, _("Text Tool")) + def on_tab_close(self): + self.draw_app.select_tool("select") + self.app.ui.notebook.callback_on_close = lambda: None + def on_apply_button(self): font_to_geo_type = "" @@ -548,8 +585,26 @@ class PaintOptionsTool(AppTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + # if the Tool Tab is hidden display it, else hide it but only if the objectName is the same + found_idx = None + for idx in range(self.app.ui.notebook.count()): + if self.app.ui.notebook.widget(idx).objectName() == "tool_tab": + found_idx = idx + break + # show the Tab + if not found_idx: + self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Tool")) + # focus on Tool Tab + self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab) + + self.app.ui.notebook.callback_on_close = self.on_tab_close + self.app.ui.notebook.setTabText(2, _("Paint Tool")) + def on_tab_close(self): + self.fcdraw.select_tool("select") + self.app.ui.notebook.callback_on_close = lambda: None + def set_tool_ui(self): # Init appGUI if self.app.defaults["tools_paint_tooldia"]: @@ -1025,6 +1080,20 @@ class TransformEditorTool(AppTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + # if the Tool Tab is hidden display it, else hide it but only if the objectName is the same + found_idx = None + for idx in range(self.app.ui.notebook.count()): + if self.app.ui.notebook.widget(idx).objectName() == "tool_tab": + found_idx = idx + break + # show the Tab + if not found_idx: + self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Tool")) + # focus on Tool Tab + self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab) + + self.app.ui.notebook.callback_on_close = self.on_tab_close + if toggle: try: if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: @@ -1039,6 +1108,10 @@ class TransformEditorTool(AppTool): self.app.ui.notebook.setTabText(2, _("Transform Tool")) + def on_tab_close(self): + self.draw_app.select_tool("select") + self.app.ui.notebook.callback_on_close = lambda: None + def install(self, icon=None, separator=None, **kwargs): AppTool.install(self, icon, separator, shortcut='Alt+T', **kwargs) @@ -2890,7 +2963,7 @@ class FCText(FCShapeTool): self.draw_app.app.inform.emit(_("Click on 1st point ...")) self.origin = (0, 0) - self.text_gui = TextInputTool(app=self.app) + self.text_gui = TextInputTool(app=self.app, draw_app=self.draw_app) self.text_gui.run() self.draw_app.app.jump_signal.connect(lambda x: self.draw_app.update_utility_geometry(data=x)) diff --git a/appEditors/AppGerberEditor.py b/appEditors/AppGerberEditor.py index 094e308c..210038b8 100644 --- a/appEditors/AppGerberEditor.py +++ b/appEditors/AppGerberEditor.py @@ -6123,6 +6123,20 @@ class TransformEditorTool(AppTool): if self.app.ui.splitter.sizes()[0] == 0: self.app.ui.splitter.setSizes([1, 1]) + # if the Tool Tab is hidden display it, else hide it but only if the objectName is the same + found_idx = None + for idx in range(self.app.ui.notebook.count()): + if self.app.ui.notebook.widget(idx).objectName() == "tool_tab": + found_idx = idx + break + # show the Tab + if not found_idx: + self.app.ui.notebook.addTab(self.app.ui.tool_tab, _("Tool")) + # focus on Tool Tab + self.app.ui.notebook.setCurrentWidget(self.app.ui.tool_tab) + + self.app.ui.notebook.callback_on_close = self.on_tab_close + if toggle: try: if self.app.ui.tool_scroll_area.widget().objectName() == self.toolName: @@ -6180,6 +6194,10 @@ class TransformEditorTool(AppTool): self.app.ui.splitter.setSizes([0, 1]) + def on_tab_close(self): + self.draw_app.select_tool("select") + self.app.ui.notebook.callback_on_close = lambda: None + def on_reference_changed(self, index): if index == 0 or index == 1: # "Origin" or "Selection" reference self.point_label.hide() diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 338c34ad..ac49bac7 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -2624,6 +2624,9 @@ class FCDetachableTab(QtWidgets.QTabWidget): self.setTabsClosable(True) self.tabCloseRequested.connect(self.closeTab) + # called when one of the tabs is closed + self.callback_on_close = lambda: None + def set_rmb_callback(self, callback): """ @@ -2685,7 +2688,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): :param currentIndex: :return: """ - + self.callback_on_close() self.removeTab(currentIndex) def on_closetab_middle_button(self, current_index): @@ -2697,6 +2700,7 @@ class FCDetachableTab(QtWidgets.QTabWidget): # if tab is protected don't delete it if self.tabBar.tabButton(current_index, QtWidgets.QTabBar.RightSide) is not None: + self.callback_on_close() self.removeTab(current_index) def protectTab(self, currentIndex):