Re: [pygtk] GdkRectangles

2002-12-04 Thread David M. Cook
On Wed, Dec 04, 2002 at 01:54:37PM +0800, James Henstridge wrote:

 There isn't very many cases in GTK where inout GdkRectangle arguments 
 are used.  For in args, you should be able to just pass a sequence of 
 integers to get it to work.  As out arguments are not pythonic, I have 
 converted them to return values in most places.  If I have missed one, 
 please submit a bugzilla bug so that it can be fixed.

Thanks, James.  Submitted as

http://bugzilla.gnome.org/show_bug.cgi?id=100301

Dave
___
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] GdkRectangles

2002-12-04 Thread David M. Cook
On Tue, Dec 03, 2002 at 08:13:27PM -0200, Christian Reis wrote:

  TreeView.get_path_at_pos(0,0) (if you want the column number in the
  callback, you'll need to attach an integer to ViewColumn at creation time;
  there are still a few holes in the C-Gtk TreeView API.)
 
 Hmm, you lost me here :-)

How did that get there.  I think that was written at the end of a long
hacking session.

Suppose you connect to a button-press-event on a TreeView.  You might like
to know what numeric column was clicked so you can pass this to, say,
store.set_value.  The callback has a TreeView and the event as parameters.
You can get the widget coordinates as event.x and event.y, and
TreeView.get_path_at_pos returns the path, a TreeViewColumn, and the (x,y)
postion relative to the cell.  But what column was clicked? That's why I
attach a numeric value to the TreeViewColumn at creation time with set_data.

I suppose you could also do something like view.get_columns.index(viewcol),
but I have no idea if TreeView.get_columns is guarenteed to return the
columns in their visible order.

Dave
___
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] GdkRectangles

2002-12-04 Thread David M. Cook
On Wed, Dec 04, 2002 at 11:14:46AM -0200, Christian Reis wrote:

 Just as a quick question: would select-row not work in your case? And

The select-row callback has only one parameter, the TreeView.  You can then
use TreeView.get_cursor() to get a TreePath and a TreeViewColumn.  Still no
numeric column value.  I put in an RFE asking for more useful parameters,
but the idea was rejected.

 what about get_selection_info() - is there a call like that for the

There's TreeView.get_selection().get_selected() which return a TreeModel and
an Iter.  Still no numeric column value.

  I suppose you could also do something like view.get_columns.index(viewcol),
  but I have no idea if TreeView.get_columns is guarenteed to return the
  columns in their visible order.
 
 Good point.

I suppose you could do:

i=0
while viewcol != view.get_column(i):
  i += 1
  
This is probably better than using set_data at creation time in the case you
want to change the order of the columns.
  
Dave
___
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] GdkRectangles

2002-12-03 Thread Christian Reis
On Mon, Dec 02, 2002 at 06:15:15PM -0800, David M. Cook wrote:
 On Mon, Dec 02, 2002 at 12:52:58AM -0800, David M. Cook wrote:
 
  Are GdkRectangles always represented by 4-tuples in pygtk?  The reason I ask
  is that functions like TreeView.get_cell_area() and
  TreeView.get_background_area seem to want GdkRectangles as input/output
  parameters.  Immutable types don't make good input/output parameters.
 
 Sorry, I figured this out with a little introspection.  I think I knew this
 at one time and forgot it.

What was the secret?

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] GdkRectangles

2002-12-03 Thread David M. Cook
 What was the secret?

I spoke too soon.  I'm no closer to understanding how Rectangles are handled
by pygtk.  I was embarassed that I might be rehashing old ground, but there
is almost nothing on this subject in over 11M of pygtk list archives.  

gdk.Rectangle has a copy method.  Playing around a bit, you can get a
GdkRectangle by copying, say, Widget.allocation:

rect = somewidget.allocation.copy()

However, I tried passing this to TreeView.get_visible_rect, but the passed
in rect doesn't change.  I was able to get what I wanted (the first visible
row  col on the top left (origin) of the TreeView) with
TreeView.get_path_at_pos(0,0) (if you want the column number in the
callback, you'll need to attach an integer to ViewColumn at creation time;
there are still a few holes in the C-Gtk TreeView API.)

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] GdkRectangles

2002-12-03 Thread Christian Reis
On Tue, Dec 03, 2002 at 04:09:53AM -0800, David M. Cook wrote:
  What was the secret?
 
 I spoke too soon.  I'm no closer to understanding how Rectangles are handled
 by pygtk.  I was embarassed that I might be rehashing old ground, but there
 is almost nothing on this subject in over 11M of pygtk list archives.  

Realize that PyGTK2 is rather recent, so few people have hacked
Rectangles before.

 gdk.Rectangle has a copy method.  Playing around a bit, you can get a
 GdkRectangle by copying, say, Widget.allocation:
 
 rect = somewidget.allocation.copy()

Can't you just use a 4-item tuple when a gdk.Rectangle is required?

 However, I tried passing this to TreeView.get_visible_rect, but the passed
 in rect doesn't change.  I was able to get what I wanted (the first visible

But it seems to take in tree coordinates. Did you use the allocation of
the tree widget?

Tree coordinates start at 0,0 for row 0 of the tree, and cover the
entire scrollable area of the tree.

 row  col on the top left (origin) of the TreeView) with
 TreeView.get_path_at_pos(0,0) (if you want the column number in the
 callback, you'll need to attach an integer to ViewColumn at creation time;
 there are still a few holes in the C-Gtk TreeView API.)

Hmm, you lost me here :-)

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] GdkRectangles

2002-12-03 Thread Johan Dahlin
tis 2002-12-03 klockan 10.09 skrev David M. Cook:
  What was the secret?
 
 I spoke too soon.  I'm no closer to understanding how Rectangles are handled
 by pygtk.  I was embarassed that I might be rehashing old ground, but there
 is almost nothing on this subject in over 11M of pygtk list archives.  

It's very recent, added to cvs only 4 month ago.
You can find some information in bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=74136

But it's mostly implementation details

-- 
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] GdkRectangles

2002-12-02 Thread David M. Cook
On Mon, Dec 02, 2002 at 12:52:58AM -0800, David M. Cook wrote:

 Are GdkRectangles always represented by 4-tuples in pygtk?  The reason I ask
 is that functions like TreeView.get_cell_area() and
 TreeView.get_background_area seem to want GdkRectangles as input/output
 parameters.  Immutable types don't make good input/output parameters.

Sorry, I figured this out with a little introspection.  I think I knew this
at one time and forgot it.

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