123
authortanya <tanya@tanin.oblgaz>
Wed, 20 Jan 2010 15:04:58 +0000 (17:04 +0200)
committertanya <tanya@tanin.oblgaz>
Wed, 20 Jan 2010 15:04:58 +0000 (17:04 +0200)
list.py

diff --git a/list.py b/list.py
index d4ebdd4..f058413 100755 (executable)
--- a/list.py
+++ b/list.py
@@ -62,7 +62,7 @@ class HelloWorld:
 
         vbox.pack_start(sw, True, True, 0)
         
-        data = [('fio fdkfdskajf jdkflasjkla', 'doldfsagfdas dlaskj', '212345'),
+        self.data = [('fio fdkfdskajf jdkflasjkla', 'doldfsagfdas dlaskj', '212345'),
             ('fdsafdsa dfasfasf dfasfdsa', 'fdsafaf fdafdas', '345678'),
             ('fdsafdsa dfasfasf dfasfdsa', 'fdsafaf fdafdas', '345678'),
             ('fdsafdsa dfasfasf dfasfdsa', 'fdsafaf fdafdas', '345678'),
@@ -76,12 +76,14 @@ class HelloWorld:
             ('fdsafdsa dfasfasf dfasfdsa', 'fdsafaf fdafdas', '345678'),
             ('fdas dafs fdsfasd ', 'fdasf dafa', '12435678')]
         store = gtk.ListStore(str, str, str)
-        for d in data:
+        for d in self.data:
             store.append([d[0], d[1], d[2]])
 
         tree = gtk.TreeView(store)
         tree.set_rules_hint(True)
 
+        tree.connect("row-activated", self.select_item)
+
         t1 = gtk.CellRendererText()
         column = gtk.TreeViewColumn("Name", t1, text=0)
         column.set_sort_column_id(0)
@@ -101,6 +103,8 @@ class HelloWorld:
 
         sw.add(tree)
 
+       
+
         self.window.add(vbox)
         self.window.show_all()
     
@@ -108,6 +112,21 @@ class HelloWorld:
         # and the window
         self.window.show()
 
+    def select_item(self, widget, path, column):
+        print "select_item path:%s" % path
+        self.dialog = gtk.Dialog("Item descrition", 
+                                self.window, 
+                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+                                (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+        
+        label = gtk.Label("select item %s" % path)
+        self.dialog.vbox.pack_start(label)
+        label.show()
+        response = self.dialog.run()
+        self.dialog.destroy()
+        print "response= %s" % response
+
+
     def main(self):
         # All PyGTK applications must have a gtk.main(). Control ends here
         # and waits for an event to occur (like a key press or mouse event).