#NEWLINE# def rename( self ) : #NEWLINE# #INDENT# '\n        Renames the selected item in the tree view\n        ' #NEWLINE# src = self . get_current_path ( ) #NEWLINE# ( pardir , name ) = os . path . split ( src ) #NEWLINE# ( new_name , status ) = QtWidgets . QInputDialog . getText ( self . tree_view , _ ( 'Rename file' ) , _ ( 'New name:' ) , QtWidgets . QLineEdit . Normal , name ) #NEWLINE# if status : #NEWLINE# #INDENT# dest = os . path . join ( pardir , new_name ) #NEWLINE# old_files = [ ] #NEWLINE# if os . path . isdir ( src ) : #NEWLINE# #INDENT# old_files = self . _get_files ( src ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# old_files = [ src ] #NEWLINE# #UNINDENT# os . rename ( src , dest ) #NEWLINE# if os . path . isdir ( dest ) : #NEWLINE# #INDENT# new_files = self . _get_files ( dest ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_files = [ dest ] #NEWLINE# #UNINDENT# self . tree_view . file_renamed . emit ( os . path . normpath ( src ) , os . path . normpath ( dest ) ) #NEWLINE# renamed_files = [ ] #NEWLINE# for ( old_f , new_f ) in zip ( old_files , new_files ) : #NEWLINE# #INDENT# self . tree_view . file_renamed . emit ( old_f , new_f ) #NEWLINE# renamed_files . append ( ( old_f , new_f ) ) #NEWLINE# #UNINDENT# self . tree_view . files_renamed . emit ( renamed_files )