[pitivi: 34/41] Show the missing dependency dialog when trying to align and numpy is missing



commit 0153fcc64aa38e2b396d1cc3d7c8a868cb8bfa23
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri Aug 12 17:01:30 2011 +0200

    Show the missing dependency dialog when trying to align and numpy is missing

 pitivi/timeline/align.py |    8 +++++++-
 pitivi/ui/timeline.py    |    7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/align.py b/pitivi/timeline/align.py
index fdd19bd..e34ccac 100644
--- a/pitivi/timeline/align.py
+++ b/pitivi/timeline/align.py
@@ -25,7 +25,10 @@ Classes for automatic alignment of L{TimelineObject}s
 
 import array
 import time
-import numpy
+try:
+    import numpy
+except ImportError:
+    numpy = None
 
 import gobject
 import gst
@@ -273,6 +276,9 @@ class AutoAligner(Loggable):
         @rtype: L{bool}
 
         """
+        # numpy is a "soft dependency".  If you're running without numpy,
+        # this False return value is your only warning not to
+        # use the AutoAligner, which will crash immediately.
         return all(getAudioTrack(t) is not None for t in timeline_objects)
 
     def _extractNextEnvelope(self):
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 1364032..816583d 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -44,7 +44,9 @@ from pitivi.ui.filelisterrordialog import FileListErrorDialog
 from pitivi.ui.curve import Curve
 from pitivi.ui.common import SPACING
 from pitivi.ui.alignmentprogress import AlignmentProgressDialog
+from pitivi.ui.depsmanager import DepsManager
 from pitivi.timeline.align import AutoAligner
+from pitivi.check import soft_deps
 
 from pitivi.factories.operation import EffectFactory
 
@@ -809,7 +811,10 @@ class Timeline(gtk.Table, Loggable, Zoomable):
             self.timeline.groupSelection()
 
     def alignSelected(self, unused_action):
-        if self.timeline:
+        if "NumPy" in soft_deps:
+            DepsManager(self.app)
+
+        elif self.timeline:
             progress_dialog = AlignmentProgressDialog(self.app)
             progress_dialog.window.show()
             self.app.action_log.begin("align")



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