add KEY_SCRIPT, and make fenrir load it from settings. Fenrir also understand its press currently

This commit is contained in:
chrys 2016-10-18 17:58:37 +02:00
parent 65448b54fb
commit c5642c4118
6 changed files with 19 additions and 10 deletions

View File

@ -105,6 +105,7 @@ numberOfClipboards=10
emoticons=True
# define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META
scriptKey=KEY_COMPOSE
timeFormat=%H:%M:%P
dateFormat=%A, %B %d, %Y
autoSpellCheck=True

View File

@ -55,6 +55,7 @@ newLinePause=True
numberOfClipboards=10
emoticons=True
fenrirKeys=KEY_KP0
scriptKey=KEY_COMPOSE
timeFormat=%H:%M:%P
dateFormat="%A, %B %d, %Y"
autoSpellCheck=True

View File

@ -12,7 +12,8 @@ input = {
'prevDeepestInput': [],
'eventBuffer': [],
'shortcutRepeat': 0,
'fenrirKey': ['KEY_KP0'],
'fenrirKey': [],
'scriptKey': [],
'keyForeward': 0,
'lastInputTime':time.time(),
'oldNumLock': True,

View File

@ -105,6 +105,8 @@ class inputManager():
eventName = 'KEY_META'
if self.isFenrirKey(eventName):
eventName = 'KEY_FENRIR'
if self.isScriptKey(eventName):
eventName = 'KEY_SCRIPT'
return eventName
def isConsumeInput(self):
@ -132,6 +134,9 @@ class inputManager():
def isFenrirKeyPressed(self):
return 'KEY_FENRIR' in self.env['input']['currInput']
def isScriptKeyPressed(self):
return 'KEY_SCRIPT' in self.env['input']['currInput']
def noKeyPressed(self):
return self.env['input']['currInput'] == []
@ -162,7 +167,8 @@ class inputManager():
def isFenrirKey(self, eventName):
return eventName in self.env['input']['fenrirKey']
def isScriptKey(self, eventName):
return eventName in self.env['input']['scriptKey']
def getCommandForShortcut(self, shortcut):
if not self.shortcutExists(shortcut):
return ''

View File

@ -48,6 +48,7 @@ settings = {
'numberOfClipboards': 10,
'emoticons': True,
'fenrirKeys': ['KEY_KP0','KEY_META'],
'scriptKeys': ['KEY_COMPOSE'],
'timeFormat': '%I:%M%P',
'dateFormat': '%A, %B %d, %Y',
'autoSpellCheck': False,

View File

@ -186,14 +186,12 @@ class settingsManager():
for key in keyList:
if not key in self.env['input']['fenrirKey']:
self.env['input']['fenrirKey'].append(key)
def keyIDasString(self, key):
try:
KeyID = self.getCodeForKeyID(key)
return str(KeyID)
except:
return ''
def setScriptKeys(self, keys):
keys = keys.upper()
keyList = keys.split(',')
for key in keyList:
if not key in self.env['input']['scriptKey']:
self.env['input']['scriptKey'].append(key)
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf'):
environment['runtime']['debug'] = debug.debug()
environment['runtime']['debug'].initialize(environment)
@ -210,6 +208,7 @@ class settingsManager():
if not validConfig:
return None
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
self.setScriptKeys(self.getSetting('general','scriptKeys'))
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))