diff -r bf174ac41631 -r dd907ee33b03 src/eric7/UI/Browser.py --- a/src/eric7/UI/Browser.py Wed Dec 21 10:54:29 2022 +0100 +++ b/src/eric7/UI/Browser.py Wed Dec 21 11:24:45 2022 +0100 @@ -1012,20 +1012,15 @@ @param fn filename to be deleted @type str """ - try: - from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ - - trashMsg = self.tr("Do you really want to move this file to the trash?") - except ImportError: - s2t = os.remove - trashMsg = self.tr("Do you really want to delete this file?") - dlg = DeleteFilesConfirmationDialog( - self.parent(), self.tr("Delete File"), trashMsg, [fn] + self.parent(), + self.tr("Delete File"), + self.tr("Do you really want to delete this file?"), + [fn] ) if dlg.exec() == QDialog.DialogCode.Accepted: try: - s2t(fn) + os.remove(fn) except OSError as err: EricMessageBox.critical( self.ui, @@ -1043,26 +1038,15 @@ @param dn directory name to be removed from the project @type str """ - try: - from send2trash import send2trash # __IGNORE_WARNING_I10__ - - s2tAvailable = True - trashMsg = self.tr( - "Do you really want to move this directory to the trash?" - ) - except ImportError: - s2tAvailable = False - trashMsg = self.tr("Do you really want to delete this directory?") - dlg = DeleteFilesConfirmationDialog( - self.parent(), self.tr("Delete Directory"), trashMsg, [dn] + self.parent(), + self.tr("Delete Directory"), + self.tr("Do you really want to delete this directory?"), + [dn], ) if dlg.exec() == QDialog.DialogCode.Accepted: try: - if s2tAvailable: - send2trash(dn) - else: - shutil.rmtree(dn, True) + shutil.rmtree(dn, True) except OSError as err: EricMessageBox.critical( self.ui, @@ -1085,21 +1069,16 @@ for itm in self.getSelectedItems(): fileNames.append(itm.fileName()) - try: - from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ - - trashMsg = self.tr("Do you really want to move these files to the trash?") - except ImportError: - s2t = os.remove - trashMsg = self.tr("Do you really want to delete these files?") - dlg = DeleteFilesConfirmationDialog( - self.parent(), self.tr("Delete Files"), trashMsg, sorted(fileNames) + self.parent(), + self.tr("Delete Files"), + self.tr("Do you really want to delete these files?"), + sorted(fileNames), ) if dlg.exec() == QDialog.DialogCode.Accepted: for fn in fileNames: try: - s2t(fn) + os.remove(fn) except OSError as err: EricMessageBox.critical( self.ui,