fix pty
This commit is contained in:
parent
14902dbab9
commit
d3bec267af
@ -14,7 +14,7 @@ class inputManager():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.setLedState = True
|
self.setLedState = True
|
||||||
self.shortcutType = 'KEY'
|
self.shortcutType = 'KEY'
|
||||||
self.toggleDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
def setShortcutType(self, shortcutType = 'KEY'):
|
def setShortcutType(self, shortcutType = 'KEY'):
|
||||||
if shortcutType in ['KEY', 'BYTE']:
|
if shortcutType in ['KEY', 'BYTE']:
|
||||||
self.shortcutType = shortcutType
|
self.shortcutType = shortcutType
|
||||||
@ -24,6 +24,8 @@ class inputManager():
|
|||||||
self.env = environment
|
self.env = environment
|
||||||
self.env['runtime']['settingsManager'].loadDriver(\
|
self.env['runtime']['settingsManager'].loadDriver(\
|
||||||
self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver')
|
self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver')
|
||||||
|
self.updateInputDevices()
|
||||||
|
|
||||||
# init LEDs with current state
|
# init LEDs with current state
|
||||||
self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState()
|
self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState()
|
||||||
self.env['input']['oldNumLock'] = self.env['input']['newNumLock']
|
self.env['input']['oldNumLock'] = self.env['input']['newNumLock']
|
||||||
@ -39,27 +41,25 @@ class inputManager():
|
|||||||
self.env['runtime']['settingsManager'].shutdownDriver('inputDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('inputDriver')
|
||||||
def getInputEvent(self):
|
def getInputEvent(self):
|
||||||
return self.env['runtime']['inputDriver'].getInputEvent()
|
return self.env['runtime']['inputDriver'].getInputEvent()
|
||||||
def handleDeviceGrab(self, useCurrentScreen = False):
|
def setExecuteDeviceGrab(self, newExecuteDeviceGrab = True):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
self.executeDeviceGrab = newExecuteDeviceGrab
|
||||||
|
def handleDeviceGrab(self):
|
||||||
|
if not self.executeDeviceGrab:
|
||||||
return
|
return
|
||||||
if useCurrentScreen:
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
self.toggleDeviceGrab = True
|
return
|
||||||
else:
|
if not self.noKeyPressed():
|
||||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored() != self.env['runtime']['screenManager'].getPrevScreenIgnored():
|
return
|
||||||
self.toggleDeviceGrab = True
|
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
||||||
|
self.ungrabAllDevices()
|
||||||
if self.toggleDeviceGrab:
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
if self.noKeyPressed():
|
else:
|
||||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
self.grabAllDevices()
|
||||||
self.ungrabAllDevices()
|
self.executeDeviceGrab = False
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
|
||||||
else:
|
|
||||||
self.grabAllDevices()
|
|
||||||
self.toggleDeviceGrab = False
|
|
||||||
def handleInputEvent(self, eventData):
|
def handleInputEvent(self, eventData):
|
||||||
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT inputMan:' + str(eventData),debug.debugLevel.INFO)
|
|
||||||
if not eventData:
|
if not eventData:
|
||||||
return
|
return
|
||||||
|
self.handleDeviceGrab()
|
||||||
self.env['input']['prevInput'] = self.env['input']['currInput'].copy()
|
self.env['input']['prevInput'] = self.env['input']['currInput'].copy()
|
||||||
if eventData['EventState'] == 0:
|
if eventData['EventState'] == 0:
|
||||||
if eventData['EventName'] in self.env['input']['currInput']:
|
if eventData['EventName'] in self.env['input']['currInput']:
|
||||||
@ -97,6 +97,8 @@ class inputManager():
|
|||||||
if self.noKeyPressed():
|
if self.noKeyPressed():
|
||||||
self.env['input']['prevInput'] = []
|
self.env['input']['prevInput'] = []
|
||||||
self.setLedState = True
|
self.setLedState = True
|
||||||
|
else:
|
||||||
|
self.handleDeviceGrab()
|
||||||
|
|
||||||
def handleLedStates(self, mEvent):
|
def handleLedStates(self, mEvent):
|
||||||
if not self.setLedState:
|
if not self.setLedState:
|
||||||
@ -144,7 +146,9 @@ class inputManager():
|
|||||||
self.env['runtime']['inputDriver'].updateInputDevices(newDevice)
|
self.env['runtime']['inputDriver'].updateInputDevices(newDevice)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.handleDeviceGrab(True)
|
self.setExecuteDeviceGrab()
|
||||||
|
if newDevice:
|
||||||
|
self.handleDeviceGrab()
|
||||||
def removeAllDevices(self):
|
def removeAllDevices(self):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputDriver'].removeAllDevices()
|
self.env['runtime']['inputDriver'].removeAllDevices()
|
||||||
|
@ -18,7 +18,10 @@ class screenManager():
|
|||||||
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
|
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
|
||||||
self.getCurrScreen()
|
self.getCurrScreen()
|
||||||
self.getCurrScreen()
|
self.getCurrScreen()
|
||||||
self.getSessionInformation()
|
self.getSessionInformation()
|
||||||
|
self.updateScreenIgnored()
|
||||||
|
self.updateScreenIgnored()
|
||||||
|
|
||||||
def getCurrScreen(self):
|
def getCurrScreen(self):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['screenDriver'].getCurrScreen()
|
self.env['runtime']['screenDriver'].getCurrScreen()
|
||||||
@ -32,18 +35,27 @@ class screenManager():
|
|||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||||
|
def isCurrScreenIgnoredChanged(self):
|
||||||
|
return self.getCurrScreenIgnored() != self.getPrevScreenIgnored()
|
||||||
def hanldeScreenChange(self, eventData):
|
def hanldeScreenChange(self, eventData):
|
||||||
self.getCurrScreen()
|
self.getCurrScreen()
|
||||||
self.getSessionInformation()
|
self.updateScreenIgnored()
|
||||||
|
if self.isCurrScreenIgnoredChanged():
|
||||||
|
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
||||||
|
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||||
|
self.getSessionInformation()
|
||||||
|
|
||||||
if self.isScreenChange():
|
if self.isScreenChange():
|
||||||
self.changeBrailleScreen()
|
self.changeBrailleScreen()
|
||||||
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||||
self.update(eventData, 'onScreenChange')
|
self.update(eventData, 'onScreenChange')
|
||||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||||
|
|
||||||
def handleScreenUpdate(self, eventData):
|
def handleScreenUpdate(self, eventData):
|
||||||
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
||||||
self.updateScreenIgnored()
|
self.updateScreenIgnored()
|
||||||
|
if self.isCurrScreenIgnoredChanged():
|
||||||
|
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
||||||
self.env['runtime']['inputManager'].handleDeviceGrab()
|
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||||
if not self.getCurrScreenIgnored():
|
if not self.getCurrScreenIgnored():
|
||||||
self.update(eventData, 'onScreenUpdate')
|
self.update(eventData, 'onScreenUpdate')
|
||||||
|
@ -275,18 +275,24 @@ class settingsManager():
|
|||||||
|
|
||||||
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'].initialize(environment)
|
||||||
|
|
||||||
|
environment['runtime']['byteManager'] = byteManager.byteManager()
|
||||||
|
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'].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']['byteManager'] = byteManager.byteManager()
|
|
||||||
environment['runtime']['byteManager'].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')):
|
||||||
@ -308,10 +314,7 @@ class settingsManager():
|
|||||||
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||||
else:
|
else:
|
||||||
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||||
|
|
||||||
|
|
||||||
environment['runtime']['outputManager'] = outputManager.outputManager()
|
|
||||||
environment['runtime']['outputManager'].initialize(environment)
|
|
||||||
environment['runtime']['cursorManager'] = cursorManager.cursorManager()
|
environment['runtime']['cursorManager'] = cursorManager.cursorManager()
|
||||||
environment['runtime']['cursorManager'].initialize(environment)
|
environment['runtime']['cursorManager'].initialize(environment)
|
||||||
environment['runtime']['applicationManager'] = applicationManager.applicationManager()
|
environment['runtime']['applicationManager'] = applicationManager.applicationManager()
|
||||||
@ -320,9 +323,6 @@ class settingsManager():
|
|||||||
environment['runtime']['headLineManager'].initialize(environment)
|
environment['runtime']['headLineManager'].initialize(environment)
|
||||||
environment['runtime']['tableManager'] = tableManager.tableManager()
|
environment['runtime']['tableManager'] = tableManager.tableManager()
|
||||||
environment['runtime']['tableManager'].initialize(environment)
|
environment['runtime']['tableManager'].initialize(environment)
|
||||||
if environment['runtime']['screenManager'] == None:
|
|
||||||
environment['runtime']['screenManager'] = screenManager.screenManager()
|
|
||||||
environment['runtime']['screenManager'].initialize(environment)
|
|
||||||
|
|
||||||
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
|
@ -53,7 +53,7 @@ class driver(inputDriver):
|
|||||||
global _evdevAvailableError
|
global _evdevAvailableError
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR)
|
||||||
return
|
return
|
||||||
self.updateInputDevices()
|
|
||||||
if _udevAvailable:
|
if _udevAvailable:
|
||||||
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev)
|
||||||
#else:
|
#else:
|
||||||
|
Loading…
Reference in New Issue
Block a user