[mousetrap] If MouseTrap's config file doesn't exist the settings window will be shown at startup



commit 67cf4ffd95540c9d3beaff0b76ea759929a305e9
Author: Flavio Percoco Premoli <flaper87 gmail com>
Date:   Wed Mar 31 22:23:00 2010 +0200

    If MouseTrap's config file doesn't exist the settings window will be shown at startup

 src/mousetrap/app/lib/settings.py |    5 +++--
 src/mousetrap/app/main.py         |    7 ++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/mousetrap/app/lib/settings.py b/src/mousetrap/app/lib/settings.py
index ac3cac7..52f2d7d 100644
--- a/src/mousetrap/app/lib/settings.py
+++ b/src/mousetrap/app/lib/settings.py
@@ -107,12 +107,13 @@ class Settings( ConfigParser.ConfigParser ):
 
 def load():
     cfg = Settings()
+    created = False
     if not os.path.exists( env.configPath ):
         os.mkdir( env.configPath )
-        cfg.write_first(env.configFile)
 
     if not os.path.exists( env.configFile ):
         cfg.write_first(env.configFile)
+        created = True
 
     cfg.readfp(open( env.configFile ))
-    return cfg
+    return created, cfg
diff --git a/src/mousetrap/app/main.py b/src/mousetrap/app/main.py
index f1a633d..732b4e5 100644
--- a/src/mousetrap/app/main.py
+++ b/src/mousetrap/app/main.py
@@ -79,7 +79,7 @@ class Controller():
         """
 
         if self.cfg is None:
-            self.cfg = settings.load()
+            conf_created, self.cfg = settings.load()
 
         self.proc_args()
 
@@ -101,6 +101,11 @@ class Controller():
         self.itf = MainGui(self)
         self.itf.build_interface()
         self.itf.load_addons()
+        
+        if conf_created:
+            from ui import settings_gui
+            settings_gui.showPreffGui(self)
+            
         debug.info("mousetrap", "MouseTrap's Interface Built and Loaded")
 
         gobject.threads_init()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]