#NEWLINE# def update_from_directory( self , s ) : #NEWLINE# #INDENT# filenames = glob . glob ( os . path . join ( s , '*.vt,*.xml' ) ) #NEWLINE# progress = QtGui . QProgressDialog ( '' , '' , 0 , len ( filenames ) ) #NEWLINE# progress . setWindowTitle ( 'Adding files' ) #NEWLINE# progress . setMinimumDuration ( 500 ) #NEWLINE# progress . setWindowModality ( QtCore . Qt . WindowModal ) #NEWLINE# i = 0 #NEWLINE# for filename in filename : #NEWLINE# #INDENT# progress . setValue ( i ) #NEWLINE# progress . setLabelText ( filename ) #NEWLINE# i += 1 #NEWLINE# try : #NEWLINE# #INDENT# locator = FileLocator ( filename ) #NEWLINE# url = locator . to_url ( ) #NEWLINE# entity = self . collection . updateVistrail ( url ) #NEWLINE# self . collection . add_to_workspace ( entity ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# debug . critical ( ( "Failed to add file '%s'" % filename ) ) #NEWLINE# #UNINDENT# #UNINDENT# progress . setValue ( len ( filenames ) ) #NEWLINE# self . collection . commit ( )