[sugar] Notify active event firing
Tomeu Vizoso
tomeu
Sun Nov 4 05:07:12 EST 2007
Eduardo, I think you were working on some kind of Sugar Cookbook?
Perhaps this should go there.
Thanks,
Tomeu
On Sun, 2007-11-04 at 01:45 -0500, Benjamin M. Schwartz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Arjun Sarwal wrote:
> > I need to turn off some drawing code when the user switches to Home View
> > (why waste so much of CPU power in the meanwhile)
> > How can I do that ?
>
> I just figured this out while writing Clock. In my activity's __init__, I do:
>
> self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK)
> self.connect("visibility-notify-event", self._visible_cb)
>
> then later,
>
> def _visible_cb(self, widget, event):
> if event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED:
> self._innards.pause()
> else:
> self._innards.resume()
>
> It works perfectly.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHLWoFUJT6e6HFtqQRAqymAKCWPL7JWKoF2U5s4peSynzJzGM0mgCeOnt4
> i+BsLLgvgud2lvpQM6MSQeA=
> =Cigo
> -----END PGP SIGNATURE-----
>
>
More information about the Sugar-devel
mailing list