changeset 1309:f2b1b22f7cbc

Make comp_dock editable
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 20 Jan 2011 10:54:27 +0800
parents 49775feefbcf
children 85d04ba11146
files pyink/comp_dock.py pyink/component_dock.glade
diffstat 2 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/comp_dock.py	Thu Jan 20 00:50:49 2011 +0800
+++ b/pyink/comp_dock.py	Thu Jan 20 10:54:27 2011 +0800
@@ -23,6 +23,8 @@
         dock_top = builder.get_object('component_dock_top')
         components_model = builder.get_object('components_model')
         timelines_model = builder.get_object('timelines_model')
+        components_treeview = builder.get_object('treeview_components')
+        timelines_treeview = builder.get_object('treeview_timelines')
         
         dock_top_parent = dock_top.get_parent()
         dock_top_parent.remove(dock_top)
@@ -36,6 +38,11 @@
         
         self._components_model = components_model
         self._timelines_model = timelines_model
+        self._components_treeview = components_treeview
+        self._timelines_treeview = timelines_treeview
+
+        self._cur_component = -1
+        self._cur_timeline = -1
         pass
 
     def install_dock(self, desktop):
@@ -59,14 +66,14 @@
         components_model.clear()
         
         for comp_name in self._domview_ui.all_comp_names():
-            components_model.append((comp_name,))
+            components_model.append((comp_name, True))
             pass
 
         timelines_model = self._timelines_model
         timelines_model.clear()
 
         for timeline_name in self._domview_ui.all_timeline_names():
-            timelines_model.append((timeline_name,))
+            timelines_model.append((timeline_name, True))
             pass
         pass
     
@@ -82,6 +89,11 @@
         print args
         pass
     
+    def on_cellrenderer_comp_edited(self, renderer, path,
+                                    new_text, *args):
+        print '%s - %s' % (path, new_text)
+        pass
+    
     def on_add_timeline_clicked(self, *args):
         print args
         pass
@@ -93,4 +105,9 @@
     def on_treeview_timelines_cursor_changed(self, *args):
         print args
         pass
+
+    def on_cellrenderer_timelines_edited(self, renderer, path,
+                                         new_text, *args):
+        print '%s - %s' % (path, new_text)
+        pass
     pass
--- a/pyink/component_dock.glade	Thu Jan 20 00:50:49 2011 +0800
+++ b/pyink/component_dock.glade	Thu Jan 20 10:54:27 2011 +0800
@@ -6,12 +6,16 @@
     <columns>
       <!-- column-name name -->
       <column type="gchararray"/>
+      <!-- column-name editable -->
+      <column type="gboolean"/>
     </columns>
   </object>
   <object class="GtkListStore" id="timelines_model">
     <columns>
       <!-- column-name name -->
       <column type="gchararray"/>
+      <!-- column-name editable -->
+      <column type="gboolean"/>
     </columns>
   </object>
   <object class="GtkWindow" id="window1">
@@ -36,8 +40,11 @@
                     <property name="title">Component Name</property>
                     <property name="expand">True</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <object class="GtkCellRendererText" id="cellrenderer_comp">
+                        <signal name="edited" handler="on_cellrenderer_comp_edited"/>
+                      </object>
                       <attributes>
+                        <attribute name="editable">1</attribute>
                         <attribute name="text">0</attribute>
                       </attributes>
                     </child>
@@ -125,8 +132,11 @@
                   <object class="GtkTreeViewColumn" id="treeviewcolumn2">
                     <property name="title">Action/Timeline Name</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                      <object class="GtkCellRendererText" id="cellrenderer_timelines">
+                        <signal name="edited" handler="on_cellrenderer_timelines_edited"/>
+                      </object>
                       <attributes>
+                        <attribute name="editable">1</attribute>
                         <attribute name="text">0</attribute>
                       </attributes>
                     </child>