first fixes

This commit is contained in:
chrys 2016-09-12 22:17:10 +02:00
parent 1ee4cbb159
commit 3ac70c14e5
3 changed files with 19 additions and 14 deletions

View File

@ -3,11 +3,15 @@
class command(): class command():
def __init__(self): def __init__(self):
pass pass
def initialize(self, environment):
return environment
def shutdown(self, environment):
return environment
def getDescription(self):
return 'No Description found'
def run(self, environment): def run(self, environment):
environment['screenData']['newCursorReview'] = { 'x': 0, 'y':environment['screenData']['lines']} environment['screenData']['newCursorReview'] = { 'x': 0, 'y':environment['screenData']['lines']}
environment['runtime']['outputManager'].presentText(environment, "Bottom", interrupt=True) environment['runtime']['outputManager'].presentText(environment, "Bottom", interrupt=True)
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass
def shutdown(self):
pass

View File

@ -64,18 +64,16 @@ class commandManager():
environment['commandInfo']['lastCommandTime'] = time.time() environment['commandInfo']['lastCommandTime'] = time.time()
return environment return environment
def isShortcutDefined(self, environment, currCommand): def isShortcutDefined(self, environment, currShortcutString):
return( environment['input']['currShortcutString'] in environment['bindings']) return( currShortcutString in environment['bindings'])
def setCurrCommandForExec(self, environment, currCommand): def setCurrCommandForExec(self, environment, currCommand):
if not self.isShortcutDefined(environment):
return environment
environment['commandInfo']['currCommand'] = currCommand environment['commandInfo']['currCommand'] = currCommand
return environment return environment
def getCommandForShortcut(self, environment, currShortcutString): def getCommandForShortcut(self, environment, currShortcutString):
if not self.isShortcutDefined(environment): if not self.isShortcutDefined(environment, currShortcutString):
return environment return ''
return environment['bindings'][currShortcutString] return environment['bindings'][currShortcutString]
def isCommandDefined(self, environment, currCommand): def isCommandDefined(self, environment, currCommand):

View File

@ -29,14 +29,17 @@ class fenrir():
self.shutdown() self.shutdown()
def handleProcess(self): def handleProcess(self):
self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment) #self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
timeout = True
try: try:
self.environment = self.environment['runtime']['screenManager'].update(self.environment) self.environment = self.environment['runtime']['screenManager'].update(self.environment)
except Exception as e: except Exception as e:
print(e)
self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR) self.environment['runtime']['debug'].writeDebugOut(self.environment, str(e),debug.debugLevel.ERROR)
if not self.environment['input']['keyForeward']: if not (self.environment['input']['keyForeward'] or timeout):
currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment) #currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
currCommand = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment) currShortcut = ''
currCommand = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment, currShortcut)
self.environment = self.environment['runtime']['commandManager'].setCurrCommandForExec(self.environment, currCommand) self.environment = self.environment['runtime']['commandManager'].setCurrCommandForExec(self.environment, currCommand)
if not timeout: if not timeout:
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput') self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')