<s> import sublime <EOL> """<STR_LIT>""" <EOL> class ThreadProgress ( ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , thread , message , success_message ) : <EOL> self . thread = thread <EOL> self . message = message <EOL> self . success_message = success_message <EOL> self . addend = <NUM_LIT:1> <EOL> self . size = <NUM_LIT:15> <EOL> self . last_view = None <EOL> self . window = None <EOL> sublime . set_timeout ( lambda : self . run ( <NUM_LIT:0> ) , <NUM_LIT:100> ) <EOL> def run ( self , i ) : <EOL> if self . window is None : <EOL> self . window = sublime . active_window ( ) <EOL> active_view = self . window . active_view ( ) <EOL> if self . last_view is not None and active_view != self . last_view : <EOL> self . last_view . erase_status ( '<STR_LIT>' ) <EOL> self . last_view = None <EOL> if not self . thread . is_alive ( ) : <EOL> def cleanup ( ) : <EOL> active_view . erase_status ( '<STR_LIT>' ) <EOL> if hasattr ( self . thread , '<STR_LIT:result>' ) and not self . thread . result : <EOL> cleanup ( ) <EOL> return <EOL> active_view . set_status ( <EOL> '<STR_LIT>' , self . success_message ) <EOL> sublime . set_timeout ( cleanup , <NUM_LIT> ) <EOL> return <EOL> before = i % self . size <EOL> after = ( self . size - <NUM_LIT:1> ) - before <EOL> active_view . set_status ( '<STR_LIT>' , '<STR_LIT>' % ( <EOL> self . message , '<STR_LIT:U+0020>' * before , '<STR_LIT:U+0020>' * after ) ) <EOL> if self . last_view is None : <EOL> self . last_view = active_view <EOL> if not after : <EOL> self . addend = - <NUM_LIT:1> <EOL> if not before : <EOL> self . addend = <NUM_LIT:1> <EOL> i += self . addend <EOL> sublime . set_timeout ( lambda : self . run ( i ) , <NUM_LIT:100> ) </s>
