2014-10-27 16:29:04 -06:00
|
|
|
# -*- coding: cp1252 -*-
|
2015-03-30 10:55:56 -06:00
|
|
|
import config_utils
|
2014-10-27 16:29:04 -06:00
|
|
|
import paths
|
2015-01-18 17:19:39 -06:00
|
|
|
import logging
|
2016-08-03 09:45:31 -05:00
|
|
|
import platform
|
2015-01-18 17:19:39 -06:00
|
|
|
|
|
|
|
log = logging.getLogger("config")
|
2014-10-27 16:29:04 -06:00
|
|
|
|
2014-11-12 20:41:29 -06:00
|
|
|
MAINFILE = "twblue.conf"
|
|
|
|
MAINSPEC = "app-configuration.defaults"
|
2017-01-16 08:49:49 -06:00
|
|
|
proxyTypes=[u"http", u"https", u"socks4", u"socks5"]
|
2014-11-12 20:41:29 -06:00
|
|
|
app = None
|
2015-05-16 00:13:54 -05:00
|
|
|
keymap=None
|
2016-08-03 09:45:31 -05:00
|
|
|
changed_keymap = False
|
|
|
|
|
2014-10-27 16:29:04 -06:00
|
|
|
def setup ():
|
2014-11-12 20:41:29 -06:00
|
|
|
global app
|
2015-01-18 17:19:39 -06:00
|
|
|
log.debug("Loading global app settings...")
|
2015-03-30 10:55:56 -06:00
|
|
|
app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
|
2015-05-16 00:13:54 -05:00
|
|
|
log.debug("Loading keymap...")
|
|
|
|
global keymap
|
2016-08-03 09:45:31 -05:00
|
|
|
if float(platform.version()[:2]) >= 10 and app["app-settings"]["load_keymap"] == "default.keymap":
|
|
|
|
app["app-settings"]["load_keymap"] = "Windows 10.keymap"
|
|
|
|
app.write()
|
|
|
|
global changed_keymap
|
|
|
|
changed_keymap = True
|
2016-12-29 11:41:31 -06:00
|
|
|
keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']), copy=False)
|