Re: [pygtk] GtkCTree: strange error

2003-01-02 Thread Christian Reis
On Thu, Jan 02, 2003 at 12:15:18PM -0200, Johan Dahlin wrote:
> tor 2003-01-02 klockan 11.51 skrev Christian Reis:
> > On Wed, Jan 01, 2003 at 09:27:25PM +0100, Ola wrote:
> > > I have a GtkCTree with two columns. if I try to access the text in
> > > column 0 I get an exception, if I try to access column 1 it works. Why?
> > > (or is there another, better whay to iterate through the data in the
> > > tree?)
> > 
> > Well, the CTree is a pretty wierd widget. I have the same trouble as you
> > using get_text(), but I suspect it is because column 0 is the tree
> > column. Have you tried using node_get_text(node, column) instead? It
> > should work. Of course, you need to get a reference to the node - it's
> > returned by insert_node() IIRC, but you can also use node_nth(row).
> 
> It's not only weird is very crappy, old and even deprecated in Pygtk
> 2.0.

But if you are using Gtk 1.2, it is actually quite usable, as
all the existing applications can prove. Oh, its API is not the
loveliest, but that could be say for more than just CTree .

> Gtk 2.x provides a new much more flexible widget called GtkTreeView
> which together with GtkTreeStore replaces CTree. 
> If you want a modern, convenient and capable of very advanced uses.

Yes, that's true; however, that's not what he asked, and TreeView has
its fair share of bugs. CTree, for all its shortcomings, has been in
use and tested over 10 iterations of Gtk+-1.2, and it's limitations are
well-known and documented.

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] GtkCTree: strange error

2003-01-02 Thread Johan Dahlin
tor 2003-01-02 klockan 11.51 skrev Christian Reis:
> On Wed, Jan 01, 2003 at 09:27:25PM +0100, Ola wrote:
> > I have a GtkCTree with two columns. if I try to access the text in
> > column 0 I get an exception, if I try to access column 1 it works. Why?
> > (or is there another, better whay to iterate through the data in the
> > tree?)
> 
> Well, the CTree is a pretty wierd widget. I have the same trouble as you
> using get_text(), but I suspect it is because column 0 is the tree
> column. Have you tried using node_get_text(node, column) instead? It
> should work. Of course, you need to get a reference to the node - it's
> returned by insert_node() IIRC, but you can also use node_nth(row).

It's not only weird is very crappy, old and even deprecated in Pygtk
2.0.

Gtk 2.x provides a new much more flexible widget called GtkTreeView
which together with GtkTreeStore replaces CTree. 
If you want a modern, convenient and capable of very advanced uses.

I would suggest that you update to PyGtk2 (1.99.14 or higher) where lots
of bug fixes and api additions has gone in.

But bad part is that it's a new API, but unless you have lots of code
using the old API in your applications it should be a problem, since
it's quite easy to learn.
-- 
Johan Dahlin <[EMAIL PROTECTED]>
Async Open Source

___
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] GtkCTree: strange error

2003-01-02 Thread Christian Reis
On Wed, Jan 01, 2003 at 09:27:25PM +0100, Ola wrote:
> I have a GtkCTree with two columns. if I try to access the text in
> column 0 I get an exception, if I try to access column 1 it works. Why?
> (or is there another, better whay to iterate through the data in the
> tree?)

Well, the CTree is a pretty wierd widget. I have the same trouble as you
using get_text(), but I suspect it is because column 0 is the tree
column. Have you tried using node_get_text(node, column) instead? It
should work. Of course, you need to get a reference to the node - it's
returned by insert_node() IIRC, but you can also use node_nth(row).

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/



[pygtk] GtkCTree: strange error

2003-01-01 Thread Ola
Hi.
I have a GtkCTree with two columns. if I try to access the text in
column 0 I get an exception, if I try to access column 1 it works. Why?
(or is there another, better whay to iterate through the data in the
tree?)

