diff --git a/CHANGELOG.md b/CHANGELOG.md index a11fe4ff..0eb9b784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - Levelling Tool - mare sure that there are no duplicate seed points when creating Voronoi polygons - Levelling Tool - fix of missing variable declaration (forgot to take everything when I moved the functionality from the CNCJob class to its own class) +- made sure that possible temporary drawn shapes are deleted when the UI of the Plugin that created them is closed (by closing it in the Plugin Tab) 6.03.2021 diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index d5e42762..b5d87423 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -903,7 +903,7 @@ class MainGUI(QtWidgets.QMainWindow): self.setCentralWidget(self.splitter) # self.notebook = QtWidgets.QTabWidget() - self.notebook = FCDetachableTab(protect=True, protect_by_name=[_("Project"), _("Properties")], parent=self) + self.notebook = FCDetachableTab2(protect=True, protect_by_name=[_("Project"), _("Properties")], parent=self) # self.notebook.setTabsClosable(False) self.notebook.useOldIndex(True) diff --git a/app_Main.py b/app_Main.py index d22eb547..ee838f3c 100644 --- a/app_Main.py +++ b/app_Main.py @@ -1544,6 +1544,9 @@ class App(QtCore.QObject): # signal emitted when a tab is closed in the Plot Area self.ui.plot_tab_area.tab_closed_signal.connect(self.on_plot_area_tab_closed) + # signal emitted when a tab is closed in the Plot Area + self.ui.notebook.tab_closed_signal.connect(self.on_notebook_closed) + # signal to close the application self.close_app_signal.connect(self.kill_app) # ################################# FINISHED CONNECTING SIGNALS ############################################# @@ -6496,6 +6499,18 @@ class App(QtCore.QObject): self.ui.toggle_coords(checked=self.defaults["global_coordsbar_show"]) self.ui.toggle_delta_coords(checked=self.defaults["global_delta_coordsbar_show"]) + def on_notebook_closed(self, tab_obj_name): + closed_plugin_name = self.ui.plugin_scroll_area.widget().objectName() + # print(closed_plugin_name) + if closed_plugin_name == _("Levelling"): + # clear the possible drawn probing shapes + self.levelling_tool.probing_shapes.clear(update=True) + elif closed_plugin_name in [_("Isolation"), _("NCC"), _("Paint"), _("Punch Gerber")]: + self.tool_shapes.clear(update=True) + + def on_close_notebook_tab(self): + self.tool_shapes.clear(update=True) + def on_flipy(self): """ Executed when the menu entry in Options -> Flip on Y axis is clicked. @@ -6868,9 +6883,6 @@ class App(QtCore.QObject): else: self.inform.emit('[WARNING_NOTCL] %s...' % _("Delete Grid value cancelled")) - def on_close_notebook_tab(self): - self.tool_shapes.clear(update=True) - def on_copy_name(self): self.defaults.report_usage("on_copy_name()")