save settingsfile and add API
This commit is contained in:
parent
52c7389ba4
commit
2fe27bdc36
@ -41,6 +41,7 @@ class settingsManager():
|
|||||||
self.settings = settingsData
|
self.settings = settingsData
|
||||||
self.settingArgDict = {}
|
self.settingArgDict = {}
|
||||||
self.bindingsBackup = None
|
self.bindingsBackup = None
|
||||||
|
self.settingsFile = ''
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
@ -75,14 +76,25 @@ class settingsManager():
|
|||||||
self.env['soundIcons'][soundIcon] = soundIconFile
|
self.env['soundIcons'][soundIcon] = soundIconFile
|
||||||
self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True)
|
self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
siConfig.close()
|
siConfig.close()
|
||||||
|
def getSettingsFile(self):
|
||||||
|
return self.settingsFile
|
||||||
|
def setSettingsFile(self, settingsFile):
|
||||||
|
if not os.path.exists(settingsFile):
|
||||||
|
return
|
||||||
|
if not os.access(settingsFile, os.R_OK):
|
||||||
|
return
|
||||||
|
self.settingsFile = settingsFile
|
||||||
def loadSettings(self, settingConfigPath):
|
def loadSettings(self, settingConfigPath):
|
||||||
if not os.path.exists(settingConfigPath):
|
if not os.path.exists(settingConfigPath):
|
||||||
return False
|
return False
|
||||||
if not os.access(settingConfigPath, os.R_OK):
|
if not os.access(settingConfigPath, os.R_OK):
|
||||||
return False
|
return False
|
||||||
self.env['settings'] = ConfigParser()
|
self.env['settings'] = ConfigParser()
|
||||||
self.env['settings'].read(settingConfigPath)
|
try:
|
||||||
|
self.env['settings'].read(settingConfigPath)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
self.setSettingsFile(settingConfigPath)
|
||||||
return True
|
return True
|
||||||
def saveSettings(self, settingConfigPath):
|
def saveSettings(self, settingConfigPath):
|
||||||
# set opt dict here
|
# set opt dict here
|
||||||
|
Loading…
Reference in New Issue
Block a user