This commit is contained in:
chrys 2018-03-26 08:55:26 +02:00
parent 9e27ec9295
commit 22189b3ac8
7 changed files with 25 additions and 11 deletions

View File

@ -90,7 +90,7 @@ Driver (screen, input):
[X] Load escape sequence shortcuts [X] Load escape sequence shortcuts
[X] controll modes (vim like mode to not collide with application shortcuts) [X] controll modes (vim like mode to not collide with application shortcuts)
[X] create keyboard layout [X] create keyboard layout
[W]set flag that it is used in emulation [X]set flag that it is used in emulation
[] write/ consume them (controll it at all) [] write/ consume them (controll it at all)
[] ATK input driver (don't grab on graphical interface) [] ATK input driver (don't grab on graphical interface)
https://git.linux-a11y.org/AIT/pyatspi2/src/master/examples/keypress.py https://git.linux-a11y.org/AIT/pyatspi2/src/master/examples/keypress.py

View File

@ -7,7 +7,7 @@
from fenrirscreenreader.core import debug from fenrirscreenreader.core import debug
from fenrirscreenreader.core.eventData import fenrirEventType from fenrirscreenreader.core.eventData import fenrirEventType
from queue import Empty from queue import Empty
import time import time, platform
from multiprocessing import Queue from multiprocessing import Queue
from multiprocessing.sharedctypes import Value from multiprocessing.sharedctypes import Value
from ctypes import c_bool from ctypes import c_bool
@ -28,7 +28,12 @@ class eventManager():
self.eventDispatcher(event) self.eventDispatcher(event)
#print('NET loop ' + str(time.time() - st)) #print('NET loop ' + str(time.time() - st))
def eventDispatcher(self, event): def eventDispatcher(self, event):
self.env['runtime']['debug'].writeDebugOut('eventManager:eventDispatcher:start: event:' + str(event['Type']) + ' QueueSize:' + str( self._eventQueue.qsize()),debug.debugLevel.INFO) if platform.system() == 'Darwin':
self.env['runtime']['debug'].writeDebugOut('eventManager:eventDispatcher:start: event:' + str(event['Type']) + ' QueueSize:Not Implemented',debug.debugLevel.INFO)
else:
self.env['runtime']['debug'].writeDebugOut('eventManager:eventDispatcher:start: event:' + str(event['Type']) + ' QueueSize:' + str( self._eventQueue.qsize()),debug.debugLevel.INFO)
if not event: if not event:
return return
if not event['Type']: if not event['Type']:

View File

@ -69,7 +69,7 @@ class fenrirManager():
if self.environment['runtime']['helpManager'].isTutorialMode(): if self.environment['runtime']['helpManager'].isTutorialMode():
self.environment['runtime']['inputManager'].clearEventBuffer() self.environment['runtime']['inputManager'].clearEventBuffer()
self.detectCommand() self.detectShortcutCommand()
if self.modifierInput: if self.modifierInput:
self.environment['runtime']['inputManager'].clearEventBuffer() self.environment['runtime']['inputManager'].clearEventBuffer()
@ -167,7 +167,7 @@ class fenrirManager():
self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, command) self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, command)
if self.command != '': if self.command != '':
self.command = '' self.command = ''
def detectCommand(self): def detectShortcutCommand(self):
if self.environment['input']['keyForeward'] > 0: if self.environment['input']['keyForeward'] > 0:
return return
if self.environment['runtime']['inputManager'].isKeyPress(): if self.environment['runtime']['inputManager'].isKeyPress():

View File

@ -11,7 +11,7 @@ generalData = {
'tutorialMode': False, 'tutorialMode': False,
'currUser':'', 'currUser':'',
'prevUser':'', 'prevUser':'',
'managerList':['processManager', 'punctuationManager', 'cursorManager', 'applicationManager', 'commandManager' 'managerList':['processManager', 'punctuationManager', 'byteManager', 'cursorManager', 'applicationManager', 'commandManager'
, 'screenManager', 'inputManager','outputManager', 'helpManager', 'memoryManager', 'eventManager', 'debug'], , 'screenManager', 'inputManager','outputManager', 'helpManager', 'memoryManager', 'eventManager', 'debug'],
'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice' 'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice'
,'onApplicationChange','onSwitchApplicationProfile','help',], ,'onApplicationChange','onSwitchApplicationProfile','help',],

View File

@ -13,6 +13,13 @@ fenrirPath = os.path.dirname(currentdir)
class inputManager(): class inputManager():
def __init__(self): def __init__(self):
self.setLedState = True self.setLedState = True
self.shortcutType = 'KEY'
def setShortcutType(self, shortcutType = 'KEY'):
if shortcutType in ['KEY', 'BYTE']:
self.shortcutType = shortcutType
def getShortcutType(self):
return self.shortcutType
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self.env['runtime']['settingsManager'].loadDriver(\ self.env['runtime']['settingsManager'].loadDriver(\

View File

@ -33,7 +33,6 @@ class settingsManager():
def __init__(self): def __init__(self):
self.settings = settingsData self.settings = settingsData
self.settingArgDict = {} self.settingArgDict = {}
self.shortcutType = 'KEY'
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
def shutdown(self): def shutdown(self):
@ -222,7 +221,6 @@ class settingsManager():
# TODO needs cleanup use dict # TODO needs cleanup use dict
#self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty') #self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty')
self.setSetting('keyboard', 'keyboardLayout', 'pty') self.setSetting('keyboard', 'keyboardLayout', 'pty')
self.shortcutType = 'BYTE'
self.setOptionArgDict('general', 'debugFile', '/tmp/fenrir-pty.log') self.setOptionArgDict('general', 'debugFile', '/tmp/fenrir-pty.log')
self.setFenrirKeys(self.getSetting('general','fenrirKeys')) self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
self.setScriptKeys(self.getSetting('general','scriptKeys')) self.setScriptKeys(self.getSetting('general','scriptKeys'))
@ -268,7 +266,7 @@ class settingsManager():
environment['runtime']['byteManager'] = byteManager.byteManager() environment['runtime']['byteManager'] = byteManager.byteManager()
environment['runtime']['byteManager'].initialize(environment) environment['runtime']['byteManager'].initialize(environment)
if self.shortcutType == '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')):
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'))
@ -278,7 +276,7 @@ class settingsManager():
environment['runtime']['inputManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout')) environment['runtime']['inputManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
else: else:
environment['runtime']['inputManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout')) environment['runtime']['inputManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout'))
elif self.shortcutType == 'BYTE': elif environment['runtime']['inputManager'].getShortcutType() == 'BYTE':
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

@ -11,3 +11,7 @@ from fenrirscreenreader.core.inputDriver import inputDriver
class driver(inputDriver): class driver(inputDriver):
def __init__(self): def __init__(self):
inputDriver.__init__(self) inputDriver.__init__(self)
def initialize(self, environment):
self.env = environment
self.env['runtime']['inputManager'].setShortcutType('BYTE')
self._isInitialized = True