add first trigger
This commit is contained in:
@ -25,7 +25,10 @@ class commandManager():
|
||||
except:
|
||||
continue
|
||||
return environment
|
||||
|
||||
def executeTriggerCommands(self, environment, trigger):
|
||||
for cmd in sorted(environment['commands'][trigger]):
|
||||
environment = environment['commands'][trigger][cmd].run(environment)
|
||||
return environment
|
||||
def executeCommand(self, environment, currCommand, section = 'commands'):
|
||||
if self.isCommandDefined(environment):
|
||||
try:
|
||||
|
@ -8,12 +8,10 @@ commandInfo = {
|
||||
}
|
||||
|
||||
commands = {
|
||||
'onnInput':{
|
||||
'onInput':{
|
||||
},
|
||||
'onScreenChanged':{
|
||||
},
|
||||
'commands':{
|
||||
# 'curr_line': curr_line.command(),
|
||||
# 'shut_up': shut_up.command()
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,13 @@
|
||||
screenData = {
|
||||
'columns': 0,
|
||||
'lines': 0,
|
||||
'delta': '',
|
||||
'oldDelta': '',
|
||||
'oldCursorReview':{'x':0,'y':0},
|
||||
'oldCursor':{'x':0,'y':0},
|
||||
'oldContentBytes': b'',
|
||||
'oldContentText': '',
|
||||
'oldContentAttrib': b'',
|
||||
'newDelta': '',
|
||||
'newCursorReview':{'x':0,'y':0},
|
||||
'newCursor':{'x':0,'y':0},
|
||||
'newContentBytes': b'',
|
||||
|
@ -2,10 +2,11 @@
|
||||
from configparser import ConfigParser
|
||||
from core.settings import settings
|
||||
import evdev
|
||||
import importlib.util
|
||||
|
||||
class settingsManager():
|
||||
def __init__(self):
|
||||
pass
|
||||
self.settings = settings
|
||||
|
||||
def loadShortcuts(self, environment, kbConfigPath='../../config/keyboard/desktop.kb'):
|
||||
kbConfig = open(kbConfigPath,"r")
|
||||
@ -66,7 +67,43 @@ class settingsManager():
|
||||
environment['settings'].read(settingConfigPath)
|
||||
return environment
|
||||
|
||||
def getSetting(self, environment, setting):
|
||||
value = True # do be implemented
|
||||
def getSetting(self, environment, section, setting):
|
||||
value = ''
|
||||
try:
|
||||
value = environment['settings'].get(section, setting)
|
||||
except:
|
||||
value = self.settings[section][setting]
|
||||
return value
|
||||
|
||||
def getSettingAsInt(self, environment, section, setting):
|
||||
return int(getSetting(self, environment, section, setting))
|
||||
|
||||
def getSettingAsBool(self, environment, section, setting):
|
||||
return bool(getSetting(self, environment, section, setting))
|
||||
|
||||
def loadSpeechDriver(self, environment, driverName):
|
||||
if environment['runtime']['speechDriver'] != None:
|
||||
environment['runtime']['speechDriver'].shutdown()
|
||||
spec = importlib.util.spec_from_file_location(driverName, 'speech/' + driverName + '.py')
|
||||
driver_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(driver_mod)
|
||||
environment['runtime']['speechDriver'] = driver_mod.speech()
|
||||
return environment
|
||||
|
||||
def loadSoundDriver(self, environment, driverName):
|
||||
if environment['runtime']['soundDriver'] != None:
|
||||
environment['runtime']['soundDriver'].shutdown()
|
||||
spec = importlib.util.spec_from_file_location(driverName, 'sound/' + driverName + '.py')
|
||||
driver_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(driver_mod)
|
||||
environment['runtime']['soundDriver'] = driver_mod.sound()
|
||||
return environment
|
||||
|
||||
def loadScreenDriver(self, environment, driverName):
|
||||
spec = importlib.util.spec_from_file_location(driverName, 'screen/' + driverName + '.py')
|
||||
driver_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(driver_mod)
|
||||
environment['runtime']['screenDriver'] = driver_mod.screen()
|
||||
return environment
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user