- modified the method that detects which tab was closed in the Plot Area so it will no longer depend on it's translated text but on it's objectName set on the QTab creation
This commit is contained in:
@@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- minor bugs fixed (not so visible)
|
- minor bugs fixed (not so visible)
|
||||||
- promoted some methods to be static
|
- promoted some methods to be static
|
||||||
- set the default layout on first run to the 'minimal' value
|
- set the default layout on first run to the 'minimal' value
|
||||||
|
- modified the method that detects which tab was closed in the Plot Area so it will no longer depend on it's translated text but on it's objectName set on the QTab creation
|
||||||
|
|
||||||
28.04.2020
|
28.04.2020
|
||||||
|
|
||||||
|
|||||||
@@ -3474,6 +3474,7 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
# BookDialog(app=self, storage=self.defaults["global_bookmarks"], parent=self.ui).exec_()
|
# BookDialog(app=self, storage=self.defaults["global_bookmarks"], parent=self.ui).exec_()
|
||||||
self.book_dialog_tab = BookmarkManager(app=self, storage=self.defaults["global_bookmarks"], parent=self.ui)
|
self.book_dialog_tab = BookmarkManager(app=self, storage=self.defaults["global_bookmarks"], parent=self.ui)
|
||||||
|
self.book_dialog_tab.setObjectName("bookmarks_tab")
|
||||||
|
|
||||||
# add the tab if it was closed
|
# add the tab if it was closed
|
||||||
self.ui.plot_tab_area.addTab(self.book_dialog_tab, _("Bookmarks Manager"))
|
self.ui.plot_tab_area.addTab(self.book_dialog_tab, _("Bookmarks Manager"))
|
||||||
@@ -6013,19 +6014,17 @@ class App(QtCore.QObject):
|
|||||||
else:
|
else:
|
||||||
self.inform.emit('[ERROR_NOTCL] %s' % _("Adding tool from DB is not allowed for this object."))
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Adding tool from DB is not allowed for this object."))
|
||||||
|
|
||||||
def on_plot_area_tab_closed(self, title):
|
def on_plot_area_tab_closed(self, tab_obj_name):
|
||||||
"""
|
"""
|
||||||
Executed whenever a tab is closed in the Plot Area.
|
Executed whenever a QTab is closed in the Plot Area.
|
||||||
|
|
||||||
:param title: The name of the tab that was closed.
|
:param title: The objectName of the Tab that was closed. This objectName is assigned on Tab creation
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
# FIXME: doing this based on translated title doesn't seem very robust.
|
|
||||||
|
|
||||||
if title == _("Preferences"):
|
if tab_obj_name == "preferences_tab":
|
||||||
self.preferencesUiManager.on_close_preferences_tab()
|
self.preferencesUiManager.on_close_preferences_tab()
|
||||||
|
elif tab_obj_name == "database_tab":
|
||||||
if title == _("Tools Database"):
|
|
||||||
# disconnect the signals from the table widget in tab
|
# disconnect the signals from the table widget in tab
|
||||||
self.tools_db_tab.ui_disconnect()
|
self.tools_db_tab.ui_disconnect()
|
||||||
|
|
||||||
@@ -6051,13 +6050,13 @@ class App(QtCore.QObject):
|
|||||||
self.inform.emit('')
|
self.inform.emit('')
|
||||||
return
|
return
|
||||||
self.tools_db_tab.deleteLater()
|
self.tools_db_tab.deleteLater()
|
||||||
|
elif tab_obj_name == "text_editor_tab":
|
||||||
if title == _("Code Editor"):
|
|
||||||
self.toggle_codeeditor = False
|
self.toggle_codeeditor = False
|
||||||
|
elif tab_obj_name == "bookmarks_tab":
|
||||||
if title == _("Bookmarks Manager"):
|
|
||||||
self.book_dialog_tab.rebuild_actions()
|
self.book_dialog_tab.rebuild_actions()
|
||||||
self.book_dialog_tab.deleteLater()
|
self.book_dialog_tab.deleteLater()
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
def on_plotarea_tab_closed(self, tab_idx):
|
def on_plotarea_tab_closed(self, tab_idx):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -2088,9 +2088,9 @@ class FCDetachableTab2(FCDetachableTab):
|
|||||||
:param currentIndex:
|
:param currentIndex:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
idx = self.currentIndex()
|
# idx = self.currentIndex()
|
||||||
|
self.tab_name = self.widget(currentIndex).objectName()
|
||||||
self.tab_closed_signal.emit(self.tabText(idx))
|
self.tab_closed_signal.emit(self.tab_name)
|
||||||
|
|
||||||
self.removeTab(currentIndex)
|
self.removeTab(currentIndex)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user