#NEWLINE# def __init__( self , parent , just_browse = False , category = '<all>' ) : #NEWLINE# #INDENT# 'Dialog for viewing/searching indexed items and returning selection.' #NEWLINE# self . dialog = QDialog ( parent ) #NEWLINE# self . ui = qt_itembrowser . Ui_Dialog ( ) #NEWLINE# self . ui . setupUi ( self . dialog ) #NEWLINE# assets_db_file = Config ( ) . read ( 'assets_db' ) #NEWLINE# starbound_folder = Config ( ) . read ( 'starbound_folder' ) #NEWLINE# self . assets = Assets ( assets_db_file , starbound_folder ) #NEWLINE# self . remember_category = category #NEWLINE# if just_browse : #NEWLINE# #INDENT# self . ui . buttonBox . setStandardButtons ( QDialogButtonBox . Close ) #NEWLINE# #UNINDENT# self . item_browse_select = None #NEWLINE# self . items = self . assets . items ( ) #NEWLINE# for cat in self . items . get_categories ( ) : #NEWLINE# #INDENT# self . ui . category . addItem ( cat [ 0 ] ) #NEWLINE# #UNINDENT# self . ui . category . setCurrentText ( self . remember_category ) #NEWLINE# self . ui . items . clear ( ) #NEWLINE# self . update_item_list ( ) #NEWLINE# self . update_item_view ( ) #NEWLINE# self . ui . items . itemSelectionChanged . connect ( self . update_item_view ) #NEWLINE# if ( not parent ) : #NEWLINE# #INDENT# self . ui . items . itemDoubleClicked . connect ( self . dialog . accept ) #NEWLINE# #UNINDENT# self . ui . filter . textChanged . connect ( self . update_item_list ) #NEWLINE# self . ui . category . currentTextChanged . connect ( self . update_item_list ) #NEWLINE# self . ui . items . setCurrentRow ( 0 ) #NEWLINE# self . ui . filter . setFocus ( )