retry grabbing
This commit is contained in:
parent
c50b64b2f1
commit
ca5ce66f31
@ -11,48 +11,50 @@ class inputDriver():
|
|||||||
self._initialized = False
|
self._initialized = False
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.env['runtime']['inputManager'].setShortcutType('KEY')
|
self.env['runtime']['inputManager'].setShortcutType('KEY')
|
||||||
self._isInitialized = True
|
self._isInitialized = True
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if self._initialized:
|
if self._initialized:
|
||||||
self.removeAllDevices()
|
self.removeAllDevices()
|
||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
def getInputEvent(self):
|
def getInputEvent(self):
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
return None
|
return None
|
||||||
def clearEventBuffer(self):
|
def clearEventBuffer(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
del self.env['input']['eventBuffer'][:]
|
del self.env['input']['eventBuffer'][:]
|
||||||
def updateInputDevices(self, newDevices = None, init = False):
|
def updateInputDevices(self, newDevices = None, init = False):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
def getLedState(self, led = 0):
|
def getLedState(self, led = 0):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
def toggleLedState(self, led = 0):
|
def toggleLedState(self, led = 0):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
return True
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
return True
|
||||||
def hasIDevices(self):
|
def hasIDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
def removeAllDevices(self):
|
def removeAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
def sendKey(self):
|
def sendKey(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.removeAllDevices()
|
self.removeAllDevices()
|
||||||
except:
|
except:
|
||||||
|
@ -57,12 +57,14 @@ class inputManager():
|
|||||||
if not self.noKeyPressed():
|
if not self.noKeyPressed():
|
||||||
return
|
return
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
|
self.executeDeviceGrab = False
|
||||||
return
|
return
|
||||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
||||||
self.ungrabAllDevices()
|
if self.ungrabAllDevices():
|
||||||
|
self.executeDeviceGrab = False
|
||||||
else:
|
else:
|
||||||
self.grabAllDevices()
|
if self.grabAllDevices():
|
||||||
self.executeDeviceGrab = False
|
self.executeDeviceGrab = False
|
||||||
def sendKeys(self, keyMacro):
|
def sendKeys(self, keyMacro):
|
||||||
for e in keyMacro:
|
for e in keyMacro:
|
||||||
key = ''
|
key = ''
|
||||||
@ -143,15 +145,17 @@ class inputManager():
|
|||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputDriver'].grabAllDevices()
|
return self.env['runtime']['inputDriver'].grabAllDevices()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
return False
|
||||||
|
return True
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputDriver'].ungrabAllDevices()
|
return self.env['runtime']['inputDriver'].ungrabAllDevices()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
return False
|
||||||
|
return True
|
||||||
def handlePlugInputDevice(self, eventData):
|
def handlePlugInputDevice(self, eventData):
|
||||||
for deviceEntry in eventData:
|
for deviceEntry in eventData:
|
||||||
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
|
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
|
||||||
|
@ -24,15 +24,15 @@ class screenManager():
|
|||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.env['runtime']['settingsManager'].loadDriver(\
|
self.env['runtime']['settingsManager'].loadDriver(\
|
||||||
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
|
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
|
||||||
self.getCurrScreen()
|
|
||||||
self.getCurrScreen()
|
self.getCurrScreen()
|
||||||
self.getSessionInformation()
|
self.getCurrScreen()
|
||||||
|
self.getSessionInformation()
|
||||||
|
self.updateScreenIgnored()
|
||||||
self.updateScreenIgnored()
|
self.updateScreenIgnored()
|
||||||
self.updateScreenIgnored()
|
|
||||||
def resetScreenText(self, screenText):
|
def resetScreenText(self, screenText):
|
||||||
self.prevScreenText = ''
|
self.prevScreenText = ''
|
||||||
self.currScreenText = screenText
|
self.currScreenText = screenText
|
||||||
def setScreenText(self, screenText):
|
def setScreenText(self, screenText):
|
||||||
self.prevScreenText = self.currScreenText
|
self.prevScreenText = self.currScreenText
|
||||||
self.currScreenText = screenText
|
self.currScreenText = screenText
|
||||||
@ -44,58 +44,54 @@ class screenManager():
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
def getSessionInformation(self):
|
def getSessionInformation(self):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['screenDriver'].getSessionInformation()
|
self.env['runtime']['screenDriver'].getSessionInformation()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||||
def isCurrScreenIgnoredChanged(self):
|
def isCurrScreenIgnoredChanged(self):
|
||||||
return self.getCurrScreenIgnored() != self.getPrevScreenIgnored()
|
return self.getCurrScreenIgnored() != self.getPrevScreenIgnored()
|
||||||
def hanldeScreenChange(self, eventData):
|
def hanldeScreenChange(self, eventData):
|
||||||
self.getCurrScreen()
|
self.getCurrScreen()
|
||||||
self.getSessionInformation()
|
self.getSessionInformation()
|
||||||
self.updateScreenIgnored()
|
self.updateScreenIgnored()
|
||||||
if self.isCurrScreenIgnoredChanged():
|
if self.isCurrScreenIgnoredChanged():
|
||||||
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
||||||
self.env['runtime']['inputManager'].handleDeviceGrab()
|
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||||
|
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()
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
|
|
||||||
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():
|
if self.isCurrScreenIgnoredChanged():
|
||||||
self.env['runtime']['inputManager'].setExecuteDeviceGrab()
|
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')
|
||||||
#if trigger == 'onUpdate' or self.isScreenChange() \
|
#if trigger == 'onUpdate' or self.isScreenChange() \
|
||||||
# or len(self.env['screen']['newDelta']) > 6:
|
# or len(self.env['screen']['newDelta']) > 6:
|
||||||
# self.env['runtime']['screenDriver'].getCurrApplication()
|
# self.env['runtime']['screenDriver'].getCurrApplication()
|
||||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||||
elif self.isCurrScreenIgnoredChanged():
|
elif self.isCurrScreenIgnoredChanged():
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
def getCurrScreenIgnored(self):
|
def getCurrScreenIgnored(self):
|
||||||
return self.currScreenIgnored
|
return self.currScreenIgnored
|
||||||
def getPrevScreenIgnored(self):
|
def getPrevScreenIgnored(self):
|
||||||
return self.prevScreenIgnored
|
return self.prevScreenIgnored
|
||||||
def updateScreenIgnored(self):
|
def updateScreenIgnored(self):
|
||||||
self.prevScreenIgnored = self.currScreenIgnored
|
self.prevScreenIgnored = self.currScreenIgnored
|
||||||
self.currScreenIgnored = self.isSuspendingScreen(self.env['screen']['newTTY'])
|
self.currScreenIgnored = self.isSuspendingScreen(self.env['screen']['newTTY'])
|
||||||
def update(self, eventData, trigger='onUpdate'):
|
def update(self, eventData, trigger='onUpdate'):
|
||||||
# set new "old" values
|
# set new "old" values
|
||||||
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
||||||
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
|
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
|
||||||
self.env['screen']['oldCursor'] = self.env['screen']['newCursor'].copy()
|
self.env['screen']['oldCursor'] = self.env['screen']['newCursor'].copy()
|
||||||
self.env['screen']['oldDelta'] = self.env['screen']['newDelta']
|
self.env['screen']['oldDelta'] = self.env['screen']['newDelta']
|
||||||
self.env['screen']['oldNegativeDelta'] = self.env['screen']['newNegativeDelta']
|
self.env['screen']['oldNegativeDelta'] = self.env['screen']['newNegativeDelta']
|
||||||
self.env['screen']['newContentBytes'] = eventData['bytes']
|
self.env['screen']['newContentBytes'] = eventData['bytes']
|
||||||
@ -104,7 +100,7 @@ class screenManager():
|
|||||||
self.env['screen']['lines'] = int( eventData['lines'])
|
self.env['screen']['lines'] = int( eventData['lines'])
|
||||||
self.env['screen']['columns'] = int( eventData['columns'])
|
self.env['screen']['columns'] = int( eventData['columns'])
|
||||||
self.colums = int( eventData['columns'])
|
self.colums = int( eventData['columns'])
|
||||||
self.rows = int( eventData['lines'])
|
self.rows = int( eventData['lines'])
|
||||||
self.env['screen']['newCursor']['x'] = int( eventData['textCursor']['x'])
|
self.env['screen']['newCursor']['x'] = int( eventData['textCursor']['x'])
|
||||||
self.env['screen']['newCursor']['y'] = int( eventData['textCursor']['y'])
|
self.env['screen']['newCursor']['y'] = int( eventData['textCursor']['y'])
|
||||||
self.env['screen']['newTTY'] = eventData['screen']
|
self.env['screen']['newTTY'] = eventData['screen']
|
||||||
@ -113,16 +109,16 @@ class screenManager():
|
|||||||
# screen change
|
# screen change
|
||||||
if self.isScreenChange():
|
if self.isScreenChange():
|
||||||
self.env['screen']['oldContentBytes'] = b''
|
self.env['screen']['oldContentBytes'] = b''
|
||||||
self.resetScreenText(eventData['text'])
|
self.resetScreenText(eventData['text'])
|
||||||
self.env['runtime']['attributeManager'].resetAttributes(eventData['attributes'])
|
self.env['runtime']['attributeManager'].resetAttributes(eventData['attributes'])
|
||||||
self.env['runtime']['attributeManager'].resetAttributeCursor()
|
self.env['runtime']['attributeManager'].resetAttributeCursor()
|
||||||
self.env['screen']['oldContentText'] = ''
|
self.env['screen']['oldContentText'] = ''
|
||||||
self.env['screen']['oldCursor']['x'] = 0
|
self.env['screen']['oldCursor']['x'] = 0
|
||||||
self.env['screen']['oldCursor']['y'] = 0
|
self.env['screen']['oldCursor']['y'] = 0
|
||||||
self.env['screen']['oldDelta'] = ''
|
self.env['screen']['oldDelta'] = ''
|
||||||
self.env['screen']['oldNegativeDelta'] = ''
|
self.env['screen']['oldNegativeDelta'] = ''
|
||||||
else:
|
else:
|
||||||
self.setScreenText(eventData['text'])
|
self.setScreenText(eventData['text'])
|
||||||
self.env['runtime']['attributeManager'].setAttributes(eventData['attributes'])
|
self.env['runtime']['attributeManager'].setAttributes(eventData['attributes'])
|
||||||
# initialize current deltas
|
# initialize current deltas
|
||||||
self.env['screen']['newNegativeDelta'] = ''
|
self.env['screen']['newNegativeDelta'] = ''
|
||||||
@ -131,10 +127,10 @@ class screenManager():
|
|||||||
|
|
||||||
# changes on the screen
|
# changes on the screen
|
||||||
oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText']))
|
oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText']))
|
||||||
newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
|
newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
|
||||||
typing = False
|
typing = False
|
||||||
diffList = []
|
diffList = []
|
||||||
|
|
||||||
if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']):
|
if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']):
|
||||||
if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '':
|
if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '':
|
||||||
if oldScreenText == '' and\
|
if oldScreenText == '' and\
|
||||||
@ -142,7 +138,7 @@ class screenManager():
|
|||||||
self.env['screen']['newDelta'] = newScreenText
|
self.env['screen']['newDelta'] = newScreenText
|
||||||
else:
|
else:
|
||||||
cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
|
cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
|
||||||
cursorLineEnd = cursorLineStart + self.env['screen']['columns']
|
cursorLineEnd = cursorLineStart + self.env['screen']['columns']
|
||||||
if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) >= 1 and \
|
if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) >= 1 and \
|
||||||
self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \
|
self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \
|
||||||
self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart] and \
|
self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart] and \
|
||||||
@ -152,14 +148,14 @@ class screenManager():
|
|||||||
#if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4:
|
#if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4:
|
||||||
# cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4
|
# cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4
|
||||||
if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3:
|
if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3:
|
||||||
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
|
cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3
|
||||||
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
||||||
# oldScreenText = re.sub(' +',' ',oldScreenText)
|
# oldScreenText = re.sub(' +',' ',oldScreenText)
|
||||||
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
|
||||||
#newScreenText = re.sub(' +',' ',newScreenText)
|
#newScreenText = re.sub(' +',' ',newScreenText)
|
||||||
diff = self.differ.compare(oldScreenText, newScreenText)
|
diff = self.differ.compare(oldScreenText, newScreenText)
|
||||||
diffList = list(diff)
|
diffList = list(diff)
|
||||||
typing = True
|
typing = True
|
||||||
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
|
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
|
||||||
if tempNewDelta.strip() != '':
|
if tempNewDelta.strip() != '':
|
||||||
if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()):
|
if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()):
|
||||||
@ -167,13 +163,13 @@ class screenManager():
|
|||||||
typing = False
|
typing = False
|
||||||
else:
|
else:
|
||||||
diff = self.differ.compare(oldScreenText.split('\n'),\
|
diff = self.differ.compare(oldScreenText.split('\n'),\
|
||||||
newScreenText.split('\n'))
|
newScreenText.split('\n'))
|
||||||
diffList = list(diff)
|
diffList = list(diff)
|
||||||
|
|
||||||
if not typing:
|
if not typing:
|
||||||
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
|
self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
|
||||||
else:
|
else:
|
||||||
self.env['screen']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+')
|
self.env['screen']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+')
|
||||||
self.env['screen']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')
|
self.env['screen']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')
|
||||||
|
|
||||||
# track highlighted
|
# track highlighted
|
||||||
@ -181,9 +177,9 @@ class screenManager():
|
|||||||
if self.env['runtime']['attributeManager'].isAttributeChange():
|
if self.env['runtime']['attributeManager'].isAttributeChange():
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
|
||||||
attributeDelta, attributeCursor = self.env['runtime']['attributeManager'].trackHighlights()
|
attributeDelta, attributeCursor = self.env['runtime']['attributeManager'].trackHighlights()
|
||||||
if attributeCursor:
|
if attributeCursor:
|
||||||
self.env['runtime']['attributeManager'].setAttributeCursor(attributeCursor)
|
self.env['runtime']['attributeManager'].setAttributeCursor(attributeCursor)
|
||||||
self.env['runtime']['attributeManager'].setAttributeDelta(attributeDelta)
|
self.env['runtime']['attributeManager'].setAttributeDelta(attributeDelta)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:update:highlight: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
@ -193,10 +189,10 @@ class screenManager():
|
|||||||
ignoreScreens = []
|
ignoreScreens = []
|
||||||
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen')
|
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen')
|
||||||
if fixIgnoreScreens != '':
|
if fixIgnoreScreens != '':
|
||||||
ignoreScreens.extend(fixIgnoreScreens.split(','))
|
ignoreScreens.extend(fixIgnoreScreens.split(','))
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
||||||
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ignore:' + str(ignoreScreens) + ' current:'+ str(screen ), debug.debugLevel.INFO)
|
||||||
return (screen in ignoreScreens)
|
return (screen in ignoreScreens)
|
||||||
|
|
||||||
def isScreenChange(self):
|
def isScreenChange(self):
|
||||||
@ -208,7 +204,7 @@ class screenManager():
|
|||||||
if ignoreSpace:
|
if ignoreSpace:
|
||||||
newDelta = newDelta.strip()
|
newDelta = newDelta.strip()
|
||||||
return newDelta != ''
|
return newDelta != ''
|
||||||
def isNegativeDelta(self):
|
def isNegativeDelta(self):
|
||||||
return self.env['screen']['newNegativeDelta'] != ''
|
return self.env['screen']['newNegativeDelta'] != ''
|
||||||
def getWindowAreaInText(self, text):
|
def getWindowAreaInText(self, text):
|
||||||
if not self.env['runtime']['cursorManager'].isApplicationWindowSet():
|
if not self.env['runtime']['cursorManager'].isApplicationWindowSet():
|
||||||
@ -220,7 +216,7 @@ class screenManager():
|
|||||||
for line in windowList:
|
for line in windowList:
|
||||||
windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n'
|
windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n'
|
||||||
return windowText
|
return windowText
|
||||||
|
|
||||||
def injectTextToScreen(self, text, screen = None):
|
def injectTextToScreen(self, text, screen = None):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['screenDriver'].injectTextToScreen(text, screen)
|
self.env['runtime']['screenDriver'].injectTextToScreen(text, screen)
|
||||||
@ -240,6 +236,6 @@ class screenManager():
|
|||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:leveScreen ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:leveScreen ' + str(e),debug.debugLevel.ERROR)
|
||||||
if not self.isSuspendingScreen():
|
if not self.isSuspendingScreen():
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['brailleDriver'].enterScreen(self.env['screen']['newTTY'])
|
self.env['runtime']['brailleDriver'].enterScreen(self.env['screen']['newTTY'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:enterScreen ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:enterScreen ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
@ -281,16 +281,18 @@ class driver(inputDriver):
|
|||||||
self.iDevices[i].set_led(led , 1)
|
self.iDevices[i].set_led(led , 1)
|
||||||
def grabAllDevices(self):
|
def grabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
ok = True
|
||||||
for fd in self.iDevices:
|
for fd in self.iDevices:
|
||||||
self.grabDevice(fd)
|
ok = ok and self.grabDevice(fd)
|
||||||
|
return ok
|
||||||
def ungrabAllDevices(self):
|
def ungrabAllDevices(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return True
|
||||||
|
ok = True
|
||||||
for fd in self.iDevices:
|
for fd in self.iDevices:
|
||||||
self.ungrabDevice(fd)
|
ok = ok and self.ungrabDevice(fd)
|
||||||
|
return ok
|
||||||
def createUInputDev(self, fd):
|
def createUInputDev(self, fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
self.uDevices[fd] = None
|
self.uDevices[fd] = None
|
||||||
@ -324,7 +326,7 @@ class driver(inputDriver):
|
|||||||
self.createUInputDev(newDevice.fd)
|
self.createUInputDev(newDevice.fd)
|
||||||
def grabDevice(self, fd):
|
def grabDevice(self, fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
return
|
return True
|
||||||
try:
|
try:
|
||||||
self.iDevices[fd].grab()
|
self.iDevices[fd].grab()
|
||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
@ -333,15 +335,20 @@ class driver(inputDriver):
|
|||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
def ungrabDevice(self,fd):
|
def ungrabDevice(self,fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
return
|
return True
|
||||||
try:
|
try:
|
||||||
self.gDevices[fd] = False
|
|
||||||
self.iDevices[fd].ungrab()
|
self.iDevices[fd].ungrab()
|
||||||
|
self.gDevices[fd] = False
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: ungrab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: ungrab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
||||||
except:
|
except IOError:
|
||||||
pass
|
self.gDevices[fd] = False
|
||||||
|
except Exception as e:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
def removeDevice(self,fd):
|
def removeDevice(self,fd):
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' +str(self.iDevices[fd]),debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: device removed: ' + str(fd) + ' ' +str(self.iDevices[fd]),debug.debugLevel.INFO)
|
||||||
self.clearEventBuffer()
|
self.clearEventBuffer()
|
||||||
|
Loading…
Reference in New Issue
Block a user