[pitivi] fixed 635984 - make -p command line argument work again



commit 6058563a634c69153be0abb6e9381a6ae8437096
Author: Alex BÄ?luÈ? <alexandru balut gmail com>
Date:   Sun Dec 5 23:28:30 2010 +0100

    fixed 635984 - make -p command line argument work again

 pitivi/application.py   |    2 +-
 pitivi/ui/mainwindow.py |    2 +-
 pitivi/ui/viewer.py     |   16 ++++++++++++----
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 600dcb0..ba84a66 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -303,7 +303,7 @@ When -r is specified, the given project file is rendered without opening the GUI
             self.gui = None
         elif options.preview:
             # init ui for previewing
-            self.gui = PitiviViewer()
+            self.gui = PitiviViewer(self)
             self.window = gtk.Window()
             self.window.connect("delete-event", self._deleteCb)
             self.window.add(self.gui)
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 7157276..73d9c72 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -465,7 +465,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.propertiestabs.show()
 
         # Viewer
-        self.viewer = PitiviViewer(instance, self.undock_action)
+        self.viewer = PitiviViewer(instance, undock_action=self.undock_action)
         # drag and drop
         self.viewer.drag_dest_set(gtk.DEST_DEFAULT_DROP | gtk.DEST_DEFAULT_MOTION,
                            [dnd.FILESOURCE_TUPLE, dnd.URI_TUPLE],
diff --git a/pitivi/ui/viewer.py b/pitivi/ui/viewer.py
index d05c3e0..136b8ad 100644
--- a/pitivi/ui/viewer.py
+++ b/pitivi/ui/viewer.py
@@ -81,7 +81,8 @@ class PitiviViewer(gtk.VBox, Loggable):
     @type action: L{ViewAction}
     """
 
-    def __init__(self, app, undock_action, action=None, pipeline=None):
+    def __init__(self, app, undock_action=None, action=None,
+                 pipeline=None):
         """
         @param action: Specific action to use instead of auto-created one
         @type action: L{ViewAction}
@@ -113,10 +114,11 @@ class PitiviViewer(gtk.VBox, Loggable):
         self.setAction(action)
         self.setPipeline(pipeline)
         self.undock_action = undock_action
-        self.undock_action.connect("activate", self._toggleDocked)
+        if undock_action:
+            self.undock_action.connect("activate", self._toggleDocked)
 
-        if not self.settings.viewerDocked:
-            self.undock()
+            if not self.settings.viewerDocked:
+                self.undock()
 
     def setPipeline(self, pipeline):
         """
@@ -501,6 +503,9 @@ class PitiviViewer(gtk.VBox, Loggable):
         self.pipeline.togglePlayback()
 
     def undock(self):
+        if not self.undock_action:
+            self.error("Cannot undock because undock_action is missing.")
+            return
         if not self.docked:
             return
 
@@ -524,6 +529,9 @@ class PitiviViewer(gtk.VBox, Loggable):
             self.settings.viewerHeight)
 
     def dock(self):
+        if not self.undock_action:
+            self.error("Cannot dock because undock_action is missing.")
+            return
         if self.docked:
             return
         self.docked = True



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