[pygtk] bug in TreeView?

2003-07-30 Thread Emanuele Olivetti
Executing the Lars Wirzenius's example about gtk.TreeView in:
http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html

if you select a node, click 'Choose parent' and select the same
node in the parent list you get a core.

Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

I don't know if it is a gtk or pygtk problem.

Hope this helps,

Emanuele

P.S.: here follows the TreeView example (it is short enough
to be here, in my opinion)

# This is an example for demonstrating use of the GtkTreeView widget.
# The code in this example is not particularly good: it is written to
# concentrate on widget usage demonstration, not for maintainability.

import pygtk
pygtk.require(2.0)
import gtk
import gobject

view = None
choose_parent_view = None
dialog = None

def move(old_iter, new_parent, model):
if old_iter:
folder = model.get_value(old_iter, 0)
model.remove(old_iter)
new_iter = model.insert_before(new_parent, None)
model.set_value(new_iter, 0, folder)
model.set_value(new_iter, 1, folder[name])

def dialog_ok(*args):
dialog.hide()
model, parent_iter = choose_parent_view.get_selection().get_selected()
model, old_iter = view.get_selection().get_selected()
if parent_iter and old_iter:
move(old_iter, parent_iter, model)

def dialog_cancel(*args):
dialog.hide()

def choose_parent(*args):
dialog.show()

def move_to_top(*args):
model, old_iter = view.get_selection().get_selected()
if old_iter:
move(old_iter, None, model)

def quit(*args):
gtk.main_quit()

def make_view(model):
# Create the view itself.
view = gtk.TreeView(model)
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn(Folder, renderer, text=1)
view.append_column(column)
view.show()

# Create scrollbars around the view.
scrolled = gtk.ScrolledWindow()
scrolled.add(view)
scrolled.show()

return view, scrolled

def make_buttons(list):
buttonbox = gtk.HBox()
for label, func in list:
button = gtk.Button()
button.set_label(label)
button.connect(clicked, func)
button.show()
buttonbox.pack_start(button, expand=gtk.FALSE, fill=gtk.FALSE)
buttonbox.show()
return buttonbox

def main():
# Create the model.
model = gtk.TreeStore(gobject.TYPE_PYOBJECT, gobject.TYPE_STRING)

# Populate the model with data. We represent folders with Python
# dicts (hash tables or hashmaps in other languages), for simplicity.
# In a real program, they would be programmer defined classes.
for i in range(100):
folder = { name: folder %d % i, files: [foo, bar] }
iter = model.insert_before(None, None)
model.set_value(iter, 0, folder)
model.set_value(iter, 1, folder[name])

# Create the main view.
global view
view, scrolled = make_view(model)
view.set_reorderable(gtk.TRUE)

# Create some command buttons.
buttonbox = make_buttons([(Quit, quit), (Choose parent, choose_parent),
  (Move to top, move_to_top)])

# Create a vertical box to hold the above stuff.
vbox = gtk.VBox()
vbox.pack_start(buttonbox, expand=gtk.FALSE, fill=gtk.FALSE)
vbox.pack_start(scrolled, expand=gtk.TRUE, fill=gtk.TRUE)
vbox.show()

# Create toplevel window to show it all.
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.connect(delete_event, quit)
win.add(vbox)
win.show()
win.resize(300, 500)

# Create the GtkTreeView for choosing a parent.
global choose_parent_view
choose_parent_view, scrolled = make_view(model)

buttonbox = make_buttons([(OK, dialog_ok), (Cancel, dialog_cancel)])

vbox = gtk.VBox()
vbox.pack_start(scrolled, expand=gtk.TRUE, fill=gtk.TRUE)
vbox.pack_start(buttonbox, expand=gtk.FALSE, fill=gtk.FALSE)
vbox.show()

global dialog
dialog = gtk.Window(gtk.WINDOW_TOPLEVEL)
dialog.set_default_size(200, 400)
dialog.add(vbox)

# Run the Gtk+ main loop.
gtk.main()

if __name__ == __main__:
main()

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


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:
 Executing the Lars Wirzenius's example about gtk.TreeView in:
 http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html
 
 if you select a node, click 'Choose parent' and select the same
 node in the parent list you get a core.
 
 Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

Before submitting reports of crashers, it would be really nice if you
could test against CVS HEAD. A lot goes in between releases and the team
is very small to be able to triage all reports that come in.

A stack trace would be great too.

If anybody else can help test, we'd appreciate it.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] bug in TreeView?

2003-07-30 Thread David M. Cook
On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:

 if you select a node, click 'Choose parent' and select the same
 node in the parent list you get a core.
 
 Configuration: LinuxBox with gtk+-2.0.9 and pygtk-1.99.16

Seems to work OK with gtk+-2.2.1.  gtk+-2.0 had all sorts of treeview bugs.
Even gtk+-2.2.0 had some severe ones.

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


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Pere Pujal i Carabantes
El dc, 30 de 07 de 2003 a las 18:37, Christian Reis escribió: 
 On Wed, Jul 30, 2003 at 06:19:00PM +0200, Emanuele Olivetti wrote:
  Executing the Lars Wirzenius's example about gtk.TreeView in:
  http://liw.iki.fi/liw/texts/gtktreeview-tutorial.html
  
  if you select a node, click 'Choose parent' and select the same
  node in the parent list you get a core.
  
There is another extrange behavior here:
step 1: Select folder 2 and choose folder 1 as parent
step 2: Select folder 1 and choose folder 0 as parent

Result folder 2 disappears


 Before submitting reports of crashers, it would be really nice if you
 could test against CVS HEAD. A lot goes in between releases and the team
 is very small to be able to triage all reports that come in.
Just build the CVS HEAD, but how to ensure python is using it instead of
the supplied with the distribution when both coexist?

 A stack trace would be great too.

If for stack trace you mean the output of 'strace' here are one for the
crash:
http://perso.wanadoo.es/perepujal/trace_with_python2.2.gz

Yours

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


Re: [pygtk] bug in TreeView?

2003-07-30 Thread Christian Reis
On Wed, Jul 30, 2003 at 11:39:52PM +0200, Pere Pujal i Carabantes wrote:
  Before submitting reports of crashers, it would be really nice if you
  could test against CVS HEAD. A lot goes in between releases and the team
  is very small to be able to triage all reports that come in.
 Just build the CVS HEAD, but how to ensure python is using it instead of
 the supplied with the distribution when both coexist?

The PYTHONPATH (or sys.path) must be set correctly.

  A stack trace would be great too.
 
 If for stack trace you mean the output of 'strace' here are one for the
 crash:
 http://perso.wanadoo.es/perepujal/trace_with_python2.2.gz

No, the output of gdb's 'where' or 'bt' command, after the dump. 

http://users.actcom.co.il/~choo/lupg/tutorials/debugging/debugging-with-gdb.html

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/