src/eric7/UI/Browser.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9573
9960d19d66b5
equal deleted inserted replaced
9481:0b936ff1bbb9 9482:a2bc06a54d9d
34 from eric7 import Preferences, Utilities 34 from eric7 import Preferences, Utilities
35 from eric7.EricGui import EricPixmapCache 35 from eric7.EricGui import EricPixmapCache
36 from eric7.EricWidgets import EricFileDialog, EricMessageBox 36 from eric7.EricWidgets import EricFileDialog, EricMessageBox
37 from eric7.EricWidgets.EricApplication import ericApp 37 from eric7.EricWidgets.EricApplication import ericApp
38 from eric7.Project.ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem 38 from eric7.Project.ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem
39 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
39 from eric7.Utilities import MimeTypes 40 from eric7.Utilities import MimeTypes
40 41
41 from .BrowserModel import ( 42 from .BrowserModel import (
42 BrowserClassAttributeItem, 43 BrowserClassAttributeItem,
43 BrowserClassItem, 44 BrowserClassItem,
1010 1011
1011 @param fn filename to be deleted 1012 @param fn filename to be deleted
1012 @type str 1013 @type str
1013 """ 1014 """
1014 try: 1015 try:
1015 from send2trash import send2trash as s2t 1016 from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__
1016 1017
1017 trashMsg = self.tr("Do you really want to move this file to the" " trash?") 1018 trashMsg = self.tr("Do you really want to move this file to the" " trash?")
1018 except ImportError: 1019 except ImportError:
1019 s2t = os.remove 1020 s2t = os.remove
1020 trashMsg = self.tr("Do you really want to delete this file?") 1021 trashMsg = self.tr("Do you really want to delete this file?")
1021
1022 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
1023 1022
1024 dlg = DeleteFilesConfirmationDialog( 1023 dlg = DeleteFilesConfirmationDialog(
1025 self.parent(), self.tr("Delete File"), trashMsg, [fn] 1024 self.parent(), self.tr("Delete File"), trashMsg, [fn]
1026 ) 1025 )
1027 if dlg.exec() == QDialog.DialogCode.Accepted: 1026 if dlg.exec() == QDialog.DialogCode.Accepted:
1043 1042
1044 @param dn directory name to be removed from the project 1043 @param dn directory name to be removed from the project
1045 @type str 1044 @type str
1046 """ 1045 """
1047 try: 1046 try:
1048 from send2trash import send2trash 1047 from send2trash import send2trash # __IGNORE_WARNING_I10__
1049 1048
1050 s2tAvailable = True 1049 s2tAvailable = True
1051 trashMsg = self.tr( 1050 trashMsg = self.tr(
1052 "Do you really want to move this directory to" " the trash?" 1051 "Do you really want to move this directory to" " the trash?"
1053 ) 1052 )
1054 except ImportError: 1053 except ImportError:
1055 s2tAvailable = False 1054 s2tAvailable = False
1056 trashMsg = self.tr("Do you really want to delete this directory?") 1055 trashMsg = self.tr("Do you really want to delete this directory?")
1057
1058 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
1059 1056
1060 dlg = DeleteFilesConfirmationDialog( 1057 dlg = DeleteFilesConfirmationDialog(
1061 self.parent(), self.tr("Delete Directory"), trashMsg, [dn] 1058 self.parent(), self.tr("Delete Directory"), trashMsg, [dn]
1062 ) 1059 )
1063 if dlg.exec() == QDialog.DialogCode.Accepted: 1060 if dlg.exec() == QDialog.DialogCode.Accepted:
1087 fileNames = [] 1084 fileNames = []
1088 for itm in self.getSelectedItems(): 1085 for itm in self.getSelectedItems():
1089 fileNames.append(itm.fileName()) 1086 fileNames.append(itm.fileName())
1090 1087
1091 try: 1088 try:
1092 from send2trash import send2trash as s2t 1089 from send2trash import send2trash as s2t # __IGNORE_WARNING_I10__
1093 1090
1094 trashMsg = self.tr( 1091 trashMsg = self.tr(
1095 "Do you really want to move these files to the" " trash?" 1092 "Do you really want to move these files to the" " trash?"
1096 ) 1093 )
1097 except ImportError: 1094 except ImportError:
1098 s2t = os.remove 1095 s2t = os.remove
1099 trashMsg = self.tr("Do you really want to delete these files?") 1096 trashMsg = self.tr("Do you really want to delete these files?")
1100
1101 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog
1102 1097
1103 dlg = DeleteFilesConfirmationDialog( 1098 dlg = DeleteFilesConfirmationDialog(
1104 self.parent(), self.tr("Delete Files"), trashMsg, sorted(fileNames) 1099 self.parent(), self.tr("Delete Files"), trashMsg, sorted(fileNames)
1105 ) 1100 )
1106 if dlg.exec() == QDialog.DialogCode.Accepted: 1101 if dlg.exec() == QDialog.DialogCode.Accepted:

eric ide

mercurial