Johan has proposed we have a separate module that wraps just the glib
functions (though they still go through _gtkmodule.o). This speeds up
importing them quite a bit, but is only useful for people that want a
mainloop for something -- which is our case, for o-p.

James, what would the proper approach to this be?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL

import _gtk

TRUE = 1
FALSE = 0
def mainloop ():
    _gtk.gtk_main ()

def mainquit (*args):
    _gtk.gtk_main_quit ()

def mainiteration (block=TRUE):
    return _gtk.gtk_main_iteration (block)

def events_pending ():
    return _gtk.gtk_events_pending ()
                                
def idle_add (callback, *args):
            return _gtk.gtk_idle_add (callback, args)
        
def idle_add_priority (priority, callback):
    return _gtk.gtk_idle_add_priority (priority, callback)

def idle_remove (tag):
    _gtk.gtk_idle_remove (tag)

def quit_add (mainlevel, callback, *args):
    return _gtk.gtk_quit_add (mainlevel, callback, args)

def quit_add_destroy (mainlevel, object):
    _gtk.gtk_quit_add_destroy (mainlevel, object._o)

def quit_remove (tag):
    _gtk.gtk_quit_remove (tag)
    
def timeout_add (timeout, callback, *args):
    return _gtk.gtk_timeout_add (timeout, callback, args)

def timeout_remove (tag):
    _gtk.gtk_timeout_remove (tag)

def input_add (source, condition, callback):
    if hasattr (source, 'fileno'):
        # handle python file handles
        def wrapper (source, condition, real_s=source,real_cb=callback):
            real_cb (real_s, condition)
            return _gtk.gtk_input_add (source.fileno (), condition, wrapper)
    else:
        return _gtk.gtk_input_add (source, condition, callback)
        
def input_remove (tag):
    _gtk.gtk_input_remove (tag)
            

Reply via email to