Re: [pygtk] Problem with CellRendererToggle

2006-11-18 Thread Pipen

On 11/18/06, Brian [EMAIL PROTECTED] wrote:


you need to check the path in the toggled callback to see if it is on
the toggle.



I have three cell renderers in one column, so the path I get in 'button-clicked'
callback is always the same no matter what cell I click in the column.
Is there a way to know exactly what whas clicked in the column?

I have to check if I'll be able to get cell renderer position boundaries and
match it with button-press event x/y position. However it'll be a bit dirty,
even if it works.

--
Artur M. Piwko
AMP29-RIPE
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Problem with CellRendererToggle

2006-11-18 Thread Brian
On Sat, 2006-18-11 at 10:52 +0100, Pipen wrote:
 On 11/18/06, Brian [EMAIL PROTECTED] wrote:
 
  you need to check the path in the toggled callback to see if it is on
  the toggle.
 
 
 I have three cell renderers in one column, so the path I get in 
 'button-clicked'
 callback is always the same no matter what cell I click in the column.
 Is there a way to know exactly what whas clicked in the column?
 
 I have to check if I'll be able to get cell renderer position boundaries and
 match it with button-press event x/y position. However it'll be a bit dirty,
 even if it works.
 

We use to have the toggle packed into a column like that as well.  If I
remember correctly clicking anywhere on the row would always toggle the
toggle.  The other problem we had was that it would not always render
correctly.  The line spacing was wrong with rows overlapping I think.

Then we added more columns with additional information as well as right
mouse button popup menus.  I would recommend you separate out the toggle
into its own column. It will simplify things.  Otherwise I think you
will have to get mouse pointer coordinates and compute its position on
your window... until you figure out if it was your toggle it was over.


-- 
Brian [EMAIL PROTECTED]

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


[pygtk] ANNOUNCE: PyGObject 2.12.3

2006-11-18 Thread Johan Dahlin
I am pleased to announce version 2.12.3 of the Python bindings for GObject.

The new release is available from ftp.gnome.org as and its mirrors
as soon as its synced correctly:

  http://download.gnome.org/sources/pygobject/2.12/

