# HG changeset patch # User Thinker K.F. Li # Date 1295455849 -28800 # Node ID 49775feefbcfe185ee71fb5a8383d97cfc4698e0 # Parent cfbc0f3e54e338930831af39672bbc600830b5fe Show components and timelines in comp_dock diff -r cfbc0f3e54e3 -r 49775feefbcf pyink/comp_dock.py --- 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 diff -r cfbc0f3e54e3 -r 49775feefbcf pyink/component_dock.glade --- a/pyink/component_dock.glade Thu Jan 20 00:34:08 2011 +0800 +++ b/pyink/component_dock.glade Thu Jan 20 00:50:49 2011 +0800 @@ -2,6 +2,18 @@ + + + + + + + + + + + + @@ -12,26 +24,28 @@ True vertical - - True - 0 - 5 - Components - - - False - False - 0 - - - 100 True True + components_model + + + + autosize + Component Name + True + + + + 0 + + + + - 1 + 0 @@ -46,6 +60,7 @@ True True True + False @@ -60,6 +75,7 @@ True True True + False @@ -72,7 +88,7 @@ False False 1 - 2 + 1 @@ -96,26 +112,29 @@ True vertical - - True - 0 - 5 - Actions / timelines - - - False - False - 0 - - - 100 True True + timelines_model + 1 + 9 + horizontal + + + + Action/Timeline Name + + + + 0 + + + + - 1 + 0 @@ -124,12 +143,13 @@ 5 start - + gtk-add True True True True + False @@ -144,6 +164,7 @@ True True True + False @@ -156,7 +177,7 @@ False False 2 - 2 + 1 diff -r cfbc0f3e54e3 -r 49775feefbcf pyink/domview.py --- a/pyink/domview.py Thu Jan 20 00:34:08 2011 +0800 +++ b/pyink/domview.py Thu Jan 20 00:50:49 2011 +0800 @@ -17,7 +17,7 @@ pass def name(self): - name = self.node.getAttribute('name') + name = self.scenes_node.getAttribute('name') return name pass diff -r cfbc0f3e54e3 -r 49775feefbcf pyink/domview_ui.py --- a/pyink/domview_ui.py Thu Jan 20 00:34:08 2011 +0800 +++ b/pyink/domview_ui.py Thu Jan 20 00:50:49 2011 +0800 @@ -379,7 +379,8 @@ ## \biref Components and timelines management for domview. # # This is mix-in for domview_ui to provide components and timelines -# management functions. +# management functions. This class expose a lot of methods from class +# component_manager. # class domview_ui_comp(object): def __init__(self): @@ -394,7 +395,7 @@ # def set_desktop(self, desktop): self._desktop = desktop - self._comp_dock.install_dock(desktop) # from component_manager + self._comp_dock.install_dock(desktop) pass def add_component(self, name): @@ -498,6 +499,7 @@ self._fl_stack.init_framelines() self._add_frameline_for_every_layer() self._fl_stack.show_framelines() + self._comp_dock.refresh() # from domview_ui_comp self._doc = doc self._root = root