Re: maintaining both gtk2 and 3 compatibility



On 11/09/2011 02:27 PM, Jasper St. Pierre wrote:
>> try:
>>    from gi.repository import GObject
>>    from gi.repository import Gtk
>>    from gi.repository import WebKit
>> except ImportError:
>>    import pygtk
>>    pygtk.require("2.0")
>>    import glib as GObject
>>    import gtk as Gtk
>>    import webkit as WebKit
> 
> import glib as GObject?

Oh, I am sorry I did not annotate why I did that.
Some methods moved to different modules in GTK3:
    glib.timeout_add() => GObject.timeout_add()
    glib.source_remove() => GObject.source_remove()

So this means that if I need access to pygtk's glib and gobject, I need
to import the individual members, or write a utility to map where the
members moved to, or have separate trees and only backport necessary
features.

-- 

__C U R T I S  C.  H O V E Y_______
Guilty of stealing everything I am.

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]