#Here is a simplified codesnippet that illustrates my problem
#The code below does not work
#If column number is changed to 1 it works
self.burntree = GtkCTree(2, 0, ['File name on CD', 'File name on
Harddisk'])
tree_item = GtkTreeItem()
self.burntree.insert_node(None, None, ['ola','ola'])
self.burntree.insert_node(None, None, ['ola','ola'])
#...
i = 0
while 1:
try:
text = self.burntree.get_text(i, 0)
print text
i = i + 1
except:
break


/Ola A
Mandrake 9.0, pygtk version 0.6.9-3mdk


___
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] GtkCTree

2002-10-01 Thread Christian Reis

On Mon, Sep 30, 2002 at 11:23:19PM -0300, Ingo -LaSombra- Hoffmann wrote:
> Anyone knows a tutorial with a good explanation on how to use GtkCTree?

It's a FAQ, but look at
http://www.moeraki.com/pygtktutorial/ch-ctreewidget.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/



[pygtk] GtkCTree

2002-09-30 Thread Ingo -LaSombra- Hoffmann

Anyone knows a tutorial with a good explanation on how to use GtkCTree?

Thanks in advance,
Ingo -LaSombra- Hoffmann

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



[pygtk] GtkCTree

2002-09-17 Thread Ingo -LaSombra- Hoffmann

Anyone knows a tutorial with a good explanation on how to use GtkCTree?

Thanks in advance,
Ingo -LaSombra- Hoffmann
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] GtkCTree: Right-click on a node?

2002-04-11 Thread Andrew Reid


  Greetings!

  I am in the process of migrating a tool from a GtkTree
to a GtkCTree.  One of the things the old GtkTree used to
do was catch right-clicks on the tree elements, which it 
used to pop-up an input dialog.  I'm trying to implement
the same functionality in the GtkCTree, but it seems there
are no node-level signals available, because the GtkCTreeNode
objects are not themselves widgets.

  I can catch the button-press-event for the GtkCTree as
a whole, and test the event structure for right-click-ness,
but it's not obvious to me how to go from a tree-level 
click event to a node.  I am reluctant to make right-clicking
operate on the selected node, because I am already using 
selection state to convey other information.

  I've gone a couple of rounds with the documentation,
in case there is a widget hidden inside the GtkCTreeNode,
but this does not appear to be the case.  Anyone have
any good clues?

-- Andrew Reid
   [EMAIL PROTECTED]

___
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] GtkCTree not updating

2001-10-01 Thread James Henstridge

On Sun, 30 Sep 2001, Jonathan Pennington wrote:

> I've got a weird problem with GtkCTree, and before I tell you what it is
> I'll say that I'm using Python2.2aX and pyGTK 0.6.8. I know, but it's
> working fine for the most part, I'm developing for a pyGTK-release running
> system (Linux on iPAQ), and I can't get the beta of pyGTK1.99 to compile
> because of failed dependancies (pkg-config? pango? it can't find glib, but
> I have it installed, blahh). If this is going to cause the problem, you

The 1.99.x releases require the development versions (1.3.x) of gtk, etc.
If you are working with gtk+-1.2.x, ignore the 1.99 releases for now --
they are betas for the 2.0 release of pygtk.

> needn't read further- just yell at me to upgrade :). Oh, all the structures
> I'm using are those from Python2.0- there's no 2.2 specific stuff in this
> one.

0.6.8 shouldn't have any problems with 2.2 (I haven't verified this
though).

>
> Quick problem synopsis: CTree built recursively from a dictionary (dict is
> in instance, ie self.dict) in a method of a single class. When I update the
> dictionary, freeze() or clear() the tree, then rebuild the tree with the
> same method that originally built the tree, it freezes and trips out (words
> write on top of words in the tree, branches disappear, etc.) If I freeze()
> or clear() the tree, then add a node manually, it works fine. If I don't
> return to the original method, but update the dictionary manually, it
> freezes. I need a way to update both the tree and dictionary, or otherwise
> keep them in sync, because the tree should reflect changes over multiple
> runs of the program (It's an expense tracker/calculator). If this is the
> wrong way to do it, I guess I can make all changes to the tree directly and
> figure out a method to dump the tree to a file.

It is a bit difficult to work out what is happening.  Are you calling the
thaw() method the same number of times as you freeze it?

>
> I'll send code if needed, but thought this might be a conceptual error on
> my part, rather than a programming error.
>
> Hmm, just thought of something... can I pickle a CTree and load it on the
> next startup, thereby eliminating the need for the dictionary altogether? I
> know that *technically* I can, because Pickle can handle arbitrary data
> types, but can I from a pyGTK perspective. Not handling the dictionary at
> all would save a lot of code!

No :).  I haven't added support for pickling widgets (it might be doable
using widget properties, but probably wouldn't handle saving the tree
structure of a CTree).

>
> (By the way James- thank you very much for pyGTK. I was forced into using
> it instead of wxPython, but already like it more.)

Thanks.  When 2.0 comes out, hopefully you will like it even more :)

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 not updating

2001-10-01 Thread Jonathan Pennington

