changeset 1305:573a51b1eb37

domview_ui_comp as a mix-in to oven comp_dock and domview_ui
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 19 Jan 2011 18:28:16 +0800
parents 94e6594dea59
children 8c0a4684c1f7
files pyink/comp_dock.py pyink/domview_ui.py
diffstat 2 files changed, 33 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/comp_dock.py	Wed Jan 19 17:56:21 2011 +0800
+++ b/pyink/comp_dock.py	Wed Jan 19 18:28:16 2011 +0800
@@ -13,7 +13,6 @@
         if not fname:
             dirname = os.path.dirname(__file__)
             fname = os.path.join(dirname, 'component_dock.glade')
-            print fname
             pass
 
         builder = gtk.Builder()
--- a/pyink/domview_ui.py	Wed Jan 19 17:56:21 2011 +0800
+++ b/pyink/domview_ui.py	Wed Jan 19 18:28:16 2011 +0800
@@ -376,6 +376,30 @@
     pass
 
 
+## \biref Components and timelines management for domview.
+#
+# This is mix-in for domview_ui to provide components and timelines
+# management functions.
+#
+class domview_ui_comp(object):
+    def __init__(self):
+        from comp_dock import comp_dock
+        
+        self._comp_dock = comp_dock(self)
+        pass
+    
+    ## \brief Setup desktop that the document will be serviced.
+    #
+    # This method must be called before handle_doc_root.
+    #
+    def set_desktop(self, desktop):
+        self._desktop = desktop
+        self._comp_dock.install_dock(desktop) # from component_manager
+        pass
+    
+    pass
+
+
 ## \brief Bridge of DOM-tree to syncrhonize data-model and UI.
 #
 # This class is a wrapper
@@ -383,13 +407,10 @@
     _tween_type_names = ('normal', 'scale')
     
     def __init__(self):
-        from comp_dock import comp_dock
-        
 	super(domview_ui, self).__init__()
         
 	self._fl_stack = frameline_stack()
 	self._dom = domview()
-        self._comp_dock = comp_dock(self)
         self._desktop = None
         self._doc = None
         self._root = None
@@ -431,15 +452,6 @@
 	    pass
 	pass
     
-    ## \brief Setup desktop that the document will be serviced.
-    #
-    # This method must be called before handle_doc_root.
-    #
-    def set_desktop(self, desktop):
-        self._desktop = desktop
-        self._comp_dock.install_dock(desktop) # from component_manager
-        pass
-    
     ## \brief This method is called to handle a new document.
     #
     def handle_doc_root(self, doc, root):
@@ -831,9 +843,17 @@
     pass
 
 
+## \brief Oven domview_ui and all mix-ins
+#
+class domview_ui_oven(domview_ui, domview_ui_comp):
+    def __init__(self):
+        super(domview_ui_oven, self).__init__()
+        pass
+    pass
+
 ## \brief A mix-in to enable workers for a domview_ui.
 #
-class domview_ui_with_workers(domview_ui, domview_internal):
+class domview_ui_with_workers(domview_ui_oven, domview_internal):
     def __init__(self):
         super(domview_ui_with_workers, self).__init__()