From 0f04eb1215cc0a007f608005f40fb8c773fc269f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 1 Jun 2020 23:09:15 +0300 Subject: [PATCH] - 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 --- AppGUI/GUIElements.py | 18 +++++++++++++ AppGUI/MainGUI.py | 16 ++++++++---- AppGUI/preferences/PreferencesUIManager.py | 7 +++++ App_Main.py | 24 ++++++++++++++++++ CHANGELOG.md | 3 +++ assets/resources/dark_resources/hud16.png | Bin 0 -> 137 bytes assets/resources/dark_resources/hud_32.png | Bin 0 -> 224 bytes .../resources/dark_resources/settings18.png | Bin 0 -> 738 bytes assets/resources/hud16.png | Bin 0 -> 382 bytes assets/resources/settings18.png | Bin 0 -> 597 bytes 10 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 assets/resources/dark_resources/hud16.png create mode 100644 assets/resources/dark_resources/hud_32.png create mode 100644 assets/resources/dark_resources/settings18.png create mode 100644 assets/resources/hud16.png create mode 100644 assets/resources/settings18.png 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 0000000000000000000000000000000000000000..5006f6e6eb7bb98a21b834608e88aa03e7bf751d GIT binary patch literal 137 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`0iG_7Ar}70DG3P)J8FJ@su%Fp zx^VSsYD!BcTcL*`!!rIHhLy7t#TvgPNi>{xy>WznC*uw#5z9RvsuCaYI`rRCl;BRO kZoKlxp)zfei8V7r@7*m6{XQ=W1Deg?>FVdQ&MBb@0R0v(4*&oF literal 0 HcmV?d00001 diff --git a/assets/resources/dark_resources/hud_32.png b/assets/resources/dark_resources/hud_32.png new file mode 100644 index 0000000000000000000000000000000000000000..85f44019834c1947dd23b423b3f81465184076bd GIT binary patch literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ<(@8%ArbCxrzi3?C~&lXcDVOn zL1x9W*}Vl^TM~Eft&7}y@VRp2lIB>Kl25-^l%BKPdZTos*2X&lj4v51Vq2JNHj6sg zb$Dncf0|?N@a3GlKs7_fsg$c`b6+*sC`PSZQ^jzgu~zm&*{O>wE8j9O*p)NP72rG2 z_>}L&{WAUoKG}Ik?;T6N%DkX>LB#T_*R$3ytL9O=*YCrzopr0Eq8g-v9sr literal 0 HcmV?d00001 diff --git a/assets/resources/dark_resources/settings18.png b/assets/resources/dark_resources/settings18.png new file mode 100644 index 0000000000000000000000000000000000000000..5143f21aadd22ce716f241c421b1e6ac634bc1f4 GIT binary patch literal 738 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaFeV{wqX6XVU3I`u#fXMsm#F#`kN z5fEmas?8@2R3I4O6XFV#y#4m=lb3HFzkK`j#oO1fUq5>F4#)-~px_fA`xS`&_$5#f zDh`tcO1%SVdT#oNnJ=)QqR0g#c^30 z^A<RWttAhpX9!n z6Sr$hS#?>wFdN6Zpgk#D?_{^+-C3ymak1f@dxb_7CMQf5%AL6L*STYgyh-hx#zVHY z&Ps<@g)RSWG;`lMaqp?IYZ+5nFK(&UtDU_+pXqmQ#Oi>RjkaIXx_xDs7Oc2Fw@#q+ z=fj#;yLSXMXG~hO!tSRo%Q11WA2!FiD$?H^m*}af-}-mExRmi3t9c)!y)P^AtcdrF Q0fst*r>mdKI;Vst0Cmu%p#T5? literal 0 HcmV?d00001 diff --git a/assets/resources/hud16.png b/assets/resources/hud16.png new file mode 100644 index 0000000000000000000000000000000000000000..f216018b88da14f64b52b45eb8c8a7541f33ed14 GIT binary patch literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6XVU3I`u#fXMsm#F#`kN z5fEmas?8@26s!pF32_C|0|G=(cys_Q)+h<`3ub7W)jF@(H9BcUd(-mm$?Nxi`abuo z=8ykrzcxO2-POS-D#N*MSy|B9Lb1g$Kt0)>E{-7;b862W=W9?9ak+T#UiJIC|NlG7 zy9k#&jP-e-!@&?dqw2VcYy#U7A8xL=n*|xM{qz4esEG(1m6`N~ebXE*6%AJ*717ZD zdq1`=dwSt36WguAM+W*P+FQO~H-E9L=05*{P3M=FS{E=1&13&l{&ez5P#Af-`njxg HN@xNAkf>oi literal 0 HcmV?d00001 diff --git a/assets/resources/settings18.png b/assets/resources/settings18.png new file mode 100644 index 0000000000000000000000000000000000000000..3e578907b2f6e035def7cdf827bd2e679c36ad9b GIT binary patch literal 597 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaFeV{wqX6XVU3I`u#fXMsm#F#`kN z5fEmas?8@26g&{%6XFV_hcw`}))xSJz@a3_FPMQz)k%a=e)-ZSwOrSY!6BPmoKyF& z-4Y>GxpmD1W^rLLw&rXWi*!ZZ$s6hpO;VTCGw)JyT$Wa^5I<2+gC`}&^{a~+(5y$E zE{-7;b3!NFtZFh4XkE_fxN?&VPm4#);-IE&dPigL|6j}HVPBG$_H6$Q%jXOsUmFd~ zIQC4tnYCSa^G$o}9og3F+^g+YdEQTQJW;8_R`~y<)ijyDQwJsdmu==sG-EN1*O|s8 z)OI>vjo0m!_EoFsm0K6gVaTdfJaakUsqPYQ%e^x8-|^F(*Kzv>JwI?a;eQw3KVivf zvImX4my~Q$?tC+uaf#J_udj;Mryu=Uy5*{Lk7I7pe~oNGhB_P1Yp&|opNQShb`Dn4 za(;7PU;+EGd5>?2+z%9HyU$g)YtK{HGT)Z^^XX!qU)mFYfTG^h)z4*}Q$iB}>};3R literal 0 HcmV?d00001