gdraw
index
/home/hashao/.FontForge/python/modules/gdraw/gdraw.py

ctypes wrapper to Attach the GDraw event handler to the gtk main loop.
 
Copyright <hashao2@gmail.com> 2009
 
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 3 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
 
We use a gdraw timeout handler to call the gtk.main_iteration() periodically.
 
You might also want to copy setup_syspath() in gdraw.py to setup proper
sys.path for fontforge scripts.
 
Usage: 
    from gdraw import gtkrunner
 
    w = gtk.Window()
    b = gtk.Button('click')
    w.add(b)
    w.show_all()
 
    gtkrunner.start()
 
Example:
    t = Timer()
    tid = t.add(timeout, func[, data])
    t.remove(t)
 
    # top start/stop gtk main iteration
    g = GtkRunner()
    g.start()
    g.stop()

 
Modules
       
gtk
types

 
Classes
       
GtkRunner
Timer

 
class GtkRunner
    A Helper class to start and stop gtk main iteration.
 
  Methods defined here:
__init__(self, timer=None)
start(self, timeout=200)
Process gtk events every some time.
stop(self)
Stop gtk event handler.

 
class Timer
    Timer class for everyone else to add timer handler to 
gdraw's event loop.
 
  Methods defined here:
__del__(self)
Cleanup everything.
__init__(self)
add(self, timeout, func, data=None)
timeout: in millisecond.
frequency: 0 => one shot.
func: stop if return false
clear(self)
Remove all the timers.
is_active(self, gtimer)
Test if a given GTimer* is active.
remove(self, timer)
Remove the give timer.
setup_event_window(self)
Setup a gdraw hidden event window to handle timeout events.

 
Data
        __all__ = ['Timer', 'GtkRunner', 'gtkrunner']
gtkrunner = <gdraw.GtkRunner instance at 0x9993fac>