Changes default keymap to win10 keymap automatically

This commit is contained in:
Manuel Cortez 2016-08-03 09:45:31 -05:00
parent 14b2189840
commit 696d1764bd
3 changed files with 14 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import config_utils
import paths
import logging
import platform
log = logging.getLogger("config")
@ -10,10 +11,17 @@ MAINSPEC = "app-configuration.defaults"
app = None
keymap=None
changed_keymap = False
def setup ():
global app
log.debug("Loading global app settings...")
app = config_utils.load_config(paths.config_path(MAINFILE), 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
keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']))

View File

@ -1161,6 +1161,8 @@ class Controller(object):
return keymap
def register_invisible_keyboard_shorcuts(self, keymap):
if config.changed_keymap:
commonMessageDialogs.changed_keymap()
self.keyboard_handler = WXKeyboardHandler(self.view)
self.keyboard_handler.register_keys(keymap)

View File

@ -67,4 +67,7 @@ def no_friends():
def view_geodata(geotext):
"""Specific message dialog to display geolocation data"""
return wx.MessageDialog(None, _(u"Geolocation data: {0}").format(geotext), _(u"Geo data for this tweet")).ShowModal()
return wx.MessageDialog(None, _(u"Geolocation data: {0}").format(geotext), _(u"Geo data for this tweet")).ShowModal()
def changed_keymap():
return wx.MessageDialog(None, _(u"TWBlue has detected that you're running windows 10 and has changed the default keymap to the Windows 10 keymap. It means that some keyboard shorcuts could be different. Please check the keystroke editor by pressing Alt+Win+K to see all available keystrokes for this keymap."), _(u"Information"), wx.OK).ShowModal()