add setting save
This commit is contained in:
parent
a0beb42e89
commit
a97c31577a
@ -43,6 +43,7 @@ class remoteManager():
|
|||||||
# setting controll
|
# setting controll
|
||||||
self.settingConst = 'SETTING '
|
self.settingConst = 'SETTING '
|
||||||
self.setSettingConst = 'SET '
|
self.setSettingConst = 'SET '
|
||||||
|
self.saveSettingConst = 'SAVE '
|
||||||
self.resetSettingConst = 'RESET'
|
self.resetSettingConst = 'RESET'
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
@ -132,6 +133,10 @@ class remoteManager():
|
|||||||
if upperSettingsText.startswith(self.setSettingConst):
|
if upperSettingsText.startswith(self.setSettingConst):
|
||||||
parameterText = settingsText[len(self.setSettingConst):]
|
parameterText = settingsText[len(self.setSettingConst):]
|
||||||
self.setSettings(parameterText)
|
self.setSettings(parameterText)
|
||||||
|
# save setting
|
||||||
|
if upperSettingsText.startswith(self.saveSettingConst):
|
||||||
|
parameterText = settingsText[len(self.saveSettingConst):]
|
||||||
|
self.saveSettings(parameterText)
|
||||||
# reset setting
|
# reset setting
|
||||||
if upperSettingsText.startswith(self.resetSettingConst):
|
if upperSettingsText.startswith(self.resetSettingConst):
|
||||||
self.resetSettings()
|
self.resetSettings()
|
||||||
@ -173,9 +178,19 @@ class remoteManager():
|
|||||||
def resetWindow(self):
|
def resetWindow(self):
|
||||||
self.env['runtime']['cursorManager'].clearWindowForApplication()
|
self.env['runtime']['cursorManager'].clearWindowForApplication()
|
||||||
def say(self, text):
|
def say(self, text):
|
||||||
|
if not text:
|
||||||
|
return
|
||||||
|
if text == '':
|
||||||
|
return
|
||||||
self.env['runtime']['outputManager'].speakText(text)
|
self.env['runtime']['outputManager'].speakText(text)
|
||||||
def interruptSpeech(self):
|
def interruptSpeech(self):
|
||||||
self.env['runtime']['outputManager'].interruptOutput()
|
self.env['runtime']['outputManager'].interruptOutput()
|
||||||
|
def saveSettings(self, settingConfigPath):
|
||||||
|
if not settingConfigPath:
|
||||||
|
return
|
||||||
|
if settingConfigPath == '':
|
||||||
|
return
|
||||||
|
self.env['runtime']['settingsManager'].saveSettings(settingConfigPath)
|
||||||
def resetSettings(self):
|
def resetSettings(self):
|
||||||
self.env['runtime']['settingsManager'].resetSettingArgDict()
|
self.env['runtime']['settingsManager'].resetSettingArgDict()
|
||||||
def setSettings(self, settingsArgs):
|
def setSettings(self, settingsArgs):
|
||||||
|
@ -78,7 +78,21 @@ class settingsManager():
|
|||||||
self.env['settings'] = ConfigParser()
|
self.env['settings'] = ConfigParser()
|
||||||
self.env['settings'].read(settingConfigPath)
|
self.env['settings'].read(settingConfigPath)
|
||||||
return True
|
return True
|
||||||
|
def saveSettings(self, settingConfigPath):
|
||||||
|
# set opt dict here
|
||||||
|
# save file
|
||||||
|
try:
|
||||||
|
#print('file: ',settingConfigPath)
|
||||||
|
for section, settings in self.settingArgDict.items():
|
||||||
|
for setting, value in settings.items():
|
||||||
|
#print(section, setting, value)
|
||||||
|
self.env['settings'].set(section, setting, value)
|
||||||
|
#print('full',self.env['settings'])
|
||||||
|
|
||||||
|
configFile = open('/tmp/settings.conf', 'w')
|
||||||
|
self.env['settings'].write(configFile)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
def setSetting(self, section, setting, value):
|
def setSetting(self, section, setting, value):
|
||||||
self.setOptionArgDict(section, setting, value)
|
self.setOptionArgDict(section, setting, value)
|
||||||
#self.env['settings'].set(section, setting, value)
|
#self.env['settings'].set(section, setting, value)
|
||||||
|
Loading…
Reference in New Issue
Block a user