What's new since PyGObject 2.12.2:
   - distutils build fixes (Cedric)
   - documentation updates (John)
   - gobject.handler_block_by_func and friends now accept methods
 (Johan, Dima, #375589)
   - avoid truncating of gparamspec (Yevgen Muntyan, #353943)
   - set __module__ on gobject derived types (Johan,
 Osmo Salomaa, #376099)
   - Ensure exceptions are raised on errors in gobject.OptionGroup
 (Johan, Laszlo Pandy, #364576)

Blurb:

GObject is a object system library used by GTK+ and GStreamer.

PyGObject provides a convenient wrapper for the GObject+ library for use
in Python programs, and takes care of many of the boring details such as
managing memory and type casting.  When combined with PyGTK, PyORBit and
gnome-python, it can be used to write full featured Gnome applications.

Like the GObject library itself PyGObject is licensed under the
GNU LGPL, so is suitable for use in both free software and proprietary
applications.  It is already in use in many applications ranging
from small single purpose scripts up to large full
featured applications.

PyGObject requires GObject = 2.8.0 and Python = 2.3.5 to build.

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


Re: [pygtk] Problem with CellRendererToggle

2006-11-18 Thread Pipen

On 11/18/06, Brian [EMAIL PROTECTED] wrote:

 I have three cell renderers in one column, so the path I get in 
'button-clicked'
 callback is always the same no matter what cell I click in the column.
 Is there a way to know exactly what whas clicked in the column?

 I have to check if I'll be able to get cell renderer position boundaries and
 match it with button-press event x/y position. However it'll be a bit dirty,
 even if it works.


We use to have the toggle packed into a column like that as well.  If I
remember correctly clicking anywhere on the row would always toggle the
toggle.  The other problem we had was that it would not always render
correctly.  The line spacing was wrong with rows overlapping I think.

Then we added more columns with additional information as well as right
mouse button popup menus.  I would recommend you separate out the toggle
into its own column. It will simplify things.  Otherwise I think you
will have to get mouse pointer coordinates and compute its position on
your window... until you figure out if it was your toggle it was over.



I did it. This is how it works now:

def on_sets_button_press( self, tree, event ):
   if event.type == gtk.gdk.BUTTON_PRESS and event.button in (1, 3):
   pathinfo = tree.get_path_at_pos( int(event.x), int(event.y) )
   if pathinfo is not None and event.button == 1:
   path, col = pathinfo[:2]
   cell = col.get_cell_renderers()[SETS_COL_TOGGLE]# Toggle cell.
   ctmin = 16 * len(path)   # - this is the left
toggle boundary.
   ctmax = ctmin + cell.get_size(tree, None)[2] # - and
this is right one.
   if ctmin = event.x  ctmax:# Toggle cell.
   # - Toggle current node (and all subnodes).
   return True# - do not propagate event (no cursor-changed).
   elif pathinfo is not None and event.button == 3:
   # - context menu
   return True# - same as above.
   return False

TODO:
1. I have to find out what is the width of those treeview expand thingies.
  That's why I use fixed 16px width.
  http://pu.kielce.pl/~pipen/varez/pygtk-toggle.png
2. I should add column spacing between cells to the result of ctmax.

Here is another way of calculating ctmax (however result slightly differ (2px)):
ctmax = ctmin + col.cell_get_position(cell)[1]

Thanks for your help.

--
Artur M. Piwko
AMP29-RIPE
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Re: bash shell in some gtk widget

2006-11-18 Thread Fabian Braennstroem
Hi to all,

* On 16 Nov 2006 * Christian Becke wrote:

 Hi,
 
 Am Donnerstag, den 16.11.2006, 11:55 -0800 schrieb David Keogh:
 
  You can also do something like this to at least get a look at what the
  module contains:
  
  import vte
  print dir(vte.Terminal)
 
 Maybe better:
 
 import vte
 help (vte.Terminal)

thanks, I see what I understand...

Greetings!
Fabian
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Re: adjust key bindings

2006-11-18 Thread Fabian Braennstroem
Hi, 

sorry, is that question to stupid or does nobody has a hint?


* On 14 Nov 2006 * Fabian Braennstroem wrote:

 Hi,
 
 I just start to use pygtk ... so it is just my first
 question :-)
 
 I would like to create a small file manager based on 'lfm'
 (curses based file manager). I used glade for the gui and I
 am able to display the existing files and directories using
 two treeview widgets.
 Now, at the beginning I am kind of stuck with the key bindings. In 'lfm'
 it was pretty easy to define special key bindings:
 
 
   keytable = {
   # movement
   ord('p'): 'cursor_up',
   ord('k'): 'cursor_up',
   ord('K'): 'cursor_up2',
   ord('P'): 'cursor_up',
   curses.KEY_UP: 'cursor_up',
   ord('n'): 'cursor_down',
   ord('j'): 'cursor_down',
   ord('J'): 'cursor_down2',
   ord('N'): 'cursor_down',
   curses.KEY_DOWN: 'cursor_down',
   curses.KEY_PPAGE: 'page_previous',
   curses.KEY_BACKSPACE: 'page_previous',
   0x08: 'page_previous', # BackSpace
   0x10: 'page_previous', # Ctrl-P
   curses.KEY_NPAGE: 'page_next',
   ord(' '): 'page_next',
   0x0E: 'page_next', # Ctrl-N
   curses.KEY_HOME: 'home',
   0x16A: 'home',
   ord('H'): 'home',
   0x001: 'home',
   curses.KEY_END: 'end',
   ord('G'): 'end',
   0x181: 'end',
   0x005: 'end',
   ord('h'): 'cursor_left',
   ord('l'): 'cursor_right',
   curses.KEY_LEFT: 'cursor_left',
   curses.KEY_RIGHT: 'cursor_right',
   ord('g'): 'goto_dir',
   0x13: 'goto_file', # Ctrl-S
   0x14: 'tree',  # Ctrl-T
   ord('0'): 'bookmark_0',
   ord('1'): 'bookmark_1',
   ...
 
 
 with such a keytable I am able to bind different 'def's to
 every existing key. As you can see, I like it a lot to use
 'vim-like' keys for moving around; 'j' and 'k' to move a row
 up and down. In glade I found those 'accelerators', but it
 is just for certain functions.
 Does anyone have an idea about using such a keybinding in
 pygtk? Would be nice!
 
 Greetings!
 Fabian
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/