def delete_file(self, fname, multiple, yes_to_all):
        """Delete file"""
        if multiple:
            buttons = QMessageBox.Yes|QMessageBox.YesToAll| \
                      QMessageBox.No|QMessageBox.Cancel
        else:
            buttons = QMessageBox.Yes|QMessageBox.No
        if yes_to_all is None:
            answer = QMessageBox.warning(self, _("Delete"),
                                 _("Do you really want "
                                   "to delete <b>%s</b>?"
                                   ) % osp.basename(fname), buttons)
            if answer == QMessageBox.No:
                return yes_to_all
            elif answer == QMessageBox.Cancel:
                return False
            elif answer == QMessageBox.YesToAll:
                yes_to_all = True
        try:
            if osp.isfile(fname):
                misc.remove_file(fname)
                self.sig_removed.emit(fname)
            else:
                self.remove_tree(fname)
                self.sig_removed_tree.emit(fname)
            return yes_to_all
        except EnvironmentError as error:
            action_str = _('delete')
            QMessageBox.critical(self, _("Project Explorer"),
                            _("<b>Unable to %s <i>%s</i></b>"
                              "<br><br>Error message:<br>%s"
                              ) % (action_str, fname, to_text_string(error)))
        return False
def delete_file ( self , fname , multiple , yes_to_all ) : if multiple : buttons = QMessageBox . Yes | QMessageBox . YesToAll | QMessageBox . No | QMessageBox . Cancel else : buttons = QMessageBox . Yes | QMessageBox . No if yes_to_all is None : answer = QMessageBox . warning ( self , _ ( "Delete" ) , _ ( "Do you really want " "to delete <b>%s</b>?" ) % osp . basename ( fname ) , buttons ) if answer == QMessageBox . No : return yes_to_all elif answer == QMessageBox . Cancel : return False elif answer == QMessageBox . YesToAll : yes_to_all = True try : if osp . isfile ( fname ) : misc . remove_file ( fname ) self . sig_removed . emit ( fname ) else : self . remove_tree ( fname ) self . sig_removed_tree . emit ( fname ) return yes_to_all except EnvironmentError as error : action_str = _ ( 'delete' ) QMessageBox . critical ( self , _ ( "Project Explorer" ) , _ ( "<b>Unable to %s <i>%s</i></b>" "<br><br>Error message:<br>%s" ) % ( action_str , fname , to_text_string ( error ) ) ) return False
Delete file