handle binding backup more clean

This commit is contained in:
chrys 2019-02-12 23:44:57 +01:00
parent 721bc4a3b7
commit 633b90f1e8
3 changed files with 7 additions and 9 deletions

View File

@ -11,7 +11,6 @@ class helpManager():
def __init__(self):
self.helpDict = {}
self.tutorialListIndex = None
self.bindingsBackup = None
def initialize(self, environment):
self.env = environment
def shutdown(self):
@ -23,7 +22,6 @@ class helpManager():
return
self.env['general']['tutorialMode'] = newTutorialMode
if newTutorialMode:
self.bindingsBackup = self.env['bindings'].copy()
self.createHelpDict()
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE'
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP'
@ -31,8 +29,7 @@ class helpManager():
self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP'
else:
try:
self.env['bindings'] = self.bindingsBackup.copy()
self.bindingsBackup = None
self.env['bindings'] = self.env['runtime']['settingsManager'].getBindingBackup()
except:
pass
def isTutorialMode(self):

View File

@ -39,11 +39,13 @@ class settingsManager():
def __init__(self):
self.settings = settingsData
self.settingArgDict = {}
self.bindingsBackup = None
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getBindingBackup(self):
return self.bindingsBackup.copy()
def loadSoundIcons(self, soundIconPath):
siConfig = open(soundIconPath + '/soundicons.conf',"r")
while(True):
@ -392,4 +394,6 @@ class settingsManager():
environment['runtime']['debug'].writeDebugOut(str(environment['settings']._sections) , debug.debugLevel.INFO, onAnyLevel=True)
environment['runtime']['debug'].writeDebugOut('\/-------self.settingArgDict-------\/',debug.debugLevel.INFO, onAnyLevel=True)
environment['runtime']['debug'].writeDebugOut(str( self.settingArgDict) ,debug.debugLevel.INFO, onAnyLevel=True)
self.bindingsBackup = environment['bindings'].copy()
return environment

View File

@ -21,7 +21,6 @@ class vmenuManager():
self.useTimeout = True
self.searchText = ''
self.lastSearchTime = time.time()
self.bindingsBackup = None
def initialize(self, environment):
self.env = environment
# use default path
@ -104,7 +103,6 @@ class vmenuManager():
except Exception as e:
print(e)
try:
self.bindingsBackup = self.env['bindings'].copy()
# navigation
self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_VMENU_MODE'
self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_VMENU_ENTRY'
@ -145,8 +143,7 @@ class vmenuManager():
else:
try:
self.currIndex = None
self.env['bindings'] = self.bindingsBackup.copy()
self.bindingsBackup = None
self.env['bindings'] = self.env['runtime']['settingsManager'].getBindingBackup()
except:
pass
def createMenuTree(self):