I've got a weird problem with GtkCTree, and before I tell you what it is
I'll say that I'm using Python2.2aX and pyGTK 0.6.8. I know, but it's
working fine for the most part, I'm developing for a pyGTK-release running
system (Linux on iPAQ), and I can't get the beta of pyGTK1.99 to compile
because of failed dependancies (pkg-config? pango? it can't find glib, but
I have it installed, blahh). If this is going to cause the problem, you
needn't read further- just yell at me to upgrade :). Oh, all the structures
I'm using are those from Python2.0- there's no 2.2 specific stuff in this
one.

Quick problem synopsis: CTree built recursively from a dictionary (dict is
in instance, ie self.dict) in a method of a single class. When I update the
dictionary, freeze() or clear() the tree, then rebuild the tree with the
same method that originally built the tree, it freezes and trips out (words
write on top of words in the tree, branches disappear, etc.) If I freeze()
or clear() the tree, then add a node manually, it works fine. If I don't
return to the original method, but update the dictionary manually, it
freezes. I need a way to update both the tree and dictionary, or otherwise
keep them in sync, because the tree should reflect changes over multiple
runs of the program (It's an expense tracker/calculator). If this is the
wrong way to do it, I guess I can make all changes to the tree directly and
figure out a method to dump the tree to a file.

I'll send code if needed, but thought this might be a conceptual error on
my part, rather than a programming error.

Hmm, just thought of something... can I pickle a CTree and load it on the
next startup, thereby eliminating the need for the dictionary altogether? I
know that *technically* I can, because Pickle can handle arbitrary data
types, but can I from a pyGTK perspective. Not handling the dictionary at
all would save a lot of code!

(By the way James- thank you very much for pyGTK. I was forced into using
it instead of wxPython, but already like it more.) 

-J
-- 
Jonathan Pennington |   [EMAIL PROTECTED]

 "It's hard to take life too seriously
when you realize yours is a joke." -me

___
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 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


Re: [pygtk] GtkCTree

2000-05-31 Thread James Henstridge

On Tue, 30 May 2000, Joshua D. Boyd wrote:

> On Sat, 27 May 2000, James Henstridge wrote:
> > For the GtkCTree, you don't use GtkTree of GtkTreeItem widgets.  Instead,
> > you create the items in the tree with the insert_node method.
> > 
> >   tree = gtk.GtkCTree(1, 0)
> >   node1 = tree.insert_node(None, None, ['an item'])
> >   node2 = tree.insert_node(None, None, ['another item'])
> >   node3 = tree.insert_node(node2, None, ['a subitem'])
> >   node4 = tree.insert_node(node2, node3, ['another subitem'])
> 
> OK, I tried that, and I get a tree with two visible nodes, and no way to
> expand the second node.  So, I was poking around the GTK+ documentation,
> and that turned up nothing, so I poked through the gtk.py file, and found
> that node2 when created above defaults to being a leaf, and apperently you
> have to manually tell it that it isn't a leaf.  Here is the way the node2
> = line should read (this is probably clunkier than it needs to be, but I'm
> very new to python):
> 
> node2 = MyTree.insert_node(None, None, ['another item'], 5, None, None,
> None, None, FALSE)
> 
> The 5, followed by the 4 Nones are the default parameters for various
> optional parameters (due to being very new to python, I wasn't sure how to
> set the last parameter in the parameter list without having to set the
> prior ones.  The FALSE says that this node isn't a leaf (leaf nodes
> obviously should say TRUE there).  
> 
> Maybe everyone in the world but me knew this, but I thought I'd post it
> anyway just in case.   Anyway, back to coding.

Oops.  Sorry about that.  You could also use the following:
  MyTree.insert_node(None, None, ['another item'], is_leaf=FALSE)

> 
> --
> Joshua Boyd
> http://catpro.dragonfire.net/joshua

James.

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


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree

2000-05-31 Thread Joshua D. Boyd

On Sat, 27 May 2000, James Henstridge wrote:
> For the GtkCTree, you don't use GtkTree of GtkTreeItem widgets.  Instead,
> you create the items in the tree with the insert_node method.
> 
>   tree = gtk.GtkCTree(1, 0)
>   node1 = tree.insert_node(None, None, ['an item'])
>   node2 = tree.insert_node(None, None, ['another item'])
>   node3 = tree.insert_node(node2, None, ['a subitem'])
>   node4 = tree.insert_node(node2, node3, ['another subitem'])

OK, I tried that, and I get a tree with two visible nodes, and no way to
expand the second node.  So, I was poking around the GTK+ documentation,
and that turned up nothing, so I poked through the gtk.py file, and found
that node2 when created above defaults to being a leaf, and apperently you
have to manually tell it that it isn't a leaf.  Here is the way the node2
= line should read (this is probably clunkier than it needs to be, but I'm
very new to python):

node2 = MyTree.insert_node(None, None, ['another item'], 5, None, None,
None, None, FALSE)

The 5, followed by the 4 Nones are the default parameters for various
optional parameters (due to being very new to python, I wasn't sure how to
set the last parameter in the parameter list without having to set the
prior ones.  The FALSE says that this node isn't a leaf (leaf nodes
obviously should say TRUE there).  

Maybe everyone in the world but me knew this, but I thought I'd post it
anyway just in case.   Anyway, back to coding.

--
Joshua Boyd
http://catpro.dragonfire.net/joshua



-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree

2000-05-27 Thread James Henstridge

On Fri, 26 May 2000, Joshua D. Boyd wrote:

> Does anyone have any examples of programs that use the CTree?  I'm trying
> to write one that does, but it's giving me trouble appending nodes to the
> tree.  I've looked at the regular gtk documentation, but it isn't helping.
> Here is what I'm currently doing:
> 
> MyTree = GtkCTree ()
> MyNewItem = GtkTreeItem ("Test")
> window.add(MyTree)
> MyTree.show()
> MyTree.append (MyNewItem)

For the GtkCTree, you don't use GtkTree of GtkTreeItem widgets.  Instead,
you create the items in the tree with the insert_node method.

  tree = gtk.GtkCTree(1, 0)
  node1 = tree.insert_node(None, None, ['an item'])
  node2 = tree.insert_node(None, None, ['another item'])
  node3 = tree.insert_node(node2, None, ['a subitem'])
  node4 = tree.insert_node(node2, node3, ['another subitem'])

> 
> I get the error from the MyTree.append line.
> --
> Joshua Boyd
> http://catpro.dragonfire.net/joshua
> 

James.

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


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] GtkCTree

