Only copy changed keystrokes in keymap.keymap and let unchanged entries in the main file

This commit is contained in:
Manuel Cortez 2016-12-29 11:41:31 -06:00
parent 7d188a40b2
commit 9d0558468a
2 changed files with 3 additions and 3 deletions

View File

@ -24,4 +24,4 @@ def setup ():
app.write()
global changed_keymap
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)

View File

@ -8,7 +8,7 @@ log = getLogger("config_utils")
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):
clean_config(config_path)
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:
raise ConfigLoadError("Unable to load %r" % config_path)
validator = Validator()
validated = config.validate(validator, preserve_errors=False, copy=True)
validated = config.validate(validator, preserve_errors=False, copy=copy)
if validated == True:
config.write()
return config