[pygtk] More on cut+paste accelerators

Geoff Bache geoff.bache at jeppesen.com
Tue Oct 6 21:11:06 WST 2009


Hi all,

I'm also having some issues with the default cut and paste which is that 
my application can also cut and paste files. These file actions have 
naturally been assigned the accelerators Ctrl+X, Ctrl+V etc but this 
naturally means that currently these accelerators don't work for 
selected text in the TextView widgets. What I'd like is for Ctrl+C to 
copy a file if a file is selected and copy some text (as the default) if 
some text is selected.

What's the easiest or "normal" way of fixing something like this? As far 
as I can tell from the docs, accelerators apply to the entire window and 
there isn't an obvious way to divide it up so that they do different 
things if different widgets are in focus. Or is there some trick 
involving accelerator paths, accelerator groups and action groups that I 
haven't understood?

Or do I need to explicitly connect up every gtk.Entry, gtk.TextView etc 
in the application so that when the user selects something there all the 
file actions get disabled?

Regards,
Geoff



More information about the pygtk mailing list