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._visibleNotifyCb
         # 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._visibleNotifyCb)
         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 _visibleNotifyCb(self, widget, event):
     def __visibility_notify_cb(self, window, event):
         if (event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED):
         if event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED:
             print "I am not visible"
             print "I am not visible"
         elif (event.state == gtk.gdk.VISIBILITY_UNOBSCURED):
         elif event.state in [gtk.gdk.VISIBILITY_UNOBSCURED, gtk.gdk.VISIBILITY_PARTIAL]:
             print "I am visible"
             print "I am visible"
</pre>
</pre>