[pitivi] Make the timeline insensitive during rendering by hijacking all events



commit 8f031dfa75effe42d2089d2597530fe02081a7a9
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Thu Dec 26 19:56:46 2013 -0500

    Make the timeline insensitive during rendering by hijacking all events
    
    Fixes bug #709468

 pitivi/mainwindow.py        |    2 ++
 pitivi/timeline/timeline.py |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 756dac1..481f0af 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -228,10 +228,12 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         dialog = RenderDialog(self.app, project)
         dialog.window.connect("destroy", self._renderDialogDestroyCb)
         self.set_sensitive(False)
+        self.timeline_ui.disableKeyboardAndMouseEvents()
         dialog.window.show()
 
     def _renderDialogDestroyCb(self, unused_dialog):
         self.set_sensitive(True)
+        self.timeline_ui.enableKeyboardAndMouseEvents()
 
     def _renderCb(self, unused_button):
         self.showRenderDialog(self.app.current_project)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 16df105..25b14c7 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -914,6 +914,23 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
         self._packScrollbars(self)
         self.stage.show()
 
+    def enableKeyboardAndMouseEvents(self):
+        self.info("Unblocking timeline mouse and keyboard signals")
+        self.stage.disconnect_by_func(self._ignoreAllEventsCb)
+
+    def disableKeyboardAndMouseEvents(self):
+        """
+        A safety measure to prevent interacting with the Clutter timeline
+        during render (no, setting GtkClutterEmbed as insensitive won't work,
+        neither will using handler_block_by_func, nor connecting to the "event"
+        signals because they won't block the children and other widgets).
+        """
+        self.info("Blocking timeline mouse and keyboard signals")
+        self.stage.connect("captured-event", self._ignoreAllEventsCb)
+
+    def _ignoreAllEventsCb(self, *args):
+        return True
+
     def _setUpDragAndDrop(self):
         self.dropHighlight = False
         self.dropOccured = False


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