mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 20:53:13 -06:00
Only copy changed keystrokes in keymap.keymap and let unchanged entries in the main file
This commit is contained in:
parent
7d188a40b2
commit
9d0558468a
@ -24,4 +24,4 @@ def setup ():
|
|||||||
app.write()
|
app.write()
|
||||||
global changed_keymap
|
global changed_keymap
|
||||||
changed_keymap = True
|
changed_keymap = True
|
||||||
keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']))
|
keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']), copy=False)
|
||||||
|
@ -8,7 +8,7 @@ log = getLogger("config_utils")
|
|||||||
|
|
||||||
class ConfigLoadError(Exception): pass
|
class ConfigLoadError(Exception): pass
|
||||||
|
|
||||||
def load_config(config_path, configspec_path=None, *args, **kwargs):
|
def load_config(config_path, configspec_path=None, copy=True, *args, **kwargs):
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_path):
|
||||||
clean_config(config_path)
|
clean_config(config_path)
|
||||||
spec = ConfigObj(configspec_path, encoding='UTF8', list_values=False, _inspec=True)
|
spec = ConfigObj(configspec_path, encoding='UTF8', list_values=False, _inspec=True)
|
||||||
@ -17,7 +17,7 @@ def load_config(config_path, configspec_path=None, *args, **kwargs):
|
|||||||
except ParseError:
|
except ParseError:
|
||||||
raise ConfigLoadError("Unable to load %r" % config_path)
|
raise ConfigLoadError("Unable to load %r" % config_path)
|
||||||
validator = Validator()
|
validator = Validator()
|
||||||
validated = config.validate(validator, preserve_errors=False, copy=True)
|
validated = config.validate(validator, preserve_errors=False, copy=copy)
|
||||||
if validated == True:
|
if validated == True:
|
||||||
config.write()
|
config.write()
|
||||||
return config
|
return config
|
||||||
|
Loading…
Reference in New Issue
Block a user