<s> """<STR_LIT>""" <EOL> from . import base_boxes as bb <EOL> from . import text_box as tb <EOL> from . import utils as ut <EOL> def ynbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" ) , image = None , <EOL> default_choice = '<STR_LIT>' , cancel_choice = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return boolbox ( msg = msg , <EOL> title = title , <EOL> choices = choices , <EOL> image = image , <EOL> default_choice = default_choice , <EOL> cancel_choice = cancel_choice ) <EOL> def ccbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" ) , image = None , <EOL> default_choice = '<STR_LIT>' , cancel_choice = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return boolbox ( msg = msg , <EOL> title = title , <EOL> choices = choices , <EOL> image = image , <EOL> default_choice = default_choice , <EOL> cancel_choice = cancel_choice ) <EOL> def boolbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" ) , image = None , <EOL> default_choice = '<STR_LIT>' , cancel_choice = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if len ( choices ) != <NUM_LIT:2> : <EOL> raise AssertionError ( <EOL> '<STR_LIT>' <EOL> ) <EOL> reply = bb . buttonbox ( msg = msg , <EOL> title = title , <EOL> choices = choices , <EOL> image = image , <EOL> default_choice = default_choice , <EOL> cancel_choice = cancel_choice ) <EOL> if reply == choices [ <NUM_LIT:0> ] : <EOL> return True <EOL> else : <EOL> return False <EOL> def indexbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" ) , image = None , <EOL> default_choice = '<STR_LIT>' , cancel_choice = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> reply = bb . buttonbox ( msg = msg , <EOL> title = title , <EOL> choices = choices , <EOL> image = image , <EOL> default_choice = default_choice , <EOL> cancel_choice = cancel_choice ) <EOL> if reply is None : <EOL> return None <EOL> for i , choice in enumerate ( choices ) : <EOL> if reply == choice : <EOL> return i <EOL> msg = ( "<STR_LIT>" <EOL> "<STR_LIT>" . format ( <EOL> reply , choices ) ) <EOL> raise AssertionError ( msg ) <EOL> def msgbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> ok_button = "<STR_LIT:OK>" , image = None , root = None ) : <EOL> """<STR_LIT>""" <EOL> if not isinstance ( ok_button , ut . basestring ) : <EOL> raise AssertionError ( <EOL> "<STR_LIT>" ) <EOL> return bb . buttonbox ( msg = msg , <EOL> title = title , <EOL> choices = [ ok_button ] , <EOL> image = image , <EOL> root = root , <EOL> default_choice = ok_button , <EOL> cancel_choice = ok_button ) <EOL> def integerbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , default = "<STR_LIT>" , <EOL> lowerbound = <NUM_LIT:0> , upperbound = <NUM_LIT> , image = None , root = None ) : <EOL> """<STR_LIT>""" <EOL> if not msg : <EOL> msg = "<STR_LIT>" . format ( <EOL> lowerbound , upperbound ) <EOL> exception_string = ( <EOL> '<STR_LIT>' ) <EOL> if default : <EOL> try : <EOL> default = int ( default ) <EOL> except ValueError : <EOL> raise ValueError ( <EOL> exception_string . format ( '<STR_LIT:default>' , default , type ( default ) ) ) <EOL> try : <EOL> lowerbound = int ( lowerbound ) <EOL> except ValueError : <EOL> raise ValueError ( <EOL> exception_string . format ( '<STR_LIT>' , <EOL> lowerbound , type ( lowerbound ) ) ) <EOL> try : <EOL> upperbound = int ( upperbound ) <EOL> except ValueError : <EOL> raise ValueError ( <EOL> exception_string . format ( '<STR_LIT>' , <EOL> upperbound , type ( upperbound ) ) ) <EOL> while True : <EOL> reply = enterbox ( msg , title , str ( default ) , image = image , root = root ) <EOL> if reply is None : <EOL> return None <EOL> try : <EOL> reply = int ( reply ) <EOL> except : <EOL> msgbox ( '<STR_LIT>' <EOL> . format ( reply ) , "<STR_LIT>" ) <EOL> continue <EOL> if reply < lowerbound : <EOL> msgbox ( '<STR_LIT>' <EOL> '<STR_LIT>' . format ( lowerbound ) , "<STR_LIT>" ) <EOL> continue <EOL> if reply > upperbound : <EOL> msgbox ( '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> upperbound ) , "<STR_LIT>" ) <EOL> continue <EOL> return reply <EOL> def multenterbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> fields = ( ) , values = ( ) ) : <EOL> r"""<STR_LIT>""" <EOL> return bb . __multfillablebox ( msg , title , fields , values , None ) <EOL> def multpasswordbox ( msg = "<STR_LIT>" , <EOL> title = "<STR_LIT:U+0020>" , fields = tuple ( ) , values = tuple ( ) ) : <EOL> r"""<STR_LIT>""" <EOL> return bb . __multfillablebox ( msg , title , fields , values , "<STR_LIT:*>" ) <EOL> def enterbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , default = "<STR_LIT>" , <EOL> strip = True , image = None , root = None ) : <EOL> """<STR_LIT>""" <EOL> result = bb . __fillablebox ( <EOL> msg , title , default = default , mask = None , image = image , root = root ) <EOL> if result and strip : <EOL> result = result . strip ( ) <EOL> return result <EOL> def passwordbox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , default = "<STR_LIT>" , <EOL> image = None , root = None ) : <EOL> """<STR_LIT>""" <EOL> return bb . __fillablebox ( msg , title , default , mask = "<STR_LIT:*>" , <EOL> image = image , root = root ) <EOL> def multchoicebox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , <EOL> choices = ( ) , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if len ( choices ) == <NUM_LIT:0> : <EOL> choices = [ "<STR_LIT>" ] <EOL> global __choiceboxMultipleSelect <EOL> __choiceboxMultipleSelect = <NUM_LIT:1> <EOL> return bb . __choicebox ( msg , title , choices ) <EOL> def choicebox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , choices = ( ) ) : <EOL> """<STR_LIT>""" <EOL> if len ( choices ) == <NUM_LIT:0> : <EOL> choices = [ "<STR_LIT>" ] <EOL> global __choiceboxMultipleSelect <EOL> __choiceboxMultipleSelect = <NUM_LIT:0> <EOL> return bb . __choicebox ( msg , title , choices ) <EOL> def exceptionbox ( msg = None , title = None ) : <EOL> """<STR_LIT>""" <EOL> if title is None : <EOL> title = "<STR_LIT>" <EOL> if msg is None : <EOL> msg = "<STR_LIT>" <EOL> codebox ( msg , title , ut . exception_format ( ) ) <EOL> def codebox ( msg = "<STR_LIT>" , title = "<STR_LIT:U+0020>" , text = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> return tb . textbox ( msg , title , text , codebox = <NUM_LIT:1> ) </s>
