more work

This commit is contained in:
chrys 2019-01-28 23:29:49 +01:00
parent 8f658171e2
commit eedba07df7
5 changed files with 21 additions and 10 deletions

View File

@ -18,22 +18,33 @@ class vmenuManager():
self.env = environment self.env = environment
def shutdown(self): def shutdown(self):
pass pass
def setCurrMenu(self, currMenu = ''):
try:
t = self.menuDict[currMenu]
l = list(menuDict.keys())
self.currIndex = [l.index(currMenu)]
self.currMenu = currMenu
except:
self.currIndex = None
self.currMenu = ''
def getCurrMenu(self):
return self.currMenu
def getActive(self): def getActive(self):
return self.active return self.active
def togglelMode(self, currMenu = ''): def togglelMode(self):
self.setActive(not self.getActive(), currMenu) self.setActive(not self.getActive())
def setActive(self, active, currMenu = ''): def setActive(self, active):
self.active = active self.active = active
self.currMenu = currMenu self.currMenu = currMenu
if active: if active:
self.createMenuTree() self.createMenuTree()
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE' self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_VMENU_MODE'
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP' self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_VMENU_ENTRY'
self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP' self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_VMENU_ENTRY'
self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP' self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_VMENU_ENTRY'
self.env['bindings'][str([1, ['KEY_LEFT']])] = 'NEXT_HELP' self.env['bindings'][str([1, ['KEY_LEFT']])] = 'DEC_LEVEL_VMENU'
self.env['bindings'][str([1, ['KEY_RIGHT']])] = 'CURR_HELP' self.env['bindings'][str([1, ['KEY_RIGHT']])] = 'INC_LEVEL_VMENU'
self.env['bindings'][str([1, ['KEY_ENTER']])] = 'CURR_HELP' self.env['bindings'][str([1, ['KEY_ENTER']])] = 'EXEC_VMENU_ENTRY'
else: else:
try: try:
self.menuDict = {} self.menuDict = {}