Added a set_key setter method that can also write out the changes to file
This commit is contained in:
parent
0d229383aa
commit
fbf854bcb8
3
electrum
3
electrum
|
@ -168,8 +168,7 @@ if __name__ == '__main__':
|
||||||
error_message.setFixedSize(350,200)
|
error_message.setFixedSize(350,200)
|
||||||
error_message.showMessage("<p>Sorry, the Electrum 'Lite GUI' requires Qt >= 4.7 to run. The pro GUI will be started instead.</p><p>Check your distributions packages for upgrades.</p>")
|
error_message.showMessage("<p>Sorry, the Electrum 'Lite GUI' requires Qt >= 4.7 to run. The pro GUI will be started instead.</p><p>Check your distributions packages for upgrades.</p>")
|
||||||
|
|
||||||
simple_config.config["gui"] = "qt"
|
simple_config.set_key("gui", "qt")
|
||||||
simple_config.save_config()
|
|
||||||
|
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,11 @@ import os
|
||||||
class SimpleConfig:
|
class SimpleConfig:
|
||||||
default_options = {"gui": "lite"}
|
default_options = {"gui": "lite"}
|
||||||
|
|
||||||
|
def set_key(self, key, value, save = True):
|
||||||
|
self.config[key] = value
|
||||||
|
if save == True:
|
||||||
|
self.save_config()
|
||||||
|
|
||||||
def save_config(self):
|
def save_config(self):
|
||||||
f = open(self.config_file_path(), "w+")
|
f = open(self.config_file_path(), "w+")
|
||||||
f.write(json.dumps(self.config))
|
f.write(json.dumps(self.config))
|
||||||
|
|
Loading…
Reference in New Issue