Development Team/Almanac: Difference between revisions
fix plus style nitpicks |
|||
| Line 57: | Line 57: | ||
<pre> | <pre> | ||
#Notify when the visibility state changes by calling self. | # Notify when the visibility state changes by calling self.__visibility_notify_cb | ||
#(PUT THIS IN YOUR ACTIVITY CODE - EG. THE __init__() METHOD) | # (PUT THIS IN YOUR ACTIVITY CODE - EG. THE __init__() METHOD) | ||
self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK) | self.add_events(gtk.gdk.VISIBILITY_NOTIFY_MASK) | ||
self.connect("visibility-notify-event", self. | self.connect("visibility-notify-event", self.__visibility_notify_cb) | ||
... | ... | ||
#Callback method for when the activity's visibility changes | # Callback method for when the activity's visibility changes | ||
def | def __visibility_notify_cb(self, window, event): | ||
if | if event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED: | ||
print "I am not visible" | print "I am not visible" | ||
elif | elif event.state in [gtk.gdk.VISIBILITY_UNOBSCURED, gtk.gdk.VISIBILITY_PARTIAL]: | ||
print "I am visible" | print "I am visible" | ||
</pre> | </pre> | ||