From ce93c548126d87d425a1657c4ae5ed3d7a000eee Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 18 Oct 2016 20:25:27 +0200 Subject: [PATCH] add initial script support --- src/fenrir/core/commandManager.py | 2 -- src/fenrir/core/settings.py | 4 ++-- src/fenrir/core/settingsManager.py | 5 ++++- src/fenrir/fenrir | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py index 3834d06c..dda0753a 100644 --- a/src/fenrir/core/commandManager.py +++ b/src/fenrir/core/commandManager.py @@ -85,7 +85,6 @@ class commandManager(): keys = commSettings[1] elif len(commSettings) > 2: continue - keys = keys.split('__+__') shortcutKeys = [] shortcut = [] @@ -95,7 +94,6 @@ class commandManager(): shortcutKeys.append('KEY_SCRIPT') shortcut.append(1) shortcut.append(sorted(shortcutKeys)) - print(shortcut,command) self.env['bindings'][str(shortcut)] = fileName.upper() except Exception as e: print(e) diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settings.py index 19210810..0d295577 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -47,8 +47,8 @@ settings = { 'newLinePause':True, 'numberOfClipboards': 10, 'emoticons': True, - 'fenrirKeys': ['KEY_KP0','KEY_META'], - 'scriptKeys': ['KEY_COMPOSE'], + 'fenrirKeys': 'KEY_KP0,KEY_META', + 'scriptKeys': 'KEY_COMPOSE', 'timeFormat': '%I:%M%P', 'dateFormat': '%A, %B %d, %Y', 'autoSpellCheck': False, diff --git a/src/fenrir/core/settingsManager.py b/src/fenrir/core/settingsManager.py index b18e4cd5..9b1e1861 100644 --- a/src/fenrir/core/settingsManager.py +++ b/src/fenrir/core/settingsManager.py @@ -192,6 +192,7 @@ class settingsManager(): 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', soundRoot = '/usr/share/sounds/fenrir'): environment['runtime']['debug'] = debug.debug() environment['runtime']['debug'].initialize(environment) @@ -210,8 +211,10 @@ class settingsManager(): validConfig = environment['runtime']['settingsManager'].loadSettings(settingsRoot + '/settings/' + settingsFile) if not validConfig: return None + 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 os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')): self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')) diff --git a/src/fenrir/fenrir b/src/fenrir/fenrir index a2c0248c..93e541c2 100755 --- a/src/fenrir/fenrir +++ b/src/fenrir/fenrir @@ -39,7 +39,7 @@ class fenrir(): eventReceived = self.environment['runtime']['inputManager'].getInputEvent() if eventReceived: 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() if self.environment['runtime']['inputManager'].noKeyPressed(): if self.wasCommand: