[nanny/win32: 40/75] Add py2exe paths to Win32Chrono



commit adc0319661ea6f874c4e760b0275f1c29c470c68
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Sat Sep 25 18:59:01 2010 +0200

    Add py2exe paths to Win32Chrono

 daemon/src/Win32Chrono.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/daemon/src/Win32Chrono.py b/daemon/src/Win32Chrono.py
index 22fc51a..e883e97 100644
--- a/daemon/src/Win32Chrono.py
+++ b/daemon/src/Win32Chrono.py
@@ -25,6 +25,7 @@
 
 import gobject
 import os
+import sys
 
 import pickle
 import datetime
@@ -53,12 +54,15 @@ class Win32Chrono(gobject.GObject) :
         '''Init function for NannyChrono class.'''
         gobject.GObject.__init__(self)
         self.quarterback = quarterback
-
-        file_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-        for x in range(6):
-            file_dir = os.path.dirname(file_dir)
-        root_path = file_dir
-        self.apps_list_path = os.path.join(root_path, "etc", "nanny", "applists")
+        if not hasattr(sys, "frozen") :
+            file_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+            for x in range(6):
+                file_dir = os.path.dirname(file_dir)
+            root_path = file_dir
+            self.apps_list_path = os.path.join(root_path, "etc", "nanny", "applists")
+        else:
+            root_path = os.path.dirname(os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))))
+            self.apps_list_path = os.path.join(root_path, "etc", "nanny", "applists")
 
         self.day = datetime.date.today().day
         self.categories = ['session', 'browser', 'email', 'im']



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