<s> """<STR_LIT>""" <EOL> import os <EOL> import time <EOL> from Foundation import NSDistributedNotificationCenter <EOL> from Foundation import NSNotificationDeliverImmediately <EOL> from Foundation import NSNotificationPostToAllSessions <EOL> NOTIFICATION_ID = '<STR_LIT>' <EOL> _currentStatus = { } <EOL> def initStatusDict ( ) : <EOL> '''<STR_LIT>''' <EOL> global _currentStatus <EOL> _currentStatus = { <EOL> '<STR_LIT:message>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . getpid ( ) <EOL> } <EOL> def launchMunkiStatus ( ) : <EOL> '''<STR_LIT>''' <EOL> initStatusDict ( ) <EOL> launchfile = "<STR_LIT>" <EOL> try : <EOL> open ( launchfile , '<STR_LIT:w>' ) . close ( ) <EOL> except ( OSError , IOError ) : <EOL> pass <EOL> time . sleep ( <NUM_LIT:0.1> ) <EOL> if os . path . exists ( launchfile ) : <EOL> os . unlink ( launchfile ) <EOL> def postStatusNotification ( ) : <EOL> '''<STR_LIT>''' <EOL> dnc = NSDistributedNotificationCenter . defaultCenter ( ) <EOL> dnc . postNotificationName_object_userInfo_options_ ( <EOL> NOTIFICATION_ID , <EOL> None , <EOL> _currentStatus , <EOL> NSNotificationDeliverImmediately + NSNotificationPostToAllSessions ) <EOL> def message ( messageText ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT:message>' ] = messageText <EOL> postStatusNotification ( ) <EOL> def detail ( detailsText ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = detailsText <EOL> postStatusNotification ( ) <EOL> def percent ( percentage ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = percentage <EOL> postStatusNotification ( ) <EOL> def hideStopButton ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = False <EOL> postStatusNotification ( ) <EOL> def showStopButton ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = True <EOL> postStatusNotification ( ) <EOL> def disableStopButton ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = False <EOL> postStatusNotification ( ) <EOL> def enableStopButton ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = True <EOL> postStatusNotification ( ) <EOL> def activate ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> postStatusNotification ( ) <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> def quit ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> postStatusNotification ( ) <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> def restartAlert ( ) : <EOL> '''<STR_LIT>''' <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> postStatusNotification ( ) <EOL> _currentStatus [ '<STR_LIT>' ] = '<STR_LIT>' </s>
