<s> from __future__ import absolute_import , division , print_function <EOL> from glue . external . qt import QtGui <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def pick_item ( items , labels , title = "<STR_LIT>" , label = "<STR_LIT>" , <EOL> default = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> choice , isok = QtGui . QInputDialog . getItem ( None , title , label , <EOL> labels , current = default , <EOL> editable = False ) <EOL> if isok : <EOL> index = labels . index ( str ( choice ) ) <EOL> return items [ index ] <EOL> def pick_class ( classes , sort = False , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> def _label ( c ) : <EOL> try : <EOL> return c . LABEL <EOL> except AttributeError : <EOL> return c . __name__ <EOL> if sort : <EOL> classes = sorted ( classes , key = lambda x : _label ( x ) ) <EOL> choices = [ _label ( c ) for c in classes ] <EOL> return pick_item ( classes , choices , ** kwargs ) <EOL> def get_text ( title = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> result , isok = QtGui . QInputDialog . getText ( None , title , title ) <EOL> if isok : <EOL> return str ( result ) </s>
