add initial script support

This commit is contained in:
chrys 2016-10-18 20:25:27 +02:00
parent c99c45436e
commit ce93c54812
4 changed files with 7 additions and 6 deletions

View File

@ -85,7 +85,6 @@ class commandManager():
keys = commSettings[1] keys = commSettings[1]
elif len(commSettings) > 2: elif len(commSettings) > 2:
continue continue
keys = keys.split('__+__') keys = keys.split('__+__')
shortcutKeys = [] shortcutKeys = []
shortcut = [] shortcut = []
@ -95,7 +94,6 @@ class commandManager():
shortcutKeys.append('KEY_SCRIPT') shortcutKeys.append('KEY_SCRIPT')
shortcut.append(1) shortcut.append(1)
shortcut.append(sorted(shortcutKeys)) shortcut.append(sorted(shortcutKeys))
print(shortcut,command)
self.env['bindings'][str(shortcut)] = fileName.upper() self.env['bindings'][str(shortcut)] = fileName.upper()
except Exception as e: except Exception as e:
print(e) print(e)

View File

@ -47,8 +47,8 @@ settings = {
'newLinePause':True, 'newLinePause':True,
'numberOfClipboards': 10, 'numberOfClipboards': 10,
'emoticons': True, 'emoticons': True,
'fenrirKeys': ['KEY_KP0','KEY_META'], 'fenrirKeys': 'KEY_KP0,KEY_META',
'scriptKeys': ['KEY_COMPOSE'], '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,

View File

@ -192,6 +192,7 @@ class settingsManager():
for key in keyList: for key in keyList:
if not key in self.env['input']['scriptKey']: if not key in self.env['input']['scriptKey']:
self.env['input']['scriptKey'].append(key) self.env['input']['scriptKey'].append(key)
def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf', soundRoot = '/usr/share/sounds/fenrir'): def initFenrirConfig(self, environment = environment.environment, settingsRoot = '/etc/fenrir/', settingsFile='settings.conf', soundRoot = '/usr/share/sounds/fenrir'):
environment['runtime']['debug'] = debug.debug() environment['runtime']['debug'] = debug.debug()
environment['runtime']['debug'].initialize(environment) environment['runtime']['debug'].initialize(environment)
@ -210,8 +211,10 @@ class settingsManager():
validConfig = environment['runtime']['settingsManager'].loadSettings(settingsRoot + '/settings/' + settingsFile) validConfig = environment['runtime']['settingsManager'].loadSettings(settingsRoot + '/settings/' + settingsFile)
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')) 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'))

View File

@ -39,7 +39,7 @@ class fenrir():
eventReceived = self.environment['runtime']['inputManager'].getInputEvent() eventReceived = self.environment['runtime']['inputManager'].getInputEvent()
if eventReceived: if eventReceived:
self.prepareCommand() self.prepareCommand()
if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen(): if not (self.wasCommand or self.environment['runtime']['inputManager'].isFenrirKeyPressed() or self.environment['runtime']['inputManager'].isScriptKeyPressed() or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():
self.environment['runtime']['inputManager'].writeEventBuffer() self.environment['runtime']['inputManager'].writeEventBuffer()
if self.environment['runtime']['inputManager'].noKeyPressed(): if self.environment['runtime']['inputManager'].noKeyPressed():
if self.wasCommand: if self.wasCommand: