[pybliographer/gtk3] Enable run pybliographic either from source or installation



commit 3cb1b8e2f6cb9ce78a0c0748146329c3958e1fe7
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Fri Mar 21 16:38:49 2014 -0700

    Enable run pybliographic either from source or installation

 Pyblio/GnomeUI/Document.py |    2 ++
 Pyblio/GnomeUI/Index.py    |    2 +-
 Pyblio/Makefile.am         |    2 ++
 Pyblio/version.py.in       |   21 +++++++++++++++++----
 4 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 15728f8..4fe8675 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -193,6 +193,7 @@ class Document (Connector.Publisher):
         self.uim.ensure_update ()
 
         gp = os.path.join(Utils.glade_root, 'pyblio.ui')
+        icon_file = os.path.join (version.pixmapsdir, 'pybliographic.png')
         
         self.xml = Gtk.Builder()
         self.xml.set_translation_domain('pybliographer')
@@ -200,6 +201,7 @@ class Document (Connector.Publisher):
         self.xml.connect_signals(self)
 
         self.w = self.xml.get_object ('main')
+        self.w.set_icon_from_file (icon_file)
         self.paned = self.xml.get_object ('main_pane')
 
         box = self.xml.get_object ('grid')
diff --git a/Pyblio/GnomeUI/Index.py b/Pyblio/GnomeUI/Index.py
index b45d052..6e12bd4 100644
--- a/Pyblio/GnomeUI/Index.py
+++ b/Pyblio/GnomeUI/Index.py
@@ -74,7 +74,7 @@ class Index (Connector.Publisher):
 
         i = 0
         self.gvpixbuf = GdkPixbuf.Pixbuf.new_from_file(
-            os.path.join (version.datadir, 'pixmaps', 'pybliographic-viewer.png'))
+            os.path.join (version.pixmapsdir, 'pybliographic-viewer.png'))
         if True:
             rend = Gtk.CellRendererPixbuf ()
             col = Gtk.TreeViewColumn ('P', rend, pixbuf = len(fields))
diff --git a/Pyblio/Makefile.am b/Pyblio/Makefile.am
index ee7c2e2..a7c8137 100644
--- a/Pyblio/Makefile.am
+++ b/Pyblio/Makefile.am
@@ -20,6 +20,7 @@
 # 
 
 pybdir = $(datadir)/$(PACKAGE)/Pyblio
+pixmapsdir = $(datadir)/pixmaps
 
 EXTRA_DIST = \
        version.py.in   \
@@ -63,6 +64,7 @@ version.py: version.py.in
                -e s!\ version\@!$(VERSION)!              \
                -e s!\ locale_dir\@!$(localedir)!         \
                -e s!\ p_datadir\@!$(datadir)! \
+               -e s!\ pixmapsdir\@!$(pixmapsdir)! \
                < $< > $@
 
 version.py: Makefile
diff --git a/Pyblio/version.py.in b/Pyblio/version.py.in
index 96f5e99..5d0654c 100644
--- a/Pyblio/version.py.in
+++ b/Pyblio/version.py.in
@@ -1,7 +1,20 @@
 # -*- python -*-
 
-datadir   = "@p_datadir@"
-pybdir    = "@datapyb@"
-localedir = "@locale_dir@"
-version   = "@version@"
+import os.path
 
+_curdir = os.path.dirname(os.path.realpath(__file__))
+_topdir = os.path.dirname(os.path.join(_curdir, '..', '..'))
+_installed = not os.path.exists(os.path.join(_topdir, 'pybliographer.doap'))
+
+if _installed:
+    datadir = '@p_datadir@'
+    pybdir = '@datapyb@'
+    localedir = '@locale_dir@'
+    version = '@version@'
+    pixmapsdir = '@pixmapsdir@'
+else:
+    datadir = _srcdir
+    pybdir = _srcdir
+    localedir = None
+    version = '@version@'
+    pixmapsdir = _srcdir


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