consume shortcuts, make paste work with pty, fix bug

This commit is contained in:
chrys
2018-03-26 11:45:30 +02:00
parent 03397495cf
commit bb6fc4d3ab
6 changed files with 41 additions and 24 deletions

View File

@ -115,7 +115,7 @@ class commandManager():
shortcutKeys = []
shortcut = []
for key in keys:
if not self.env['runtime']['settingsManager'].isValidKey(key.upper()):
if not self.env['runtime']['inputManager'].isValidKey(key.upper()):
self.env['runtime']['debug'].writeDebugOut("invalid key : "+ key.upper() + ' command:' +commandName ,debug.debugLevel.WARNING)
invalid = True
break

View File

@ -90,13 +90,13 @@ class fenrirManager():
return
if event['Data'] == b'':
return
self.handleControlMode(event['Data'])
isCommand = False
if self.controlMode and not self.switchCtrlModeOnce == 1 or\
not self.controlMode and self.switchCtrlModeOnce == 1:
self.detectByteCommand(event['Data'])
isCommand = self.detectByteCommand(event['Data'])
if not isCommand:
self.environment['runtime']['screenManager'].injectTextToScreen(event['Data'])
def handleControlMode(self, escapeSequence):
convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence)
if self.switchCtrlModeOnce > 0:
@ -108,10 +108,12 @@ class fenrirManager():
self.environment['runtime']['outputManager'].presentText(_('Sticky Mode On'), soundIcon='Accept', interrupt=True, flush=True)
else:
self.environment['runtime']['outputManager'].presentText(_('Sticky Mode On'), soundIcon='Cancel', interrupt=True, flush=True)
return True
if convertedEscapeSequence == b'^[:':
self.switchCtrlModeOnce = 2
self.environment['runtime']['outputManager'].presentText(_('bypass'), soundIcon='PTYBypass', interrupt=True, flush=True)
return True
return False
def handleExecuteCommand(self, event):
if event['Data'] == '':
return
@ -163,10 +165,14 @@ class fenrirManager():
def detectByteCommand(self, escapeSequence):
convertedEscapeSequence = self.environment['runtime']['byteManager'].unifyEscapeSeq(escapeSequence)
command = self.environment['runtime']['inputManager'].getCommandForShortcut(convertedEscapeSequence)
self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, command)
if self.handleControlMode(convertedEscapeSequence):
return True
self.command = self.environment['runtime']['inputManager'].getCommandForShortcut(convertedEscapeSequence)
self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, self.command)
if self.command != '':
self.command = ''
return True
return False
def detectShortcutCommand(self):
if self.environment['input']['keyForeward'] > 0:
return

View File

@ -187,6 +187,7 @@ class screenManager():
try:
self.env['runtime']['screenDriver'].injectTextToScreen(text, screen)
except Exception as e:
print(e)
self.env['runtime']['debug'].writeDebugOut('screenManager:injectTextToScreen ' + str(e),debug.debugLevel.ERROR)
def changeBrailleScreen(self):

View File

@ -255,14 +255,19 @@ class settingsManager():
environment['runtime']['memoryManager'] = memoryManager.memoryManager()
environment['runtime']['memoryManager'].initialize(environment)
environment['runtime']['eventManager'] = eventManager.eventManager()
environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['processManager'] = processManager.processManager()
environment['runtime']['processManager'].initialize(environment)
environment['runtime']['commandManager'] = commandManager.commandManager()
environment['runtime']['commandManager'].initialize(environment)
environment['runtime']['processManager'].initialize(environment)
environment['runtime']['inputManager'] = inputManager.inputManager()
environment['runtime']['inputManager'].initialize(environment)
environment['runtime']['commandManager'] = commandManager.commandManager()
environment['runtime']['commandManager'].initialize(environment)
environment['runtime']['byteManager'] = byteManager.byteManager()
environment['runtime']['byteManager'].initialize(environment)