<s> """<STR_LIT>""" <EOL> import logging <EOL> import sys <EOL> import wx <EOL> from traits . api import Bool , HasTraits , provides , Unicode <EOL> from pyface . util . guisupport import start_event_loop_wx <EOL> from pyface . i_gui import IGUI , MGUI <EOL> logger = logging . getLogger ( __name__ ) <EOL> @ provides ( IGUI ) <EOL> class GUI ( MGUI , HasTraits ) : <EOL> busy = Bool ( False ) <EOL> started = Bool ( False ) <EOL> state_location = Unicode <EOL> def __init__ ( self , splash_screen = None ) : <EOL> self . _splash_screen = splash_screen <EOL> if self . _splash_screen is not None : <EOL> self . _splash_screen . open ( ) <EOL> def invoke_after ( cls , millisecs , callable , * args , ** kw ) : <EOL> wx . FutureCall ( millisecs , callable , * args , ** kw ) <EOL> invoke_after = classmethod ( invoke_after ) <EOL> def invoke_later ( cls , callable , * args , ** kw ) : <EOL> wx . CallAfter ( callable , * args , ** kw ) <EOL> invoke_later = classmethod ( invoke_later ) <EOL> def set_trait_after ( cls , millisecs , obj , trait_name , new ) : <EOL> wx . FutureCall ( millisecs , setattr , obj , trait_name , new ) <EOL> set_trait_after = classmethod ( set_trait_after ) <EOL> def set_trait_later ( cls , obj , trait_name , new ) : <EOL> wx . CallAfter ( setattr , obj , trait_name , new ) <EOL> set_trait_later = classmethod ( set_trait_later ) <EOL> def process_events ( allow_user_events = True ) : <EOL> if allow_user_events : <EOL> wx . GetApp ( ) . Yield ( True ) <EOL> else : <EOL> wx . SafeYield ( ) <EOL> process_events = staticmethod ( process_events ) <EOL> def set_busy ( busy = True ) : <EOL> if busy : <EOL> GUI . _cursor = wx . BusyCursor ( ) <EOL> else : <EOL> GUI . _cursor = None <EOL> set_busy = staticmethod ( set_busy ) <EOL> def start_event_loop ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . _splash_screen is not None : <EOL> self . _splash_screen . close ( ) <EOL> self . set_trait_after ( <NUM_LIT:10> , self , "<STR_LIT>" , True ) <EOL> if sys . platform == '<STR_LIT>' : <EOL> def _mac_os_x_hack ( ) : <EOL> f = wx . Frame ( None , - <NUM_LIT:1> ) <EOL> f . Show ( True ) <EOL> f . Close ( ) <EOL> self . invoke_later ( _mac_os_x_hack ) <EOL> logger . debug ( "<STR_LIT>" ) <EOL> start_event_loop_wx ( ) <EOL> self . started = False <EOL> def stop_event_loop ( self ) : <EOL> """<STR_LIT>""" <EOL> logger . debug ( "<STR_LIT>" ) <EOL> wx . GetApp ( ) . ExitMainLoop ( ) <EOL> def _state_location_default ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _default_state_location ( ) <EOL> def _busy_changed ( self , new ) : <EOL> """<STR_LIT>""" <EOL> if new : <EOL> self . _wx_cursor = wx . BusyCursor ( ) <EOL> else : <EOL> del self . _wx_cursor <EOL> return </s>
