Keymap: load/save improvements
- avoid passing redundant operator name to keymap property set function. - avoid double attr lookups when setting each property. - handle exceptions on value type mismatch. - avoid resource warning on failed load.
This commit is contained in:
@@ -494,10 +494,10 @@ def keyconfig_set(filepath, report=None):
|
||||
keyconfigs_old = keyconfigs[:]
|
||||
|
||||
try:
|
||||
keyfile = open(filepath)
|
||||
exec(compile(keyfile.read(), filepath, "exec"), {"__file__": filepath})
|
||||
keyfile.close()
|
||||
error_msg = ""
|
||||
with open(filepath, 'r', encoding='utf-8') as keyfile:
|
||||
exec(compile(keyfile.read(), filepath, "exec"),
|
||||
{"__file__": filepath})
|
||||
except:
|
||||
import traceback
|
||||
error_msg = traceback.format_exc()
|
||||
|
||||
Reference in New Issue
Block a user