changeset 1258:2609b219703d

Move initialize of consistency_checker to domview_ui_with_workers
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 11 Jan 2011 17:24:56 +0800
parents 027cd060d9ba
children df474448364e
files pyink/MBScene.py pyink/domview_ui.py
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Tue Jan 11 15:03:01 2011 +0800
+++ b/pyink/MBScene.py	Tue Jan 11 17:24:56 2011 +0800
@@ -7,7 +7,7 @@
 import traceback
 import pybInkscape
 from tween import scenes_director
-from domview_ui import domview_ui
+from domview_ui import create_domview_ui
 from data_monitor import data_monitor
 
 # Please refer to
@@ -69,7 +69,7 @@
 	self._disable_tween_type_selector = False
 	self.current = 0
 
-	self._domview = domview_ui()
+	self._domview = create_domview_ui()
 	pass
 
     def change_active_frame(self, node):
--- a/pyink/domview_ui.py	Tue Jan 11 15:03:01 2011 +0800
+++ b/pyink/domview_ui.py	Tue Jan 11 17:24:56 2011 +0800
@@ -361,7 +361,6 @@
 	self._dom = domview()
         self._doc = None
         self._root = None
-        self._consistency_checker = consistency.consistency_checker(self)
         self._lock = False
 	pass
 
@@ -410,7 +409,6 @@
 
         self._doc = doc
         self._root = root
-        self._consistency_checker.handle_doc_root(doc, root)
 	pass
 
     ## \brief Mark given frame as a key frame.
@@ -654,3 +652,27 @@
         return True
     pass
 
+
+## \brief A mix-in to enable workers for a domview_ui.
+#
+class domview_ui_with_workers(domview_ui):
+    def __init__(self):
+        super(domview_ui_with_workers, self).__init__()
+        
+        self._consistency_checker = consistency.consistency_checker(self)
+        pass
+
+    def handle_doc_root(self, doc, root):
+        super(domview_ui_with_workers, self).handle_doc_root(doc, root)
+        
+        self._consistency_checker.handle_doc_root(doc, root)
+        pass
+    pass
+
+
+## \brief Factory function of domview_ui.
+#
+def create_domview_ui():
+    domview = domview_ui_with_workers()
+    return domview
+