Our Python table widget uses OpenEV/pymod/pgugrid.py's class pguGrid.
We'd like to add some capability such as:
1) Double clicking - such as double click a cell contains an image name
to load the image in OpenEV viewer.
2) Right click - give a menu for options like load, delete, delete all
There are notes at the beginning of pgugrid.py (see below) that probably
indicates that double clicking was not implemented.
Can pgugrid widget handle the above 1) and 2), if not, what widget would
you recommend to use?
# NOTE: This grid has to simulate double click behaviour by tracking the
# last clicked row/column/cell because on windows a) the gtk double
# event is not sent out if the callback on the single click event is too
# long (this can happen for row selection when there are a large number
# of shapes- on the order of 50000- and the expose event demands a lot
# of the cpu),
# and b) even if the double click event is sent out, the associated
# single press events are sent out in different orders on windows than
# they are on linux/unix. The sequence of events sent out for a double
# click is as follows:
# linux/unix: BUTTON_PRESS, BUTTON_PRESS, _2BUTTON_PRESS
# windows: BUTTON_PRESS, BUTTON_PRESS (if single press callback is too
# BUTTON_PRESS, _2BUTTON_PRESS, BUTTON_PRESS
# GTK's double click behaviour is reasonable for linux/unix, but for
# consistency the approach for all platforms has been to treat the
# double click event as a single click event and track the last
# clicked cell/row/column internally. Internally, the grid only uses
# simulated double click event to launch cell editing.
# The better alternative would be to fix gtk itself for windows, but
# could be complicated and would require new users to build a special
# version of gtk for windows...
# THIS SHOULD BE REVISITED IF OPENEV IS UPGRADED TO GTK2, AS GTK2 MAY
# NOT SUFFER THESE PROBLEMS.
From: Mario Beauchamp <starged@gm...> - 2008-05-02 01:38:56
On Wed, Apr 30, 2008 at 3:07 PM, Gong, Shawn (Contractor)
> hi list,
> There are notes at the beginning of pgugrid.py (see below) that probably
> indicates that double clicking was not implemented.
Quite frankly, I am not sure what those notes mean... I guess only the
original authors can answer that.
> Can pgugrid widget handle the above 1) and 2), if not, what widget would
> you recommend to use?
Unfortunately, I cannot help you with this one... but the key phrase is here:
> # THIS SHOULD BE REVISITED IF OPENEV IS UPGRADED TO GTK2, AS GTK2 MAY
> # NOT SUFFER THESE PROBLEMS.
And indeed, it doesn't (the double-clicking part anyways). For
CIETmap, I have implemented a completely different grid based on the
powerful (but a bit cumbersome) gtk.TreeView so I wouldn't know how
pgugrid itself would behave in the GTK2 environment.