Use instance method for _load_config (#4112)
This commit is contained in:
parent
cb4b7e3db0
commit
efd57870d0
|
|
@ -32,24 +32,21 @@ class LocaleConfiguration:
|
||||||
output += '{}: {}'.format(tr('Locale encoding'), self.sys_enc)
|
output += '{}: {}'.format(tr('Locale encoding'), self.sys_enc)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@classmethod
|
def _load_config(self, args: dict[str, str]) -> None:
|
||||||
def _load_config(cls, config: 'LocaleConfiguration', args: dict[str, str]) -> 'LocaleConfiguration':
|
|
||||||
if 'sys_lang' in args:
|
if 'sys_lang' in args:
|
||||||
config.sys_lang = args['sys_lang']
|
self.sys_lang = args['sys_lang']
|
||||||
if 'sys_enc' in args:
|
if 'sys_enc' in args:
|
||||||
config.sys_enc = args['sys_enc']
|
self.sys_enc = args['sys_enc']
|
||||||
if 'kb_layout' in args:
|
if 'kb_layout' in args:
|
||||||
config.kb_layout = args['kb_layout']
|
self.kb_layout = args['kb_layout']
|
||||||
|
|
||||||
return config
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parse_arg(cls, args: dict[str, Any]) -> 'LocaleConfiguration':
|
def parse_arg(cls, args: dict[str, Any]) -> 'LocaleConfiguration':
|
||||||
default = cls.default()
|
default = cls.default()
|
||||||
|
|
||||||
if 'locale_config' in args:
|
if 'locale_config' in args:
|
||||||
default = cls._load_config(default, args['locale_config'])
|
default._load_config(args['locale_config'])
|
||||||
else:
|
else:
|
||||||
default = cls._load_config(default, args)
|
default._load_config(args)
|
||||||
|
|
||||||
return default
|
return default
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue