try command structure, fix tutorial mode command

This commit is contained in:
chrys 2016-09-17 17:35:03 +02:00
parent 0f10ecd08a
commit 11289c09cd
5 changed files with 10 additions and 11 deletions

View File

@ -12,9 +12,9 @@ class command():
return 'You are leving the tutorial mode. Press that shortcut again to enter the tutorial mode again.' return 'You are leving the tutorial mode. Press that shortcut again to enter the tutorial mode again.'
def run(self, environment): def run(self, environment):
text = 'you entered the tutorial mode. In that mode the commands are not executed. but you get an description what the shortcut does. to leve the tutorial mode press that shortcut again.' text = 'you entered the tutorial mode. In that mode the commands are not executed. but you get an description what the shortcut does. to leve the tutorial mode press that shortcut again.'
environment['runtime']['outputManager'].presentText(environment, text, interrupt=True) environment['runtime']['outputManager'].presentText(environment, text, interrupt=True)
environment['generalInformation']['tutorialMode'] = True environment['generalInformation']['tutorialMode'] = True
return environment return environment
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -22,7 +22,7 @@ class inputManager():
timeout = False timeout = False
environment['input']['firstEvent'] = event environment['input']['firstEvent'] = event
environment['input']['currEvent'] = event environment['input']['currEvent'] = event
if not #if not
#print(event) #print(event)
return timeout return timeout

View File

@ -17,7 +17,6 @@ class outputManager():
environment['runtime']['speechDriver'].shutdown(environment) environment['runtime']['speechDriver'].shutdown(environment)
def presentText(self, environment, text, interrupt=True, soundIcon = ''): def presentText(self, environment, text, interrupt=True, soundIcon = ''):
print(soundIcon,text)
environment['runtime']['debug'].writeDebugOut(environment,"presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO) environment['runtime']['debug'].writeDebugOut(environment,"presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
if self.playSoundIcon(environment, soundIcon, interrupt): if self.playSoundIcon(environment, soundIcon, interrupt):
environment['runtime']['debug'].writeDebugOut(environment,"soundIcon found" ,debug.debugLevel.INFO) environment['runtime']['debug'].writeDebugOut(environment,"soundIcon found" ,debug.debugLevel.INFO)

View File

@ -45,7 +45,7 @@ class settingsManager():
shortcutKeys.append(key.upper()) shortcutKeys.append(key.upper())
shortcut.append(shortcutRepeat) shortcut.append(shortcutRepeat)
shortcut.append(sorted(shortcutKeys)) shortcut.append(sorted(shortcutKeys))
print(str(shortcut)) print(str(shortcut), commandName)
environment['bindings'][str(shortcut)] = commandName environment['bindings'][str(shortcut)] = commandName
kbConfig.close() kbConfig.close()

View File

@ -33,8 +33,9 @@ class fenrir():
self.shutdown() self.shutdown()
def handleProcess(self): def handleProcess(self):
time.sleep(3)
timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment) timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
timeout = True timeout = False
try: try:
self.environment['runtime']['screenManager'].update(self.environment) self.environment['runtime']['screenManager'].update(self.environment)
except Exception as e: except Exception as e:
@ -42,18 +43,17 @@ class fenrir():
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'] or timeout): if not (self.environment['input']['keyForeward'] or timeout):
#currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment) #currShortcut = self.environment['runtime']['inputManager'].getCurrShortcut(self.environment)
shortcut = '' shortcut = "[1, ['KEY_FENRIR', 'KEY_T']]"
command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut) command = self.environment['runtime']['inputManager'].getCommandForShortcut(self.environment, shortcut)
self.environment['runtime']['commandManager'].queueCommand(self.environment, command) self.environment['runtime']['commandManager'].queueCommand(self.environment, command)
if not timeout: if not timeout:
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput') self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged') self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
if not self.environment['input']['keyForeward']: if not self.environment['input']['keyForeward']:
if self.environment['runtime']['commandManager'].isCommandQueued(): self.handleCommands()
self.handleCommands()
def handleCommands(self): def handleCommands(self):
if (self.environment['commandInfo']['currCommand'] != ''): if self.environment['runtime']['commandManager'].isCommandQueued(self.environment):
self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands') self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
def shutdownRequest(self): def shutdownRequest(self):