Debugger/DebugUI.py

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

eric ide

mercurial