twblue/src/config.py

29 lines
957 B
Python
Raw Normal View History

# -*- coding: cp1252 -*-
2019-06-06 11:52:23 -05:00
import os
import config_utils
import paths
2015-01-18 17:19:39 -06:00
import logging
import platform
2015-01-18 17:19:39 -06:00
log = logging.getLogger("config")
MAINFILE = "twblue.conf"
MAINSPEC = "app-configuration.defaults"
proxyTypes = ["system", "http", "socks4", "socks4a", "socks5", "socks5h"]
app = None
keymap=None
changed_keymap = False
def setup ():
global app
2015-01-18 17:19:39 -06:00
log.debug("Loading global app settings...")
2019-06-06 11:52:23 -05:00
app = config_utils.load_config(os.path.join(paths.config_path(), MAINFILE), os.path.join(paths.app_path(), MAINSPEC))
log.debug("Loading keymap...")
global keymap
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
2019-06-06 11:52:23 -05:00
keymap = config_utils.load_config(os.path.join(paths.config_path(), "keymap.keymap"), os.path.join(paths.app_path(), "keymaps/"+app['app-settings']['load_keymap']), copy=False)