<s> import wx <EOL> class ScoreDialog ( wx . Dialog ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , parent , groups , filters , enrichments = True ) : <EOL> """<STR_LIT>""" <EOL> wx . Dialog . __init__ ( self , parent , - <NUM_LIT:1> , "<STR_LIT>" ) <EOL> def key_value ( item ) : <EOL> if isinstance ( item , tuple ) : <EOL> return item <EOL> else : <EOL> return ( item , str ( item ) ) <EOL> self . groups = map ( key_value , groups ) <EOL> self . filters = map ( key_value , filters ) <EOL> self . groups_lb = wx . ListBox ( self , choices = [ v for k , v in self . groups ] ) <EOL> self . groups_lb . SetSelection ( <NUM_LIT:0> ) <EOL> self . filters_lb = wx . ListBox ( self , choices = [ v for k , v in self . filters ] ) <EOL> self . filters_lb . SetSelection ( <NUM_LIT:0> ) <EOL> self . _wants_enrichments = wx . CheckBox ( self , - <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . _wants_enrichments . SetValue ( enrichments ) <EOL> vbox = wx . BoxSizer ( wx . VERTICAL ) <EOL> vbox . Add ( wx . StaticText ( self , - <NUM_LIT:1> , '<STR_LIT>' ) , <NUM_LIT:0> ) <EOL> vbox . Add ( self . groups_lb , <NUM_LIT:1> , wx . EXPAND ) <EOL> vbox . Add ( wx . StaticText ( self , - <NUM_LIT:1> , '<STR_LIT>' ) , <NUM_LIT:0> , wx . TOP , <NUM_LIT:5> ) <EOL> vbox . Add ( self . filters_lb , <NUM_LIT:1> , wx . EXPAND ) <EOL> vbox . Add ( self . _wants_enrichments ) <EOL> vbox . Add ( self . CreateButtonSizer ( wx . OK | wx . CANCEL ) , <NUM_LIT:0> , <EOL> wx . TOP | wx . ALIGN_CENTER , <NUM_LIT:5> ) <EOL> hbox = wx . BoxSizer ( wx . HORIZONTAL ) <EOL> hbox . Add ( vbox , <NUM_LIT:1> , wx . EXPAND | wx . ALL , <NUM_LIT:10> ) <EOL> self . SetSizer ( hbox ) <EOL> self . Centre ( ) <EOL> @ property <EOL> def group ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . groups [ self . groups_lb . GetSelections ( ) [ <NUM_LIT:0> ] ] [ <NUM_LIT:0> ] <EOL> @ property <EOL> def filter ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . filters [ self . filters_lb . GetSelections ( ) [ <NUM_LIT:0> ] ] [ <NUM_LIT:0> ] <EOL> @ property <EOL> def wants_enrichments ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _wants_enrichments . Value <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> app = wx . PySimpleApp ( ) <EOL> d = ScoreDialog ( None , [ str ( a ) for a in range ( <NUM_LIT:15> ) ] , <EOL> [ ( None , '<STR_LIT:None>' ) , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> if d . ShowModal ( ) == wx . ID_OK : <EOL> print '<STR_LIT:a>' <EOL> print "<STR_LIT>" , repr ( d . group ) <EOL> print "<STR_LIT>" , repr ( d . filter ) <EOL> print ( d . wants_enrichments and '<STR_LIT>' or '<STR_LIT>' ) + '<STR_LIT>' <EOL> d . Destroy ( ) </s>
