Preferences/ToolConfigurationDialog.py

changeset 945
8cd4d08fa9f6
parent 882
34b86be88bf0
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
15 from E5Gui.E5Completers import E5FileCompleter 15 from E5Gui.E5Completers import E5FileCompleter
16 from E5Gui import E5MessageBox, E5FileDialog 16 from E5Gui import E5MessageBox, E5FileDialog
17 17
18 from .Ui_ToolConfigurationDialog import Ui_ToolConfigurationDialog 18 from .Ui_ToolConfigurationDialog import Ui_ToolConfigurationDialog
19 import Utilities 19 import Utilities
20
20 21
21 class ToolConfigurationDialog(QDialog, Ui_ToolConfigurationDialog): 22 class ToolConfigurationDialog(QDialog, Ui_ToolConfigurationDialog):
22 """ 23 """
23 Class implementing a configuration dialog for the tools menu. 24 Class implementing a configuration dialog for the tools menu.
24 """ 25 """
123 .format(menutext)) 124 .format(menutext))
124 return 125 return
125 126
126 self.toolsList.addItem(menutext) 127 self.toolsList.addItem(menutext)
127 tool = { 128 tool = {
128 'menutext' : menutext, 129 'menutext': menutext,
129 'icon' : icon, 130 'icon': icon,
130 'executable' : executable, 131 'executable': executable,
131 'arguments' : arguments, 132 'arguments': arguments,
132 'redirect' : redirect, 133 'redirect': redirect,
133 } 134 }
134 self.toollist.append(tool) 135 self.toollist.append(tool)
135 136
136 @pyqtSlot() 137 @pyqtSlot()
137 def on_changeButton_clicked(self): 138 def on_changeButton_clicked(self):
169 " is not an executable." 170 " is not an executable."
170 " Please choose an existing executable filename.")) 171 " Please choose an existing executable filename."))
171 return 172 return
172 173
173 self.toollist[row] = { 174 self.toollist[row] = {
174 'menutext' : menutext, 175 'menutext': menutext,
175 'icon' : icon, 176 'icon': icon,
176 'executable' : executable, 177 'executable': executable,
177 'arguments' : arguments, 178 'arguments': arguments,
178 'redirect' : redirect, 179 'redirect': redirect,
179 } 180 }
180 self.toolsList.currentItem().setText(menutext) 181 self.toolsList.currentItem().setText(menutext)
181 self.changeButton.setEnabled(False) 182 self.changeButton.setEnabled(False)
182 183
183 @pyqtSlot() 184 @pyqtSlot()
232 """ 233 """
233 Private slot to add a menu separator. 234 Private slot to add a menu separator.
234 """ 235 """
235 self.toolsList.addItem('--') 236 self.toolsList.addItem('--')
236 tool = { 237 tool = {
237 'menutext' : '--', 238 'menutext': '--',
238 'icon' : '', 239 'icon': '',
239 'executable' : '', 240 'executable': '',
240 'arguments' : '', 241 'arguments': '',
241 'redirect' : 'no', 242 'redirect': 'no',
242 } 243 }
243 self.toollist.append(tool) 244 self.toollist.append(tool)
244 245
245 @pyqtSlot() 246 @pyqtSlot()
246 def on_executableButton_clicked(self): 247 def on_executableButton_clicked(self):
303 if row != 0: 304 if row != 0:
304 self.upButton.setEnabled(True) 305 self.upButton.setEnabled(True)
305 else: 306 else:
306 self.upButton.setEnabled(False) 307 self.upButton.setEnabled(False)
307 308
308 if row+1 != len(self.toollist): 309 if row + 1 != len(self.toollist):
309 self.downButton.setEnabled(True) 310 self.downButton.setEnabled(True)
310 else: 311 else:
311 self.downButton.setEnabled(False) 312 self.downButton.setEnabled(False)
312 else: 313 else:
313 self.executableEdit.clear() 314 self.executableEdit.clear()
370 """ 371 """
371 self.__toolEntryChanged() 372 self.__toolEntryChanged()
372 373
373 def getToollist(self): 374 def getToollist(self):
374 """ 375 """
375 Public method to retrieve the tools list. 376 Public method to retrieve the tools list.
376 377
377 @return a list of tuples containing the menu text, the executable, 378 @return a list of tuples containing the menu text, the executable,
378 the executables arguments and a redirection flag 379 the executables arguments and a redirection flag
379 """ 380 """
380 return self.toollist[:] 381 return self.toollist[:]
381 382
382 def __swap(self, itm1, itm2): 383 def __swap(self, itm1, itm2):

eric ide

mercurial