[pygtk] insert_at_cursor signal - cannot connect?
quale1 at charter.net
Tue Jun 15 10:19:49 WST 2004
Christian Robottom Reis <kiko at async.com.br> writes:
> I've grepped through the GTK+ source and I don't see where the
> insert_at_cursor signal could be emitted, but I don't claim expert
> status there either. delete_from_cursor itself is emitted by GDK.Delete,
> visibly in gtktextview.c:
> /* Deleting text */
> gtk_binding_entry_add_signal (binding_set, GDK_Delete, 0,
> "delete_from_cursor", 2,
> G_TYPE_ENUM, GTK_DELETE_CHARS,
> G_TYPE_INT, 1);
> with similar lines for KP_Delete and Backspace. So the question is: who,
> if anybody, emits insert_at_cursor? Or is this simply meant to be
> emitted from userspace when convenient?
Hmmm. Maybe that's right. It looks like "delete_from_cursor" is only
emitted by a few keybindings. Perhaps "insert_at_cursor" is available
for symmetry and for use by a keybinding, but none of the default
keybindings for TextView use it.
I was experimenting with deleting text directly from the TextView
TextBuffer and the "delete_at_cursor" signal is not emitted when the
TextBuffer.delete() method is used. This means it's possible to
delete text from the TextView without triggering the
"delete_at_cursor" signal, although probably not from the keyboard. I
think the "insert_at_cursor" and "delete_from_cursor" TextView signals
aren't really suitable for what the original poster wants to do. It's
probably better to look at the underlying TextBuffer directly. In
fact, I think he hinted that all he needs to know is if the buffer is
empty. The TextBuffer "changed" signal would be the easiest one to
use for that.
More information about the pygtk