#NEWLINE# def _print_menu( self , message , choices ) : #NEWLINE# #INDENT# 'Print a menu on the screen.\n\n        :param str message: title of menu\n        :param choices: Menu lines\n        :type choices: list of tuples (tag, item) or\n            list of descriptions (tags will be enumerated)\n\n        ' #NEWLINE# if ( choices and isinstance ( choices [ 0 ] , tuple ) ) : #NEWLINE# #INDENT# choices = [ ( '%s - %s' % ( c [ 0 ] , c [ 1 ] ) ) for c in choices ] #NEWLINE# #UNINDENT# self . outfile . write ( '{new}{msg}{new}' . format ( new = os . linesep , msg = self ) ) #NEWLINE# side_frame = ( ( '-' * 79 ) + os . linesep ) #NEWLINE# self . outfile . write ( side_frame ) #NEWLINE# for ( i , desc ) in enumerate ( choices , 1 ) : #NEWLINE# #INDENT# self . outfile . write ( textwrap . fill ( '{num}: {desc}' . format ( num = i , desc = desc ) , 80 ) ) #NEWLINE# self . outfile . write ( os . linesep ) #NEWLINE# #UNINDENT# self . outfile . write ( side_frame )