2000-05-26 Thread Joshua D. Boyd

Does anyone have any examples of programs that use the CTree?  I'm trying
to write one that does, but it's giving me trouble appending nodes to the
tree.  I've looked at the regular gtk documentation, but it isn't helping.
Here is what I'm currently doing:

MyTree = GtkCTree ()
MyNewItem = GtkTreeItem ("Test")
window.add(MyTree)
MyTree.show()
MyTree.append (MyNewItem)

I get the error from the MyTree.append line.
--
Joshua Boyd
http://catpro.dragonfire.net/joshua

-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree

2000-02-25 Thread Brandt Kurowski

> > The things to pay attention to are the parent/sibling
> > relationships, which are explained in the GTK+ API docs.
> 
> You probably got better docs then I do, or understood them better
> (I'm using the info files from gtk+-1.2.6)

The docs on http://developer.gnome.org/ are the best I've
found so yet (but they are still *far* from complete). I
haven't looked at the info files, however, so I can't
compare them.

-- 
Brandt
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree

2000-02-25 Thread Moshe Zadka

On Fri, 25 Feb 2000, Brandt Kurowski wrote:

> this is off the top ofmy head, but it should be close to
> something functional for creating a GtkCTree:

Thanks a lot.

> The things to pay attention to are the parent/sibling
> relationships, which are explained in the GTK+ API docs.

You probably got better docs then I do, or understood them better
(I'm using the info files from gtk+-1.2.6)

Well, I guess my next project should have something to do with trees.

--
Moshe Zadka <[EMAIL PROTECTED]>. 
INTERNET: Learn what you know.
Share what you don't.

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree

2000-02-25 Thread Brandt Kurowski

On Fri, Feb 25, 2000 at 08:59:15PM +0200, Moshe Zadka wrote:
> I've been trying to play a bit with GtkCTree, and I can't seem
> to get anything useful out of it. Does anyone have small
> sample code which displays a GtkCTree?

this is off the top of my head, but it should be close to
something functional for creating a GtkCTree:

gct = GtkCTree()
r =  gct.insert_node(None,None,'root'  ,is_leaf=FALSE)
n2 = gct.insert_node(r,   None,'node 2',is_leaf=FALSE)
n1 = gct.insert_node(r,   n2,  'node 1',is_leaf=FALSE)
ld = gct.insert_node(n2,  None,'leaf d',is_leaf=TRUE)
lc = gct.insert_node(n2,  ld,  'leaf c',is_leaf=TRUE)
lb = gct.insert_node(n1,  None,'leaf d',is_leaf=TRUE)
la = gct.insert_node(n1,  lb,  'leaf c',is_leaf=TRUE)

The things to pay attention to are the parent/sibling
relationships, which are explained in the GTK+ API docs.

-- 
Brandt
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] GtkCTree

2000-02-25 Thread Moshe Zadka

I've been trying to play a bit with GtkCTree, and I can't seem
to get anything useful out of it. Does anyone have small
sample code which displays a GtkCTree?

Thanks.
--
Moshe Zadka <[EMAIL PROTECTED]>. 
INTERNET: Learn what you know.
Share what you don't.

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree in a GtkScrolledWindow strange behaviour

1999-12-06 Thread Rob Hodges

Thankyou very much for the quick response.  Seeing your answer I
realise now that it was a stupid question and I should have paid more
attention to the chain of inheritance before posting.  I'll try to be
a bit less daft in the future :)

