[Sugar-devel] closing an activity immediately
Erik Blankinship
erikb at mediamods.com
Wed Feb 9 13:55:12 EST 2011
If I wanted to stop an activity as soon as it was initiated, how would I do
that? The code below hangs with a grey screen.
Why would I want to do this? I am trying to understand how the sugar code
base works. This seems like a good exercise for understanding how sugar
activities start and stop.
Yes, this would be a bad user experience.
class NotTodayActivity( activity.Activity ):
def __init__( self, handle ):
activity.Activity.__init__( self, handle )
self._auto_shut_down = False
if not self.should_this_activity_run_today( ):
self._auto_shut_down = True
logger.debug( "goin' down" )
self.close( )
return
def write_file( self, file_path ):
logger.debug( "write_file..." )
if self._auto_shut_down:
return
def should_this_activity_run_today( self ):
#todo: details go here
return False
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110209/0e6e125b/attachment.html>
More information about the Sugar-devel
mailing list