comparison frontends/src/primitivus/config.py @ 1165:ca15fb1abbc4

primitivus: added disable_mouse config option /!\ minimal Urwid version is now 1.2.0
author Goffi <goffi@goffi.org>
date Thu, 04 Sep 2014 20:30:57 +0200
parents 85fd02356dba
children 069ad98b360d
comparison
equal deleted inserted replaced
1164:af395a6f2551 1165:ca15fb1abbc4
22 from sat_frontends.primitivus.constants import Const as C 22 from sat_frontends.primitivus.constants import Const as C
23 from sat_frontends.primitivus.keys import action_key_map 23 from sat_frontends.primitivus.keys import action_key_map
24 import ConfigParser 24 import ConfigParser
25 25
26 26
27 def applyConfig(): 27 def applyConfig(host):
28 """Parse configuration and apply found change 28 """Parse configuration and apply found change
29 29
30 raise: can raise various Exceptions if configuration is not good 30 raise: can raise various Exceptions if configuration is not good
31 """ 31 """
32 config = ConfigParser.SafeConfigParser() 32 config = ConfigParser.SafeConfigParser()
41 action = name[len(C.CONFIG_OPT_KEY_PREFIX):].upper() 41 action = name[len(C.CONFIG_OPT_KEY_PREFIX):].upper()
42 shortcut = value 42 shortcut = value
43 if not action or not shortcut: 43 if not action or not shortcut:
44 raise ValueError("Bad option: {} = {}".format(name, value)) 44 raise ValueError("Bad option: {} = {}".format(name, value))
45 shortcuts[action] = shortcut 45 shortcuts[action] = shortcut
46 if name == "disable_mouse":
47 host.loop.screen.set_mouse_tracking(False)
46 48
47 action_key_map.replace(shortcuts) 49 action_key_map.replace(shortcuts)
48 action_key_map.check_namespaces() 50 action_key_map.check_namespaces()