From cdf81f370b8ccab9c1b55726233b881c4908692a Mon Sep 17 00:00:00 2001
From: ThomasV <thomasv@gitorious>
Date: Sat, 13 Oct 2012 07:38:22 +0200
Subject: [PATCH] save config after checking qt version

---
 lib/gui_lite.py      | 17 +++++++++++------
 lib/interface.py     |  2 --
 lib/simple_config.py |  1 +
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/gui_lite.py b/lib/gui_lite.py
index 6552751e6..8d40cdb47 100644
--- a/lib/gui_lite.py
+++ b/lib/gui_lite.py
@@ -10,12 +10,6 @@ except ImportError:
     sys.exit(0)
 
 
-qtVersion = qVersion()
-if not(int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
-    app = QApplication(sys.argv)
-    QMessageBox.warning(None,"Could not start Lite GUI.", "Electrum was unable to load the 'Lite GUI' because it needs Qt version >= 4.7.\nPlease use the 'Qt' GUI")
-    sys.exit(0)
-
 
 
 from decimal import Decimal as D
@@ -62,8 +56,19 @@ class ElectrumGui(QObject):
 
         self.wallet = wallet
         self.config = config
+        self.check_qt_version()
         self.app = QApplication(sys.argv)
 
+
+    def check_qt_version(self):
+        qtVersion = qVersion()
+        if not(int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
+            app = QApplication(sys.argv)
+            QMessageBox.warning(None,"Could not start Lite GUI.", "Electrum was unable to load the 'Lite GUI' because it needs Qt version >= 4.7.\nChanging your config to use the 'Qt' GUI")
+            self.config.set_key('gui','qt',True)
+            sys.exit(0)
+
+
     def main(self, url):
         actuator = MiniActuator(self.wallet)
         self.connect(self, SIGNAL("updateservers()"),
diff --git a/lib/interface.py b/lib/interface.py
index 655f2ca29..24c5e04a9 100644
--- a/lib/interface.py
+++ b/lib/interface.py
@@ -481,5 +481,3 @@ class WalletSynchronizer(threading.Thread):
             else:
                 break
 
-
-
diff --git a/lib/simple_config.py b/lib/simple_config.py
index 90686af47..410876261 100644
--- a/lib/simple_config.py
+++ b/lib/simple_config.py
@@ -59,6 +59,7 @@ class SimpleConfig:
     def set_key(self, key, value, save = False):
         # find where a setting comes from and save it there
         if self.options_config.get(key):
+            print "Warning: cannot change '%s' because it was passed as a command-line option"%key
             return
 
         elif self.user_config.get(key):