[pygtk] Re: renderer, style and drag-n-drop
Laurent G.
lauranger at free.fr
Sat Jan 5 23:40:10 WST 2008
Laurent G. a écrit :
> Laurent G. a écrit :
>> Laurent G. a écrit :
>>> Hi
>>> I managed to write a kind of ColorButtonCellRenderer trying to use
>>> Styles. No fully satisfying but quite functionnable until I set my
>>> TreeView row-reorderable. On dragging on_render get passed a pixmap
>>> instead of a window and the style methode "vomit" a :
>>>
>>> TypeError: GtkStyle.paint_box() argument 1 must be gtk.gdk.Window, not
>>> gtk.gdk.Pixmap
>>> Traceback (most recent call last):
>>> File "./mapcolorist.py", line 99, in on_render
>>> cell_area.width, cell_area.height)
>>>
>>> Apart from mimic-ing style code for a drawable what are the options to
>>> face this trickage (illegal but legitimate in my mind) from drag-n-drop
>>> code ?
>>>
>>> Thanks in advance for any advice or explanation.
>>>
>>> Laurent G.
>>>
>> After some readfing in CellRenderer I correct that the "trickage" is legal.
>> After reading gtk+ source I see that gtk_cell_renderer_text_render
>> uses gtk_paint_layout that waits a GdkWindow* giving it a GdkDrawable*
>> and it works fine. Would it be that the wrapper is stricter than gtk
>> itself ?
>>
>> Have nice coding.
>>
>> Laurent G.
>>
> It's me --again, sorry-- how could I tell the wrapper to pretend a
> GdkDawable could fit as a GdkWindow ?
>
> Thanks in advance.
>
> Laurent G.
Hi, some positive news on this topic :
I made changes in gtk-base.defs : for every GtkStyle drawing methods
changed GDkWindow to GdkDrawable. Tried my cellrenderer in a
drag-n-drop, it works :)
This is not very sound but as C implementation seems not to care a lot
about GdkDrawable* passed as GdkWindow* and back.
Regards
More information about the pygtk
mailing list