eric7/Preferences/ToolConfigurationDialog.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8327
666c2b81cbb7
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
10 import copy 10 import copy
11 11
12 from PyQt6.QtCore import Qt, pyqtSlot 12 from PyQt6.QtCore import Qt, pyqtSlot
13 from PyQt6.QtWidgets import QDialog 13 from PyQt6.QtWidgets import QDialog
14 14
15 from E5Gui import E5MessageBox 15 from E5Gui import EricMessageBox
16 from E5Gui.E5PathPicker import E5PathPickerModes 16 from E5Gui.EricPathPicker import EricPathPickerModes
17 17
18 from .Ui_ToolConfigurationDialog import Ui_ToolConfigurationDialog 18 from .Ui_ToolConfigurationDialog import Ui_ToolConfigurationDialog
19 19
20 import Utilities 20 import Utilities
21 21
32 @param parent parent widget (QWidget) 32 @param parent parent widget (QWidget)
33 """ 33 """
34 super().__init__(parent) 34 super().__init__(parent)
35 self.setupUi(self) 35 self.setupUi(self)
36 36
37 self.iconPicker.setMode(E5PathPickerModes.OPEN_FILE_MODE) 37 self.iconPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
38 self.iconPicker.setFilters(self.tr("Icon files (*.png)")) 38 self.iconPicker.setFilters(self.tr("Icon files (*.png)"))
39 self.executablePicker.setMode(E5PathPickerModes.OPEN_FILE_MODE) 39 self.executablePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
40 40
41 self.redirectionModes = [ 41 self.redirectionModes = [
42 ("no", self.tr("no redirection")), 42 ("no", self.tr("no redirection")),
43 ("show", self.tr("show output")), 43 ("show", self.tr("show output")),
44 ("insert", self.tr("insert into current editor")), 44 ("insert", self.tr("insert into current editor")),
95 executable = self.executablePicker.text() 95 executable = self.executablePicker.text()
96 arguments = self.argumentsEdit.text() 96 arguments = self.argumentsEdit.text()
97 redirect = self.redirectionModes[self.redirectCombo.currentIndex()][0] 97 redirect = self.redirectionModes[self.redirectCombo.currentIndex()][0]
98 98
99 if not executable: 99 if not executable:
100 E5MessageBox.critical( 100 EricMessageBox.critical(
101 self, 101 self,
102 self.tr("Add tool entry"), 102 self.tr("Add tool entry"),
103 self.tr( 103 self.tr(
104 "You have to set an executable to add to the" 104 "You have to set an executable to add to the"
105 " Tools-Menu first.")) 105 " Tools-Menu first."))
106 return 106 return
107 107
108 if not menutext: 108 if not menutext:
109 E5MessageBox.critical( 109 EricMessageBox.critical(
110 self, 110 self,
111 self.tr("Add tool entry"), 111 self.tr("Add tool entry"),
112 self.tr( 112 self.tr(
113 "You have to insert a menuentry text to add the" 113 "You have to insert a menuentry text to add the"
114 " selected program to the Tools-Menu first.")) 114 " selected program to the Tools-Menu first."))
115 return 115 return
116 116
117 if not Utilities.isinpath(executable): 117 if not Utilities.isinpath(executable):
118 E5MessageBox.critical( 118 EricMessageBox.critical(
119 self, 119 self,
120 self.tr("Add tool entry"), 120 self.tr("Add tool entry"),
121 self.tr( 121 self.tr(
122 "The selected file could not be found or" 122 "The selected file could not be found or"
123 " is not an executable." 123 " is not an executable."
124 " Please choose an executable filename.")) 124 " Please choose an executable filename."))
125 return 125 return
126 126
127 if len(self.toolsList.findItems( 127 if len(self.toolsList.findItems(
128 menutext, Qt.MatchFlag.MatchExactly)): 128 menutext, Qt.MatchFlag.MatchExactly)):
129 E5MessageBox.critical( 129 EricMessageBox.critical(
130 self, 130 self,
131 self.tr("Add tool entry"), 131 self.tr("Add tool entry"),
132 self.tr("An entry for the menu text {0} already exists.") 132 self.tr("An entry for the menu text {0} already exists.")
133 .format(menutext)) 133 .format(menutext))
134 return 134 return
157 executable = self.executablePicker.text() 157 executable = self.executablePicker.text()
158 arguments = self.argumentsEdit.text() 158 arguments = self.argumentsEdit.text()
159 redirect = self.redirectionModes[self.redirectCombo.currentIndex()][0] 159 redirect = self.redirectionModes[self.redirectCombo.currentIndex()][0]
160 160
161 if not executable: 161 if not executable:
162 E5MessageBox.critical( 162 EricMessageBox.critical(
163 self, 163 self,
164 self.tr("Change tool entry"), 164 self.tr("Change tool entry"),
165 self.tr( 165 self.tr(
166 "You have to set an executable to change the" 166 "You have to set an executable to change the"
167 " Tools-Menu entry.")) 167 " Tools-Menu entry."))
168 return 168 return
169 169
170 if not menutext: 170 if not menutext:
171 E5MessageBox.critical( 171 EricMessageBox.critical(
172 self, 172 self,
173 self.tr("Change tool entry"), 173 self.tr("Change tool entry"),
174 self.tr( 174 self.tr(
175 "You have to insert a menuentry text to change the" 175 "You have to insert a menuentry text to change the"
176 " selected Tools-Menu entry.")) 176 " selected Tools-Menu entry."))
177 return 177 return
178 178
179 if not Utilities.isinpath(executable): 179 if not Utilities.isinpath(executable):
180 E5MessageBox.critical( 180 EricMessageBox.critical(
181 self, 181 self,
182 self.tr("Change tool entry"), 182 self.tr("Change tool entry"),
183 self.tr( 183 self.tr(
184 "The selected file could not be found or" 184 "The selected file could not be found or"
185 " is not an executable." 185 " is not an executable."
265 265
266 @param path path of the executable 266 @param path path of the executable
267 @type str 267 @type str
268 """ 268 """
269 if path and not Utilities.isinpath(path): 269 if path and not Utilities.isinpath(path):
270 E5MessageBox.critical( 270 EricMessageBox.critical(
271 self, 271 self,
272 self.tr("Select executable"), 272 self.tr("Select executable"),
273 self.tr( 273 self.tr(
274 "The selected file is not an executable." 274 "The selected file is not an executable."
275 " Please choose an executable filename.")) 275 " Please choose an executable filename."))

eric ide

mercurial