<s> import pygtk <EOL> pygtk . require ( '<STR_LIT>' ) <EOL> import gtk , gobject <EOL> def progress_timeout ( pbobj ) : <EOL> if pbobj . activity_check . get_active ( ) : <EOL> pbobj . pbar . pulse ( ) <EOL> else : <EOL> new_val = pbobj . pbar . get_fraction ( ) + <NUM_LIT> <EOL> if new_val > <NUM_LIT:1.0> : <EOL> new_val = <NUM_LIT:0.0> <EOL> pbobj . pbar . set_fraction ( new_val ) <EOL> return True <EOL> class ProgressBar : <EOL> def toggle_show_text ( self , widget , data = None ) : <EOL> if widget . get_active ( ) : <EOL> self . pbar . set_text ( "<STR_LIT>" ) <EOL> else : <EOL> self . pbar . set_text ( "<STR_LIT>" ) <EOL> def toggle_activity_mode ( self , widget , data = None ) : <EOL> if widget . get_active ( ) : <EOL> self . pbar . pulse ( ) <EOL> else : <EOL> self . pbar . set_fraction ( <NUM_LIT:0.0> ) <EOL> def toggle_orientation ( self , widget , data = None ) : <EOL> if self . pbar . get_orientation ( ) == gtk . PROGRESS_LEFT_TO_RIGHT : <EOL> self . pbar . set_orientation ( gtk . PROGRESS_RIGHT_TO_LEFT ) <EOL> elif self . pbar . get_orientation ( ) == gtk . PROGRESS_RIGHT_TO_LEFT : <EOL> self . pbar . set_orientation ( gtk . PROGRESS_LEFT_TO_RIGHT ) <EOL> def destroy_progress ( self , widget , data = None ) : <EOL> gobject . source_remove ( self . timer ) <EOL> self . timer = <NUM_LIT:0> <EOL> gtk . main_quit ( ) <EOL> def __init__ ( self ) : <EOL> self . window = gtk . Window ( gtk . WINDOW_TOPLEVEL ) <EOL> self . window . set_resizable ( True ) <EOL> self . window . connect ( "<STR_LIT>" , self . destroy_progress ) <EOL> self . window . set_title ( "<STR_LIT>" ) <EOL> self . window . set_border_width ( <NUM_LIT:0> ) <EOL> vbox = gtk . VBox ( False , <NUM_LIT:5> ) <EOL> vbox . set_border_width ( <NUM_LIT:10> ) <EOL> self . window . add ( vbox ) <EOL> vbox . show ( ) <EOL> align = gtk . Alignment ( <NUM_LIT:0.5> , <NUM_LIT:0.5> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> vbox . pack_start ( align , False , False , <NUM_LIT:5> ) <EOL> align . show ( ) <EOL> self . pbar = gtk . ProgressBar ( ) <EOL> align . add ( self . pbar ) <EOL> self . pbar . show ( ) <EOL> self . timer = gobject . timeout_add ( <NUM_LIT:100> , progress_timeout , self ) <EOL> separator = gtk . HSeparator ( ) <EOL> vbox . pack_start ( separator , False , False , <NUM_LIT:0> ) <EOL> separator . show ( ) <EOL> table = gtk . Table ( <NUM_LIT:2> , <NUM_LIT:2> , False ) <EOL> vbox . pack_start ( table , False , True , <NUM_LIT:0> ) <EOL> table . show ( ) <EOL> check = gtk . CheckButton ( "<STR_LIT>" ) <EOL> table . attach ( check , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> , <EOL> gtk . EXPAND | gtk . FILL , gtk . EXPAND | gtk . FILL , <EOL> <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> check . connect ( "<STR_LIT>" , self . toggle_show_text ) <EOL> check . show ( ) <EOL> self . activity_check = check = gtk . CheckButton ( "<STR_LIT>" ) <EOL> table . attach ( check , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <EOL> gtk . EXPAND | gtk . FILL , gtk . EXPAND | gtk . FILL , <EOL> <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> check . connect ( "<STR_LIT>" , self . toggle_activity_mode ) <EOL> check . show ( ) <EOL> check = gtk . CheckButton ( "<STR_LIT>" ) <EOL> table . attach ( check , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <EOL> gtk . EXPAND | gtk . FILL , gtk . EXPAND | gtk . FILL , <EOL> <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> check . connect ( "<STR_LIT>" , self . toggle_orientation ) <EOL> check . show ( ) <EOL> button = gtk . Button ( "<STR_LIT>" ) <EOL> button . connect ( "<STR_LIT>" , self . destroy_progress ) <EOL> vbox . pack_start ( button , False , False , <NUM_LIT:0> ) <EOL> button . set_flags ( gtk . CAN_DEFAULT ) <EOL> button . grab_default ( ) <EOL> button . show ( ) <EOL> self . window . show ( ) <EOL> def main ( ) : <EOL> gtk . main ( ) <EOL> return <NUM_LIT:0> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> ProgressBar ( ) <EOL> main ( ) </s>
