#NEWLINE# def delete( self ) : #NEWLINE# #INDENT# '\n        Deletes the selected items.\n        ' #NEWLINE# urls = self . selected_urls ( ) #NEWLINE# rep = QtWidgets . QMessageBox . question ( self . tree_view , _ ( 'Confirm delete' ) , _ ( 'Are you sure about deleting the selected files?' ) , ( QtWidgets . QMessageBox . Yes | QtWidgets . QMessageBox . No ) , QtWidgets . QMessageBox . Yes ) #NEWLINE# if ( rep == QtWidgets . QMessageBox . Yes ) : #NEWLINE# #INDENT# deleted_files = [ ] #NEWLINE# for fn in urls : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if os . path . isfile ( fn ) : #NEWLINE# #INDENT# os . remove ( fn ) #NEWLINE# deleted_files . append ( fn ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# files = self . _get_files ( fn ) #NEWLINE# shutil . rmtree ( fn ) #NEWLINE# deleted_files += files #NEWLINE# #UNINDENT# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# QtWidgets . QMessageBox . warning ( self . tree_view , ( _ ( 'Failed to remove %s' ) % fn ) , str ( e ) ) #NEWLINE# _logger ( ) . exception ( 'failed to remove %s' , fn ) #NEWLINE# #UNINDENT# #UNINDENT# self . tree_view . files_deleted . emit ( deleted_files ) #NEWLINE# for d in deleted_files : #NEWLINE# #INDENT# debug ( '%s removed' , d ) #NEWLINE# self . tree_view . file_deleted . emit ( os . path . normpath ( d ) )