[pybliographer/wip/gtk3: 38/42] Enable run pybliographic either from source or installation



commit db18db331cd324e7a65c0f84aced097e8009db38
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 |    7 ++++---
 Pyblio/GnomeUI/Index.py    |    2 +-
 Pyblio/Makefile.am         |    2 ++
 Pyblio/version.py.in       |   21 +++++++++++++++++----
 4 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 0417dec..3b7d2c6 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -194,6 +194,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')
@@ -201,6 +202,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')
@@ -1228,8 +1230,7 @@ class Document (Connector.Publisher):
 
     def about (self, *arg):
         pybliologo = GdkPixbuf.Pixbuf.new_from_file(
-                        os.path.join (version.pybdir,
-                                      'pixmaps',
+                        os.path.join (version.pixmapsdir,
                                       'pybliographic-logo.png'))
         authors = ['Hervé Dréau',
                    'Frédéric Gobry',
@@ -1254,7 +1255,7 @@ class Document (Connector.Publisher):
                         authors=authors,
                         documenters=documentors,
                         translator_credits=translators,
-                        logo=)
+                        logo=pybliologo)
 
         about.connect('response', lambda w, b: w.destroy())
         about.show()
diff --git a/Pyblio/GnomeUI/Index.py b/Pyblio/GnomeUI/Index.py
index 73a6900..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.pybdir, '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..df1d3f9 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 = os.path.join(_topdir, 'data')
+    pybdir = _topdir
+    localedir = None
+    version = '@version@'
+    pixmapsdir = os.path.join(datadir, 'pixmaps')


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