- some UI changes in the Preferences: the clicked tab now have a distinctive color (green) and some strings are optimized

This commit is contained in:
Marius Stanciu
2022-01-09 16:39:06 +02:00
committed by Marius
parent 12e69af3ef
commit 9d9bfa8b03
23 changed files with 64 additions and 42 deletions

View File

@@ -708,6 +708,9 @@ class PreferencesUIManager:
}
# set the colors of the tab text's to default and the color of the first tab is 'green'
self.ui.on_pref_tabbar_clicked(0)
def defaults_read_form(self):
"""
Will read all the values in the Preferences GUI and update the defaults dictionary.
@@ -1118,28 +1121,6 @@ class PreferencesUIManager:
if should_restart is True:
self.ui.app.on_app_restart()
def on_pref_close_button(self):
# Preferences saved, update flag
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("")
self.defaults_write_form(source_dict=self.defaults.current_defaults)
self.defaults.update(self.defaults.current_defaults)
# Preferences save, update the color of the Preferences Tab text
for idx in range(self.ui.plot_tab_area.count()):
if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
self.ui.plot_tab_area.tabBar.setTabTextColor(idx, self.old_color)
self.ui.plot_tab_area.closeTab(idx)
break
self.inform.emit('%s' % _("Preferences closed without saving."))
self.ignore_tab_close_event = False
def on_restore_defaults_preferences(self):
"""
Loads the application's factory default settings into ``self.defaults``.
@@ -1310,3 +1291,25 @@ class PreferencesUIManager:
self.preferences_changed_flag = False
self.inform.emit('')
return
def on_pref_close_button(self):
# Preferences saved, update flag
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("")
self.defaults_write_form(source_dict=self.defaults.current_defaults)
self.defaults.update(self.defaults.current_defaults)
# Preferences save, update the color of the Preferences Tab text
for idx in range(self.ui.plot_tab_area.count()):
if self.ui.plot_tab_area.tabText(idx) == _("Preferences"):
self.ui.plot_tab_area.tabBar.setTabTextColor(idx, self.old_color)
self.ui.plot_tab_area.closeTab(idx)
break
self.inform.emit('%s' % _("Preferences closed without saving."))
self.ignore_tab_close_event = False

View File

@@ -18,7 +18,7 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
self.decimals = decimals
self.defaults = defaults
self.setTitle(str(_("CNC Job Adv. Options")))
self.setTitle(str(_("Adv. Options")))
# #############################################################################################################
# PARAMETERS Frame

View File

@@ -18,7 +18,7 @@ class CNCJobEditorPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
super(CNCJobEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("CNC Job Editor")))
self.setTitle(str(_("Editor")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
super(CNCJobGenPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("CNC Job General")))
self.setTitle(str(_("General")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -18,7 +18,7 @@ class CNCJobOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
super(CNCJobOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("CNC Job Options")))
self.setTitle(str(_("Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
super(ExcellonAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Adv. Options")))
self.setTitle(str(_("Adv. Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -16,7 +16,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
def __init__(self, defaults, decimals=4, parent=None):
super(ExcellonEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Editor")))
self.setTitle(str(_("Editor")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -16,7 +16,7 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI):
def __init__(self, defaults, decimals=4, parent=None):
super(ExcellonExpPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Export")))
self.setTitle(str(_("Export")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -20,7 +20,7 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonGenPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon General")))
self.setTitle(str(_("General")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Excellon Options")))
self.setTitle(str(_("Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
super(GeometryAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry Adv. Options")))
self.setTitle(str(_("Adv. Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class GeometryEditorPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GeometryEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry Editor")))
self.setTitle(str(_("Editor")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -16,7 +16,7 @@ class GeometryExpPrefGroupUI(OptionsGroupUI):
def __init__(self, defaults, decimals=4, parent=None):
super(GeometryExpPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry Export")))
self.setTitle(str(_("Export")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -19,7 +19,7 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
super(GeometryGenPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry General")))
self.setTitle(str(_("General")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -18,7 +18,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
super(GeometryOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Geometry Options")))
self.setTitle(str(_("Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -18,7 +18,7 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GerberAdvOptPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Gerber Adv. Options")))
self.setTitle(str(_("Adv. Options")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -18,7 +18,7 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GerberEditorPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Gerber Editor")))
self.setTitle(str(_("Editor")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -17,7 +17,7 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
def __init__(self, defaults, decimals=4, parent=None):
super(GerberExpPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Gerber Export")))
self.setTitle(str(_("Export")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -18,7 +18,7 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
# OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
super(GerberGenPrefGroupUI, self).__init__(self, parent=parent)
self.setTitle(str(_("Gerber General")))
self.setTitle(str(_("General")))
self.decimals = decimals
self.defaults = defaults

View File

@@ -20,7 +20,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
self.decimals = decimals
self.defaults = defaults
self.setTitle(str(_("Gerber Options")))
self.setTitle(str(_("Options")))
# #############################################################################################################
# Non-copper Regions Frame