Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread Aaron Optimizer Digulla

On Mon, Sep 18, 2000 at 07:59:10PM +0800, James Henstridge wrote:

> > To get the current selection, try ctree.selection (it's an attribute,
> > not a method).
> > 
> > And there is a bug in 0.6.6: node_set_cell_style() and
> > node_get_cell_style() call _gtk.gtk_ctree_node_[sg]et_row_style()
> > instead of ...cell_style(). James, can you fix it, please ?
> Sorry about not releasing a new version for a while.  I have been very
> busy at university for the last few months.  I am not sure how soon I will
> have the time to make a new release.

As long as you use Python, I have no problem whatsoever with that
because I can fix the bugs I find myself :-)

-- 
==
Sowatec AG,   CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
--
Aaron "Optimizer" Digulla, [EMAIL PROTECTED]
==

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread James Henstridge

On Mon, 18 Sep 2000, Aaron Optimizer Digulla wrote:

> On Mon, Sep 18, 2000 at 02:36:10AM -0500, Eric Gillespie, Jr. wrote:
> 
> > With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
> > attach any data to a row in a CTree. I don't know of any other
> > way to find what the user selected. Even if i were to catch the
> > selection signal, i would still have the same problem of mapping
> > the node to useful data. Am i missing something obvious?
> > 
> > Anyway, i've attached a small program demonstrating the problem.
> > The error message i get is below.
> > 
> > Traceback (innermost last):
> >   File "hey.py", line 11, in ?
> > ctree.set_row_data(node, "hey")
> >   File "/usr/lib/python1.5/site-packages/gtk.py", line 1278, in set_row_data
> > _gtk.gtk_clist_set_row_data(self._o, row, data)
> > TypeError: illegal argument type for built-in operation
> 
> To get the current selection, try ctree.selection (it's an attribute,
> not a method).
> 
> And there is a bug in 0.6.6: node_set_cell_style() and
> node_get_cell_style() call _gtk.gtk_ctree_node_[sg]et_row_style()
> instead of ...cell_style(). James, can you fix it, please ?

fixed.

Sorry about not releasing a new version for a while.  I have been very
busy at university for the last few months.  I am not sure how soon I will
have the time to make a new release.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread Aaron Optimizer Digulla

On Mon, Sep 18, 2000 at 02:36:10AM -0500, Eric Gillespie, Jr. wrote:

> With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
> attach any data to a row in a CTree. I don't know of any other
> way to find what the user selected. Even if i were to catch the
> selection signal, i would still have the same problem of mapping
> the node to useful data. Am i missing something obvious?
> 
> Anyway, i've attached a small program demonstrating the problem.
> The error message i get is below.
> 
> Traceback (innermost last):
>   File "hey.py", line 11, in ?
> ctree.set_row_data(node, "hey")
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 1278, in set_row_data
> _gtk.gtk_clist_set_row_data(self._o, row, data)
> TypeError: illegal argument type for built-in operation

To get the current selection, try ctree.selection (it's an attribute,
not a method).

And there is a bug in 0.6.6: node_set_cell_style() and
node_get_cell_style() call _gtk.gtk_ctree_node_[sg]et_row_style()
instead of ...cell_style(). James, can you fix it, please ?

In the meantime, everyone else can use this code as a workaround:

# Bugfix in pygtk
import _gtk
def node_set_cell_style(self, node, col, style):
return _gtk.gtk_ctree_node_set_cell_style(self._o, node, col, style)
def node_get_cell_style(self, node, col):
return _gtk.gtk_ctree_node_get_cell_style(self._o, node, col)
GtkCTree.node_set_cell_style = node_set_cell_style
GtkCTree.node_get_cell_style = node_get_cell_style

Python is great :-)

-- 
==
Sowatec AG,   CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
--
Aaron "Optimizer" Digulla, [EMAIL PROTECTED]
==

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread Alexandre Fayolle

On Mon, 18 Sep 2000, Eric Gillespie, Jr. wrote:

> With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
> attach any data to a row in a CTree. I don't know of any other
> way to find what the user selected. Even if i were to catch the
> selection signal, i would still have the same problem of mapping
> the node to useful data. Am i missing something obvious?

You are using the wrong method: to attach data to a row in a GtkCTree, you
need to call 

ctree.node_set_row_data(node, "hey")
  ^

By the way, you will have something much better if you insert your nodes
using a list of labels, as in:

node = ctree.insert_node(None, None, ['hey'])

(a GtkCTree can have multiple columns, and you need to provide a list of
strings to insert a new item. By default, there is only one column, and it
is the tree column, so a one element list is fine)

Cheers

Alexandre, who might have been asking the same question just one month
ago...

-- 
Alexandre Fayolle
http://www.logilab.com - "Mais où est donc Ornicar ?" - 
LOGILAB, Paris (France).


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



Re: [pygtk] GtkCTree Doesn't Work

2000-09-18 Thread James Henstridge

On Mon, 18 Sep 2000, Eric Gillespie, Jr. wrote:

> With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
> attach any data to a row in a CTree. I don't know of any other
> way to find what the user selected. Even if i were to catch the
> selection signal, i would still have the same problem of mapping
> the node to useful data. Am i missing something obvious?
> 
> Anyway, i've attached a small program demonstrating the problem.
> The error message i get is below.
> 
> Traceback (innermost last):
>   File "hey.py", line 11, in ?
> ctree.set_row_data(node, "hey")
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 1278, in set_row_data
> _gtk.gtk_clist_set_row_data(self._o, row, data)
> TypeError: illegal argument type for built-in operation

You should be using the node_set_row_data() method, rather than the clist
set_row_data() method.  This method takes a GtkCTreeNode rather than a row
number.

I think this is probably covered in the gtk reference documentation.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk



[pygtk] GtkCTree Doesn't Work

2000-09-18 Thread Eric Gillespie, Jr.

With Gnome-Python 1.0.53 from Debian unstable, i can't seem to
attach any data to a row in a CTree. I don't know of any other
way to find what the user selected. Even if i were to catch the
selection signal, i would still have the same problem of mapping
the node to useful data. Am i missing something obvious?

Anyway, i've attached a small program demonstrating the problem.
The error message i get is below.

Traceback (innermost last):
  File "hey.py", line 11, in ?
ctree.set_row_data(node, "hey")
  File "/usr/lib/python1.5/site-packages/gtk.py", line 1278, in set_row_data
_gtk.gtk_clist_set_row_data(self._o, row, data)
TypeError: illegal argument type for built-in operation

-- 
Eric Gillespie, Jr. <*> [EMAIL PROTECTED]
Software Developer
Progeny Linux Systems - http://progenylinux.com


from gtk import *

w = GtkWindow(WINDOW_TOPLEVEL)
w.show()

ctree = GtkCTree()
ctree.show()
w.add(ctree)

node = ctree.insert_node(None, None, "hey")
ctree.set_row_data(node, "hey")

mainloop()

 PGP signature