Thanks again,

-Rob

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



Re: [pygtk] GtkCTree in a GtkScrolledWindow strange behaviour

1999-12-05 Thread ChiDeok Hwang

On Mon, Dec 06, 1999 at 05:06:08AM +1000, Rob Hodges wrote:
> I was wondering if anybody could explain how a GtkCTree goes about
> deciding how wide it is?  (Or more to the point, how to make one only
> be as wide as it needs to be, to contain its contents -- I'd like to
> be able to place one inside a scrolled window and have the horizontal
> scrollbar represent the width of the contents -- which of course is
> what normally happens automatically with most widgets.)

Use GtkCList's columns_autosize method.

> 
> Furthermore, something strange happens if you put one inside a
> GtkScrolledWindow with POLICY_AUTOMATIC set on the scrollbars: each
> time you expand and collapse the tree, it gets wider!  Can anybody
> shed light on this oddity?
> 
> (Also, is it a bug that the text argument to GtkCTree.insert_node is
> seemingly truncated after the first character?)

Instead of text, give him list of texts.

> 
> The following script is sufficient to demonstrate the width-altering
> behaviour:
>


--- ab.py.orig  Mon Dec  6 09:27:52 1999
+++ ab.py   Mon Dec  6 09:28:13 1999
@@ -5,14 +5,12 @@
 
 tree = GtkCTree()
 tree.show()
-basenode = tree.insert_node(None,None,'base',expanded=TRUE,is_leaf=FALSE)
-tree.node_set_text(basenode,0,'base') #otherwise we only get 'b' (???)
+basenode = tree.insert_node(None,None,['base'],expanded=TRUE,is_leaf=FALSE)
 for name in map(str, range(100)):
-n = tree.insert_node(basenode, None, " ")
-tree.node_set_text(n, 0, name)
+n = tree.insert_node(basenode, None, [name])
 for node in tree.base_nodes():
 tree.sort_recursive(node)
-
+tree.columns_autosize()
 treewin = GtkScrolledWindow()
 treewin.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
 win.add(treewin)
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] GtkCTree in a GtkScrolledWindow strange behaviour

1999-12-05 Thread Rob Hodges

I was wondering if anybody could explain how a GtkCTree goes about
deciding how wide it is?  (Or more to the point, how to make one only
be as wide as it needs to be, to contain its contents -- I'd like to
be able to place one inside a scrolled window and have the horizontal
scrollbar represent the width of the contents -- which of course is
what normally happens automatically with most widgets.)

Furthermore, something strange happens if you put one inside a
GtkScrolledWindow with POLICY_AUTOMATIC set on the scrollbars: each
time you expand and collapse the tree, it gets wider!  Can anybody
shed light on this oddity?

(Also, is it a bug that the text argument to GtkCTree.insert_node is
seemingly truncated after the first character?)

The following script is sufficient to demonstrate the width-altering
behaviour:


#! /usr/bin/env python
from gtk import *

win = GtkWindow()

tree = GtkCTree()
tree.show()
basenode = tree.insert_node(None,None,'base',expanded=TRUE,is_leaf=FALSE)
tree.node_set_text(basenode,0,'base') #otherwise we only get 'b' (???)
for name in map(str, range(100)):
n = tree.insert_node(basenode, None, " ")
tree.node_set_text(n, 0, name)
for node in tree.base_nodes():
tree.sort_recursive(node)

treewin = GtkScrolledWindow()
treewin.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
win.add(treewin)
treewin.add(tree)
treewin.show()

win.connect("delete_event", mainquit)
win.show()
mainloop()


Thanks,

-Rob

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]