[pitivi] render: Show rendering errors in a dialog



commit e70b0550210d9afe3677e866ee80af096c801e6b
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Sat Apr 27 20:27:49 2013 -0400

    render:  Show rendering errors in a dialog
    
    Abort rendering when an error is encountered in the pipeline,
    show the error so that the user actually knows something went wrong.
    
    Fixes bug #635874

 pitivi/render.py |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/render.py b/pitivi/render.py
index 6d98b98..7c16d71 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -767,6 +767,15 @@ class RenderDialog(Loggable):
                                             parent_window=self.window)
         self.dialog.ok_btn.connect("clicked", self._okButtonClickedCb, settings_attr)
 
+    def _showRenderErrorDialog(self, error, details):
+        dialog = Gtk.MessageDialog(self.window, Gtk.DialogFlags.MODAL,
+            Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
+            error)
+        dialog.set_title(_("Error While Rendering Project"))
+        dialog.set_property("secondary-text", details)
+        dialog.run()
+        dialog.destroy()
+
     def startAction(self):
         """ Start the render process """
         self._pipeline.set_state(Gst.State.NULL)
@@ -775,8 +784,8 @@ class RenderDialog(Loggable):
         self._gstSigId[encodebin] = encodebin.connect("element-added", self._elementAddedCb)
         self._pipeline.set_state(Gst.State.PLAYING)
 
-    def _cancelRender(self, progress):
-        self.debug("aborting render")
+    def _cancelRender(self, *unused_args):
+        self.debug("Aborting render")
         self._shutDown()
         self._destroyProgressWindow()
 
@@ -867,6 +876,13 @@ class RenderDialog(Loggable):
             self.progress.cancel_button.hide()
             self.progress.play_pause_button.hide()
 
+        elif message.type == Gst.MessageType.ERROR:
+            # Errors in a GStreamer pipeline are fatal. If we encounter one,
+            # we should abort and show the error instead of sitting around.
+            error, details = message.parse_error()
+            self._cancelRender()
+            self._showRenderErrorDialog(error, details)
+
         elif message.type == Gst.MessageType.STATE_CHANGED and self.progress:
             prev, state, pending = message.parse_state_changed()
             if message.src == self._pipeline:


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