Wow .. great information about GtkTreeModel and GtkTreeView ... Thank you very much Mr Finlay.

So, for the first time I select other than first row I still get two "changed" signal.
First for the first row and second for the row I selected. Is it just the way it is ?


regards,
mige

John Finlay wrote:


Your code is changing the list contents while not actually changing the model i.e. you always pass self.list to set_listview_model() so the treeview doesn't actually see a model change. That's why you have to remove the model first and then set it again.


I think this is caused by changing the model under the covers in selection_changed() before unsetting it in set_listview_model(). The treeview tries to unref the tree model nodes while unsetting the model but you've already changed it with self.list.set_root(node). I think you need to unset the model before changing the root node to get rid of the message. Something like:

   def selection_changed(self,selection,*at):
       model, iter = selection.get_selected()
       if not iter: return
       node = model.get_value(iter,0)
       if isinstance(node,AppModel.Node):
           print "Change to: ", node.get_column_value(1)
           #self.print_children(self.list)
           self.win.set_listview_model(self.list,node)

and:

   def set_listview_model(self,list,node):
       self.tv_right.set_model(None)
       self.remove_all_listview_columns()
       list.set_root(node)
       self.add_listview_column(list)
       self.tv_right.set_model(list)

Alternatively create a new AppListModel for each list.

John


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to