[pitivi] undo: Get rid of the debug action log observer
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] undo: Get rid of the debug action log observer
- Date: Tue, 6 May 2014 13:02:37 +0000 (UTC)
commit fbe504fe599e13c56dd09035b8c20f80594f6e6b
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Fri Apr 11 19:44:58 2014 +0200
undo: Get rid of the debug action log observer
pitivi/application.py | 7 ++---
pitivi/undo/undo.py | 50 ++++++++++--------------------------------------
2 files changed, 14 insertions(+), 43 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 8f87d86..cd49a16 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -34,7 +34,7 @@ from pitivi.settings import GlobalSettings
from pitivi.utils.threads import ThreadMaster
from pitivi.mainwindow import PitiviMainWindow
from pitivi.project import ProjectManager, ProjectLogObserver
-from pitivi.undo.undo import UndoableActionLog, DebugActionLogObserver
+from pitivi.undo.undo import UndoableActionLog
from pitivi.undo.timeline import TimelineLogObserver
from pitivi.dialogs.startupwizard import StartUpWizard
@@ -71,8 +71,9 @@ class Pitivi(Gtk.Application, Loggable):
self.effects = None
self.system = None
self.project_manager = ProjectManager(self)
+
self.action_log = None
- self.debug_action_log_observer = None
+ self.timeline_log_observer = None
self.project_log_observer = None
self.gui = None
@@ -103,8 +104,6 @@ class Pitivi(Gtk.Application, Loggable):
self.action_log.connect("undo", self._actionLogUndo)
self.action_log.connect("redo", self._actionLogRedo)
self.action_log.connect("cleaned", self._actionLogCleaned)
- self.debug_action_log_observer = DebugActionLogObserver()
- self.debug_action_log_observer.startObserving(self.action_log)
self.timeline_log_observer = TimelineLogObserver(self.action_log)
self.project_log_observer = ProjectLogObserver(self.action_log)
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 2767015..94f6a38 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -132,18 +132,21 @@ class UndoableActionLog(Signallable, Loggable):
self._checkpoint = self._takeSnapshot()
def begin(self, action_group_name):
- self.debug("Begining %s", action_group_name)
+ self.debug("Beginning %s", action_group_name)
if self.running:
+ self.debug("Abort because already running")
return
stack = UndoableActionStack(action_group_name)
nested = self._stackIsNested(stack)
self.stacks.append(stack)
+ self.debug("begin action group %s, nested %s", stack.action_group_name, nested)
self.emit("begin", stack, nested)
def push(self, action):
self.debug("Pushing %s", action)
if self.running:
+ self.debug("Abort because already running")
return
try:
@@ -152,21 +155,27 @@ class UndoableActionLog(Signallable, Loggable):
return
stack.push(action)
+ self.debug("push action %s in action group %s", action, stack.action_group_name)
self.emit("push", stack, action)
def rollback(self):
+ self.debug("Rolling back")
if self.running:
+ self.debug("Abort because already running")
return
stack = self._getTopmostStack(pop=True)
if stack is None:
return
nested = self._stackIsNested(stack)
+ self.debug("rollback action group %s, nested %s", stack.action_group_name, nested)
self.emit("rollback", stack, nested)
stack.undo()
def commit(self):
+ self.debug("Committing")
if self.running:
+ self.debug("Abort because already running")
return
stack = self._getTopmostStack(pop=True)
@@ -181,7 +190,7 @@ class UndoableActionLog(Signallable, Loggable):
if self.redo_stacks:
self.redo_stacks = []
- self.debug("%s pushed", stack)
+ self.debug("commit action group %s nested %s", stack.action_group_name, nested)
self.emit("commit", stack, nested)
def undo(self):
@@ -247,43 +256,6 @@ class UndoableActionLog(Signallable, Loggable):
return bool(len(self.stacks))
-class DebugActionLogObserver(Loggable):
- """
- Allows getting more debug output from the UndoableActionLog than the default
- """
- # FIXME: this looks overengineered at first glance. This is used in only one
- # place in the codebase (in application.py). Why not just put the debug
- # directly in UndoableActionLog if we really need them anyway?
- def startObserving(self, log):
- self._connectToActionLog(log)
-
- def stopObserving(self, log):
- self._disconnectFromActionLog(log)
-
- def _connectToActionLog(self, log):
- log.connect("begin", self._actionLogBeginCb)
- log.connect("commit", self._actionLogCommitCb)
- log.connect("rollback", self._actionLogRollbackCb)
- log.connect("push", self._actionLogPushCb)
-
- def _disconnectFromActionLog(self, log):
- for method in (self._actionLogBeginCb, self._actionLogCommitCb,
- self._actionLogrollbackCb, self._actionLogPushCb):
- log.disconnect_by_func(method)
-
- def _actionLogBeginCb(self, unused_log, stack, nested):
- self.debug("begin action %s nested %s", stack.action_group_name, nested)
-
- def _actionLogCommitCb(self, unused_log, stack, nested):
- self.debug("commit action %s nested %s", stack.action_group_name, nested)
-
- def _actionLogRollbackCb(self, unused_log, stack, nested):
- self.debug("rollback action %s nested %s", stack.action_group_name, nested)
-
- def _actionLogPushCb(self, unused_log, stack, action):
- self.debug("push %s in %s", action, stack.action_group_name)
-
-
class PropertyChangeTracker(Signallable):
"""
BaseClass to track a class property, Used for undo/redo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]