diff pyink/comp_dock.py @ 1308:49775feefbcf

Show components and timelines in comp_dock
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 20 Jan 2011 00:50:49 +0800
parents 573a51b1eb37
children f2b1b22f7cbc
line wrap: on
line diff
--- a/pyink/comp_dock.py	Thu Jan 20 00:34:08 2011 +0800
+++ b/pyink/comp_dock.py	Thu Jan 20 00:50:49 2011 +0800
@@ -2,10 +2,12 @@
 import os
 import data_monitor
 
+
 ## \brief User interface for management components and their timelines.
 #
 class comp_dock(object):
     __metaclass__ = data_monitor.data_monitor
+    __data_monitor_prefix__ = 'on_'
 
     def __init__(self, domview_ui, fname=None):
         super(comp_dock, self).__init__()
@@ -17,7 +19,11 @@
 
         builder = gtk.Builder()
         builder.add_from_file(fname)
+        builder.connect_signals(self)
         dock_top = builder.get_object('component_dock_top')
+        components_model = builder.get_object('components_model')
+        timelines_model = builder.get_object('timelines_model')
+        
         dock_top_parent = dock_top.get_parent()
         dock_top_parent.remove(dock_top)
 
@@ -27,6 +33,9 @@
         self._dock_top = dock_top
         self._desktop = None
         self._dock_item = None
+        
+        self._components_model = components_model
+        self._timelines_model = timelines_model
         pass
 
     def install_dock(self, desktop):
@@ -42,4 +51,46 @@
         item_vbox.pack_start(self._dock_top)
         self._dock_top.show()
         pass
+
+    ## \brief Refresh content of component list and timeline list.
+    #
+    def refresh(self):
+        components_model = self._components_model
+        components_model.clear()
+        
+        for comp_name in self._domview_ui.all_comp_names():
+            components_model.append((comp_name,))
+            pass
+
+        timelines_model = self._timelines_model
+        timelines_model.clear()
+
+        for timeline_name in self._domview_ui.all_timeline_names():
+            timelines_model.append((timeline_name,))
+            pass
+        pass
+    
+    def on_add_comp_clicked(self, *args):
+        print args
+        pass
+
+    def on_remove_comp_clicked(self, *args):
+        print args
+        pass
+
+    def on_treeview_components_cursor_changed(self, *args):
+        print args
+        pass
+    
+    def on_add_timeline_clicked(self, *args):
+        print args
+        pass
+
+    def on_remove_timeline_clicked(self, *args):
+        print args
+        pass
+
+    def on_treeview_timelines_cursor_changed(self, *args):
+        print args
+        pass
     pass