- fixed an issue where the selected application translation language is not remembered as was selected and defaulting to English language
- refactored code in Preferences section
This commit is contained in:
committed by
Marius Stanciu
parent
a5c1b348fe
commit
7acabdfa0f
@@ -15,12 +15,12 @@ if '_' not in builtins.__dict__:
|
||||
|
||||
|
||||
class GeneralAPPSetGroupUI(OptionsGroupUI):
|
||||
def __init__(self, defaults, decimals=4, parent=None):
|
||||
def __init__(self, app, parent=None):
|
||||
super(GeneralAPPSetGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("App Settings")))
|
||||
self.decimals = decimals
|
||||
self.defaults = defaults
|
||||
self.decimals = app.decimals
|
||||
self.options = app.options
|
||||
|
||||
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
|
||||
if theme_settings.contains("theme"):
|
||||
|
||||
@@ -18,12 +18,12 @@ if '_' not in builtins.__dict__:
|
||||
# https://www.w3schools.com/colors/colors_names.asp
|
||||
# Colors names
|
||||
class GeneralAppPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, defaults, decimals=4, parent=None):
|
||||
def __init__(self, app, parent=None):
|
||||
super(GeneralAppPrefGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(_("App Preferences"))
|
||||
self.decimals = decimals
|
||||
self.defaults = defaults
|
||||
self.decimals = app.decimals
|
||||
self.options = app.options
|
||||
|
||||
# #############################################################################################################
|
||||
# Grid0 Frame
|
||||
@@ -200,7 +200,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
|
||||
grid3_frame.setLayout(grid3)
|
||||
|
||||
self.language_combo = FCComboBox()
|
||||
self.language_combo.addItems(self.defaults["global_languages"])
|
||||
self.language_combo.addItems(self.app.options["global_languages"])
|
||||
grid3.addWidget(self.language_combo, 0, 0, 1, 2)
|
||||
|
||||
self.language_apply_btn = FCButton(_("Apply Language"))
|
||||
|
||||
@@ -15,12 +15,12 @@ if '_' not in builtins.__dict__:
|
||||
|
||||
|
||||
class GeneralGUIPrefGroupUI(OptionsGroupUI):
|
||||
def __init__(self, defaults, decimals=4, parent=None):
|
||||
def __init__(self, app, parent=None):
|
||||
super(GeneralGUIPrefGroupUI, self).__init__(self, parent=parent)
|
||||
|
||||
self.setTitle(str(_("GUI Preferences")))
|
||||
self.decimals = decimals
|
||||
self.defaults = defaults
|
||||
self.decimals = app.decimals
|
||||
self.options = app.options
|
||||
|
||||
self.param_lbl = FCLabel('<span style="color:blue;"><b>%s</b></span>' % _("Parameters"))
|
||||
self.layout.addWidget(self.param_lbl)
|
||||
|
||||
@@ -14,20 +14,18 @@ if '_' not in builtins.__dict__:
|
||||
|
||||
|
||||
class GeneralPreferencesUI(QtWidgets.QWidget):
|
||||
def __init__(self, decimals, defaults, parent=None):
|
||||
def __init__(self, app, parent=None):
|
||||
QtWidgets.QWidget.__init__(self, parent=parent)
|
||||
self.layout = QtWidgets.QHBoxLayout()
|
||||
self.setLayout(self.layout)
|
||||
self.decimals = decimals
|
||||
self.defaults = defaults
|
||||
|
||||
self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals, defaults=self.defaults)
|
||||
self.general_app_group = GeneralAppPrefGroupUI(app=app)
|
||||
self.general_app_group.setMinimumWidth(250)
|
||||
|
||||
self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals, defaults=self.defaults)
|
||||
self.general_gui_group = GeneralGUIPrefGroupUI(app=app)
|
||||
self.general_gui_group.setMinimumWidth(250)
|
||||
|
||||
self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals, defaults=self.defaults)
|
||||
self.general_app_set_group = GeneralAPPSetGroupUI(app=app)
|
||||
self.general_app_set_group.setMinimumWidth(250)
|
||||
|
||||
self.layout.addWidget(self.general_app_group)
|
||||
|
||||
Reference in New Issue
Block a user