Example #1
0
    def record(self, obj, signal, *args):
        if signal in ('button-press-event', 'button-release-event'):
            evnt = args[0]
            if signal == 'button-press-event':
                eventname = "BUTTON_PRESS"
            else:
                eventname = "BUTTON_RELEASE"
            wvar = loggers.localvar('widget')
            return [
                "%s = %s" % (wvar, self.location(obj, *args)),
                "%s.event(event(gtk.gdk.%s,x=%20.13e,y=%20.13e,button=%d,state=%d,window=%s.window))"
                % (wvar, eventname, evnt.x, evnt.y, evnt.button, evnt.state,
                   wvar)
            ]
        if signal == 'motion-notify-event':
            evnt = args[0]
            if logutils.suppress_motion_events(obj):
                return self.ignore
            wvar = loggers.localvar('widget')
            return [
                "%s = %s" % (wvar, self.location(obj, *args)),
                "%s.event(event(gtk.gdk.MOTION_NOTIFY,x=%20.13e,y=%20.13e,state=%d,window=%s.window))"
                % (wvar, evnt.x, evnt.y, evnt.state, wvar)
            ]
        if signal == 'focus-in-event':
            wvar = loggers.localvar('widget')
            return [
                "%s=%s" % (wvar, self.location(obj, *args)),
                "%(widget)s.event(event(gtk.gdk.FOCUS_CHANGE, in_=1, window=%(widget)s.window))"
                % dict(widget=wvar)
            ]
        if signal == 'focus-out-event':
            wvar = loggers.localvar('widget')
            return [
                "%s=%s" % (wvar, self.location(obj, *args)),
                "%(widget)s.event(event(gtk.gdk.FOCUS_CHANGE, in_=0, window=%(widget)s.window))"
                % dict(widget=wvar)
            ]

        if signal == 'size-allocate':
            alloc = obj.get_allocation()
            parent = obj.get_parent()
            return ["%s.size_allocate(gtk.gdk.Rectangle(%d, %d, %d, %d))" \
                   % (self.location(obj, *args),
                      alloc.x, alloc.y, alloc.width, alloc.height)]
        return super(WidgetLogger, self).record(obj, signal, *args)
Example #2
0
 def record(self, obj, signal, *args):
     if signal in ('button-press-event', 'button-release-event'):
         evnt = args[0]
         if signal == 'button-press-event':
             eventname = "BUTTON_PRESS"
         else:
             eventname = "BUTTON_RELEASE"
         wvar = loggers.localvar('widget')
         return [
             "%s = %s" % (wvar, self.location(obj, *args)),
             "%s.event(event(gtk.gdk.%s,x=%20.13e,y=%20.13e,button=%d,state=%d,window=%s.window))"
             % (wvar, eventname,
                evnt.x, evnt.y, evnt.button, evnt.state, wvar)
             ]
     if signal == 'motion-notify-event':
         evnt = args[0]
         if logutils.suppress_motion_events(obj):
             return self.ignore
         wvar = loggers.localvar('widget')
         return [
             "%s = %s" % (wvar, self.location(obj, *args)),
             "%s.event(event(gtk.gdk.MOTION_NOTIFY,x=%20.13e,y=%20.13e,state=%d,window=%s.window))"
             % (wvar, evnt.x, evnt.y, evnt.state, wvar)
             ]
     if signal == 'focus-in-event':
         wvar = loggers.localvar('widget')
         return [
    "%s=%s" % (wvar, self.location(obj, *args)),
    "%(widget)s.event(event(gtk.gdk.FOCUS_CHANGE, in_=1, window=%(widget)s.window))" % dict(widget=wvar)
             ]
     if signal == 'focus-out-event':
         wvar = loggers.localvar('widget')
         return [
    "%s=%s" % (wvar,self.location(obj, *args)),
    "%(widget)s.event(event(gtk.gdk.FOCUS_CHANGE, in_=0, window=%(widget)s.window))" % dict(widget=wvar)
             ]
         
     if signal == 'size-allocate':
         alloc = obj.get_allocation()
         parent = obj.get_parent()
         return ["%s.size_allocate(gtk.gdk.Rectangle(%d, %d, %d, %d))" \
                % (self.location(obj, *args),
                   alloc.x, alloc.y, alloc.width, alloc.height)]
     return super(WidgetLogger, self).record(obj, signal, *args)
Example #3
0
def suppress_motion_events():
    return logutils.suppress_motion_events()
Example #4
0
def suppress_motion_events():
    return logutils.suppress_motion_events()