eric6/Debugger/StartDialog.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8043
0acf98cd089a
parent 8163
29fb6d420a25
child 8273
698ae46f40a4
equal deleted inserted replaced
8153:e01ae92db699 8176:31965986ecd1
28 """ 28 """
29 def __init__(self, caption, lastUsedVenvName, argvList, wdList, envList, 29 def __init__(self, caption, lastUsedVenvName, argvList, wdList, envList,
30 exceptions, 30 exceptions,
31 parent=None, dialogType=0, modfuncList=None, 31 parent=None, dialogType=0, modfuncList=None,
32 tracePython=False, autoClearShell=True, autoContinue=True, 32 tracePython=False, autoClearShell=True, autoContinue=True,
33 enableMultiprocess=False, multiprocessNoDebugHistory=None): 33 enableMultiprocess=False, multiprocessNoDebugHistory=None,
34 configOverride=None):
34 """ 35 """
35 Constructor 36 Constructor
36 37
37 @param caption the caption to be displayed 38 @param caption the caption to be displayed
38 @type str 39 @type str
72 debugging 73 debugging
73 @type bool 74 @type bool
74 @param multiprocessNoDebugHistory list of lists with programs not to be 75 @param multiprocessNoDebugHistory list of lists with programs not to be
75 debugged 76 debugged
76 @type list of str 77 @type list of str
78 @param configOverride dictionary containing the global config override
79 data
80 @type dict
77 """ 81 """
78 super(StartDialog, self).__init__(parent) 82 super(StartDialog, self).__init__(parent)
79 self.setModal(True) 83 self.setModal(True)
80 84
81 self.dialogType = dialogType 85 self.dialogType = dialogType
99 .getVirtualenvNames())) 103 .getVirtualenvNames()))
100 104
101 self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode) 105 self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode)
102 self.ui.workdirPicker.setDefaultDirectory( 106 self.ui.workdirPicker.setDefaultDirectory(
103 Preferences.getMultiProject("Workspace")) 107 Preferences.getMultiProject("Workspace"))
104 self.ui.workdirPicker.setInsertPolicy(QComboBox.InsertAtTop) 108 self.ui.workdirPicker.setInsertPolicy(
109 QComboBox.InsertPolicy.InsertAtTop)
105 self.ui.workdirPicker.setSizeAdjustPolicy( 110 self.ui.workdirPicker.setSizeAdjustPolicy(
106 QComboBox.AdjustToMinimumContentsLength) 111 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
107 112
108 self.clearButton = self.ui.buttonBox.addButton( 113 self.clearButton = self.ui.buttonBox.addButton(
109 self.tr("Clear Histories"), QDialogButtonBox.ActionRole) 114 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole)
110 self.editButton = self.ui.buttonBox.addButton( 115 self.editButton = self.ui.buttonBox.addButton(
111 self.tr("Edit History"), QDialogButtonBox.ActionRole) 116 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole)
112 117
113 self.setWindowTitle(caption) 118 self.setWindowTitle(caption)
114 self.ui.cmdlineCombo.clear() 119 self.ui.cmdlineCombo.clear()
115 self.ui.cmdlineCombo.addItems(argvList) 120 self.ui.cmdlineCombo.addItems(argvList)
116 if len(argvList) > 0: 121 if len(argvList) > 0:
126 self.ui.consoleCheckBox.setEnabled( 131 self.ui.consoleCheckBox.setEnabled(
127 Preferences.getDebugger("ConsoleDbgCommand") != "") 132 Preferences.getDebugger("ConsoleDbgCommand") != "")
128 self.ui.consoleCheckBox.setChecked(False) 133 self.ui.consoleCheckBox.setChecked(False)
129 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName)) 134 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName))
130 self.ui.venvComboBox.setCurrentIndex(venvIndex) 135 self.ui.venvComboBox.setCurrentIndex(venvIndex)
136 self.ui.globalOverrideGroup.setChecked(configOverride["enable"])
137 self.ui.redirectCheckBox.setChecked(configOverride["redirect"])
131 138
132 if dialogType == 0: # start debug dialog 139 if dialogType == 0: # start debug dialog
133 enableMultiprocessGlobal = Preferences.getDebugger( 140 enableMultiprocessGlobal = Preferences.getDebugger(
134 "MultiProcessEnabled") 141 "MultiProcessEnabled")
135 self.ui.tracePythonCheckBox.setChecked(tracePython) 142 self.ui.tracePythonCheckBox.setChecked(tracePython)
159 166
160 def on_modFuncCombo_editTextChanged(self): 167 def on_modFuncCombo_editTextChanged(self):
161 """ 168 """
162 Private slot to enable/disable the OK button. 169 Private slot to enable/disable the OK button.
163 """ 170 """
164 self.ui.buttonBox.button(QDialogButtonBox.Ok).setDisabled( 171 self.ui.buttonBox.button(
165 self.ui.modFuncCombo.currentText() == "") 172 QDialogButtonBox.StandardButton.Ok).setDisabled(
173 self.ui.modFuncCombo.currentText() == "")
166 174
167 def getData(self): 175 def getData(self):
168 """ 176 """
169 Public method to retrieve the data entered into this dialog. 177 Public method to retrieve the data entered into this dialog.
170 178
183 environment, 191 environment,
184 self.ui.exceptionCheckBox.isChecked(), 192 self.ui.exceptionCheckBox.isChecked(),
185 self.ui.clearShellCheckBox.isChecked(), 193 self.ui.clearShellCheckBox.isChecked(),
186 self.ui.consoleCheckBox.isChecked(), 194 self.ui.consoleCheckBox.isChecked(),
187 ) 195 )
188 196
197 def getGlobalOverrideData(self):
198 """
199 Public method to retrieve the global configuration override data
200 entered into this dialog.
201
202 @return dictionary containing a flag indicating to activate the global
203 override and a flag indicating a redirect of stdin/stdout/stderr
204 @rtype dict
205 """
206 return {
207 "enable": self.ui.globalOverrideGroup.isChecked(),
208 "redirect": self.ui.redirectCheckBox.isChecked(),
209 }
210
189 def getDebugData(self): 211 def getDebugData(self):
190 """ 212 """
191 Public method to retrieve the debug related data entered into this 213 Public method to retrieve the debug related data entered into this
192 dialog. 214 dialog.
193 215
294 history.append(combo.itemText(index)) 316 history.append(combo.itemText(index))
295 317
296 if history: 318 if history:
297 from .StartHistoryEditDialog import StartHistoryEditDialog 319 from .StartHistoryEditDialog import StartHistoryEditDialog
298 dlg = StartHistoryEditDialog(history, self) 320 dlg = StartHistoryEditDialog(history, self)
299 if dlg.exec() == QDialog.Accepted: 321 if dlg.exec() == QDialog.DialogCode.Accepted:
300 history = dlg.getHistory() 322 history = dlg.getHistory()
301 combo = combos[historiesIndex] 323 combo = combos[historiesIndex]
302 if combo: 324 if combo:
303 combo.clear() 325 combo.clear()
304 combo.addItems(history) 326 combo.addItems(history)

eric ide

mercurial