From: Maran Date: Thu, 30 Aug 2012 15:52:03 +0000 (+0200) Subject: Added a set_key setter method that can also write out the changes to file X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=fbf854bcb8fc53ae4e9f0fabc5618eca16f5dd57;p=electrum-nvc.git Added a set_key setter method that can also write out the changes to file --- diff --git a/electrum b/electrum index d9e1347..a414d94 100755 --- a/electrum +++ b/electrum @@ -168,8 +168,7 @@ if __name__ == '__main__': error_message.setFixedSize(350,200) error_message.showMessage("

Sorry, the Electrum 'Lite GUI' requires Qt >= 4.7 to run. The pro GUI will be started instead.

Check your distributions packages for upgrades.

") - simple_config.config["gui"] = "qt" - simple_config.save_config() + simple_config.set_key("gui", "qt") app.exec_() diff --git a/lib/simple_config.py b/lib/simple_config.py index 47a17e0..ce64c28 100644 --- a/lib/simple_config.py +++ b/lib/simple_config.py @@ -4,6 +4,11 @@ import os class SimpleConfig: 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): f = open(self.config_file_path(), "w+") f.write(json.dumps(self.config))