[pitivi] ui: Resolve gracefully glade files path on windows



commit 3b919ac6381bba101c5134604e2322969b15ddd8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Apr 27 22:23:43 2010 +0200

    ui: Resolve gracefully glade files path on windows
    
    Instead of checking for platform.system() =='Windows',
    check if we launched pitivi.exe. This way windows developers
    can still run pitivi using the python script by copying the
    content in $ROOT/pitivi to $ROOT/win32/dist/lib/pitivi/

 pitivi/ui/mainwindow.py               |    8 ++++++--
 pitivi/ui/netstream_managerdialog.py  |    7 ++++++-
 pitivi/ui/pluginmanagerdialog.py      |    6 +++++-
 pitivi/ui/screencast_managerdialog.py |    6 +++++-
 win32/configure.py                    |    3 ++-
 5 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index c5ce795..f7e8a1d 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -47,7 +47,7 @@ from pitivi.ui.timeline import Timeline
 from pitivi.ui.projecttabs import ProjectTabs
 from pitivi.ui.viewer import PitiviViewer
 from pitivi.configure import pitivi_version, APPNAME, get_pixmap_dir, \
-     get_global_pixmap_dir
+     get_global_pixmap_dir, LIBDIR
 from pitivi.ui import dnd
 from pitivi.pipeline import Pipeline
 from pitivi.action import ViewAction
@@ -358,8 +358,12 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.uimanager = gtk.UIManager()
         self.add_accel_group(self.uimanager.get_accel_group())
         self.uimanager.insert_action_group(self.actiongroup, 0)
+        if 'pitivi.exe' in __file__.lower():
+            xml = LIBDIR + '\\pitivi.exe'
+        else:
+            xml = __file__
         self.uimanager.add_ui_from_file(os.path.join(os.path.dirname(
-            os.path.abspath(__file__)), "mainwindow.xml"))
+            os.path.abspath(xml)), "mainwindow.xml"))
 
     def _createUi(self, instance):
         """ Create the graphical interface """
diff --git a/pitivi/ui/netstream_managerdialog.py b/pitivi/ui/netstream_managerdialog.py
index 49ff081..63ee6a9 100644
--- a/pitivi/ui/netstream_managerdialog.py
+++ b/pitivi/ui/netstream_managerdialog.py
@@ -24,6 +24,7 @@ import gtk
 import gtk.glade
 import gst
 import tempfile
+from pitivi.configure import LIBDIR
 from pitivi.sourcelist import SourceList
 from pitivi.bin import SmartStreamBin, SinkBin
 from pitivi.settings import ExportSettings
@@ -35,7 +36,11 @@ class NetstreamManagerDialog(object):
         self.capture_pipe = None
         self.player = None
 
-        glade_dir = os.path.dirname(os.path.abspath(__file__))
+        if 'pitivi.exe' in __file__.lower():
+            glade_dir = LIBDIR + '\\pitivi.exe'
+        else:
+            glade_dir = os.path.dirname(os.path.abspath(__file__))
+
         self.objectpool_ui = gtk.glade.XML(os.path.join(glade_dir, "net_capture.glade"))
         self.stream_window = self.objectpool_ui.get_widget("network_capture")
         self.screen = self.objectpool_ui.get_widget("screen")
diff --git a/pitivi/ui/pluginmanagerdialog.py b/pitivi/ui/pluginmanagerdialog.py
index 51148d7..c556fda 100644
--- a/pitivi/ui/pluginmanagerdialog.py
+++ b/pitivi/ui/pluginmanagerdialog.py
@@ -26,6 +26,7 @@ import pango
 import gobject
 from gettext import gettext as _
 
+from pitivi.configure import LIBDIR
 import pitivi.plugincore as plugincore
 import pitivi.pluginmanager as pluginmanager
 
@@ -40,7 +41,10 @@ class PluginManagerDialog(object):
         self.pm = plugin_manager
 
         # load user interface items
-        glade_dir = os.path.dirname(os.path.abspath(__file__))
+        if 'pitivi.exe' in __file__.lower():
+            glade_dir = LIBDIR
+        else:
+            glade_dir = os.path.dirname(os.path.abspath(__file__))
         self.wTree = gtk.glade.XML(os.path.join(glade_dir, 'pluginmanagerdialog.glade'))
         self.window = self.wTree.get_widget('pluginmanager_dlg')
         self.search_entry = self.wTree.get_widget('search_entry')
diff --git a/pitivi/ui/screencast_managerdialog.py b/pitivi/ui/screencast_managerdialog.py
index c3f6aa0..c4a0671 100644
--- a/pitivi/ui/screencast_managerdialog.py
+++ b/pitivi/ui/screencast_managerdialog.py
@@ -29,6 +29,7 @@ import dbus.glib
 import thread
 import time
 
+from pitivi.configure import LIBDIR
 
 class ScreencastManagerDialog(object):
 
@@ -37,7 +38,10 @@ class ScreencastManagerDialog(object):
         self.app = instance
 
         # Create gtk widget using glade model
-        glade_dir = os.path.dirname(os.path.abspath(__file__))
+        if 'pitivi.exe' in __file__.lower():
+            glade_dir = LIBDIR + '\\pitivi.exe'
+        else:
+            glade_dir = os.path.dirname(os.path.abspath(__file__))
         pool_ui = gtk.glade.XML(os.path.join(glade_dir, "screencast_manager.glade"))
 
         self.window = pool_ui.get_widget("screencast_window")
diff --git a/win32/configure.py b/win32/configure.py
index ecca4b8..748be65 100644
--- a/win32/configure.py
+++ b/win32/configure.py
@@ -25,7 +25,8 @@ Enables identical use for installed and uninstalled versions.
 
 import os.path
 
-LIBDIR = os.path.realpath('../lib/')
+LIBDIR = os.path.realpath('../lib/pitivi')
+WIN32_LIBDIR = '..\\..\\..\\..\\lib\\pitivi\\'
 PKGDATADIR = os.path.realpath('../share/pitivi')
 PIXMAPDIR = os.path.realpath('../share/pitivi/pixmaps')
 pitivi_version = '0.13.4'



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