announce shortct

This commit is contained in:
chrys 2017-07-12 23:28:23 +02:00
parent 6133f100f8
commit 7a460b0d83
3 changed files with 16 additions and 5 deletions

View File

@ -16,7 +16,6 @@ class command():
def getDescription(self):
return _('Toggle the Tutorial mode')
def run(self):
print('TM')
text = ''
if self.env['runtime']['helpManager'].isTutorialMode():
text = _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.')

View File

@ -126,7 +126,6 @@ class commandManager():
shortcut.append(sorted(shortcutKeys))
self.env['bindings'][str(shortcut)] = fileName.upper()
except Exception as e:
print(e)
self.env['runtime']['debug'].writeDebugOut("Loading script:" + command ,debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
continue
@ -196,7 +195,6 @@ class commandManager():
if self.commandExists(command, section):
try:
self.env['runtime']['debug'].writeDebugOut("Executing command:" + section + "." + command ,debug.debugLevel.INFO)
print(command, section)
self.env['commands'][section][command].run()
except Exception as e:
self.env['runtime']['debug'].writeDebugOut("Executing command:" + section + "." + command +' ' + str(e),debug.debugLevel.ERROR)
@ -222,4 +220,11 @@ class commandManager():
self.env['commandInfo']['currCommand'] = command
def commandExists(self, command, section = 'commands'):
return( command in self.env['commands'][section])
return( command in self.env['commands'][section])
def getShortcutForCommand(self, command):
shortcut = ''
try:
shortcut = list(self.env['bindings'].keys())[list(self.env['bindings'].values()).index(command)]
except:
pass
return shortcut

View File

@ -28,7 +28,14 @@ class helpManager():
commandName = commandName.split('__-__')[0]
commandName = commandName.replace('_',' ')
commandName = commandName.replace('_',' ')
helptext = commandName + ', Shortcut , Description' + self.env['runtime']['commandManager'].getCommandDescription( command, section = 'commands')
commandDescription = self.env['runtime']['commandManager'].getCommandDescription( command, section = 'commands')
if commandDescription == '':
commandDescription = 'no Description available'
commandShortcut = self.env['runtime']['commandManager'].getShortcutForCommand( command)
commandShortcut = commandShortcut.replace('KEY_',' ')
if commandShortcut == '':
commandShortcut = 'unbound'
helptext = commandName + ', Shortcut ' + commandShortcut + ', Description' + commandDescription
return helptext
def createHelpDict(self, section = 'commands'):
self.helpDict = {}