On Wed, Jun 25, 2003 at 07:10:48PM -0700, Austin Henry wrote:
> Now, I have the cell renderer working happily (editing supplied by a
> gtk.Entry), and the DBCombo working happily too. The problem seems to
> be convincing the TreeView widget that it would like to use the DBCombo
> as the editing widget. Buried deep in the Gtk code
> (gtktreeviewcolumn.c, line 2606) is the following bit of code
> g_return_val_if_fail (GTK_IS_CELL_EDITABLE (*editable_widget), FALSE);
> which is on the code path that is followed when you ask to edit a
> TreeView's Cell.
This is a *very* interesting problem. I've not thought a lot about it,
but it seems to stem from the fact that GtkCombo is *not* an Editable,
but instead *wraps* one (at least it did in 1.2, and I don't think
anybody's gone and fixed *that* one).
> That code basically means that I can't just implement the interface in
> python, and have the calls be made with no one the wiser. I tried to
> declare my DBCombo like this:
> class DBCombo(gtk.Combo, gtk.CellEditable)
> but python complains:
> Traceback (most recent call last):
> File "widgets.py", line 11, in ?
> class DBCombo(gtk.Combo, gtk.CellEditable):
> TypeError: multiple bases have instance lay-out conflict
>
> So, I went and read the C code for GtkEntry to see how "officially"
> adding the interface CellEditable to a GType is done. Turns out that
> the call is:
> g_type_add_interface_static(...)
> There's unfortunately no corresponding function in PyGtk.
That's one way to proceed, but I'm not sure this is safe to call. I'm
afraid to say your question belongs more to the GTK+ development lists;
I'd give that a go first, because it's more likely someone there will
have an idea of what the best fix is. The way I see it, there are two
approaches:
- Make your GtkCombo `look' like a GtkEditable and avoid that check.
The problem here is that this is the first bump on the road, and
who knows how much trouble you'll have making your Combo proxy
everything into its inner Entry.
- Make the TreeView more lenient as to what it accepts as an
editable widget.
Oh, just thought of something -- have you tried passing in the combo's
*entry* as the editing widget instead of the combo itself? That might
work. I have no idea of how renderers are set up (having no GTK+2
experience myself), but that might work.
Offtopic question: I, too, implemented an autocomplete widget for Kiwi,
and I was wondering if you've benchmarked your widget to see how many
items it accepts before it gets slow. Mine takes about 800 items before
it gets slow displaying the full like, and I added a `min_chars'
parameter that determines how many chars need to be typed before we pop
open the completion box.
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/