[pitivi] application: Add 'wait' action between actions



commit d462bab9527d603ac8a2849f0ad459994cf91adc
Author: Thibault Saunier <tsaunier gnome org>
Date:   Fri Sep 26 17:54:17 2014 +0200

    application: Add 'wait' action between actions
    
    + stop everything when quitting.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739251

 pitivi/application.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 19ce795..6237189 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -24,6 +24,8 @@
 import os
 import time
 
+from datetime import datetime
+
 from gi.repository import GObject
 from gi.repository import Gio
 from gi.repository import Gtk
@@ -78,6 +80,7 @@ class Pitivi(Gtk.Application, Loggable):
         self.action_log = UndoableActionLog(self)
         self.timeline_log_observer = None
         self.project_log_observer = None
+        self._last_action_time = Gst.util_get_timestamp()
 
         if 'PITIVI_SCENARIO_FILE' in os.environ:
             uri = quote_uri(os.environ['PITIVI_SCENARIO_FILE'])
@@ -104,6 +107,14 @@ class Pitivi(Gtk.Application, Loggable):
                 "description, seek=true, handles-states=true\n")
             self._first_action = False
 
+        now = Gst.util_get_timestamp()
+        if now - self._last_action_time > 0.05 * Gst.SECOND:
+            # We need to make sure that the waiting time was more than 50 ms.
+            st = Gst.Structure.new_empty("wait")
+            st["duration"] = float((now - self._last_action_time) / Gst.SECOND)
+            self.log_file.write(st.to_string() + "\n")
+            self._last_action_time = now
+
         if not isinstance(action, Gst.Structure):
             structure = Gst.Structure.new_empty(action)
 
@@ -217,6 +228,7 @@ class Pitivi(Gtk.Application, Loggable):
             self.gui.destroy()
         self.threads.stopAllThreads()
         self.settings.storeSettings()
+        self.write_action("stop")
         self.log_file.close()
         self.quit()
         return True


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