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]



[pygtk] Default button

2000-05-31 Thread Luca Minuti

I have a simple form with a GtkEntry and two button (ok/cancel).
I want that the ok button is the default button (activate with the enter
key) and that the Entry has the focus when the form is showed.

I write this code:

file_entry.grab_focus()
ok_button.set_flags(CAN_DEFAULT)
ok_button.grab_default()

But if the "file_entry" has the focus the ok_button isn't the default.

Someone can help me?

Thanks.

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



[pygtk] string.atof(str) causing problems in xmlparse.py

2000-05-31 Thread christian folini

Hi there,

being mostly new to python and this list, i do not
want to miss the opportunity to report a strange
behavior:

string.atof('0.5') is valid when used by itself.

However, when processing my glade-file in 
xmlparse.py it is causing problems:

[...]
  File "/usr/lib/python1.5/site-packages/pyglade/build.py", line 83,
in __new_widget
widget = create(node)
  File "/usr/lib/python1.5/site-packages/pyglade/build.py", line 225,
in label_new
misc_set(label, node)
  File "/usr/lib/python1.5/site-packages/pyglade/build.py", line 214,
in misc_set
xalign = info.get_float('xalign', 0.5)
  File "/usr/lib/python1.5/site-packages/pyglade/xmlparse.py", line
88, in get_float
return string.atof(self.__tags[key])
ValueError: invalid literal for atof(): 0.5

this seems quite strange to me. only to me?

if this is a bug, i can not see why i should be the first to
encounter.

cheers, christian folini
-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]



[pygtk] Ctree bug

2000-05-31 Thread Phillip Ezolt

Hi all,
When using Ctree  trying to read text from the 0th row, pygtk
generates an execption.

However, if I access row 1 and above things work fine. 

I have data in row zero, so what's wrong? 

Here's the stack trace.  I've included the test program. (select a row
to see it crash.)

[ezolt@pulitzer test]$ python hello.py 
Traceback (innermost last):
  File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__
ret = apply(self.func, a)
  File "hello.py", line 12, in on_epoch_tree_tree_select_row
print tree.node_get_text(node, 0)
  File "/usr/lib/python1.5/site-packages/gtk.py", line 1412, in node_get_text
return _gtk.gtk_ctree_node_get_text(self._o, node, col)
ValueError: can't get text value

Python Version: python-1.5.2-7
PyGtk version: pygtk-0.6.6
Gtk Version: gtk+-1.2.7-1
OS: Redhat Alpha/Linux 6.1 

Thanks much,
--Phil

Compaq:  High Performance Server Division/Benchmark Performance Engineering 
 Alpha, The Fastest Processor on Earth 
[EMAIL PROTECTED]|C|O|M|P|A|Q|[EMAIL PROTECTED]
--- See the results at www.spec.org ---


#!/usr/bin/env python

from gtk import *

def destroy(*args):
window.hide()
mainquit()

def  on_epoch_tree_tree_select_row(*args):
tree = args[0]
node = args[1]
print tree.node_get_text(node, 0)
pass


window = GtkWindow(WINDOW_TOPLEVEL)
window.connect("destroy", destroy)
window.set_border_width(10)
window.show()

epoch_tree=GtkCTree(1)
window.add(epoch_tree)
epoch_tree.set_column_width(0, 80)
epoch_tree.connect("tree_select_row", on_epoch_tree_tree_select_row, epoch_tree)

epoch_tree.show()
epoch_tree.insert_node(None, None, ["foo"], is_leaf = FALSE)

mainloop()



Re: [pygtk] Ctree bug

2000-05-31 Thread James Henstridge

On Wed, 31 May 2000, Phillip Ezolt wrote:

 Hi all,
   When using Ctree  trying to read text from the 0th row, pygtk
 generates an execption.
 
   However, if I access row 1 and above things work fine. 
 
   I have data in row zero, so what's wrong? 
   
 Here's the stack trace.  I've included the test program. (select a row
 to see it crash.)
 
 [ezolt@pulitzer test]$ python hello.py 
 Traceback (innermost last):
   File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__
 ret = apply(self.func, a)
   File "hello.py", line 12, in on_epoch_tree_tree_select_row
 print tree.node_get_text(node, 0)
   File "/usr/lib/python1.5/site-packages/gtk.py", line 1412, in node_get_text
 return _gtk.gtk_ctree_node_get_text(self._o, node, col)
 ValueError: can't get text value

You shouldn't access the tree column of the CTree with gettext.  Instead,
use the get_node_info(node) method to get info about the tree column.

 
 Thanks much,
 --Phil
 

James.

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


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



[pygtk] E-Table support

2000-05-31 Thread Nathan Clegg

Does gnome-python support the E-Table widget used by the helix folks?
Looks particularly handy.


--
Nathan Clegg
 [EMAIL PROTECTED]


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