diff pyink/domview_ui.py @ 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 07e0cb1e051d
children df474448364e
line wrap: on
line diff
--- 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
+