[pitivi/ges: 134/287] pitivi/system.py: implement getSystem(), gets the best available *System



commit 2b0863ea76f889b44c137e1c3ca97f086600619e
Author: Stephen Griffiths <scgmk5 gmail com>
Date:   Wed Feb 10 23:04:33 2010 +1100

    pitivi/system.py: implement getSystem(), gets the best available *System

 pitivi/system.py |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/system.py b/pitivi/system.py
index 238cdd7..6a94aa1 100644
--- a/pitivi/system.py
+++ b/pitivi/system.py
@@ -20,6 +20,8 @@
 # Boston, MA 02111-1307, USA.
 
 
+import os
+
 from pitivi.configure import APPNAME
 from pitivi.log.loggable import Loggable
 from pitivi.signalinterface import Signallable
@@ -271,3 +273,40 @@ class GnomeSystem(FreedesktopOrgSystem):
                 self.debug("uninhibited")
             else:
                 self.debug("already uninhibited")
+
+
+system_ = None
+
+#attempts to identify the System, import dependencies and overide system_
+if os.name == 'posix':
+    if 'GNOME_DESKTOP_SESSION_ID' in os.environ:
+        try:
+            import pynotify
+            import dbus
+            pynotify.init(APPNAME)
+            system_ = GnomeSystem
+        except:
+            pass
+
+    if  system_ == None:
+        try:
+            import pynotify
+            pynotify.init(APPNAME)
+            system_ = FreedesktopOrgSystem
+        except:
+            pass
+elif os.name == 'nt':
+    pass
+elif os.name == 'mac':
+    pass
+
+
+def getSystem():
+    system = None
+    if system_ != None:
+        system = system_()
+
+    if system == None:
+        system = System()
+
+    return system



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