add remote manager

This commit is contained in:
chrys 2018-09-04 22:32:03 +02:00
parent 8cf251753f
commit d142fa952c
2 changed files with 40 additions and 20 deletions

View File

@ -0,0 +1,15 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
class remoteManager():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass

View File

@ -26,6 +26,7 @@ from fenrirscreenreader.core import tableManager
from fenrirscreenreader.core import byteManager from fenrirscreenreader.core import byteManager
from fenrirscreenreader.core import attributeManager from fenrirscreenreader.core import attributeManager
from fenrirscreenreader.core import barrierManager from fenrirscreenreader.core import barrierManager
from fenrirscreenreader.core import remoteManager
from fenrirscreenreader.core import environment from fenrirscreenreader.core import environment
from fenrirscreenreader.core.settingsData import settingsData from fenrirscreenreader.core.settingsData import settingsData
from fenrirscreenreader.core import debug from fenrirscreenreader.core import debug
@ -159,7 +160,7 @@ class settingsManager():
self.env['runtime'][driverType].shutdown() self.env['runtime'][driverType].shutdown()
except Exception as e: except Exception as e:
pass pass
del self.env['runtime'][driverType] del self.env['runtime'][driverType]
def setFenrirKeys(self, keys): def setFenrirKeys(self, keys):
keys = keys.upper() keys = keys.upper()
@ -180,7 +181,7 @@ class settingsManager():
e = self.settingArgDict[section] e = self.settingArgDict[section]
except KeyError: except KeyError:
self.settingArgDict[section] = {} self.settingArgDict[section] = {}
self.settingArgDict[section][option] = str(value) self.settingArgDict[section][option] = str(value)
def parseSettingArgs(self, settingArgs): def parseSettingArgs(self, settingArgs):
for optionElem in settingArgs.split(';'): for optionElem in settingArgs.split(';'):
@ -190,7 +191,7 @@ class settingsManager():
continue continue
section = str(optionElem.split('#',1)[0]).lower() section = str(optionElem.split('#',1)[0]).lower()
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower() option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()
value = optionElem.split('#',1)[1].split('=',1)[1] value = optionElem.split('#',1)[1].split('=',1)[1]
self.setOptionArgDict(section, option, value) self.setOptionArgDict(section, option, value)
def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment): def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment):
@ -208,7 +209,7 @@ class settingsManager():
if os.path.exists(settingsRoot + '/settings/settings.conf'): if os.path.exists(settingsRoot + '/settings/settings.conf'):
settingsFile = settingsRoot + '/settings/settings.conf' settingsFile = settingsRoot + '/settings/settings.conf'
else: else:
return None return None
# get sound themes root # get sound themes root
if not os.path.exists(soundRoot): if not os.path.exists(soundRoot):
if os.path.exists(fenrirPath + '/../../config/sound/'): if os.path.exists(fenrirPath + '/../../config/sound/'):
@ -234,12 +235,12 @@ class settingsManager():
#self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty') #self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty')
self.setSetting('keyboard', 'keyboardLayout', 'pty') self.setSetting('keyboard', 'keyboardLayout', 'pty')
self.setOptionArgDict('general', 'debugFile', '/tmp/fenrir-pty.log') self.setOptionArgDict('general', 'debugFile', '/tmp/fenrir-pty.log')
if cliArgs.emulated_evdev: if cliArgs.emulated_evdev:
self.setOptionArgDict('screen', 'driver', 'ptyDriver') self.setOptionArgDict('screen', 'driver', 'ptyDriver')
self.setOptionArgDict('keyboard', 'driver', 'evdevDriver') self.setOptionArgDict('keyboard', 'driver', 'evdevDriver')
self.setFenrirKeys(self.getSetting('general','fenrirKeys')) self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
self.setScriptKeys(self.getSetting('general','scriptKeys')) self.setScriptKeys(self.getSetting('general','scriptKeys'))
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile')) environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
environment['runtime']['debug'].initialize(environment) environment['runtime']['debug'].initialize(environment)
@ -265,39 +266,43 @@ class settingsManager():
else: else:
environment['runtime']['punctuationManager'].loadDicts(self.getSetting('general','punctuationProfile')) environment['runtime']['punctuationManager'].loadDicts(self.getSetting('general','punctuationProfile'))
if fenrirManager: if fenrirManager:
environment['runtime']['fenrirManager'] = fenrirManager environment['runtime']['fenrirManager'] = fenrirManager
environment['runtime']['memoryManager'] = memoryManager.memoryManager() environment['runtime']['memoryManager'] = memoryManager.memoryManager()
environment['runtime']['memoryManager'].initialize(environment) environment['runtime']['memoryManager'].initialize(environment)
environment['runtime']['attributeManager'] = attributeManager.attributeManager() environment['runtime']['attributeManager'] = attributeManager.attributeManager()
environment['runtime']['attributeManager'].initialize(environment) environment['runtime']['attributeManager'].initialize(environment)
environment['runtime']['eventManager'] = eventManager.eventManager() environment['runtime']['eventManager'] = eventManager.eventManager()
environment['runtime']['eventManager'].initialize(environment) environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['processManager'] = processManager.processManager() environment['runtime']['processManager'] = processManager.processManager()
environment['runtime']['processManager'].initialize(environment) environment['runtime']['processManager'].initialize(environment)
environment['runtime']['outputManager'] = outputManager.outputManager() environment['runtime']['outputManager'] = outputManager.outputManager()
environment['runtime']['outputManager'].initialize(environment) environment['runtime']['outputManager'].initialize(environment)
environment['runtime']['byteManager'] = byteManager.byteManager() environment['runtime']['byteManager'] = byteManager.byteManager()
environment['runtime']['byteManager'].initialize(environment) environment['runtime']['byteManager'].initialize(environment)
environment['runtime']['inputManager'] = inputManager.inputManager() environment['runtime']['inputManager'] = inputManager.inputManager()
environment['runtime']['inputManager'].initialize(environment) environment['runtime']['inputManager'].initialize(environment)
environment['runtime']['screenManager'] = screenManager.screenManager() environment['runtime']['screenManager'] = screenManager.screenManager()
environment['runtime']['screenManager'].initialize(environment) environment['runtime']['screenManager'].initialize(environment)
environment['runtime']['commandManager'] = commandManager.commandManager() environment['runtime']['commandManager'] = commandManager.commandManager()
environment['runtime']['commandManager'].initialize(environment) environment['runtime']['commandManager'].initialize(environment)
environment['runtime']['helpManager'] = helpManager.helpManager() environment['runtime']['helpManager'] = helpManager.helpManager()
environment['runtime']['helpManager'].initialize(environment) environment['runtime']['helpManager'].initialize(environment)
environment['runtime']['remoteManager'] = remoteManager.remoteManager()
environment['runtime']['remoteManager'].initialize(environment)
if environment['runtime']['inputManager'].getShortcutType() == 'KEY': if environment['runtime']['inputManager'].getShortcutType() == 'KEY':
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')): if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):