mige wrote:
Hi,
I'm trying to build two custom GtkTreeModel, first for the tree-like
view and second for list-like view, but using one tree-model object.
The source-code is attached.
On the first attempt I got an odd behavior. On the TreeView widget on
the right position is not showing all the node/row.
But after i add the ' tv_right.set_model(None) ' before '
tv_right.set_model(list) ' I get what I want. Is this necessary to do this ?
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:
I still get other odd behavior. Why, on the first time, if I select other than first row I get two "changed" signal. First for the first row and second for the row I selected.
One more thing, I get this message, but not all the time, when I change the selection " (pyta.py:1176): Gtk-CRITICAL **: file gtktreeview.c: line 7013 (gtk_tree_view_unref_tree_helper): assertion `node != NULL' failed "
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/
