diff --git a/AppGUI/GUIElements.py b/AppGUI/GUIElements.py index 0cdbabba..1f07acde 100644 --- a/AppGUI/GUIElements.py +++ b/AppGUI/GUIElements.py @@ -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 diff --git a/AppGUI/MainGUI.py b/AppGUI/MainGUI.py index 66bc24bb..43b69767 100644 --- a/AppGUI/MainGUI.py +++ b/AppGUI/MainGUI.py @@ -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.") diff --git a/AppGUI/preferences/PreferencesUIManager.py b/AppGUI/preferences/PreferencesUIManager.py index 6dede0db..b8756c5f 100644 --- a/AppGUI/preferences/PreferencesUIManager.py +++ b/AppGUI/preferences/PreferencesUIManager.py @@ -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): diff --git a/App_Main.py b/App_Main.py index a916605a..b1010763 100644 --- a/App_Main.py +++ b/App_Main.py @@ -1027,6 +1027,7 @@ class App(QtCore.QObject): # ########################################################################################################### self.ui.hud_label.clicked.connect(self.plotcanvas.on_toggle_hud) self.ui.axis_status_label.clicked.connect(self.plotcanvas.on_toggle_axis) + self.ui.pref_status_label.clicked.connect(self.on_toggle_preferences) # ########################################################################################################### # ####################################### VARIOUS SIGNALS ################################################### @@ -5130,6 +5131,29 @@ class App(QtCore.QObject): if self.defaults['global_selection_shape'] is True: self.draw_selection_shape(curr_sel_obj) + def on_toggle_preferences(self): + pref_open = False + for idx in range(self.ui.plot_tab_area.count()): + if self.ui.plot_tab_area.tabText(idx) == _("Preferences"): + pref_open = True + + if pref_open: + for idx in range(self.ui.plot_tab_area.count()): + if self.ui.plot_tab_area.tabText(idx) == _("Preferences"): + self.ui.plot_tab_area.removeTab(idx) + break + self.ui.pref_status_label.setStyleSheet("") + else: + self.on_preferences() + self.ui.pref_status_label.setStyleSheet(""" + QLabel + { + color: black; + background-color: lightseagreen; + } + """ + ) + def on_preferences(self): """ Adds the Preferences in a Tab in Plot Area diff --git a/CHANGELOG.md b/CHANGELOG.md index fd455211..4bde32b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ CHANGELOG for FlatCAM beta - fix an issue with progressive plotted shapes not being deleted on the end of the job - some fixed due of recent changes and some strings changed - added a validator for the FCColorEntry GUI element such that only the valid chars are accepted +- 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 31.05.2020 diff --git a/assets/resources/dark_resources/hud16.png b/assets/resources/dark_resources/hud16.png new file mode 100644 index 00000000..5006f6e6 Binary files /dev/null and b/assets/resources/dark_resources/hud16.png differ diff --git a/assets/resources/dark_resources/hud_32.png b/assets/resources/dark_resources/hud_32.png new file mode 100644 index 00000000..85f44019 Binary files /dev/null and b/assets/resources/dark_resources/hud_32.png differ diff --git a/assets/resources/dark_resources/settings18.png b/assets/resources/dark_resources/settings18.png new file mode 100644 index 00000000..5143f21a Binary files /dev/null and b/assets/resources/dark_resources/settings18.png differ diff --git a/assets/resources/hud16.png b/assets/resources/hud16.png new file mode 100644 index 00000000..f216018b Binary files /dev/null and b/assets/resources/hud16.png differ diff --git a/assets/resources/settings18.png b/assets/resources/settings18.png new file mode 100644 index 00000000..3e578907 Binary files /dev/null and b/assets/resources/settings18.png differ