Debugger/DebugUI.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 2991
226481ff40d1
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
15 from PyQt4.QtGui import QKeySequence, QMenu, QToolBar, QApplication, QDialog, \ 15 from PyQt4.QtGui import QKeySequence, QMenu, QToolBar, QApplication, QDialog, \
16 QInputDialog 16 QInputDialog
17 17
18 from UI.Info import Program 18 from UI.Info import Program
19 19
20 from .DebugClientCapabilities import HasDebugger, HasInterpreter, HasProfiler, \ 20 from .DebugClientCapabilities import HasDebugger, HasInterpreter, \
21 HasCoverage 21 HasProfiler, HasCoverage
22 import Preferences 22 import Preferences
23 import Utilities 23 import Utilities
24 import UI.PixmapCache 24 import UI.PixmapCache
25 import UI.Config 25 import UI.Config
26 26
34 """ 34 """
35 Class implementing the debugger part of the UI. 35 Class implementing the debugger part of the UI.
36 36
37 @signal clientStack(stack) emitted at breaking after a reported exception 37 @signal clientStack(stack) emitted at breaking after a reported exception
38 @signal compileForms() emitted if changed project forms should be compiled 38 @signal compileForms() emitted if changed project forms should be compiled
39 @signal compileResources() emitted if changed project resources should be compiled 39 @signal compileResources() emitted if changed project resources should be
40 @signal debuggingStarted(filename) emitted when a debugging session was started 40 compiled
41 @signal debuggingStarted(filename) emitted when a debugging session was
42 started
41 @signal resetUI() emitted to reset the UI 43 @signal resetUI() emitted to reset the UI
42 @signal exceptionInterrupt() emitted after the execution was interrupted by an 44 @signal exceptionInterrupt() emitted after the execution was interrupted
43 exception and acknowledged by the user 45 by an exception and acknowledged by the user
44 @signal appendStdout(msg) emitted when the client program has terminated and the 46 @signal appendStdout(msg) emitted when the client program has terminated
45 display of the termination dialog is suppressed 47 and the display of the termination dialog is suppressed
46 """ 48 """
47 clientStack = pyqtSignal(list) 49 clientStack = pyqtSignal(list)
48 resetUI = pyqtSignal() 50 resetUI = pyqtSignal()
49 exceptionInterrupt = pyqtSignal() 51 exceptionInterrupt = pyqtSignal()
50 compileForms = pyqtSignal() 52 compileForms = pyqtSignal()
76 78
77 # read the saved debug info values 79 # read the saved debug info values
78 self.argvHistory = Preferences.toList( 80 self.argvHistory = Preferences.toList(
79 Preferences.Prefs.settings.value('DebugInfo/ArgumentsHistory')) 81 Preferences.Prefs.settings.value('DebugInfo/ArgumentsHistory'))
80 self.wdHistory = Preferences.toList( 82 self.wdHistory = Preferences.toList(
81 Preferences.Prefs.settings.value('DebugInfo/WorkingDirectoryHistory')) 83 Preferences.Prefs.settings.value(
84 'DebugInfo/WorkingDirectoryHistory'))
82 self.envHistory = Preferences.toList( 85 self.envHistory = Preferences.toList(
83 Preferences.Prefs.settings.value('DebugInfo/EnvironmentHistory')) 86 Preferences.Prefs.settings.value('DebugInfo/EnvironmentHistory'))
84 self.excList = Preferences.toList( 87 self.excList = Preferences.toList(
85 Preferences.Prefs.settings.value('DebugInfo/Exceptions')) 88 Preferences.Prefs.settings.value('DebugInfo/Exceptions'))
86 self.excIgnoreList = Preferences.toList( 89 self.excIgnoreList = Preferences.toList(
87 Preferences.Prefs.settings.value('DebugInfo/IgnoredExceptions')) 90 Preferences.Prefs.settings.value('DebugInfo/IgnoredExceptions'))
88 self.exceptions = Preferences.toBool( 91 self.exceptions = Preferences.toBool(
89 Preferences.Prefs.settings.value('DebugInfo/ReportExceptions', True)) 92 Preferences.Prefs.settings.value(
93 'DebugInfo/ReportExceptions', True))
90 self.autoClearShell = Preferences.toBool( 94 self.autoClearShell = Preferences.toBool(
91 Preferences.Prefs.settings.value('DebugInfo/AutoClearShell', True)) 95 Preferences.Prefs.settings.value('DebugInfo/AutoClearShell', True))
92 self.tracePython = Preferences.toBool( 96 self.tracePython = Preferences.toBool(
93 Preferences.Prefs.settings.value('DebugInfo/TracePython', False)) 97 Preferences.Prefs.settings.value('DebugInfo/TracePython', False))
94 self.autoContinue = Preferences.toBool( 98 self.autoContinue = Preferences.toBool(
95 Preferences.Prefs.settings.value('DebugInfo/AutoContinue', True)) 99 Preferences.Prefs.settings.value('DebugInfo/AutoContinue', True))
96 self.forkAutomatically = Preferences.toBool( 100 self.forkAutomatically = Preferences.toBool(
97 Preferences.Prefs.settings.value('DebugInfo/ForkAutomatically', False)) 101 Preferences.Prefs.settings.value(
102 'DebugInfo/ForkAutomatically', False))
98 self.forkIntoChild = Preferences.toBool( 103 self.forkIntoChild = Preferences.toBool(
99 Preferences.Prefs.settings.value('DebugInfo/ForkIntoChild', False)) 104 Preferences.Prefs.settings.value('DebugInfo/ForkIntoChild', False))
100 105
101 self.evalHistory = [] 106 self.evalHistory = []
102 self.execHistory = [] 107 self.execHistory = []
105 self.clientType = "" 110 self.clientType = ""
106 self.lastAction = -1 111 self.lastAction = -1
107 self.debugActions = [self.__continue, self.__step,\ 112 self.debugActions = [self.__continue, self.__step,\
108 self.__stepOver, self.__stepOut,\ 113 self.__stepOver, self.__stepOut,\
109 self.__stepQuit, self.__runToCursor] 114 self.__stepQuit, self.__runToCursor]
110 self.localsVarFilter, self.globalsVarFilter = Preferences.getVarFilters() 115 self.localsVarFilter, self.globalsVarFilter = \
111 self.debugViewer.setVariablesFilter(self.globalsVarFilter, self.localsVarFilter) 116 Preferences.getVarFilters()
117 self.debugViewer.setVariablesFilter(
118 self.globalsVarFilter, self.localsVarFilter)
112 119
113 # Connect the signals emitted by the debug-server 120 # Connect the signals emitted by the debug-server
114 debugServer.clientGone.connect(self.__clientGone) 121 debugServer.clientGone.connect(self.__clientGone)
115 debugServer.clientLine.connect(self.__clientLine) 122 debugServer.clientLine.connect(self.__clientLine)
116 debugServer.clientExit.connect(self.__clientExit) 123 debugServer.clientExit.connect(self.__clientExit)
117 debugServer.clientSyntaxError.connect(self.__clientSyntaxError) 124 debugServer.clientSyntaxError.connect(self.__clientSyntaxError)
118 debugServer.clientException.connect(self.__clientException) 125 debugServer.clientException.connect(self.__clientException)
119 debugServer.clientVariables.connect(self.__clientVariables) 126 debugServer.clientVariables.connect(self.__clientVariables)
120 debugServer.clientVariable.connect(self.__clientVariable) 127 debugServer.clientVariable.connect(self.__clientVariable)
121 debugServer.clientBreakConditionError.connect(self.__clientBreakConditionError) 128 debugServer.clientBreakConditionError.connect(
122 debugServer.clientWatchConditionError.connect(self.__clientWatchConditionError) 129 self.__clientBreakConditionError)
130 debugServer.clientWatchConditionError.connect(
131 self.__clientWatchConditionError)
123 debugServer.passiveDebugStarted.connect(self.__passiveDebugStarted) 132 debugServer.passiveDebugStarted.connect(self.__passiveDebugStarted)
124 debugServer.clientThreadSet.connect(self.__clientThreadSet) 133 debugServer.clientThreadSet.connect(self.__clientThreadSet)
125 134
126 debugServer.clientRawInput.connect(debugViewer.handleRawInput) 135 debugServer.clientRawInput.connect(debugViewer.handleRawInput)
127 debugServer.clientRawInputSent.connect(debugViewer.restoreCurrentPage) 136 debugServer.clientRawInputSent.connect(debugViewer.restoreCurrentPage)
160 """ 169 """
161 self.actions = [] 170 self.actions = []
162 171
163 self.runAct = E5Action(self.trUtf8('Run Script'), 172 self.runAct = E5Action(self.trUtf8('Run Script'),
164 UI.PixmapCache.getIcon("runScript.png"), 173 UI.PixmapCache.getIcon("runScript.png"),
165 self.trUtf8('&Run Script...'), Qt.Key_F2, 0, self, 'dbg_run_script') 174 self.trUtf8('&Run Script...'),
175 Qt.Key_F2, 0, self, 'dbg_run_script')
166 self.runAct.setStatusTip(self.trUtf8('Run the current Script')) 176 self.runAct.setStatusTip(self.trUtf8('Run the current Script'))
167 self.runAct.setWhatsThis(self.trUtf8( 177 self.runAct.setWhatsThis(self.trUtf8(
168 """<b>Run Script</b>""" 178 """<b>Run Script</b>"""
169 """<p>Set the command line arguments and run the script outside the""" 179 """<p>Set the command line arguments and run the script outside"""
170 """ debugger. If the file has unsaved changes it may be saved first.</p>""" 180 """ the debugger. If the file has unsaved changes it may be"""
181 """ saved first.</p>"""
171 )) 182 ))
172 self.runAct.triggered[()].connect(self.__runScript) 183 self.runAct.triggered[()].connect(self.__runScript)
173 self.actions.append(self.runAct) 184 self.actions.append(self.runAct)
174 185
175 self.runProjectAct = E5Action(self.trUtf8('Run Project'), 186 self.runProjectAct = E5Action(self.trUtf8('Run Project'),
179 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project')) 190 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project'))
180 self.runProjectAct.setWhatsThis(self.trUtf8( 191 self.runProjectAct.setWhatsThis(self.trUtf8(
181 """<b>Run Project</b>""" 192 """<b>Run Project</b>"""
182 """<p>Set the command line arguments and run the current project""" 193 """<p>Set the command line arguments and run the current project"""
183 """ outside the debugger.""" 194 """ outside the debugger."""
184 """ If files of the current project have unsaved changes they may""" 195 """ If files of the current project have unsaved changes they"""
185 """ be saved first.</p>""" 196 """ may be saved first.</p>"""
186 )) 197 ))
187 self.runProjectAct.triggered[()].connect(self.__runProject) 198 self.runProjectAct.triggered[()].connect(self.__runProject)
188 self.actions.append(self.runProjectAct) 199 self.actions.append(self.runProjectAct)
189 200
190 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'), 201 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'),
191 UI.PixmapCache.getIcon("coverageScript.png"), 202 UI.PixmapCache.getIcon("coverageScript.png"),
192 self.trUtf8('Coverage run of Script...'), 0, 0, self, 'dbg_coverage_script') 203 self.trUtf8('Coverage run of Script...'), 0, 0, self,
204 'dbg_coverage_script')
193 self.coverageAct.setStatusTip( 205 self.coverageAct.setStatusTip(
194 self.trUtf8('Perform a coverage run of the current Script')) 206 self.trUtf8('Perform a coverage run of the current Script'))
195 self.coverageAct.setWhatsThis(self.trUtf8( 207 self.coverageAct.setWhatsThis(self.trUtf8(
196 """<b>Coverage run of Script</b>""" 208 """<b>Coverage run of Script</b>"""
197 """<p>Set the command line arguments and run the script under the control""" 209 """<p>Set the command line arguments and run the script under"""
198 """ of a coverage analysis tool. If the file has unsaved changes it may be""" 210 """ the control of a coverage analysis tool. If the file has"""
199 """ saved first.</p>""" 211 """ unsaved changes it may be saved first.</p>"""
200 )) 212 ))
201 self.coverageAct.triggered[()].connect(self.__coverageScript) 213 self.coverageAct.triggered[()].connect(self.__coverageScript)
202 self.actions.append(self.coverageAct) 214 self.actions.append(self.coverageAct)
203 215
204 self.coverageProjectAct = E5Action(self.trUtf8('Coverage run of Project'), 216 self.coverageProjectAct = E5Action(
205 UI.PixmapCache.getIcon("coverageProject.png"), 217 self.trUtf8('Coverage run of Project'),
206 self.trUtf8('Coverage run of Project...'), 0, 0, self, 'dbg_coverage_project') 218 UI.PixmapCache.getIcon("coverageProject.png"),
219 self.trUtf8('Coverage run of Project...'), 0, 0, self,
220 'dbg_coverage_project')
207 self.coverageProjectAct.setStatusTip( 221 self.coverageProjectAct.setStatusTip(
208 self.trUtf8('Perform a coverage run of the current Project')) 222 self.trUtf8('Perform a coverage run of the current Project'))
209 self.coverageProjectAct.setWhatsThis(self.trUtf8( 223 self.coverageProjectAct.setWhatsThis(self.trUtf8(
210 """<b>Coverage run of Project</b>""" 224 """<b>Coverage run of Project</b>"""
211 """<p>Set the command line arguments and run the current project""" 225 """<p>Set the command line arguments and run the current project"""
212 """ under the control of a coverage analysis tool.""" 226 """ under the control of a coverage analysis tool."""
213 """ If files of the current project have unsaved changes they may""" 227 """ If files of the current project have unsaved changes"""
214 """ be saved first.</p>""" 228 """ they may be saved first.</p>"""
215 )) 229 ))
216 self.coverageProjectAct.triggered[()].connect(self.__coverageProject) 230 self.coverageProjectAct.triggered[()].connect(self.__coverageProject)
217 self.actions.append(self.coverageProjectAct) 231 self.actions.append(self.coverageProjectAct)
218 232
219 self.profileAct = E5Action(self.trUtf8('Profile Script'), 233 self.profileAct = E5Action(self.trUtf8('Profile Script'),
220 UI.PixmapCache.getIcon("profileScript.png"), 234 UI.PixmapCache.getIcon("profileScript.png"),
221 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script') 235 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script')
222 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script')) 236 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script'))
223 self.profileAct.setWhatsThis(self.trUtf8( 237 self.profileAct.setWhatsThis(self.trUtf8(
224 """<b>Profile Script</b>""" 238 """<b>Profile Script</b>"""
225 """<p>Set the command line arguments and profile the script.""" 239 """<p>Set the command line arguments and profile the script."""
226 """ If the file has unsaved changes it may be saved first.</p>""" 240 """ If the file has unsaved changes it may be saved first.</p>"""
227 )) 241 ))
228 self.profileAct.triggered[()].connect(self.__profileScript) 242 self.profileAct.triggered[()].connect(self.__profileScript)
229 self.actions.append(self.profileAct) 243 self.actions.append(self.profileAct)
230 244
231 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'), 245 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'),
232 UI.PixmapCache.getIcon("profileProject.png"), 246 UI.PixmapCache.getIcon("profileProject.png"),
233 self.trUtf8('Profile Project...'), 0, 0, self, 'dbg_profile_project') 247 self.trUtf8('Profile Project...'), 0, 0, self,
234 self.profileProjectAct.setStatusTip(self.trUtf8('Profile the current Project')) 248 'dbg_profile_project')
249 self.profileProjectAct.setStatusTip(
250 self.trUtf8('Profile the current Project'))
235 self.profileProjectAct.setWhatsThis(self.trUtf8( 251 self.profileProjectAct.setWhatsThis(self.trUtf8(
236 """<b>Profile Project</b>""" 252 """<b>Profile Project</b>"""
237 """<p>Set the command line arguments and profile the current project.""" 253 """<p>Set the command line arguments and profile the current"""
238 """ If files of the current project have unsaved changes they may""" 254 """ project. If files of the current project have unsaved"""
239 """ be saved first.</p>""" 255 """ changes they may be saved first.</p>"""
240 )) 256 ))
241 self.profileProjectAct.triggered[()].connect(self.__profileProject) 257 self.profileProjectAct.triggered[()].connect(self.__profileProject)
242 self.actions.append(self.profileProjectAct) 258 self.actions.append(self.profileProjectAct)
243 259
244 self.debugAct = E5Action(self.trUtf8('Debug Script'), 260 self.debugAct = E5Action(self.trUtf8('Debug Script'),
245 UI.PixmapCache.getIcon("debugScript.png"), 261 UI.PixmapCache.getIcon("debugScript.png"),
246 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self, 'dbg_debug_script') 262 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self,
263 'dbg_debug_script')
247 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script')) 264 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script'))
248 self.debugAct.setWhatsThis(self.trUtf8( 265 self.debugAct.setWhatsThis(self.trUtf8(
249 """<b>Debug Script</b>""" 266 """<b>Debug Script</b>"""
250 """<p>Set the command line arguments and set the current line to be the""" 267 """<p>Set the command line arguments and set the current line"""
251 """ first executable Python statement of the current editor window.""" 268 """ to be the first executable Python statement of the current"""
252 """ If the file has unsaved changes it may be saved first.</p>""" 269 """ editor window. If the file has unsaved changes it may be"""
270 """ saved first.</p>"""
253 )) 271 ))
254 self.debugAct.triggered[()].connect(self.__debugScript) 272 self.debugAct.triggered[()].connect(self.__debugScript)
255 self.actions.append(self.debugAct) 273 self.actions.append(self.debugAct)
256 274
257 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'), 275 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'),
258 UI.PixmapCache.getIcon("debugProject.png"), 276 UI.PixmapCache.getIcon("debugProject.png"),
259 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, 277 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self,
260 'dbg_debug_project') 278 'dbg_debug_project')
261 self.debugProjectAct.setStatusTip(self.trUtf8('Debug the current Project')) 279 self.debugProjectAct.setStatusTip(self.trUtf8(
280 'Debug the current Project'))
262 self.debugProjectAct.setWhatsThis(self.trUtf8( 281 self.debugProjectAct.setWhatsThis(self.trUtf8(
263 """<b>Debug Project</b>""" 282 """<b>Debug Project</b>"""
264 """<p>Set the command line arguments and set the current line to be the""" 283 """<p>Set the command line arguments and set the current line"""
265 """ first executable Python statement of the main script of the current""" 284 """ to be the first executable Python statement of the main"""
266 """ project. If files of the current project have unsaved changes they may""" 285 """ script of the current project. If files of the current"""
267 """ be saved first.</p>""" 286 """ project have unsaved changes they may be saved first.</p>"""
268 )) 287 ))
269 self.debugProjectAct.triggered[()].connect(self.__debugProject) 288 self.debugProjectAct.triggered[()].connect(self.__debugProject)
270 self.actions.append(self.debugProjectAct) 289 self.actions.append(self.debugProjectAct)
271 290
272 self.restartAct = E5Action(self.trUtf8('Restart'), 291 self.restartAct = E5Action(self.trUtf8('Restart'),
273 UI.PixmapCache.getIcon("restart.png"), 292 UI.PixmapCache.getIcon("restart.png"),
274 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') 293 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script')
275 self.restartAct.setStatusTip(self.trUtf8('Restart the last debugged script')) 294 self.restartAct.setStatusTip(self.trUtf8(
295 'Restart the last debugged script'))
276 self.restartAct.setWhatsThis(self.trUtf8( 296 self.restartAct.setWhatsThis(self.trUtf8(
277 """<b>Restart</b>""" 297 """<b>Restart</b>"""
278 """<p>Set the command line arguments and set the current line to be the""" 298 """<p>Set the command line arguments and set the current line"""
279 """ first executable Python statement of the script that was debugged last.""" 299 """ to be the first executable Python statement of the script"""
280 """ If there are unsaved changes, they may be saved first.</p>""" 300 """ that was debugged last. If there are unsaved changes, they"""
301 """ may be saved first.</p>"""
281 )) 302 ))
282 self.restartAct.triggered[()].connect(self.__doRestart) 303 self.restartAct.triggered[()].connect(self.__doRestart)
283 self.actions.append(self.restartAct) 304 self.actions.append(self.restartAct)
284 305
285 self.stopAct = E5Action(self.trUtf8('Stop'), 306 self.stopAct = E5Action(self.trUtf8('Stop'),
286 UI.PixmapCache.getIcon("stopScript.png"), 307 UI.PixmapCache.getIcon("stopScript.png"),
287 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0, 308 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0,
288 self, 'dbg_stop_script') 309 self, 'dbg_stop_script')
289 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script.""")) 310 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script."""))
290 self.stopAct.setWhatsThis(self.trUtf8( 311 self.stopAct.setWhatsThis(self.trUtf8(
291 """<b>Stop</b>""" 312 """<b>Stop</b>"""
292 """<p>This stops the script running in the debugger backend.</p>""" 313 """<p>This stops the script running in the debugger backend.</p>"""
293 )) 314 ))
295 self.actions.append(self.stopAct) 316 self.actions.append(self.stopAct)
296 317
297 self.debugActGrp = createActionGroup(self) 318 self.debugActGrp = createActionGroup(self)
298 319
299 act = E5Action(self.trUtf8('Continue'), 320 act = E5Action(self.trUtf8('Continue'),
300 UI.PixmapCache.getIcon("continue.png"), 321 UI.PixmapCache.getIcon("continue.png"),
301 self.trUtf8('&Continue'), Qt.Key_F6, 0, 322 self.trUtf8('&Continue'), Qt.Key_F6, 0,
302 self.debugActGrp, 'dbg_continue') 323 self.debugActGrp, 'dbg_continue')
303 act.setStatusTip( 324 act.setStatusTip(
304 self.trUtf8('Continue running the program from the current line')) 325 self.trUtf8('Continue running the program from the current line'))
305 act.setWhatsThis(self.trUtf8( 326 act.setWhatsThis(self.trUtf8(
306 """<b>Continue</b>""" 327 """<b>Continue</b>"""
307 """<p>Continue running the program from the current line. The program will""" 328 """<p>Continue running the program from the current line. The"""
308 """ stop when it terminates or when a breakpoint is reached.</p>""" 329 """ program will stop when it terminates or when a breakpoint"""
330 """ is reached.</p>"""
309 )) 331 ))
310 act.triggered[()].connect(self.__continue) 332 act.triggered[()].connect(self.__continue)
311 self.actions.append(act) 333 self.actions.append(act)
312 334
313 act = E5Action(self.trUtf8('Continue to Cursor'), 335 act = E5Action(self.trUtf8('Continue to Cursor'),
314 UI.PixmapCache.getIcon("continueToCursor.png"), 336 UI.PixmapCache.getIcon("continueToCursor.png"),
315 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, 337 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0,
316 self.debugActGrp, 'dbg_continue_to_cursor') 338 self.debugActGrp, 'dbg_continue_to_cursor')
317 act.setStatusTip(self.trUtf8("""Continue running the program from the""" 339 act.setStatusTip(self.trUtf8(
340 """Continue running the program from the"""
318 """ current line to the current cursor position""")) 341 """ current line to the current cursor position"""))
319 act.setWhatsThis(self.trUtf8( 342 act.setWhatsThis(self.trUtf8(
320 """<b>Continue To Cursor</b>""" 343 """<b>Continue To Cursor</b>"""
321 """<p>Continue running the program from the current line to the""" 344 """<p>Continue running the program from the current line to the"""
322 """ current cursor position.</p>""" 345 """ current cursor position.</p>"""
323 )) 346 ))
324 act.triggered[()].connect(self.__runToCursor) 347 act.triggered[()].connect(self.__runToCursor)
325 self.actions.append(act) 348 self.actions.append(act)
326 349
327 act = E5Action(self.trUtf8('Single Step'), 350 act = E5Action(self.trUtf8('Single Step'),
328 UI.PixmapCache.getIcon("step.png"), 351 UI.PixmapCache.getIcon("step.png"),
329 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0, 352 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0,
330 self.debugActGrp, 'dbg_single_step') 353 self.debugActGrp, 'dbg_single_step')
331 act.setStatusTip(self.trUtf8('Execute a single Python statement')) 354 act.setStatusTip(self.trUtf8('Execute a single Python statement'))
332 act.setWhatsThis(self.trUtf8( 355 act.setWhatsThis(self.trUtf8(
333 """<b>Single Step</b>""" 356 """<b>Single Step</b>"""
334 """<p>Execute a single Python statement. If the statement""" 357 """<p>Execute a single Python statement. If the statement"""
335 """ is an <tt>import</tt> statement, a class constructor, or a""" 358 """ is an <tt>import</tt> statement, a class constructor, or a"""
336 """ method or function call then control is returned to the debugger at""" 359 """ method or function call then control is returned to the"""
337 """ the next statement.</p>""" 360 """ debugger at the next statement.</p>"""
338 )) 361 ))
339 act.triggered[()].connect(self.__step) 362 act.triggered[()].connect(self.__step)
340 self.actions.append(act) 363 self.actions.append(act)
341 364
342 act = E5Action(self.trUtf8('Step Over'), 365 act = E5Action(self.trUtf8('Step Over'),
343 UI.PixmapCache.getIcon("stepOver.png"), 366 UI.PixmapCache.getIcon("stepOver.png"),
344 self.trUtf8('Step &Over'), Qt.Key_F8, 0, 367 self.trUtf8('Step &Over'), Qt.Key_F8, 0,
345 self.debugActGrp, 'dbg_step_over') 368 self.debugActGrp, 'dbg_step_over')
346 act.setStatusTip(self.trUtf8("""Execute a single Python statement staying""" 369 act.setStatusTip(self.trUtf8(
370 """Execute a single Python statement staying"""
347 """ in the current frame""")) 371 """ in the current frame"""))
348 act.setWhatsThis(self.trUtf8( 372 act.setWhatsThis(self.trUtf8(
349 """<b>Step Over</b>""" 373 """<b>Step Over</b>"""
350 """<p>Execute a single Python statement staying in the same frame. If""" 374 """<p>Execute a single Python statement staying in the same"""
351 """ the statement is an <tt>import</tt> statement, a class constructor,""" 375 """ frame. If the statement is an <tt>import</tt> statement,"""
352 """ or a method or function call then control is returned to the debugger""" 376 """ a class constructor, or a method or function call then"""
353 """ after the statement has completed.</p>""" 377 """ control is returned to the debugger after the statement"""
378 """ has completed.</p>"""
354 )) 379 ))
355 act.triggered[()].connect(self.__stepOver) 380 act.triggered[()].connect(self.__stepOver)
356 self.actions.append(act) 381 self.actions.append(act)
357 382
358 act = E5Action(self.trUtf8('Step Out'), 383 act = E5Action(self.trUtf8('Step Out'),
359 UI.PixmapCache.getIcon("stepOut.png"), 384 UI.PixmapCache.getIcon("stepOut.png"),
360 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0, 385 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0,
361 self.debugActGrp, 'dbg_step_out') 386 self.debugActGrp, 'dbg_step_out')
362 act.setStatusTip(self.trUtf8("""Execute Python statements until leaving""" 387 act.setStatusTip(self.trUtf8(
388 """Execute Python statements until leaving"""
363 """ the current frame""")) 389 """ the current frame"""))
364 act.setWhatsThis(self.trUtf8( 390 act.setWhatsThis(self.trUtf8(
365 """<b>Step Out</b>""" 391 """<b>Step Out</b>"""
366 """<p>Execute Python statements until leaving the current frame. If""" 392 """<p>Execute Python statements until leaving the current"""
367 """ the statements are inside an <tt>import</tt> statement, a class""" 393 """ frame. If the statements are inside an <tt>import</tt>"""
368 """ constructor, or a method or function call then control is returned""" 394 """ statement, a class constructor, or a method or function"""
369 """ to the debugger after the current frame has been left.</p>""" 395 """ call then control is returned to the debugger after the"""
396 """ current frame has been left.</p>"""
370 )) 397 ))
371 act.triggered[()].connect(self.__stepOut) 398 act.triggered[()].connect(self.__stepOut)
372 self.actions.append(act) 399 self.actions.append(act)
373 400
374 act = E5Action(self.trUtf8('Stop'), 401 act = E5Action(self.trUtf8('Stop'),
375 UI.PixmapCache.getIcon("stepQuit.png"), 402 UI.PixmapCache.getIcon("stepQuit.png"),
376 self.trUtf8('&Stop'), Qt.Key_F10, 0, 403 self.trUtf8('&Stop'), Qt.Key_F10, 0,
377 self.debugActGrp, 'dbg_stop') 404 self.debugActGrp, 'dbg_stop')
378 act.setStatusTip(self.trUtf8('Stop debugging')) 405 act.setStatusTip(self.trUtf8('Stop debugging'))
379 act.setWhatsThis(self.trUtf8( 406 act.setWhatsThis(self.trUtf8(
380 """<b>Stop</b>""" 407 """<b>Stop</b>"""
381 """<p>Stop the running debugging session.</p>""" 408 """<p>Stop the running debugging session.</p>"""
382 )) 409 ))
384 self.actions.append(act) 411 self.actions.append(act)
385 412
386 self.debugActGrp2 = createActionGroup(self) 413 self.debugActGrp2 = createActionGroup(self)
387 414
388 act = E5Action(self.trUtf8('Evaluate'), 415 act = E5Action(self.trUtf8('Evaluate'),
389 self.trUtf8('E&valuate...'), 416 self.trUtf8('E&valuate...'),
390 0, 0, self.debugActGrp2, 'dbg_evaluate') 417 0, 0, self.debugActGrp2, 'dbg_evaluate')
391 act.setStatusTip(self.trUtf8('Evaluate in current context')) 418 act.setStatusTip(self.trUtf8('Evaluate in current context'))
392 act.setWhatsThis(self.trUtf8( 419 act.setWhatsThis(self.trUtf8(
393 """<b>Evaluate</b>""" 420 """<b>Evaluate</b>"""
394 """<p>Evaluate an expression in the current context of the""" 421 """<p>Evaluate an expression in the current context of the"""
395 """ debugged program. The result is displayed in the""" 422 """ debugged program. The result is displayed in the"""
410 )) 437 ))
411 act.triggered[()].connect(self.__exec) 438 act.triggered[()].connect(self.__exec)
412 self.actions.append(act) 439 self.actions.append(act)
413 440
414 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'), 441 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'),
415 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self, 442 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self,
416 'dbg_variables_filter') 443 'dbg_variables_filter')
417 self.dbgFilterAct.setStatusTip(self.trUtf8('Configure variables type filter')) 444 self.dbgFilterAct.setStatusTip(self.trUtf8(
445 'Configure variables type filter'))
418 self.dbgFilterAct.setWhatsThis(self.trUtf8( 446 self.dbgFilterAct.setWhatsThis(self.trUtf8(
419 """<b>Variables Type Filter</b>""" 447 """<b>Variables Type Filter</b>"""
420 """<p>Configure the variables type filter. Only variable types that are not""" 448 """<p>Configure the variables type filter. Only variable types"""
421 """ selected are displayed in the global or local variables window""" 449 """ that are not selected are displayed in the global or local"""
422 """ during a debugging session.</p>""" 450 """ variables window during a debugging session.</p>"""
423 )) 451 ))
424 self.dbgFilterAct.triggered[()].connect(self.__configureVariablesFilters) 452 self.dbgFilterAct.triggered[()].connect(
453 self.__configureVariablesFilters)
425 self.actions.append(self.dbgFilterAct) 454 self.actions.append(self.dbgFilterAct)
426 455
427 self.excFilterAct = E5Action(self.trUtf8('Exceptions Filter'), 456 self.excFilterAct = E5Action(self.trUtf8('Exceptions Filter'),
428 self.trUtf8('&Exceptions Filter...'), 0, 0, self, 'dbg_exceptions_filter') 457 self.trUtf8('&Exceptions Filter...'), 0, 0, self,
429 self.excFilterAct.setStatusTip(self.trUtf8('Configure exceptions filter')) 458 'dbg_exceptions_filter')
459 self.excFilterAct.setStatusTip(self.trUtf8(
460 'Configure exceptions filter'))
430 self.excFilterAct.setWhatsThis(self.trUtf8( 461 self.excFilterAct.setWhatsThis(self.trUtf8(
431 """<b>Exceptions Filter</b>""" 462 """<b>Exceptions Filter</b>"""
432 """<p>Configure the exceptions filter. Only exception types that are""" 463 """<p>Configure the exceptions filter. Only exception types"""
433 """ listed are highlighted during a debugging session.</p>""" 464 """ that are listed are highlighted during a debugging"""
434 """<p>Please note, that all unhandled exceptions are highlighted""" 465 """ session.</p><p>Please note, that all unhandled exceptions"""
435 """ indepent from the filter list.</p>""" 466 """ are highlighted indepent from the filter list.</p>"""
436 )) 467 ))
437 self.excFilterAct.triggered[()].connect(self.__configureExceptionsFilter) 468 self.excFilterAct.triggered[()].connect(
469 self.__configureExceptionsFilter)
438 self.actions.append(self.excFilterAct) 470 self.actions.append(self.excFilterAct)
439 471
440 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'), 472 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'),
441 self.trUtf8('&Ignored Exceptions...'), 0, 0, 473 self.trUtf8('&Ignored Exceptions...'), 0, 0,
442 self, 'dbg_ignored_exceptions') 474 self, 'dbg_ignored_exceptions')
443 self.excIgnoreFilterAct.setStatusTip(self.trUtf8('Configure ignored exceptions')) 475 self.excIgnoreFilterAct.setStatusTip(self.trUtf8(
476 'Configure ignored exceptions'))
444 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8( 477 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8(
445 """<b>Ignored Exceptions</b>""" 478 """<b>Ignored Exceptions</b>"""
446 """<p>Configure the ignored exceptions. Only exception types that are""" 479 """<p>Configure the ignored exceptions. Only exception types"""
447 """ not listed are highlighted during a debugging session.</p>""" 480 """ that are not listed are highlighted during a debugging"""
448 """<p>Please note, that unhandled exceptions cannot be ignored.</p>""" 481 """ session.</p><p>Please note, that unhandled exceptions"""
449 )) 482 """ cannot be ignored.</p>"""
450 self.excIgnoreFilterAct.triggered[()].connect(self.__configureIgnoredExceptions) 483 ))
484 self.excIgnoreFilterAct.triggered[()].connect(
485 self.__configureIgnoredExceptions)
451 self.actions.append(self.excIgnoreFilterAct) 486 self.actions.append(self.excIgnoreFilterAct)
452 487
453 self.dbgSetBpActGrp = createActionGroup(self) 488 self.dbgSetBpActGrp = createActionGroup(self)
454 489
455 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'), 490 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'),
456 UI.PixmapCache.getIcon("breakpointToggle.png"), 491 UI.PixmapCache.getIcon("breakpointToggle.png"),
457 self.trUtf8('Toggle Breakpoint'), 492 self.trUtf8('Toggle Breakpoint'),
458 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")), 0, 493 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")),
459 self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') 494 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint')
460 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint')) 495 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint'))
461 self.dbgToggleBpAct.setWhatsThis(self.trUtf8( 496 self.dbgToggleBpAct.setWhatsThis(self.trUtf8(
462 """<b>Toggle Breakpoint</b>""" 497 """<b>Toggle Breakpoint</b>"""
463 """<p>Toggles a breakpoint at the current line of the""" 498 """<p>Toggles a breakpoint at the current line of the"""
464 """ current editor.</p>""" 499 """ current editor.</p>"""
465 )) 500 ))
466 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint) 501 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint)
467 self.actions.append(self.dbgToggleBpAct) 502 self.actions.append(self.dbgToggleBpAct)
468 503
469 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'), 504 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'),
470 UI.PixmapCache.getIcon("cBreakpointToggle.png"), 505 UI.PixmapCache.getIcon("cBreakpointToggle.png"),
471 self.trUtf8('Edit Breakpoint...'), 506 self.trUtf8('Edit Breakpoint...'),
472 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0, 507 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0,
473 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') 508 self.dbgSetBpActGrp, 'dbg_edit_breakpoint')
474 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint')) 509 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint'))
475 self.dbgEditBpAct.setWhatsThis(self.trUtf8( 510 self.dbgEditBpAct.setWhatsThis(self.trUtf8(
476 """<b>Edit Breakpoint</b>""" 511 """<b>Edit Breakpoint</b>"""
477 """<p>Opens a dialog to edit the breakpoints properties.""" 512 """<p>Opens a dialog to edit the breakpoints properties."""
478 """ It works at the current line of the current editor.</p>""" 513 """ It works at the current line of the current editor.</p>"""
479 )) 514 ))
480 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint) 515 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint)
481 self.actions.append(self.dbgEditBpAct) 516 self.actions.append(self.dbgEditBpAct)
482 517
483 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'), 518 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'),
484 UI.PixmapCache.getIcon("breakpointNext.png"), 519 UI.PixmapCache.getIcon("breakpointNext.png"),
485 self.trUtf8('Next Breakpoint'), 520 self.trUtf8('Next Breakpoint'),
486 QKeySequence(self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0, 521 QKeySequence(
487 self.dbgSetBpActGrp, 'dbg_next_breakpoint') 522 self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0,
523 self.dbgSetBpActGrp, 'dbg_next_breakpoint')
488 self.dbgNextBpAct.setStatusTip(self.trUtf8('Next Breakpoint')) 524 self.dbgNextBpAct.setStatusTip(self.trUtf8('Next Breakpoint'))
489 self.dbgNextBpAct.setWhatsThis(self.trUtf8( 525 self.dbgNextBpAct.setWhatsThis(self.trUtf8(
490 """<b>Next Breakpoint</b>""" 526 """<b>Next Breakpoint</b>"""
491 """<p>Go to next breakpoint of the current editor.</p>""" 527 """<p>Go to next breakpoint of the current editor.</p>"""
492 )) 528 ))
493 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint) 529 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint)
494 self.actions.append(self.dbgNextBpAct) 530 self.actions.append(self.dbgNextBpAct)
495 531
496 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'), 532 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'),
497 UI.PixmapCache.getIcon("breakpointPrevious.png"), 533 UI.PixmapCache.getIcon("breakpointPrevious.png"),
498 self.trUtf8('Previous Breakpoint'), 534 self.trUtf8('Previous Breakpoint'),
499 QKeySequence(self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")), 535 QKeySequence(
500 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint') 536 self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")),
537 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint')
501 self.dbgPrevBpAct.setStatusTip(self.trUtf8('Previous Breakpoint')) 538 self.dbgPrevBpAct.setStatusTip(self.trUtf8('Previous Breakpoint'))
502 self.dbgPrevBpAct.setWhatsThis(self.trUtf8( 539 self.dbgPrevBpAct.setWhatsThis(self.trUtf8(
503 """<b>Previous Breakpoint</b>""" 540 """<b>Previous Breakpoint</b>"""
504 """<p>Go to previous breakpoint of the current editor.</p>""" 541 """<p>Go to previous breakpoint of the current editor.</p>"""
505 )) 542 ))
506 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint) 543 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint)
507 self.actions.append(self.dbgPrevBpAct) 544 self.actions.append(self.dbgPrevBpAct)
508 545
509 act = E5Action(self.trUtf8('Clear Breakpoints'), 546 act = E5Action(self.trUtf8('Clear Breakpoints'),
510 self.trUtf8('Clear Breakpoints'), 547 self.trUtf8('Clear Breakpoints'),
511 QKeySequence(self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0, 548 QKeySequence(
512 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') 549 self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0,
550 self.dbgSetBpActGrp, 'dbg_clear_breakpoint')
513 act.setStatusTip(self.trUtf8('Clear Breakpoints')) 551 act.setStatusTip(self.trUtf8('Clear Breakpoints'))
514 act.setWhatsThis(self.trUtf8( 552 act.setWhatsThis(self.trUtf8(
515 """<b>Clear Breakpoints</b>""" 553 """<b>Clear Breakpoints</b>"""
516 """<p>Clear breakpoints of all editors.</p>""" 554 """<p>Clear breakpoints of all editors.</p>"""
517 )) 555 ))
578 616
579 def initToolbars(self, toolbarManager): 617 def initToolbars(self, toolbarManager):
580 """ 618 """
581 Public slot to initialize the debug toolbars. 619 Public slot to initialize the debug toolbars.
582 620
583 @param toolbarManager reference to a toolbar manager object (E5ToolBarManager) 621 @param toolbarManager reference to a toolbar manager object
622 (E5ToolBarManager)
584 @return the generated toolbars (list of QToolBar) 623 @return the generated toolbars (list of QToolBar)
585 """ 624 """
586 starttb = QToolBar(self.trUtf8("Start"), self.ui) 625 starttb = QToolBar(self.trUtf8("Start"), self.ui)
587 starttb.setIconSize(UI.Config.ToolBarIconSize) 626 starttb.setIconSize(UI.Config.ToolBarIconSize)
588 starttb.setObjectName("StartToolbar") 627 starttb.setObjectName("StartToolbar")
612 toolbarManager.addToolBar(starttb, starttb.windowTitle()) 651 toolbarManager.addToolBar(starttb, starttb.windowTitle())
613 toolbarManager.addToolBar(debugtb, debugtb.windowTitle()) 652 toolbarManager.addToolBar(debugtb, debugtb.windowTitle())
614 toolbarManager.addAction(self.profileAct, starttb.windowTitle()) 653 toolbarManager.addAction(self.profileAct, starttb.windowTitle())
615 toolbarManager.addAction(self.profileProjectAct, starttb.windowTitle()) 654 toolbarManager.addAction(self.profileProjectAct, starttb.windowTitle())
616 toolbarManager.addAction(self.coverageAct, starttb.windowTitle()) 655 toolbarManager.addAction(self.coverageAct, starttb.windowTitle())
617 toolbarManager.addAction(self.coverageProjectAct, starttb.windowTitle()) 656 toolbarManager.addAction(self.coverageProjectAct,
657 starttb.windowTitle())
618 658
619 return [starttb, debugtb] 659 return [starttb, debugtb]
620 660
621 def setArgvHistory(self, argsStr, clearHistories=False): 661 def setArgvHistory(self, argsStr, clearHistories=False):
622 """ 662 """
707 747
708 def setAutoContinue(self, autoContinue): 748 def setAutoContinue(self, autoContinue):
709 """ 749 """
710 Public slot to initialize the autoContinue flag. 750 Public slot to initialize the autoContinue flag.
711 751
712 @param autoContinue flag indicating, that the debugger should not stop at 752 @param autoContinue flag indicating, that the debugger should not
713 the first executable line (boolean) 753 stop at the first executable line (boolean)
714 """ 754 """
715 self.autoContinue = autoContinue 755 self.autoContinue = autoContinue
716 756
717 def __editorOpened(self, fn): 757 def __editorOpened(self, fn):
718 """ 758 """
855 del self.wdHistory[10:] 895 del self.wdHistory[10:]
856 del self.envHistory[10:] 896 del self.envHistory[10:]
857 897
858 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory', 898 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory',
859 self.argvHistory) 899 self.argvHistory)
860 Preferences.Prefs.settings.setValue('DebugInfo/WorkingDirectoryHistory', 900 Preferences.Prefs.settings.setValue(
861 self.wdHistory) 901 'DebugInfo/WorkingDirectoryHistory', self.wdHistory)
862 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory', 902 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory',
863 self.envHistory) 903 self.envHistory)
864 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions', 904 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions',
865 self.excList) 905 self.excList)
866 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions', 906 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions',
949 ' status of {0}.</p>').format(status)) 989 ' status of {0}.</p>').format(status))
950 else: 990 else:
951 E5MessageBox.information(self.ui, Program, 991 E5MessageBox.information(self.ui, Program,
952 self.trUtf8('<p><b>{0}</b> has terminated with an exit' 992 self.trUtf8('<p><b>{0}</b> has terminated with an exit'
953 ' status of {1}.</p>') 993 ' status of {1}.</p>')
954 .format(Utilities.normabspath(self.ui.currentProg), status)) 994 .format(Utilities.normabspath(self.ui.currentProg),
995 status))
955 else: 996 else:
956 if self.ui.notificationsEnabled(): 997 if self.ui.notificationsEnabled():
957 if self.ui.currentProg is None: 998 if self.ui.currentProg is None:
958 msg = self.trUtf8('The program has terminated with an exit' 999 msg = self.trUtf8('The program has terminated with an exit'
959 ' status of {0}.').format(status) 1000 ' status of {0}.').format(status)
960 else: 1001 else:
961 msg = self.trUtf8('"{0}" has terminated with an exit' 1002 msg = self.trUtf8('"{0}" has terminated with an exit'
962 ' status of {1}.')\ 1003 ' status of {1}.')\
963 .format(os.path.basename(self.ui.currentProg), status) 1004 .format(os.path.basename(self.ui.currentProg),
964 self.ui.showNotification(UI.PixmapCache.getPixmap("debug48.png"), 1005 status)
1006 self.ui.showNotification(
1007 UI.PixmapCache.getPixmap("debug48.png"),
965 self.trUtf8("Program terminated"), msg) 1008 self.trUtf8("Program terminated"), msg)
966 else: 1009 else:
967 if self.ui.currentProg is None: 1010 if self.ui.currentProg is None:
968 self.appendStdout.emit( 1011 self.appendStdout.emit(
969 self.trUtf8('The program has terminated with an exit' 1012 self.trUtf8('The program has terminated with an exit'
970 ' status of {0}.\n').format(status)) 1013 ' status of {0}.\n').format(status))
971 else: 1014 else:
972 self.appendStdout.emit( 1015 self.appendStdout.emit(
973 self.trUtf8('"{0}" has terminated with an exit' 1016 self.trUtf8('"{0}" has terminated with an exit'
974 ' status of {1}.\n') 1017 ' status of {1}.\n')
975 .format(Utilities.normabspath(self.ui.currentProg), status)) 1018 .format(Utilities.normabspath(self.ui.currentProg),
1019 status))
976 1020
977 def __clientSyntaxError(self, message, filename, lineNo, characterNo): 1021 def __clientSyntaxError(self, message, filename, lineNo, characterNo):
978 """ 1022 """
979 Private method to handle a syntax error in the debugged program. 1023 Private method to handle a syntax error in the debugged program.
980 1024
981 @param message message of the syntax error (string) 1025 @param message message of the syntax error (string)
982 @param filename translated filename of the syntax error position (string) 1026 @param filename translated filename of the syntax error position
1027 (string)
983 @param lineNo line number of the syntax error position (integer) 1028 @param lineNo line number of the syntax error position (integer)
984 @param characterNo character number of the syntax error position (integer) 1029 @param characterNo character number of the syntax error position
1030 (integer)
985 """ 1031 """
986 self.__resetUI() 1032 self.__resetUI()
987 self.ui.raise_() 1033 self.ui.raise_()
988 self.ui.activateWindow() 1034 self.ui.activateWindow()
989 1035
990 if message is None: 1036 if message is None:
991 E5MessageBox.critical(self.ui, Program, 1037 E5MessageBox.critical(self.ui, Program,
992 self.trUtf8('The program being debugged contains an unspecified' 1038 self.trUtf8(
993 ' syntax error.')) 1039 'The program being debugged contains an unspecified'
1040 ' syntax error.'))
994 return 1041 return
995 1042
996 if not os.path.isabs(filename): 1043 if not os.path.isabs(filename):
997 if os.path.exists(os.path.join(self.project.getProjectPath(), filename)): 1044 if os.path.exists(os.path.join(self.project.getProjectPath(),
998 filename = os.path.join(self.project.getProjectPath(), filename) 1045 filename)):
1046 filename = os.path.join(self.project.getProjectPath(),
1047 filename)
999 else: 1048 else:
1000 d = os.path.dirname(self.project.getMainScript(normalized=True)) 1049 d = os.path.dirname(
1050 self.project.getMainScript(normalized=True))
1001 if os.path.exists(os.path.join(d, filename)): 1051 if os.path.exists(os.path.join(d, filename)):
1002 filename = os.path.join(d, filename) 1052 filename = os.path.join(d, filename)
1003 self.viewmanager.setFileLine(filename, lineNo, True, True) 1053 self.viewmanager.setFileLine(filename, lineNo, True, True)
1004 E5MessageBox.critical(self.ui, Program, 1054 E5MessageBox.critical(self.ui, Program,
1005 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error' 1055 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error'
1006 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.</p>') 1056 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.'
1057 '</p>')
1007 .format(filename, message, lineNo, characterNo)) 1058 .format(filename, message, lineNo, characterNo))
1008 1059
1009 def __clientException(self, exceptionType, exceptionMessage, stackTrace): 1060 def __clientException(self, exceptionType, exceptionMessage, stackTrace):
1010 """ 1061 """
1011 Private method to handle an exception of the debugged program. 1062 Private method to handle an exception of the debugged program.
1039 source[line - 1]): 1090 source[line - 1]):
1040 res = E5MessageBox.No 1091 res = E5MessageBox.No
1041 except (UnicodeError, IOError): 1092 except (UnicodeError, IOError):
1042 pass 1093 pass
1043 if res != E5MessageBox.No: 1094 if res != E5MessageBox.No:
1044 self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True) 1095 self.viewmanager.setFileLine(
1096 stackTrace[0][0], stackTrace[0][1], True)
1045 if res != E5MessageBox.No: 1097 if res != E5MessageBox.No:
1046 if Preferences.getDebugger("BreakAlways"): 1098 if Preferences.getDebugger("BreakAlways"):
1047 res = E5MessageBox.Yes 1099 res = E5MessageBox.Yes
1048 else: 1100 else:
1049 if stackTrace: 1101 if stackTrace:
1055 buttons = E5MessageBox.StandardButtons( 1107 buttons = E5MessageBox.StandardButtons(
1056 E5MessageBox.No | \ 1108 E5MessageBox.No | \
1057 E5MessageBox.Yes | \ 1109 E5MessageBox.Yes | \
1058 E5MessageBox.Ignore) 1110 E5MessageBox.Ignore)
1059 res = E5MessageBox.critical(self.ui, Program, 1111 res = E5MessageBox.critical(self.ui, Program,
1060 self.trUtf8('<p>The debugged program raised the exception' 1112 self.trUtf8(
1061 ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,' 1113 '<p>The debugged program raised the exception'
1062 ' Line: <b>{3}</b></p><p>Break here?</p>') 1114 ' <b>{0}</b><br>"<b>{1}</b>"<br>'
1063 .format(exceptionType, 1115 'File: <b>{2}</b>, Line: <b>{3}</b></p>'
1064 Utilities.html_encode(exceptionMessage), 1116 '<p>Break here?</p>')
1065 stackTrace[0][0], 1117 .format(
1066 stackTrace[0][1]), 1118 exceptionType,
1119 Utilities.html_encode(exceptionMessage),
1120 stackTrace[0][0],
1121 stackTrace[0][1]),
1067 buttons, 1122 buttons,
1068 E5MessageBox.No) 1123 E5MessageBox.No)
1069 else: 1124 else:
1070 res = E5MessageBox.critical(self.ui, Program, 1125 res = E5MessageBox.critical(self.ui, Program,
1071 self.trUtf8('<p>The debugged program raised the exception' 1126 self.trUtf8(
1072 ' <b>{0}</b><br>"<b>{1}</b>"</p>') 1127 '<p>The debugged program raised the exception'
1073 .format(exceptionType, 1128 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1074 Utilities.html_encode(exceptionMessage))) 1129 .format(
1130 exceptionType,
1131 Utilities.html_encode(exceptionMessage)))
1075 if res == E5MessageBox.Yes: 1132 if res == E5MessageBox.Yes:
1076 self.exceptionInterrupt.emit() 1133 self.exceptionInterrupt.emit()
1077 stack = [] 1134 stack = []
1078 for fn, ln, func, args in stackTrace: 1135 for fn, ln, func, args in stackTrace:
1079 stack.append((fn, ln, func, args)) 1136 stack.append((fn, ln, func, args))
1100 @param unplanned True if the client died, False otherwise 1157 @param unplanned True if the client died, False otherwise
1101 """ 1158 """
1102 self.__resetUI() 1159 self.__resetUI()
1103 if unplanned: 1160 if unplanned:
1104 E5MessageBox.information(self.ui, Program, 1161 E5MessageBox.information(self.ui, Program,
1105 self.trUtf8('The program being debugged has terminated unexpectedly.')) 1162 self.trUtf8('The program being debugged has terminated'
1163 ' unexpectedly.'))
1106 1164
1107 def __getThreadList(self): 1165 def __getThreadList(self):
1108 """ 1166 """
1109 Private method to get the list of threads from the client. 1167 Private method to get the list of threads from the client.
1110 """ 1168 """
1130 1188
1131 def __clientVariables(self, scope, variables): 1189 def __clientVariables(self, scope, variables):
1132 """ 1190 """
1133 Private method to write the clients variables to the user interface. 1191 Private method to write the clients variables to the user interface.
1134 1192
1135 @param scope scope of the variables (-1 = empty global, 1 = global, 0 = local) 1193 @param scope scope of the variables (-1 = empty global, 1 = global,
1194 0 = local)
1136 @param variables the list of variables from the client 1195 @param variables the list of variables from the client
1137 """ 1196 """
1138 if scope > 0: 1197 if scope > 0:
1139 self.debugViewer.showVariables(variables, True) 1198 self.debugViewer.showVariables(variables, True)
1140 if scope == 1: 1199 if scope == 1:
1150 self.debugActGrp.setEnabled(True) 1209 self.debugActGrp.setEnabled(True)
1151 self.debugActGrp2.setEnabled(True) 1210 self.debugActGrp2.setEnabled(True)
1152 1211
1153 def __clientVariable(self, scope, variables): 1212 def __clientVariable(self, scope, variables):
1154 """ 1213 """
1155 Private method to write the contents of a clients classvariable to the user 1214 Private method to write the contents of a clients classvariable to
1156 interface. 1215 the user interface.
1157 1216
1158 @param scope scope of the variables (-1 = empty global, 1 = global, 0 = local) 1217 @param scope scope of the variables (-1 = empty global, 1 = global,
1218 0 = local)
1159 @param variables the list of members of a classvariable from the client 1219 @param variables the list of members of a classvariable from the client
1160 """ 1220 """
1161 if scope == 1: 1221 if scope == 1:
1162 self.debugViewer.showVariable(variables, 1) 1222 self.debugViewer.showVariable(variables, 1)
1163 elif scope == 0: 1223 elif scope == 0:
1170 @param filename filename of the breakpoint (string) 1230 @param filename filename of the breakpoint (string)
1171 @param lineno linenumber of the breakpoint (integer) 1231 @param lineno linenumber of the breakpoint (integer)
1172 """ 1232 """
1173 E5MessageBox.critical(self.ui, 1233 E5MessageBox.critical(self.ui,
1174 self.trUtf8("Breakpoint Condition Error"), 1234 self.trUtf8("Breakpoint Condition Error"),
1175 self.trUtf8("""<p>The condition of the breakpoint <b>{0}, {1}</b>""" 1235 self.trUtf8(
1176 """ contains a syntax error.</p>""")\ 1236 """<p>The condition of the breakpoint <b>{0}, {1}</b>"""
1177 .format(filename, lineno)) 1237 """ contains a syntax error.</p>""")\
1238 .format(filename, lineno))
1178 1239
1179 model = self.debugServer.getBreakPointModel() 1240 model = self.debugServer.getBreakPointModel()
1180 index = model.getBreakPointIndex(filename, lineno) 1241 index = model.getBreakPointIndex(filename, lineno)
1181 if not index.isValid(): 1242 if not index.isValid():
1182 return 1243 return
1190 from .EditBreakpointDialog import EditBreakpointDialog 1251 from .EditBreakpointDialog import EditBreakpointDialog
1191 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count), 1252 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count),
1192 [], self.ui, modal=True) 1253 [], self.ui, modal=True)
1193 if dlg.exec_() == QDialog.Accepted: 1254 if dlg.exec_() == QDialog.Accepted:
1194 cond, temp, enabled, count = dlg.getData() 1255 cond, temp, enabled, count = dlg.getData()
1195 model.setBreakPointByIndex(index, fn, line, (cond, temp, enabled, count)) 1256 model.setBreakPointByIndex(index, fn, line,
1257 (cond, temp, enabled, count))
1196 1258
1197 def __clientWatchConditionError(self, cond): 1259 def __clientWatchConditionError(self, cond):
1198 """ 1260 """
1199 Public method to handle a expression error of a watch expression. 1261 Public method to handle a expression error of a watch expression.
1200 1262
1225 if dlg.exec_() == QDialog.Accepted: 1287 if dlg.exec_() == QDialog.Accepted:
1226 cond, temp, enabled, count, special = dlg.getData() 1288 cond, temp, enabled, count, special = dlg.getData()
1227 1289
1228 # check for duplicates 1290 # check for duplicates
1229 idx = self.__model.getWatchPointIndex(cond, special) 1291 idx = self.__model.getWatchPointIndex(cond, special)
1230 duplicate = idx.isValid() and idx.internalPointer() != index.internalPointer() 1292 duplicate = idx.isValid() and \
1293 idx.internalPointer() != index.internalPointer()
1231 if duplicate: 1294 if duplicate:
1232 if not special: 1295 if not special:
1233 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1296 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1234 """ already exists.</p>""")\ 1297 """ already exists.</p>""")\
1235 .format(Utilities.html_encode(cond)) 1298 .format(Utilities.html_encode(cond))
1236 else: 1299 else:
1237 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1300 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1238 """ for the variable <b>{1}</b> already exists.</p>""")\ 1301 """ for the variable <b>{1}</b> already"""
1302 """ exists.</p>""")\
1239 .format(special, 1303 .format(special,
1240 Utilities.html_encode(cond)) 1304 Utilities.html_encode(cond))
1241 E5MessageBox.warning(self, 1305 E5MessageBox.warning(self,
1242 self.trUtf8("Watch expression already exists"), 1306 self.trUtf8("Watch expression already exists"),
1243 msg) 1307 msg)
1373 1437
1374 def __doCoverage(self, runProject): 1438 def __doCoverage(self, runProject):
1375 """ 1439 """
1376 Private method to handle the coverage actions. 1440 Private method to handle the coverage actions.
1377 1441
1378 @param runProject flag indicating coverage of the current project (True) 1442 @param runProject flag indicating coverage of the current project
1379 or script (false) 1443 (True) or script (false)
1380 """ 1444 """
1381 from .StartDialog import StartDialog 1445 from .StartDialog import StartDialog
1382 1446
1383 self.__resetUI() 1447 self.__resetUI()
1384 doNotStart = False 1448 doNotStart = False
1387 # exception reporting flag. 1451 # exception reporting flag.
1388 if runProject: 1452 if runProject:
1389 cap = self.trUtf8("Coverage of Project") 1453 cap = self.trUtf8("Coverage of Project")
1390 else: 1454 else:
1391 cap = self.trUtf8("Coverage of Script") 1455 cap = self.trUtf8("Coverage of Script")
1392 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1456 dlg = StartDialog(cap, self.argvHistory, self.wdHistory,
1393 self.exceptions, self.ui, 2, autoClearShell=self.autoClearShell) 1457 self.envHistory, self.exceptions, self.ui, 2,
1458 autoClearShell=self.autoClearShell)
1394 if dlg.exec_() == QDialog.Accepted: 1459 if dlg.exec_() == QDialog.Accepted:
1395 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1460 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1461 dlg.getData()
1396 eraseCoverage = dlg.getCoverageData() 1462 eraseCoverage = dlg.getCoverageData()
1397 1463
1398 if runProject: 1464 if runProject:
1399 fn = self.project.getMainScript(1) 1465 fn = self.project.getMainScript(1)
1400 if fn is None: 1466 if fn is None:
1407 if Preferences.getDebugger("Autosave") and \ 1473 if Preferences.getDebugger("Autosave") and \
1408 not self.project.saveAllScripts(reportSyntaxErrors=True): 1474 not self.project.saveAllScripts(reportSyntaxErrors=True):
1409 doNotStart = True 1475 doNotStart = True
1410 1476
1411 # save the info for later use 1477 # save the info for later use
1412 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1478 self.project.setDbgInfo(
1479 argv, wd, env, exceptions, self.excList,
1413 self.excIgnoreList, clearShell) 1480 self.excIgnoreList, clearShell)
1414 1481
1415 self.lastStartAction = 6 1482 self.lastStartAction = 6
1416 self.clientType = self.project.getProjectLanguage() 1483 self.clientType = self.project.getProjectLanguage()
1417 else: 1484 else:
1483 1550
1484 def __doProfile(self, runProject): 1551 def __doProfile(self, runProject):
1485 """ 1552 """
1486 Private method to handle the profile actions. 1553 Private method to handle the profile actions.
1487 1554
1488 @param runProject flag indicating profiling of the current project (True) 1555 @param runProject flag indicating profiling of the current project
1489 or script (False) 1556 (True) or script (False)
1490 """ 1557 """
1491 from .StartDialog import StartDialog 1558 from .StartDialog import StartDialog
1492 1559
1493 self.__resetUI() 1560 self.__resetUI()
1494 doNotStart = False 1561 doNotStart = False
1497 # exception reporting flag. 1564 # exception reporting flag.
1498 if runProject: 1565 if runProject:
1499 cap = self.trUtf8("Profile of Project") 1566 cap = self.trUtf8("Profile of Project")
1500 else: 1567 else:
1501 cap = self.trUtf8("Profile of Script") 1568 cap = self.trUtf8("Profile of Script")
1502 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1569 dlg = StartDialog(
1570 cap, self.argvHistory, self.wdHistory, self.envHistory,
1503 self.exceptions, self.ui, 3, 1571 self.exceptions, self.ui, 3,
1504 autoClearShell=self.autoClearShell) 1572 autoClearShell=self.autoClearShell)
1505 if dlg.exec_() == QDialog.Accepted: 1573 if dlg.exec_() == QDialog.Accepted:
1506 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1574 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1575 dlg.getData()
1507 eraseTimings = dlg.getProfilingData() 1576 eraseTimings = dlg.getProfilingData()
1508 1577
1509 if runProject: 1578 if runProject:
1510 fn = self.project.getMainScript(1) 1579 fn = self.project.getMainScript(1)
1511 if fn is None: 1580 if fn is None:
1518 if Preferences.getDebugger("Autosave") and \ 1587 if Preferences.getDebugger("Autosave") and \
1519 not self.project.saveAllScripts(reportSyntaxErrors=True): 1588 not self.project.saveAllScripts(reportSyntaxErrors=True):
1520 doNotStart = True 1589 doNotStart = True
1521 1590
1522 # save the info for later use 1591 # save the info for later use
1523 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1592 self.project.setDbgInfo(
1593 argv, wd, env, exceptions, self.excList,
1524 self.excIgnoreList, clearShell) 1594 self.excIgnoreList, clearShell)
1525 1595
1526 self.lastStartAction = 8 1596 self.lastStartAction = 8
1527 self.clientType = self.project.getProjectLanguage() 1597 self.clientType = self.project.getProjectLanguage()
1528 else: 1598 else:
1608 # exception reporting flag. 1678 # exception reporting flag.
1609 if runProject: 1679 if runProject:
1610 cap = self.trUtf8("Run Project") 1680 cap = self.trUtf8("Run Project")
1611 else: 1681 else:
1612 cap = self.trUtf8("Run Script") 1682 cap = self.trUtf8("Run Script")
1613 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1683 dlg = StartDialog(
1684 cap, self.argvHistory, self.wdHistory, self.envHistory,
1614 self.exceptions, self.ui, 1, 1685 self.exceptions, self.ui, 1,
1615 autoClearShell=self.autoClearShell, 1686 autoClearShell=self.autoClearShell,
1616 autoFork=self.forkAutomatically, 1687 autoFork=self.forkAutomatically,
1617 forkChild=self.forkIntoChild) 1688 forkChild=self.forkIntoChild)
1618 if dlg.exec_() == QDialog.Accepted: 1689 if dlg.exec_() == QDialog.Accepted:
1619 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1690 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1691 dlg.getData()
1620 forkAutomatically, forkIntoChild = dlg.getRunData() 1692 forkAutomatically, forkIntoChild = dlg.getRunData()
1621 1693
1622 if runProject: 1694 if runProject:
1623 fn = self.project.getMainScript(1) 1695 fn = self.project.getMainScript(1)
1624 if fn is None: 1696 if fn is None:
1631 if Preferences.getDebugger("Autosave") and \ 1703 if Preferences.getDebugger("Autosave") and \
1632 not self.project.saveAllScripts(reportSyntaxErrors=True): 1704 not self.project.saveAllScripts(reportSyntaxErrors=True):
1633 doNotStart = True 1705 doNotStart = True
1634 1706
1635 # save the info for later use 1707 # save the info for later use
1636 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1708 self.project.setDbgInfo(
1709 argv, wd, env, exceptions, self.excList,
1637 self.excIgnoreList, clearShell) 1710 self.excIgnoreList, clearShell)
1638 1711
1639 self.lastStartAction = 4 1712 self.lastStartAction = 4
1640 self.clientType = self.project.getProjectLanguage() 1713 self.clientType = self.project.getProjectLanguage()
1641 else: 1714 else:
1708 1781
1709 def __doDebug(self, debugProject): 1782 def __doDebug(self, debugProject):
1710 """ 1783 """
1711 Private method to handle the debug actions. 1784 Private method to handle the debug actions.
1712 1785
1713 @param debugProject flag indicating debugging the current project (True) 1786 @param debugProject flag indicating debugging the current project
1714 or script (False) 1787 (True) or script (False)
1715 """ 1788 """
1716 from .StartDialog import StartDialog 1789 from .StartDialog import StartDialog
1717 1790
1718 self.__resetUI() 1791 self.__resetUI()
1719 doNotStart = False 1792 doNotStart = False
1722 # exception reporting flag. 1795 # exception reporting flag.
1723 if debugProject: 1796 if debugProject:
1724 cap = self.trUtf8("Debug Project") 1797 cap = self.trUtf8("Debug Project")
1725 else: 1798 else:
1726 cap = self.trUtf8("Debug Script") 1799 cap = self.trUtf8("Debug Script")
1727 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1800 dlg = StartDialog(
1801 cap, self.argvHistory, self.wdHistory, self.envHistory,
1728 self.exceptions, self.ui, 0, tracePython=self.tracePython, 1802 self.exceptions, self.ui, 0, tracePython=self.tracePython,
1729 autoClearShell=self.autoClearShell, autoContinue=self.autoContinue, 1803 autoClearShell=self.autoClearShell, autoContinue=self.autoContinue,
1730 autoFork=self.forkAutomatically, forkChild=self.forkIntoChild) 1804 autoFork=self.forkAutomatically, forkChild=self.forkIntoChild)
1731 if dlg.exec_() == QDialog.Accepted: 1805 if dlg.exec_() == QDialog.Accepted:
1732 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1806 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1807 dlg.getData()
1733 tracePython, autoContinue, forkAutomatically, forkIntoChild = \ 1808 tracePython, autoContinue, forkAutomatically, forkIntoChild = \
1734 dlg.getDebugData() 1809 dlg.getDebugData()
1735 1810
1736 if debugProject: 1811 if debugProject:
1737 fn = self.project.getMainScript(True) 1812 fn = self.project.getMainScript(True)
1745 if Preferences.getDebugger("Autosave") and \ 1820 if Preferences.getDebugger("Autosave") and \
1746 not self.project.saveAllScripts(reportSyntaxErrors=True): 1821 not self.project.saveAllScripts(reportSyntaxErrors=True):
1747 doNotStart = True 1822 doNotStart = True
1748 1823
1749 # save the info for later use 1824 # save the info for later use
1750 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1825 self.project.setDbgInfo(
1826 argv, wd, env, exceptions, self.excList,
1751 self.excIgnoreList, clearShell, tracePython=tracePython, 1827 self.excIgnoreList, clearShell, tracePython=tracePython,
1752 autoContinue=self.autoContinue) 1828 autoContinue=self.autoContinue)
1753 1829
1754 self.lastStartAction = 2 1830 self.lastStartAction = 2
1755 self.clientType = self.project.getProjectLanguage() 1831 self.clientType = self.project.getProjectLanguage()
1798 1874
1799 # Hide all error highlights 1875 # Hide all error highlights
1800 self.viewmanager.unhighlight() 1876 self.viewmanager.unhighlight()
1801 1877
1802 if not doNotStart: 1878 if not doNotStart:
1803 if debugProject and self.project.getProjectType() == "E4Plugin": 1879 if debugProject and \
1880 self.project.getProjectType() == "E4Plugin":
1804 argv = '--plugin="{0}" {1}'.format(fn, argv) 1881 argv = '--plugin="{0}" {1}'.format(fn, argv)
1805 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1882 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1806 tracePython = True # override flag because it must be true 1883 tracePython = True # override flag because it must be true
1807 1884
1808 self.debugViewer.initCallStackViewer(debugProject) 1885 self.debugViewer.initCallStackViewer(debugProject)
1812 self.debugViewer.clearCallTrace() 1889 self.debugViewer.clearCallTrace()
1813 self.debugViewer.setCallTraceToProjectMode(debugProject) 1890 self.debugViewer.setCallTraceToProjectMode(debugProject)
1814 1891
1815 # Ask the client to open the new program. 1892 # Ask the client to open the new program.
1816 self.debugServer.remoteLoad(fn, argv, wd, env, 1893 self.debugServer.remoteLoad(fn, argv, wd, env,
1817 autoClearShell=self.autoClearShell, tracePython=tracePython, 1894 autoClearShell=self.autoClearShell,
1895 tracePython=tracePython,
1818 autoContinue=autoContinue, forProject=debugProject, 1896 autoContinue=autoContinue, forProject=debugProject,
1819 runInConsole=console, autoFork=forkAutomatically, 1897 runInConsole=console, autoFork=forkAutomatically,
1820 forkChild=forkIntoChild, clientType=self.clientType, 1898 forkChild=forkIntoChild, clientType=self.clientType,
1821 enableCallTrace=enableCallTrace) 1899 enableCallTrace=enableCallTrace)
1822 1900
1825 1903
1826 self.stopAct.setEnabled(True) 1904 self.stopAct.setEnabled(True)
1827 1905
1828 def __doRestart(self): 1906 def __doRestart(self):
1829 """ 1907 """
1830 Private slot to handle the restart action to restart the last debugged file. 1908 Private slot to handle the restart action to restart the last
1909 debugged file.
1831 """ 1910 """
1832 self.__resetUI() 1911 self.__resetUI()
1833 doNotStart = False 1912 doNotStart = False
1834 1913
1835 # first save any changes 1914 # first save any changes
1870 enableCallTrace = self.debugViewer.isCallTraceEnabled() 1949 enableCallTrace = self.debugViewer.isCallTraceEnabled()
1871 self.debugViewer.clearCallTrace() 1950 self.debugViewer.clearCallTrace()
1872 self.debugViewer.setCallTraceToProjectMode(forProject) 1951 self.debugViewer.setCallTraceToProjectMode(forProject)
1873 1952
1874 # Ask the client to debug the new program. 1953 # Ask the client to debug the new program.
1875 self.debugServer.remoteLoad(fn, argv, wd, env, 1954 self.debugServer.remoteLoad(
1876 autoClearShell=self.autoClearShell, tracePython=self.tracePython, 1955 fn, argv, wd, env,
1877 autoContinue=self.autoContinue, forProject=forProject, 1956 autoClearShell=self.autoClearShell,
1878 runInConsole=self.runInConsole, autoFork=self.forkAutomatically, 1957 tracePython=self.tracePython,
1879 forkChild=self.forkIntoChild, clientType=self.clientType, 1958 autoContinue=self.autoContinue,
1959 forProject=forProject,
1960 runInConsole=self.runInConsole,
1961 autoFork=self.forkAutomatically,
1962 forkChild=self.forkIntoChild,
1963 clientType=self.clientType,
1880 enableCallTrace=enableCallTrace) 1964 enableCallTrace=enableCallTrace)
1881 1965
1882 # Signal that we have started a debugging session 1966 # Signal that we have started a debugging session
1883 self.debuggingStarted.emit(fn) 1967 self.debuggingStarted.emit(fn)
1884 1968
1885 elif self.lastStartAction in [3, 4]: 1969 elif self.lastStartAction in [3, 4]:
1886 # Ask the client to run the new program. 1970 # Ask the client to run the new program.
1887 self.debugServer.remoteRun(fn, argv, wd, env, 1971 self.debugServer.remoteRun(
1888 autoClearShell=self.autoClearShell, forProject=forProject, 1972 fn, argv, wd, env,
1889 runInConsole=self.runInConsole, autoFork=self.forkAutomatically, 1973 autoClearShell=self.autoClearShell,
1890 forkChild=self.forkIntoChild, clientType=self.clientType) 1974 forProject=forProject,
1975 runInConsole=self.runInConsole,
1976 autoFork=self.forkAutomatically,
1977 forkChild=self.forkIntoChild,
1978 clientType=self.clientType)
1891 1979
1892 elif self.lastStartAction in [5, 6]: 1980 elif self.lastStartAction in [5, 6]:
1893 # Ask the client to coverage run the new program. 1981 # Ask the client to coverage run the new program.
1894 self.debugServer.remoteCoverage(fn, argv, wd, env, 1982 self.debugServer.remoteCoverage(
1895 autoClearShell=self.autoClearShell, erase=self.eraseCoverage, 1983 fn, argv, wd, env,
1896 forProject=forProject, runInConsole=self.runInConsole, 1984 autoClearShell=self.autoClearShell,
1985 erase=self.eraseCoverage,
1986 forProject=forProject,
1987 runInConsole=self.runInConsole,
1897 clientType=self.clientType) 1988 clientType=self.clientType)
1898 1989
1899 elif self.lastStartAction in [7, 8]: 1990 elif self.lastStartAction in [7, 8]:
1900 # Ask the client to profile run the new program. 1991 # Ask the client to profile run the new program.
1901 self.debugServer.remoteProfile(fn, argv, wd, env, 1992 self.debugServer.remoteProfile(
1902 autoClearShell=self.autoClearShell, erase=self.eraseTimings, 1993 fn, argv, wd, env,
1903 forProject=forProject, runInConsole=self.runInConsole, 1994 autoClearShell=self.autoClearShell,
1995 erase=self.eraseTimings,
1996 forProject=forProject,
1997 runInConsole=self.runInConsole,
1904 clientType=self.clientType) 1998 clientType=self.clientType)
1905 1999
1906 self.stopAct.setEnabled(True) 2000 self.stopAct.setEnabled(True)
1907 2001
1908 def __stopScript(self): 2002 def __stopScript(self):

eric ide

mercurial