add KEY_SCRIPT, and make fenrir load it from settings. Fenrir also understand its press currently
This commit is contained in:
parent
65448b54fb
commit
c5642c4118
@ -105,6 +105,7 @@ numberOfClipboards=10
|
|||||||
emoticons=True
|
emoticons=True
|
||||||
# define the current fenrir key
|
# define the current fenrir key
|
||||||
fenrirKeys=KEY_KP0,KEY_META
|
fenrirKeys=KEY_KP0,KEY_META
|
||||||
|
scriptKey=KEY_COMPOSE
|
||||||
timeFormat=%H:%M:%P
|
timeFormat=%H:%M:%P
|
||||||
dateFormat=%A, %B %d, %Y
|
dateFormat=%A, %B %d, %Y
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
|
@ -55,6 +55,7 @@ newLinePause=True
|
|||||||
numberOfClipboards=10
|
numberOfClipboards=10
|
||||||
emoticons=True
|
emoticons=True
|
||||||
fenrirKeys=KEY_KP0
|
fenrirKeys=KEY_KP0
|
||||||
|
scriptKey=KEY_COMPOSE
|
||||||
timeFormat=%H:%M:%P
|
timeFormat=%H:%M:%P
|
||||||
dateFormat="%A, %B %d, %Y"
|
dateFormat="%A, %B %d, %Y"
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
|
@ -12,7 +12,8 @@ input = {
|
|||||||
'prevDeepestInput': [],
|
'prevDeepestInput': [],
|
||||||
'eventBuffer': [],
|
'eventBuffer': [],
|
||||||
'shortcutRepeat': 0,
|
'shortcutRepeat': 0,
|
||||||
'fenrirKey': ['KEY_KP0'],
|
'fenrirKey': [],
|
||||||
|
'scriptKey': [],
|
||||||
'keyForeward': 0,
|
'keyForeward': 0,
|
||||||
'lastInputTime':time.time(),
|
'lastInputTime':time.time(),
|
||||||
'oldNumLock': True,
|
'oldNumLock': True,
|
||||||
|
@ -105,6 +105,8 @@ class inputManager():
|
|||||||
eventName = 'KEY_META'
|
eventName = 'KEY_META'
|
||||||
if self.isFenrirKey(eventName):
|
if self.isFenrirKey(eventName):
|
||||||
eventName = 'KEY_FENRIR'
|
eventName = 'KEY_FENRIR'
|
||||||
|
if self.isScriptKey(eventName):
|
||||||
|
eventName = 'KEY_SCRIPT'
|
||||||
return eventName
|
return eventName
|
||||||
|
|
||||||
def isConsumeInput(self):
|
def isConsumeInput(self):
|
||||||
@ -133,6 +135,9 @@ class inputManager():
|
|||||||
def isFenrirKeyPressed(self):
|
def isFenrirKeyPressed(self):
|
||||||
return 'KEY_FENRIR' in self.env['input']['currInput']
|
return 'KEY_FENRIR' in self.env['input']['currInput']
|
||||||
|
|
||||||
|
def isScriptKeyPressed(self):
|
||||||
|
return 'KEY_SCRIPT' in self.env['input']['currInput']
|
||||||
|
|
||||||
def noKeyPressed(self):
|
def noKeyPressed(self):
|
||||||
return self.env['input']['currInput'] == []
|
return self.env['input']['currInput'] == []
|
||||||
|
|
||||||
@ -162,7 +167,8 @@ class inputManager():
|
|||||||
|
|
||||||
def isFenrirKey(self, eventName):
|
def isFenrirKey(self, eventName):
|
||||||
return eventName in self.env['input']['fenrirKey']
|
return eventName in self.env['input']['fenrirKey']
|
||||||
|
def isScriptKey(self, eventName):
|
||||||
|
return eventName in self.env['input']['scriptKey']
|
||||||
def getCommandForShortcut(self, shortcut):
|
def getCommandForShortcut(self, shortcut):
|
||||||
if not self.shortcutExists(shortcut):
|
if not self.shortcutExists(shortcut):
|
||||||
return ''
|
return ''
|
||||||
|
@ -48,6 +48,7 @@ settings = {
|
|||||||
'numberOfClipboards': 10,
|
'numberOfClipboards': 10,
|
||||||
'emoticons': True,
|
'emoticons': True,
|
||||||
'fenrirKeys': ['KEY_KP0','KEY_META'],
|
'fenrirKeys': ['KEY_KP0','KEY_META'],
|
||||||
|
'scriptKeys': ['KEY_COMPOSE'],
|
||||||
'timeFormat': '%I:%M%P',
|
'timeFormat': '%I:%M%P',
|
||||||
'dateFormat': '%A, %B %d, %Y',
|
'dateFormat': '%A, %B %d, %Y',
|
||||||
'autoSpellCheck': False,
|
'autoSpellCheck': False,
|
||||||
|
@ -186,14 +186,12 @@ class settingsManager():
|
|||||||
for key in keyList:
|
for key in keyList:
|
||||||
if not key in self.env['input']['fenrirKey']:
|
if not key in self.env['input']['fenrirKey']:
|
||||||
self.env['input']['fenrirKey'].append(key)
|
self.env['input']['fenrirKey'].append(key)
|
||||||
|
def setScriptKeys(self, keys):
|
||||||
def keyIDasString(self, key):
|
keys = keys.upper()
|
||||||
try:
|
keyList = keys.split(',')
|
||||||
KeyID = self.getCodeForKeyID(key)
|
for key in keyList:
|
||||||
return str(KeyID)
|
if not key in self.env['input']['scriptKey']:
|
||||||
except:
|
self.env['input']['scriptKey'].append(key)
|
||||||
return ''
|
|
||||||
|
|
||||||
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf'):
|
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf'):
|
||||||
environment['runtime']['debug'] = debug.debug()
|
environment['runtime']['debug'] = debug.debug()
|
||||||
environment['runtime']['debug'].initialize(environment)
|
environment['runtime']['debug'].initialize(environment)
|
||||||
@ -210,6 +208,7 @@ class settingsManager():
|
|||||||
if not validConfig:
|
if not validConfig:
|
||||||
return None
|
return None
|
||||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||||
|
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||||
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
||||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
||||||
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
||||||
|
Loading…
Reference in New Issue
Block a user