lxproxy: Update to new location
authorJulien Lavergne <julien.lavergne@gmail.com>
Sat, 19 Jun 2010 19:00:26 +0000 (21:00 +0200)
committerJulien Lavergne <julien.lavergne@gmail.com>
Sat, 19 Jun 2010 19:00:26 +0000 (21:00 +0200)
data/ui/lxproxy/AboutLxproxyDialog.ui
data/ui/lxproxy/LxproxyWindow.ui
data/ui/lxproxy/PreferencesLxproxyDialog.ui
src/lxproxy/AboutLxproxyDialog.py
src/lxproxy/Makefile.am
src/lxproxy/PreferencesLxproxyDialog.py
src/lxproxy/__init__.py [deleted file]
src/lxproxy/lxproxy.py
src/lxproxy/lxproxyconfig.py

index 98d6fa5..017cca8 100644 (file)
@@ -6,7 +6,7 @@
   <object class="AboutLxproxyDialog" id="about_lxproxy_dialog">
     <property name="border_width">5</property>
     <property name="window_position">center</property>
-    <property name="icon">../media/icon.png</property>
+    <property name="icon">../../media/icon.png</property>
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
     <property name="program_name">Lxproxy</property>
index 6662af7..ec65e95 100644 (file)
@@ -3,13 +3,13 @@
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-requires lxproxy_window 1.0 -->
   <!-- interface-naming-policy project-wide -->
-  <!-- interface-local-resource-path ../media -->
+  <!-- interface-local-resource-path ../../media -->
   <object class="LxproxyWindow" id="lxproxy_window">
     <property name="width_request">500</property>
     <property name="height_request">250</property>
     <property name="title" translatable="yes">Proxy Settings</property>
     <property name="window_position">center</property>
-    <property name="icon">../media/icon.png</property>
+    <property name="icon">../../media/icon.png</property>
     <signal name="destroy" handler="on_destroy"/>
     <child>
       <object class="GtkVBox" id="vbox1">
index d52c1b8..6af7419 100644 (file)
@@ -5,7 +5,7 @@
   <!-- interface-naming-policy project-wide -->
   <object class="PreferencesLxproxyDialog" id="preferences_lxproxy_dialog">
     <property name="border_width">5</property>
-    <property name="icon">../media/icon.png</property>
+    <property name="icon">../../media/icon.png</property>
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
     <child internal-child="vbox">
index 08ce0bf..b0870c6 100644 (file)
@@ -18,7 +18,7 @@ import sys
 import os
 import gtk
 
-from lxproxy.lxproxyconfig import getdatapath
+from lxproxyconfig import getdatapath
 
 class AboutLxproxyDialog(gtk.AboutDialog):
     __gtype_name__ = "AboutLxproxyDialog"
@@ -55,7 +55,7 @@ def NewAboutLxproxyDialog():
     """
 
     #look for the ui file that describes the ui
-    ui_filename = os.path.join(getdatapath(), 'ui', 'AboutLxproxyDialog.ui')
+    ui_filename = os.path.join(getdatapath(), 'ui', 'lxproxy', 'AboutLxproxyDialog.ui')
     if not os.path.exists(ui_filename):
         ui_filename = None
 
index 258df9f..18e4082 100644 (file)
@@ -4,7 +4,7 @@ SUBDIRS=
 
 lxproxydir = $(prefix)/bin
 
-lxproxymoduledir = $(pkgdatadir)
+lxproxymoduledir = $(pkgdatadir)/lxproxy
 lxproxymodule_DATA =   \
        __init__.py     \
     AboutLxproxyDialog.py \
@@ -24,3 +24,6 @@ EXTRA_DIST =  \
     lxproxy.py \
     $(lxproxymodule_DATA) \
        $(NULL)
+
+clean-local:
+       rm -rf *.pyc *.pyo
index a368d6f..c97e338 100644 (file)
@@ -20,7 +20,7 @@ import gtk
 from desktopcouch.records.server import CouchDatabase
 from desktopcouch.records.record import Record
 
-from lxproxy.lxproxyconfig import getdatapath
+from lxproxyconfig import getdatapath
 
 class PreferencesLxproxyDialog(gtk.Dialog):
     __gtype_name__ = "PreferencesLxproxyDialog"
@@ -113,7 +113,7 @@ def NewPreferencesLxproxyDialog():
     """
 
     #look for the ui file that describes the ui
-    ui_filename = os.path.join(getdatapath(), 'ui', 'PreferencesLxproxyDialog.ui')
+    ui_filename = os.path.join(getdatapath(), 'ui', 'lxproxy', 'PreferencesLxproxyDialog.ui')
     if not os.path.exists(ui_filename):
         ui_filename = None
 
diff --git a/src/lxproxy/__init__.py b/src/lxproxy/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
index ea2ab7e..23e2c6d 100755 (executable)
@@ -34,8 +34,8 @@ DEFAULTDICT = {"export http_proxy": "http://user:password@hostname:8080",
                "export https_proxy": "http://user:password@hostname:8080",
                "export ftp_proxy": "http://user:password@hostname:8080"}
 
-from lxproxy import AboutLxproxyDialog
-from lxproxy.lxproxyconfig import getdatapath
+import AboutLxproxyDialog
+from lxproxyconfig import getdatapath
 
 class LxproxyWindow(gtk.Window):
     __gtype_name__ = "LxproxyWindow"
@@ -106,14 +106,17 @@ class LxproxyWindow(gtk.Window):
         #code for other initialization actions should be added here
 
     def readfile(self):
+        profile_location = os.path.expanduser('~/.profile')
+        if not os.path.exists(profile_location):
+            tmpfile = open(profile_location, 'w') 
+            tmpfile.write('') 
+            tmpfile.close()
         try:
-            f = file(home + "/.profile")
-            data = f.read()
-        except:
-            print "Could not open proxyconfig" 
-        finally:
-            f.close()
+            data = profile_location.read()
+            profile_location.close()
             config = self.parse(data)
+        except:
+            print "Could not open proxyconfig"
 
     def parse(self, s):
         #Fetch a *copy* of the default dictionary.
@@ -232,10 +235,11 @@ def NewLxproxyWindow():
     """
 
     #look for the ui file that describes the ui
-    ui_filename = os.path.join(getdatapath(), 'ui', 'LxproxyWindow.ui')
+    ui_filename = os.path.join(getdatapath(), 'ui', 'lxproxy', 'LxproxyWindow.ui')
     if not os.path.exists(ui_filename):
         ui_filename = None
 
+    print ('1',ui_filename)
     builder = gtk.Builder()
     builder.add_from_file(ui_filename)
     window = builder.get_object("lxproxy_window")
index 68a814d..bb263e4 100644 (file)
@@ -21,7 +21,7 @@
 
 # where your project will head for your data (for instance, images and ui files)
 # by default, this is ../data, relative your trunk layout
-__lxproxy_data_directory__ = '../data/'
+__lxproxy_data_directory__ = '../../data/'
 
 
 import os