Wed, 21 Dec 2022 11:24:45 +0100
Removed use of 'send2trash'.
--- a/pyproject.toml Wed Dec 21 10:54:29 2022 +0100 +++ b/pyproject.toml Wed Dec 21 11:24:45 2022 +0100 @@ -60,7 +60,6 @@ "chardet", "asttokens", "EditorConfig", - "Send2Trash", "Pygments", "parso", "jedi",
--- a/scripts/install-dependencies.py Wed Dec 21 10:54:29 2022 +0100 +++ b/scripts/install-dependencies.py Wed Dec 21 11:24:45 2022 +0100 @@ -75,13 +75,13 @@ "cyclonedx-bom", "trove-classifiers", "black>=22.6.0", + "isort>=5.10.0", ) optionalPackages = ( "docutils", "Markdown", "pyyaml", "chardet", - "Send2Trash", "pyenchant", "wheel", )
--- a/scripts/install.py Wed Dec 21 10:54:29 2022 +0100 +++ b/scripts/install.py Wed Dec 21 11:24:45 2022 +0100 @@ -1709,7 +1709,6 @@ "Markdown": ("markdown", ""), "pyyaml": ("yaml", ""), "chardet": ("chardet", ""), - "Send2Trash": ("send2trash", ""), "pyenchant": ("enchant", ""), "wheel": ("wheel", ""), }
--- a/src/eric7/Project/Project.py Wed Dec 21 10:54:29 2022 +0100 +++ b/src/eric7/Project/Project.py Wed Dec 21 11:24:45 2022 +0100 @@ -1764,18 +1764,13 @@ @param langFile the translation file to be removed (string) """ - try: - from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ - except ImportError: - s2t = os.remove - langFile = self.getRelativePath(langFile) qmFile = self.__binaryTranslationFile(langFile) try: fn = os.path.join(self.ppath, langFile) if os.path.exists(fn): - s2t(fn) + os.remove(fn) except OSError as err: EricMessageBox.critical( self.ui, @@ -1801,7 +1796,7 @@ ) fn = os.path.join(self.ppath, qmFile) if os.path.exists(fn): - s2t(fn) + os.remove(fn) except OSError as err: EricMessageBox.critical( self.ui, @@ -2374,27 +2369,22 @@ @return flag indicating success (boolean) """ try: - from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__ - except ImportError: - s2t = os.remove - - try: - s2t(os.path.join(self.ppath, fn)) + os.remove(os.path.join(self.ppath, fn)) path, ext = os.path.splitext(fn) if ext == ".ui": fn2 = os.path.join(self.ppath, "{0}.h".format(fn)) if os.path.isfile(fn2): - s2t(fn2) + os.remove(fn2) head, tail = os.path.split(path) for ext in [".pyc", ".pyo"]: fn2 = os.path.join(self.ppath, path + ext) if os.path.isfile(fn2): - s2t(fn2) + os.remove(fn2) pat = os.path.join( self.ppath, head, "__pycache__", "{0}.*{1}".format(tail, ext) ) for f in glob.glob(pat): - s2t(f) + os.remove(f) except OSError as err: EricMessageBox.critical( self.ui, @@ -2421,12 +2411,7 @@ if not os.path.isabs(dn): dn = os.path.join(self.ppath, dn) try: - try: - from send2trash import send2trash # __IGNORE_WARNING_I10__ - - send2trash(dn) - except ImportError: - shutil.rmtree(dn, True) + shutil.rmtree(dn, True) except OSError as err: EricMessageBox.critical( self.ui,
--- 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,