- changed the status bar label to have an icon instead of text

- added a label in status bar that will toggle the Preferences tab
- made some changes such that that the label in status bar for toggling the Preferences Tab will be updated in various cases of closing the tab
This commit is contained in:
Marius Stanciu
2020-06-01 23:09:15 +03:00
committed by Marius
parent cb5a20fda6
commit 0f04eb1215
10 changed files with 63 additions and 5 deletions

View File

@@ -2231,6 +2231,24 @@ class FCDetachableTab2(FCDetachableTab):
def __init__(self, protect=None, protect_by_name=None, parent=None):
super(FCDetachableTab2, self).__init__(protect=protect, protect_by_name=protect_by_name, parent=parent)
try:
self.tabBar.onCloseTabSignal.disconnect()
except TypeError:
pass
self.tabBar.onCloseTabSignal.connect(self.on_closetab_middle_button)
def on_closetab_middle_button(self, current_index):
"""
:param current_index:
:return:
"""
# if tab is protected don't delete it
if self.tabBar.tabButton(current_index, QtWidgets.QTabBar.RightSide) is not None:
self.closeTab(current_index)
def closeTab(self, currentIndex):
"""
Slot connected to the tabCloseRequested signal

View File

@@ -1103,11 +1103,22 @@ class MainGUI(QtWidgets.QMainWindow):
self.status_toolbar.addWidget(self.axis_status_label)
self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
self.pref_status_label = FCLabel()
self.pref_status_label.setToolTip(_("Preferences"))
self.pref_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/settings18.png'))
self.status_toolbar.addWidget(self.pref_status_label)
self.shell_status_label = FCLabel()
self.shell_status_label.setToolTip(_("Command Line"))
self.shell_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/shell20.png'))
self.status_toolbar.addWidget(self.shell_status_label)
self.hud_label = FCLabel()
self.hud_label.setToolTip(_("HUD (Heads up display)"))
self.hud_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/hud16.png'))
self.status_toolbar.addWidget(self.hud_label)
self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False)
self.corner_snap_btn = self.status_toolbar.addAction(
@@ -1538,11 +1549,6 @@ class MainGUI(QtWidgets.QMainWindow):
self.status_toolbar.setMaximumHeight(24)
self.infobar.addWidget(self.status_toolbar)
self.hud_label = FCLabel("H")
self.hud_label.setToolTip(_("HUD (Heads up display)"))
self.hud_label.setMargin(2)
self.infobar.addWidget(self.hud_label)
self.wplace_label = FCLabel("A4")
self.wplace_label.setToolTip(_("Draw a delimiting rectangle on canvas.\n"
"The purpose is to illustrate the limits for our work.")

View File

@@ -948,10 +948,14 @@ class PreferencesUIManager:
self.preferences_changed_flag = False
self.ignore_tab_close_event = True
# restore stylesheet to default for the statusBar icon
self.ui.pref_status_label.setStyleSheet("")
try:
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.disconnect()
except (TypeError, AttributeError):
pass
self.defaults_write_form(source_dict=self.defaults.current_defaults)
self.ui.general_defaults_form.general_app_group.units_radio.activated_custom.connect(
lambda: self.ui.app.on_toggle_units(no_pref=False))
@@ -1076,6 +1080,9 @@ class PreferencesUIManager:
if self.ignore_tab_close_event:
return
# restore stylesheet to default for the statusBar icon
self.ui.pref_status_label.setStyleSheet("")
# disconnect
for idx in range(self.ui.pref_tab_area.count()):
for tb in self.ui.pref_tab_area.widget(idx).findChildren(QtCore.QObject):