Debugger/StartDialog.py

changeset 4582
3a1d1d4c6f4f
parent 4021
195a471c327b
child 4589
b648ccbdbef9
equal deleted inserted replaced
4581:76999ca7bbf1 4582:3a1d1d4c6f4f
7 Module implementing the Start Program dialog. 7 Module implementing the Start Program dialog.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14 13
15 from E5Gui.E5Completers import E5DirCompleter 14 from E5Gui.E5PathPicker import E5PathPickerModes
16 from E5Gui import E5FileDialog 15
17
18 import Utilities
19 import Preferences 16 import Preferences
20 import UI.PixmapCache
21 17
22 18
23 class StartDialog(QDialog): 19 class StartDialog(QDialog):
24 """ 20 """
25 Class implementing the Start Program dialog. 21 Class implementing the Start Program dialog.
76 self.ui = Ui_StartCoverageDialog() 72 self.ui = Ui_StartCoverageDialog()
77 elif type == 3: 73 elif type == 3:
78 from .Ui_StartProfileDialog import Ui_StartProfileDialog 74 from .Ui_StartProfileDialog import Ui_StartProfileDialog
79 self.ui = Ui_StartProfileDialog() 75 self.ui = Ui_StartProfileDialog()
80 self.ui.setupUi(self) 76 self.ui.setupUi(self)
81 self.ui.dirButton.setIcon(UI.PixmapCache.getIcon("open.png")) 77 self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode)
78 self.ui.workdirPicker.setDefaultDirectory(
79 Preferences.getMultiProject("Workspace"))
82 80
83 self.clearButton = self.ui.buttonBox.addButton( 81 self.clearButton = self.ui.buttonBox.addButton(
84 self.tr("Clear Histories"), QDialogButtonBox.ActionRole) 82 self.tr("Clear Histories"), QDialogButtonBox.ActionRole)
85
86 self.workdirCompleter = E5DirCompleter(self.ui.workdirCombo)
87 83
88 self.setWindowTitle(caption) 84 self.setWindowTitle(caption)
89 self.ui.cmdlineCombo.clear() 85 self.ui.cmdlineCombo.clear()
90 self.ui.cmdlineCombo.addItems(argvList) 86 self.ui.cmdlineCombo.addItems(argvList)
91 if len(argvList) > 0: 87 if len(argvList) > 0:
92 self.ui.cmdlineCombo.setCurrentIndex(0) 88 self.ui.cmdlineCombo.setCurrentIndex(0)
93 self.ui.workdirCombo.clear() 89 self.ui.workdirPicker.clear()
94 self.ui.workdirCombo.addItems(wdList) 90 self.ui.workdirPicker.addItems(wdList)
95 if len(wdList) > 0: 91 if len(wdList) > 0:
96 self.ui.workdirCombo.setCurrentIndex(0) 92 self.ui.workdirPicker.setCurrentIndex(0)
97 self.ui.environmentCombo.clear() 93 self.ui.environmentCombo.clear()
98 self.ui.environmentCombo.addItems(envList) 94 self.ui.environmentCombo.addItems(envList)
99 self.ui.exceptionCheckBox.setChecked(exceptions) 95 self.ui.exceptionCheckBox.setChecked(exceptions)
100 self.ui.clearShellCheckBox.setChecked(autoClearShell) 96 self.ui.clearShellCheckBox.setChecked(autoClearShell)
101 self.ui.consoleCheckBox.setEnabled( 97 self.ui.consoleCheckBox.setEnabled(
119 self.__clearHistoryLists = False 115 self.__clearHistoryLists = False
120 116
121 msh = self.minimumSizeHint() 117 msh = self.minimumSizeHint()
122 self.resize(max(self.width(), msh.width()), msh.height()) 118 self.resize(max(self.width(), msh.width()), msh.height())
123 119
124 @pyqtSlot()
125 def on_dirButton_clicked(self):
126 """
127 Private method used to open a directory selection dialog.
128 """
129 cwd = self.ui.workdirCombo.currentText()
130 d = E5FileDialog.getExistingDirectory(
131 self,
132 self.tr("Working directory"),
133 cwd,
134 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
135
136 if d:
137 self.ui.workdirCombo.setEditText(Utilities.toNativeSeparators(d))
138
139 def on_modFuncCombo_editTextChanged(self): 120 def on_modFuncCombo_editTextChanged(self):
140 """ 121 """
141 Private slot to enable/disable the OK button. 122 Private slot to enable/disable the OK button.
142 """ 123 """
143 self.ui.buttonBox.button(QDialogButtonBox.Ok).setDisabled( 124 self.ui.buttonBox.button(QDialogButtonBox.Ok).setDisabled(
151 (string), exceptions flag (boolean), clear interpreter flag 132 (string), exceptions flag (boolean), clear interpreter flag
152 (boolean), clear histories flag (boolean) and run in console 133 (boolean), clear histories flag (boolean) and run in console
153 flag (boolean) 134 flag (boolean)
154 """ 135 """
155 cmdLine = self.ui.cmdlineCombo.currentText() 136 cmdLine = self.ui.cmdlineCombo.currentText()
156 workdir = self.ui.workdirCombo.currentText() 137 workdir = self.ui.workdirPicker.currentText()
157 environment = self.ui.environmentCombo.currentText() 138 environment = self.ui.environmentCombo.currentText()
158 139
159 return (cmdLine, 140 return (cmdLine,
160 workdir, 141 workdir,
161 environment, 142 environment,
222 clear the lists. 203 clear the lists.
223 """ 204 """
224 self.__clearHistoryLists = True 205 self.__clearHistoryLists = True
225 206
226 cmdLine = self.ui.cmdlineCombo.currentText() 207 cmdLine = self.ui.cmdlineCombo.currentText()
227 workdir = self.ui.workdirCombo.currentText() 208 workdir = self.ui.workdirPicker.currentText()
228 environment = self.ui.environmentCombo.currentText() 209 environment = self.ui.environmentCombo.currentText()
229 210
230 self.ui.cmdlineCombo.clear() 211 self.ui.cmdlineCombo.clear()
231 self.ui.workdirCombo.clear() 212 self.ui.workdirPicker.clear()
232 self.ui.environmentCombo.clear() 213 self.ui.environmentCombo.clear()
233 214
234 self.ui.cmdlineCombo.addItem(cmdLine) 215 self.ui.cmdlineCombo.addItem(cmdLine)
235 self.ui.workdirCombo.addItem(workdir) 216 self.ui.workdirPicker.addItem(workdir)
236 self.ui.environmentCombo.addItem(environment) 217 self.ui.environmentCombo.addItem(environment)
237 218
238 def on_buttonBox_clicked(self, button): 219 def on_buttonBox_clicked(self, button):
239 """ 220 """
240 Private slot called by a button of the button box clicked. 221 Private slot called by a button of the button box clicked.

eric ide

mercurial