changeset 1312:89e640789750

Separate envet handlers from base functions of comp_doc
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 20 Jan 2011 13:47:56 +0800
parents e6bb9d00341f
children cc557ce8e9fa
files pyink/comp_dock.py
diffstat 1 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/comp_dock.py	Thu Jan 20 13:08:26 2011 +0800
+++ b/pyink/comp_dock.py	Thu Jan 20 13:47:56 2011 +0800
@@ -5,12 +5,11 @@
 
 ## \brief User interface for management components and their timelines.
 #
-class comp_dock(object):
-    __metaclass__ = data_monitor.data_monitor
-    __data_monitor_prefix__ = 'on_'
-
+# This class provide base functions to show components and timelines.
+#
+class comp_dock_base(object):
     def __init__(self, domview_ui, fname=None):
-        super(comp_dock, self).__init__()
+        super(comp_dock_base, self).__init__(domview_ui, fname)
         
         if not fname:
             dirname = os.path.dirname(__file__)
@@ -122,7 +121,20 @@
             pass
         
         raise ValueError, 'unknown component name - %s' % (name)
+    pass
 
+## \brief UI interactive handlers
+#
+# A mix-in to handle UI events.
+#
+class comp_dock_ui(object):
+    __metaclass__ = data_monitor.data_monitor
+    __data_monitor_prefix__ = 'on_'
+
+    def __init__(self, *args):
+        super(comp_dock_ui, self).__init__()
+        pass
+    
     def _current_component(self):
         treeview = self._components_treeview
         path, col = treeview.get_cursor()
@@ -238,3 +250,13 @@
         print '%s - %s' % (path, new_text)
         pass
     pass
+
+## \brief Component dock
+#
+# Mix base functions and event handlers together.
+#
+class comp_dock(comp_dock_base, comp_dock_ui):
+    def __init__(self, domview_ui, fname=None):
+        super(comp_dock, self).__init__(domview_ui, fname)
+        pass
+    pass