Debugger/DebugUI.py

changeset 945
8cd4d08fa9f6
parent 816
53e282890577
child 991
5ec5e707dfa5
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
26 26
27 from E5Gui.E5Action import E5Action, createActionGroup 27 from E5Gui.E5Action import E5Action, createActionGroup
28 from E5Gui import E5MessageBox 28 from E5Gui import E5MessageBox
29 29
30 from eric5config import getConfig 30 from eric5config import getConfig
31
31 32
32 class DebugUI(QObject): 33 class DebugUI(QObject):
33 """ 34 """
34 Class implementing the debugger part of the UI. 35 Class implementing the debugger part of the UI.
35 36
162 """ 163 """
163 self.actions = [] 164 self.actions = []
164 165
165 self.runAct = E5Action(self.trUtf8('Run Script'), 166 self.runAct = E5Action(self.trUtf8('Run Script'),
166 UI.PixmapCache.getIcon("runScript.png"), 167 UI.PixmapCache.getIcon("runScript.png"),
167 self.trUtf8('&Run Script...'),Qt.Key_F2,0,self,'dbg_run_script') 168 self.trUtf8('&Run Script...'), Qt.Key_F2, 0, self, 'dbg_run_script')
168 self.runAct.setStatusTip(self.trUtf8('Run the current Script')) 169 self.runAct.setStatusTip(self.trUtf8('Run the current Script'))
169 self.runAct.setWhatsThis(self.trUtf8( 170 self.runAct.setWhatsThis(self.trUtf8(
170 """<b>Run Script</b>""" 171 """<b>Run Script</b>"""
171 """<p>Set the command line arguments and run the script outside the""" 172 """<p>Set the command line arguments and run the script outside the"""
172 """ debugger. If the file has unsaved changes it may be saved first.</p>""" 173 """ debugger. If the file has unsaved changes it may be saved first.</p>"""
174 self.runAct.triggered[()].connect(self.__runScript) 175 self.runAct.triggered[()].connect(self.__runScript)
175 self.actions.append(self.runAct) 176 self.actions.append(self.runAct)
176 177
177 self.runProjectAct = E5Action(self.trUtf8('Run Project'), 178 self.runProjectAct = E5Action(self.trUtf8('Run Project'),
178 UI.PixmapCache.getIcon("runProject.png"), 179 UI.PixmapCache.getIcon("runProject.png"),
179 self.trUtf8('Run &Project...'),Qt.SHIFT + Qt.Key_F2,0,self, 180 self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self,
180 'dbg_run_project') 181 'dbg_run_project')
181 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project')) 182 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project'))
182 self.runProjectAct.setWhatsThis(self.trUtf8( 183 self.runProjectAct.setWhatsThis(self.trUtf8(
183 """<b>Run Project</b>""" 184 """<b>Run Project</b>"""
184 """<p>Set the command line arguments and run the current project""" 185 """<p>Set the command line arguments and run the current project"""
189 self.runProjectAct.triggered[()].connect(self.__runProject) 190 self.runProjectAct.triggered[()].connect(self.__runProject)
190 self.actions.append(self.runProjectAct) 191 self.actions.append(self.runProjectAct)
191 192
192 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'), 193 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'),
193 UI.PixmapCache.getIcon("coverageScript.png"), 194 UI.PixmapCache.getIcon("coverageScript.png"),
194 self.trUtf8('Coverage run of Script...'),0,0,self,'dbg_coverage_script') 195 self.trUtf8('Coverage run of Script...'), 0, 0, self, 'dbg_coverage_script')
195 self.coverageAct.setStatusTip( 196 self.coverageAct.setStatusTip(
196 self.trUtf8('Perform a coverage run of the current Script')) 197 self.trUtf8('Perform a coverage run of the current Script'))
197 self.coverageAct.setWhatsThis(self.trUtf8( 198 self.coverageAct.setWhatsThis(self.trUtf8(
198 """<b>Coverage run of Script</b>""" 199 """<b>Coverage run of Script</b>"""
199 """<p>Set the command line arguments and run the script under the control""" 200 """<p>Set the command line arguments and run the script under the control"""
203 self.coverageAct.triggered[()].connect(self.__coverageScript) 204 self.coverageAct.triggered[()].connect(self.__coverageScript)
204 self.actions.append(self.coverageAct) 205 self.actions.append(self.coverageAct)
205 206
206 self.coverageProjectAct = E5Action(self.trUtf8('Coverage run of Project'), 207 self.coverageProjectAct = E5Action(self.trUtf8('Coverage run of Project'),
207 UI.PixmapCache.getIcon("coverageProject.png"), 208 UI.PixmapCache.getIcon("coverageProject.png"),
208 self.trUtf8('Coverage run of Project...'),0,0,self,'dbg_coverage_project') 209 self.trUtf8('Coverage run of Project...'), 0, 0, self, 'dbg_coverage_project')
209 self.coverageProjectAct.setStatusTip( 210 self.coverageProjectAct.setStatusTip(
210 self.trUtf8('Perform a coverage run of the current Project')) 211 self.trUtf8('Perform a coverage run of the current Project'))
211 self.coverageProjectAct.setWhatsThis(self.trUtf8( 212 self.coverageProjectAct.setWhatsThis(self.trUtf8(
212 """<b>Coverage run of Project</b>""" 213 """<b>Coverage run of Project</b>"""
213 """<p>Set the command line arguments and run the current project""" 214 """<p>Set the command line arguments and run the current project"""
218 self.coverageProjectAct.triggered[()].connect(self.__coverageProject) 219 self.coverageProjectAct.triggered[()].connect(self.__coverageProject)
219 self.actions.append(self.coverageProjectAct) 220 self.actions.append(self.coverageProjectAct)
220 221
221 self.profileAct = E5Action(self.trUtf8('Profile Script'), 222 self.profileAct = E5Action(self.trUtf8('Profile Script'),
222 UI.PixmapCache.getIcon("profileScript.png"), 223 UI.PixmapCache.getIcon("profileScript.png"),
223 self.trUtf8('Profile Script...'),0,0,self,'dbg_profile_script') 224 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script')
224 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script')) 225 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script'))
225 self.profileAct.setWhatsThis(self.trUtf8( 226 self.profileAct.setWhatsThis(self.trUtf8(
226 """<b>Profile Script</b>""" 227 """<b>Profile Script</b>"""
227 """<p>Set the command line arguments and profile the script.""" 228 """<p>Set the command line arguments and profile the script."""
228 """ If the file has unsaved changes it may be saved first.</p>""" 229 """ If the file has unsaved changes it may be saved first.</p>"""
230 self.profileAct.triggered[()].connect(self.__profileScript) 231 self.profileAct.triggered[()].connect(self.__profileScript)
231 self.actions.append(self.profileAct) 232 self.actions.append(self.profileAct)
232 233
233 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'), 234 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'),
234 UI.PixmapCache.getIcon("profileProject.png"), 235 UI.PixmapCache.getIcon("profileProject.png"),
235 self.trUtf8('Profile Project...'),0,0,self,'dbg_profile_project') 236 self.trUtf8('Profile Project...'), 0, 0, self, 'dbg_profile_project')
236 self.profileProjectAct.setStatusTip(self.trUtf8('Profile the current Project')) 237 self.profileProjectAct.setStatusTip(self.trUtf8('Profile the current Project'))
237 self.profileProjectAct.setWhatsThis(self.trUtf8( 238 self.profileProjectAct.setWhatsThis(self.trUtf8(
238 """<b>Profile Project</b>""" 239 """<b>Profile Project</b>"""
239 """<p>Set the command line arguments and profile the current project.""" 240 """<p>Set the command line arguments and profile the current project."""
240 """ If files of the current project have unsaved changes they may""" 241 """ If files of the current project have unsaved changes they may"""
243 self.profileProjectAct.triggered[()].connect(self.__profileProject) 244 self.profileProjectAct.triggered[()].connect(self.__profileProject)
244 self.actions.append(self.profileProjectAct) 245 self.actions.append(self.profileProjectAct)
245 246
246 self.debugAct = E5Action(self.trUtf8('Debug Script'), 247 self.debugAct = E5Action(self.trUtf8('Debug Script'),
247 UI.PixmapCache.getIcon("debugScript.png"), 248 UI.PixmapCache.getIcon("debugScript.png"),
248 self.trUtf8('&Debug Script...'),Qt.Key_F5,0,self,'dbg_debug_script') 249 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self, 'dbg_debug_script')
249 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script')) 250 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script'))
250 self.debugAct.setWhatsThis(self.trUtf8( 251 self.debugAct.setWhatsThis(self.trUtf8(
251 """<b>Debug Script</b>""" 252 """<b>Debug Script</b>"""
252 """<p>Set the command line arguments and set the current line to be the""" 253 """<p>Set the command line arguments and set the current line to be the"""
253 """ first executable Python statement of the current editor window.""" 254 """ first executable Python statement of the current editor window."""
256 self.debugAct.triggered[()].connect(self.__debugScript) 257 self.debugAct.triggered[()].connect(self.__debugScript)
257 self.actions.append(self.debugAct) 258 self.actions.append(self.debugAct)
258 259
259 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'), 260 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'),
260 UI.PixmapCache.getIcon("debugProject.png"), 261 UI.PixmapCache.getIcon("debugProject.png"),
261 self.trUtf8('Debug &Project...'),Qt.SHIFT + Qt.Key_F5,0,self, 262 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self,
262 'dbg_debug_project') 263 'dbg_debug_project')
263 self.debugProjectAct.setStatusTip(self.trUtf8('Debug the current Project')) 264 self.debugProjectAct.setStatusTip(self.trUtf8('Debug the current Project'))
264 self.debugProjectAct.setWhatsThis(self.trUtf8( 265 self.debugProjectAct.setWhatsThis(self.trUtf8(
265 """<b>Debug Project</b>""" 266 """<b>Debug Project</b>"""
266 """<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 to be the"""
271 self.debugProjectAct.triggered[()].connect(self.__debugProject) 272 self.debugProjectAct.triggered[()].connect(self.__debugProject)
272 self.actions.append(self.debugProjectAct) 273 self.actions.append(self.debugProjectAct)
273 274
274 self.restartAct = E5Action(self.trUtf8('Restart Script'), 275 self.restartAct = E5Action(self.trUtf8('Restart Script'),
275 UI.PixmapCache.getIcon("restart.png"), 276 UI.PixmapCache.getIcon("restart.png"),
276 self.trUtf8('Restart Script'),Qt.Key_F4,0,self,'dbg_restart_script') 277 self.trUtf8('Restart Script'), Qt.Key_F4, 0, self, 'dbg_restart_script')
277 self.restartAct.setStatusTip(self.trUtf8('Restart the last debugged script')) 278 self.restartAct.setStatusTip(self.trUtf8('Restart the last debugged script'))
278 self.restartAct.setWhatsThis(self.trUtf8( 279 self.restartAct.setWhatsThis(self.trUtf8(
279 """<b>Restart Script</b>""" 280 """<b>Restart Script</b>"""
280 """<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 to be the"""
281 """ first executable Python statement of the script that was debugged last.""" 282 """ first executable Python statement of the script that was debugged last."""
284 self.restartAct.triggered[()].connect(self.__doRestart) 285 self.restartAct.triggered[()].connect(self.__doRestart)
285 self.actions.append(self.restartAct) 286 self.actions.append(self.restartAct)
286 287
287 self.stopAct = E5Action(self.trUtf8('Stop Script'), 288 self.stopAct = E5Action(self.trUtf8('Stop Script'),
288 UI.PixmapCache.getIcon("stopScript.png"), 289 UI.PixmapCache.getIcon("stopScript.png"),
289 self.trUtf8('Stop Script'),Qt.SHIFT + Qt.Key_F10,0, 290 self.trUtf8('Stop Script'), Qt.SHIFT + Qt.Key_F10, 0,
290 self,'dbg_stop_script') 291 self, 'dbg_stop_script')
291 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script.""")) 292 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script."""))
292 self.stopAct.setWhatsThis(self.trUtf8( 293 self.stopAct.setWhatsThis(self.trUtf8(
293 """<b>Stop Script</b>""" 294 """<b>Stop Script</b>"""
294 """<p>This stops the script running in the debugger backend.</p>""" 295 """<p>This stops the script running in the debugger backend.</p>"""
295 )) 296 ))
298 299
299 self.debugActGrp = createActionGroup(self) 300 self.debugActGrp = createActionGroup(self)
300 301
301 act = E5Action(self.trUtf8('Continue'), 302 act = E5Action(self.trUtf8('Continue'),
302 UI.PixmapCache.getIcon("continue.png"), 303 UI.PixmapCache.getIcon("continue.png"),
303 self.trUtf8('&Continue'),Qt.Key_F6,0, 304 self.trUtf8('&Continue'), Qt.Key_F6, 0,
304 self.debugActGrp,'dbg_continue') 305 self.debugActGrp, 'dbg_continue')
305 act.setStatusTip( 306 act.setStatusTip(
306 self.trUtf8('Continue running the program from the current line')) 307 self.trUtf8('Continue running the program from the current line'))
307 act.setWhatsThis(self.trUtf8( 308 act.setWhatsThis(self.trUtf8(
308 """<b>Continue</b>""" 309 """<b>Continue</b>"""
309 """<p>Continue running the program from the current line. The program will""" 310 """<p>Continue running the program from the current line. The program will"""
312 act.triggered[()].connect(self.__continue) 313 act.triggered[()].connect(self.__continue)
313 self.actions.append(act) 314 self.actions.append(act)
314 315
315 act = E5Action(self.trUtf8('Continue to Cursor'), 316 act = E5Action(self.trUtf8('Continue to Cursor'),
316 UI.PixmapCache.getIcon("continueToCursor.png"), 317 UI.PixmapCache.getIcon("continueToCursor.png"),
317 self.trUtf8('Continue &To Cursor'),Qt.SHIFT + Qt.Key_F6,0, 318 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0,
318 self.debugActGrp,'dbg_continue_to_cursor') 319 self.debugActGrp, 'dbg_continue_to_cursor')
319 act.setStatusTip(self.trUtf8("""Continue running the program from the""" 320 act.setStatusTip(self.trUtf8("""Continue running the program from the"""
320 """ current line to the current cursor position""")) 321 """ current line to the current cursor position"""))
321 act.setWhatsThis(self.trUtf8( 322 act.setWhatsThis(self.trUtf8(
322 """<b>Continue To Cursor</b>""" 323 """<b>Continue To Cursor</b>"""
323 """<p>Continue running the program from the current line to the""" 324 """<p>Continue running the program from the current line to the"""
326 act.triggered[()].connect(self.__runToCursor) 327 act.triggered[()].connect(self.__runToCursor)
327 self.actions.append(act) 328 self.actions.append(act)
328 329
329 act = E5Action(self.trUtf8('Single Step'), 330 act = E5Action(self.trUtf8('Single Step'),
330 UI.PixmapCache.getIcon("step.png"), 331 UI.PixmapCache.getIcon("step.png"),
331 self.trUtf8('Sin&gle Step'),Qt.Key_F7,0, 332 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0,
332 self.debugActGrp,'dbg_single_step') 333 self.debugActGrp, 'dbg_single_step')
333 act.setStatusTip(self.trUtf8('Execute a single Python statement')) 334 act.setStatusTip(self.trUtf8('Execute a single Python statement'))
334 act.setWhatsThis(self.trUtf8( 335 act.setWhatsThis(self.trUtf8(
335 """<b>Single Step</b>""" 336 """<b>Single Step</b>"""
336 """<p>Execute a single Python statement. If the statement""" 337 """<p>Execute a single Python statement. If the statement"""
337 """ is an <tt>import</tt> statement, a class constructor, or a""" 338 """ is an <tt>import</tt> statement, a class constructor, or a"""
341 act.triggered[()].connect(self.__step) 342 act.triggered[()].connect(self.__step)
342 self.actions.append(act) 343 self.actions.append(act)
343 344
344 act = E5Action(self.trUtf8('Step Over'), 345 act = E5Action(self.trUtf8('Step Over'),
345 UI.PixmapCache.getIcon("stepOver.png"), 346 UI.PixmapCache.getIcon("stepOver.png"),
346 self.trUtf8('Step &Over'),Qt.Key_F8,0, 347 self.trUtf8('Step &Over'), Qt.Key_F8, 0,
347 self.debugActGrp,'dbg_step_over') 348 self.debugActGrp, 'dbg_step_over')
348 act.setStatusTip(self.trUtf8("""Execute a single Python statement staying""" 349 act.setStatusTip(self.trUtf8("""Execute a single Python statement staying"""
349 """ in the current frame""")) 350 """ in the current frame"""))
350 act.setWhatsThis(self.trUtf8( 351 act.setWhatsThis(self.trUtf8(
351 """<b>Step Over</b>""" 352 """<b>Step Over</b>"""
352 """<p>Execute a single Python statement staying in the same frame. If""" 353 """<p>Execute a single Python statement staying in the same frame. If"""
357 act.triggered[()].connect(self.__stepOver) 358 act.triggered[()].connect(self.__stepOver)
358 self.actions.append(act) 359 self.actions.append(act)
359 360
360 act = E5Action(self.trUtf8('Step Out'), 361 act = E5Action(self.trUtf8('Step Out'),
361 UI.PixmapCache.getIcon("stepOut.png"), 362 UI.PixmapCache.getIcon("stepOut.png"),
362 self.trUtf8('Step Ou&t'),Qt.Key_F9,0, 363 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0,
363 self.debugActGrp,'dbg_step_out') 364 self.debugActGrp, 'dbg_step_out')
364 act.setStatusTip(self.trUtf8("""Execute Python statements until leaving""" 365 act.setStatusTip(self.trUtf8("""Execute Python statements until leaving"""
365 """ the current frame""")) 366 """ the current frame"""))
366 act.setWhatsThis(self.trUtf8( 367 act.setWhatsThis(self.trUtf8(
367 """<b>Step Out</b>""" 368 """<b>Step Out</b>"""
368 """<p>Execute Python statements until leaving the current frame. If""" 369 """<p>Execute Python statements until leaving the current frame. If"""
373 act.triggered[()].connect(self.__stepOut) 374 act.triggered[()].connect(self.__stepOut)
374 self.actions.append(act) 375 self.actions.append(act)
375 376
376 act = E5Action(self.trUtf8('Stop'), 377 act = E5Action(self.trUtf8('Stop'),
377 UI.PixmapCache.getIcon("stepQuit.png"), 378 UI.PixmapCache.getIcon("stepQuit.png"),
378 self.trUtf8('&Stop'),Qt.Key_F10,0, 379 self.trUtf8('&Stop'), Qt.Key_F10, 0,
379 self.debugActGrp,'dbg_stop') 380 self.debugActGrp, 'dbg_stop')
380 act.setStatusTip(self.trUtf8('Stop debugging')) 381 act.setStatusTip(self.trUtf8('Stop debugging'))
381 act.setWhatsThis(self.trUtf8( 382 act.setWhatsThis(self.trUtf8(
382 """<b>Stop</b>""" 383 """<b>Stop</b>"""
383 """<p>Stop the running debugging session.</p>""" 384 """<p>Stop the running debugging session.</p>"""
384 )) 385 ))
387 388
388 self.debugActGrp2 = createActionGroup(self) 389 self.debugActGrp2 = createActionGroup(self)
389 390
390 act = E5Action(self.trUtf8('Evaluate'), 391 act = E5Action(self.trUtf8('Evaluate'),
391 self.trUtf8('E&valuate...'), 392 self.trUtf8('E&valuate...'),
392 0,0,self.debugActGrp2,'dbg_evaluate') 393 0, 0, self.debugActGrp2, 'dbg_evaluate')
393 act.setStatusTip(self.trUtf8('Evaluate in current context')) 394 act.setStatusTip(self.trUtf8('Evaluate in current context'))
394 act.setWhatsThis(self.trUtf8( 395 act.setWhatsThis(self.trUtf8(
395 """<b>Evaluate</b>""" 396 """<b>Evaluate</b>"""
396 """<p>Evaluate an expression in the current context of the""" 397 """<p>Evaluate an expression in the current context of the"""
397 """ debugged program. The result is displayed in the""" 398 """ debugged program. The result is displayed in the"""
400 act.triggered[()].connect(self.__eval) 401 act.triggered[()].connect(self.__eval)
401 self.actions.append(act) 402 self.actions.append(act)
402 403
403 act = E5Action(self.trUtf8('Execute'), 404 act = E5Action(self.trUtf8('Execute'),
404 self.trUtf8('E&xecute...'), 405 self.trUtf8('E&xecute...'),
405 0,0,self.debugActGrp2,'dbg_execute') 406 0, 0, self.debugActGrp2, 'dbg_execute')
406 act.setStatusTip( 407 act.setStatusTip(
407 self.trUtf8('Execute a one line statement in the current context')) 408 self.trUtf8('Execute a one line statement in the current context'))
408 act.setWhatsThis(self.trUtf8( 409 act.setWhatsThis(self.trUtf8(
409 """<b>Execute</b>""" 410 """<b>Execute</b>"""
410 """<p>Execute a one line statement in the current context""" 411 """<p>Execute a one line statement in the current context"""
412 )) 413 ))
413 act.triggered[()].connect(self.__exec) 414 act.triggered[()].connect(self.__exec)
414 self.actions.append(act) 415 self.actions.append(act)
415 416
416 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'), 417 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'),
417 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self, 418 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self,
418 'dbg_variables_filter') 419 'dbg_variables_filter')
419 self.dbgFilterAct.setStatusTip(self.trUtf8('Configure variables type filter')) 420 self.dbgFilterAct.setStatusTip(self.trUtf8('Configure variables type filter'))
420 self.dbgFilterAct.setWhatsThis(self.trUtf8( 421 self.dbgFilterAct.setWhatsThis(self.trUtf8(
421 """<b>Variables Type Filter</b>""" 422 """<b>Variables Type Filter</b>"""
422 """<p>Configure the variables type filter. Only variable types that are not""" 423 """<p>Configure the variables type filter. Only variable types that are not"""
438 )) 439 ))
439 self.excFilterAct.triggered[()].connect(self.__configureExceptionsFilter) 440 self.excFilterAct.triggered[()].connect(self.__configureExceptionsFilter)
440 self.actions.append(self.excFilterAct) 441 self.actions.append(self.excFilterAct)
441 442
442 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'), 443 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'),
443 self.trUtf8('&Ignored Exceptions...'), 0, 0, 444 self.trUtf8('&Ignored Exceptions...'), 0, 0,
444 self, 'dbg_ignored_exceptions') 445 self, 'dbg_ignored_exceptions')
445 self.excIgnoreFilterAct.setStatusTip(self.trUtf8('Configure ignored exceptions')) 446 self.excIgnoreFilterAct.setStatusTip(self.trUtf8('Configure ignored exceptions'))
446 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8( 447 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8(
447 """<b>Ignored Exceptions</b>""" 448 """<b>Ignored Exceptions</b>"""
448 """<p>Configure the ignored exceptions. Only exception types that are""" 449 """<p>Configure the ignored exceptions. Only exception types that are"""
454 455
455 self.dbgSetBpActGrp = createActionGroup(self) 456 self.dbgSetBpActGrp = createActionGroup(self)
456 457
457 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'), 458 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'),
458 UI.PixmapCache.getIcon("breakpointToggle.png"), 459 UI.PixmapCache.getIcon("breakpointToggle.png"),
459 self.trUtf8('Toggle Breakpoint'), 460 self.trUtf8('Toggle Breakpoint'),
460 QKeySequence(self.trUtf8("Shift+F11","Debug|Toggle Breakpoint")), 0, 461 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")), 0,
461 self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') 462 self.dbgSetBpActGrp, 'dbg_toggle_breakpoint')
462 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint')) 463 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint'))
463 self.dbgToggleBpAct.setWhatsThis(self.trUtf8( 464 self.dbgToggleBpAct.setWhatsThis(self.trUtf8(
464 """<b>Toggle Breakpoint</b>""" 465 """<b>Toggle Breakpoint</b>"""
465 """<p>Toggles a breakpoint at the current line of the""" 466 """<p>Toggles a breakpoint at the current line of the"""
469 self.actions.append(self.dbgToggleBpAct) 470 self.actions.append(self.dbgToggleBpAct)
470 471
471 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'), 472 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'),
472 UI.PixmapCache.getIcon("cBreakpointToggle.png"), 473 UI.PixmapCache.getIcon("cBreakpointToggle.png"),
473 self.trUtf8('Edit Breakpoint...'), 474 self.trUtf8('Edit Breakpoint...'),
474 QKeySequence(self.trUtf8("Shift+F12","Debug|Edit Breakpoint")), 0, 475 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0,
475 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') 476 self.dbgSetBpActGrp, 'dbg_edit_breakpoint')
476 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint')) 477 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint'))
477 self.dbgEditBpAct.setWhatsThis(self.trUtf8( 478 self.dbgEditBpAct.setWhatsThis(self.trUtf8(
478 """<b>Edit Breakpoint</b>""" 479 """<b>Edit Breakpoint</b>"""
479 """<p>Opens a dialog to edit the breakpoints properties.""" 480 """<p>Opens a dialog to edit the breakpoints properties."""
483 self.actions.append(self.dbgEditBpAct) 484 self.actions.append(self.dbgEditBpAct)
484 485
485 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'), 486 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'),
486 UI.PixmapCache.getIcon("breakpointNext.png"), 487 UI.PixmapCache.getIcon("breakpointNext.png"),
487 self.trUtf8('Next Breakpoint'), 488 self.trUtf8('Next Breakpoint'),
488 QKeySequence(self.trUtf8("Ctrl+Shift+PgDown","Debug|Next Breakpoint")), 0, 489 QKeySequence(self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0,
489 self.dbgSetBpActGrp, 'dbg_next_breakpoint') 490 self.dbgSetBpActGrp, 'dbg_next_breakpoint')
490 self.dbgNextBpAct.setStatusTip(self.trUtf8('Next Breakpoint')) 491 self.dbgNextBpAct.setStatusTip(self.trUtf8('Next Breakpoint'))
491 self.dbgNextBpAct.setWhatsThis(self.trUtf8( 492 self.dbgNextBpAct.setWhatsThis(self.trUtf8(
492 """<b>Next Breakpoint</b>""" 493 """<b>Next Breakpoint</b>"""
493 """<p>Go to next breakpoint of the current editor.</p>""" 494 """<p>Go to next breakpoint of the current editor.</p>"""
496 self.actions.append(self.dbgNextBpAct) 497 self.actions.append(self.dbgNextBpAct)
497 498
498 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'), 499 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'),
499 UI.PixmapCache.getIcon("breakpointPrevious.png"), 500 UI.PixmapCache.getIcon("breakpointPrevious.png"),
500 self.trUtf8('Previous Breakpoint'), 501 self.trUtf8('Previous Breakpoint'),
501 QKeySequence(self.trUtf8("Ctrl+Shift+PgUp","Debug|Previous Breakpoint")), 502 QKeySequence(self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")),
502 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint') 503 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint')
503 self.dbgPrevBpAct.setStatusTip(self.trUtf8('Previous Breakpoint')) 504 self.dbgPrevBpAct.setStatusTip(self.trUtf8('Previous Breakpoint'))
504 self.dbgPrevBpAct.setWhatsThis(self.trUtf8( 505 self.dbgPrevBpAct.setWhatsThis(self.trUtf8(
505 """<b>Previous Breakpoint</b>""" 506 """<b>Previous Breakpoint</b>"""
506 """<p>Go to previous breakpoint of the current editor.</p>""" 507 """<p>Go to previous breakpoint of the current editor.</p>"""
508 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint) 509 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint)
509 self.actions.append(self.dbgPrevBpAct) 510 self.actions.append(self.dbgPrevBpAct)
510 511
511 act = E5Action(self.trUtf8('Clear Breakpoints'), 512 act = E5Action(self.trUtf8('Clear Breakpoints'),
512 self.trUtf8('Clear Breakpoints'), 513 self.trUtf8('Clear Breakpoints'),
513 QKeySequence(self.trUtf8("Ctrl+Shift+C","Debug|Clear Breakpoints")), 0, 514 QKeySequence(self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0,
514 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') 515 self.dbgSetBpActGrp, 'dbg_clear_breakpoint')
515 act.setStatusTip(self.trUtf8('Clear Breakpoints')) 516 act.setStatusTip(self.trUtf8('Clear Breakpoints'))
516 act.setWhatsThis(self.trUtf8( 517 act.setWhatsThis(self.trUtf8(
517 """<b>Clear Breakpoints</b>""" 518 """<b>Clear Breakpoints</b>"""
518 """<p>Clear breakpoints of all editors.</p>""" 519 """<p>Clear breakpoints of all editors.</p>"""
618 toolbarManager.addAction(self.coverageAct, starttb.windowTitle()) 619 toolbarManager.addAction(self.coverageAct, starttb.windowTitle())
619 toolbarManager.addAction(self.coverageProjectAct, starttb.windowTitle()) 620 toolbarManager.addAction(self.coverageProjectAct, starttb.windowTitle())
620 621
621 return [starttb, debugtb] 622 return [starttb, debugtb]
622 623
623 def setArgvHistory(self, argsStr, clearHistories = False): 624 def setArgvHistory(self, argsStr, clearHistories=False):
624 """ 625 """
625 Public slot to initialize the argv history. 626 Public slot to initialize the argv history.
626 627
627 @param argsStr the commandline arguments (string) 628 @param argsStr the commandline arguments (string)
628 @param clearHistories flag indicating, that the list should 629 @param clearHistories flag indicating, that the list should
633 else: 634 else:
634 if argsStr in self.argvHistory: 635 if argsStr in self.argvHistory:
635 self.argvHistory.remove(argsStr) 636 self.argvHistory.remove(argsStr)
636 self.argvHistory.insert(0, argsStr) 637 self.argvHistory.insert(0, argsStr)
637 638
638 def setWdHistory(self, wdStr, clearHistories = False): 639 def setWdHistory(self, wdStr, clearHistories=False):
639 """ 640 """
640 Public slot to initialize the wd history. 641 Public slot to initialize the wd history.
641 642
642 @param wdStr the working directory (string) 643 @param wdStr the working directory (string)
643 @param clearHistories flag indicating, that the list should 644 @param clearHistories flag indicating, that the list should
648 else: 649 else:
649 if wdStr in self.wdHistory: 650 if wdStr in self.wdHistory:
650 self.wdHistory.remove(wdStr) 651 self.wdHistory.remove(wdStr)
651 self.wdHistory.insert(0, wdStr) 652 self.wdHistory.insert(0, wdStr)
652 653
653 def setEnvHistory(self, envStr, clearHistories = False): 654 def setEnvHistory(self, envStr, clearHistories=False):
654 """ 655 """
655 Public slot to initialize the env history. 656 Public slot to initialize the env history.
656 657
657 @param envStr the environment settings (string) 658 @param envStr the environment settings (string)
658 @param clearHistories flag indicating, that the list should 659 @param clearHistories flag indicating, that the list should
855 # Just save the 10 most recent entries 856 # Just save the 10 most recent entries
856 del self.argvHistory[10:] 857 del self.argvHistory[10:]
857 del self.wdHistory[10:] 858 del self.wdHistory[10:]
858 del self.envHistory[10:] 859 del self.envHistory[10:]
859 860
860 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory', 861 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory',
861 self.argvHistory) 862 self.argvHistory)
862 Preferences.Prefs.settings.setValue('DebugInfo/WorkingDirectoryHistory', 863 Preferences.Prefs.settings.setValue('DebugInfo/WorkingDirectoryHistory',
863 self.wdHistory) 864 self.wdHistory)
864 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory', 865 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory',
865 self.envHistory) 866 self.envHistory)
866 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions', 867 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions',
867 self.excList) 868 self.excList)
868 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions', 869 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions',
869 self.excIgnoreList) 870 self.excIgnoreList)
870 Preferences.Prefs.settings.setValue('DebugInfo/ReportExceptions', 871 Preferences.Prefs.settings.setValue('DebugInfo/ReportExceptions',
871 self.exceptions) 872 self.exceptions)
872 Preferences.Prefs.settings.setValue('DebugInfo/AutoClearShell', 873 Preferences.Prefs.settings.setValue('DebugInfo/AutoClearShell',
873 self.autoClearShell) 874 self.autoClearShell)
874 Preferences.Prefs.settings.setValue('DebugInfo/TracePython', 875 Preferences.Prefs.settings.setValue('DebugInfo/TracePython',
875 self.tracePython) 876 self.tracePython)
876 Preferences.Prefs.settings.setValue('DebugInfo/AutoContinue', 877 Preferences.Prefs.settings.setValue('DebugInfo/AutoContinue',
877 self.autoContinue) 878 self.autoContinue)
878 Preferences.Prefs.settings.setValue('DebugInfo/ForkAutomatically', 879 Preferences.Prefs.settings.setValue('DebugInfo/ForkAutomatically',
879 self.forkAutomatically) 880 self.forkAutomatically)
880 Preferences.Prefs.settings.setValue('DebugInfo/ForkIntoChild', 881 Preferences.Prefs.settings.setValue('DebugInfo/ForkIntoChild',
881 self.forkIntoChild) 882 self.forkIntoChild)
882 883
883 def shutdownServer(self): 884 def shutdownServer(self):
884 """ 885 """
885 Public method to shut down the debug server. 886 Public method to shut down the debug server.
977 self.__resetUI() 978 self.__resetUI()
978 self.ui.raise_() 979 self.ui.raise_()
979 self.ui.activateWindow() 980 self.ui.activateWindow()
980 981
981 if message is None: 982 if message is None:
982 E5MessageBox.critical(self.ui,Program, 983 E5MessageBox.critical(self.ui, Program,
983 self.trUtf8('The program being debugged contains an unspecified' 984 self.trUtf8('The program being debugged contains an unspecified'
984 ' syntax error.')) 985 ' syntax error.'))
985 return 986 return
986 987
987 self.viewmanager.setFileLine(filename, lineNo, True, True) 988 self.viewmanager.setFileLine(filename, lineNo, True, True)
988 E5MessageBox.critical(self.ui,Program, 989 E5MessageBox.critical(self.ui, Program,
989 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error' 990 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error'
990 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.</p>') 991 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.</p>')
991 .format(filename, message, lineNo, characterNo)) 992 .format(filename, message, lineNo, characterNo))
992 993
993 def __clientException(self, exceptionType, exceptionMessage, stackTrace): 994 def __clientException(self, exceptionType, exceptionMessage, stackTrace):
1000 """ 1001 """
1001 self.ui.raise_() 1002 self.ui.raise_()
1002 self.ui.activateWindow() 1003 self.ui.activateWindow()
1003 QApplication.processEvents() 1004 QApplication.processEvents()
1004 if exceptionType is None: 1005 if exceptionType is None:
1005 E5MessageBox.critical(self.ui,Program, 1006 E5MessageBox.critical(self.ui, Program,
1006 self.trUtf8('An unhandled exception occured.' 1007 self.trUtf8('An unhandled exception occured.'
1007 ' See the shell window for details.')) 1008 ' See the shell window for details.'))
1008 return 1009 return
1009 1010
1010 if (self.exceptions and \ 1011 if (self.exceptions and \
1029 E5MessageBox.Ignore) 1030 E5MessageBox.Ignore)
1030 res = E5MessageBox.critical(self.ui, Program, 1031 res = E5MessageBox.critical(self.ui, Program,
1031 self.trUtf8('<p>The debugged program raised the exception' 1032 self.trUtf8('<p>The debugged program raised the exception'
1032 ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,' 1033 ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
1033 ' Line: <b>{3}</b></p><p>Break here?</p>') 1034 ' Line: <b>{3}</b></p><p>Break here?</p>')
1034 .format(exceptionType, 1035 .format(exceptionType,
1035 Utilities.html_encode(exceptionMessage), 1036 Utilities.html_encode(exceptionMessage),
1036 stackTrace[0][0], 1037 stackTrace[0][0],
1037 stackTrace[0][1]), 1038 stackTrace[0][1]),
1038 buttons, 1039 buttons,
1039 E5MessageBox.No) 1040 E5MessageBox.No)
1040 else: 1041 else:
1041 res = E5MessageBox.critical(self.ui, Program, 1042 res = E5MessageBox.critical(self.ui, Program,
1042 self.trUtf8('<p>The debugged program raised the exception' 1043 self.trUtf8('<p>The debugged program raised the exception'
1043 ' <b>{0}</b><br>"<b>{1}</b>"</p>') 1044 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1044 .format(exceptionType, 1045 .format(exceptionType,
1045 Utilities.html_encode(exceptionMessage))) 1046 Utilities.html_encode(exceptionMessage)))
1046 if res == E5MessageBox.Yes: 1047 if res == E5MessageBox.Yes:
1047 self.exceptionInterrupt.emit() 1048 self.exceptionInterrupt.emit()
1048 stack = [] 1049 stack = []
1049 for fn, ln in stackTrace: 1050 for fn, ln in stackTrace:
1070 1071
1071 @param unplanned True if the client died, False otherwise 1072 @param unplanned True if the client died, False otherwise
1072 """ 1073 """
1073 self.__resetUI() 1074 self.__resetUI()
1074 if unplanned: 1075 if unplanned:
1075 E5MessageBox.information(self.ui,Program, 1076 E5MessageBox.information(self.ui, Program,
1076 self.trUtf8('The program being debugged has terminated unexpectedly.')) 1077 self.trUtf8('The program being debugged has terminated unexpectedly.'))
1077 1078
1078 def __getThreadList(self): 1079 def __getThreadList(self):
1079 """ 1080 """
1080 Private method to get the list of threads from the client. 1081 Private method to get the list of threads from the client.
1112 # now get the local variables 1113 # now get the local variables
1113 self.debugServer.remoteClientVariables(0, self.localsVarFilter) 1114 self.debugServer.remoteClientVariables(0, self.localsVarFilter)
1114 elif scope == 0: 1115 elif scope == 0:
1115 self.debugViewer.showVariables(variables, False) 1116 self.debugViewer.showVariables(variables, False)
1116 elif scope == -1: 1117 elif scope == -1:
1117 vlist = [('None','','')] 1118 vlist = [('None', '', '')]
1118 self.debugViewer.showVariables(vlist, False) 1119 self.debugViewer.showVariables(vlist, False)
1119 1120
1120 if scope < 1: 1121 if scope < 1:
1121 self.debugActGrp.setEnabled(True) 1122 self.debugActGrp.setEnabled(True)
1122 self.debugActGrp2.setEnabled(True) 1123 self.debugActGrp2.setEnabled(True)
1157 return 1158 return
1158 1159
1159 fn, line, cond, temp, enabled, count = bp[:6] 1160 fn, line, cond, temp, enabled, count = bp[:6]
1160 1161
1161 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count), 1162 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count),
1162 [], self.ui, modal = True) 1163 [], self.ui, modal=True)
1163 if dlg.exec_() == QDialog.Accepted: 1164 if dlg.exec_() == QDialog.Accepted:
1164 cond, temp, enabled, count = dlg.getData() 1165 cond, temp, enabled, count = dlg.getData()
1165 model.setBreakPointByIndex(index, fn, line, (cond, temp, enabled, count)) 1166 model.setBreakPointByIndex(index, fn, line, (cond, temp, enabled, count))
1166 1167
1167 def __clientWatchConditionError(self, cond): 1168 def __clientWatchConditionError(self, cond):
1203 """ already exists.</p>""")\ 1204 """ already exists.</p>""")\
1204 .format(Utilities.html_encode(cond)) 1205 .format(Utilities.html_encode(cond))
1205 else: 1206 else:
1206 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1207 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1207 """ for the variable <b>{1}</b> already exists.</p>""")\ 1208 """ for the variable <b>{1}</b> already exists.</p>""")\
1208 .format(special, 1209 .format(special,
1209 Utilities.html_encode(cond)) 1210 Utilities.html_encode(cond))
1210 E5MessageBox.warning(self, 1211 E5MessageBox.warning(self,
1211 self.trUtf8("Watch expression already exists"), 1212 self.trUtf8("Watch expression already exists"),
1212 msg) 1213 msg)
1213 model.deleteWatchPointByIndex(index) 1214 model.deleteWatchPointByIndex(index)
1214 else: 1215 else:
1215 model.setWatchPointByIndex(index, cond, special, 1216 model.setWatchPointByIndex(index, cond, special,
1216 (temp, enabled, count)) 1217 (temp, enabled, count))
1217 1218
1218 def __configureVariablesFilters(self): 1219 def __configureVariablesFilters(self):
1219 """ 1220 """
1220 Private slot for displaying the variables filter configuration dialog. 1221 Private slot for displaying the variables filter configuration dialog.
1230 1231
1231 def __configureExceptionsFilter(self): 1232 def __configureExceptionsFilter(self):
1232 """ 1233 """
1233 Private slot for displaying the exception filter dialog. 1234 Private slot for displaying the exception filter dialog.
1234 """ 1235 """
1235 dlg = ExceptionsFilterDialog(self.excList, ignore = False) 1236 dlg = ExceptionsFilterDialog(self.excList, ignore=False)
1236 if dlg.exec_() == QDialog.Accepted: 1237 if dlg.exec_() == QDialog.Accepted:
1237 self.excList = dlg.getExceptionsList()[:] # keep a copy 1238 self.excList = dlg.getExceptionsList()[:] # keep a copy
1238 1239
1239 def __configureIgnoredExceptions(self): 1240 def __configureIgnoredExceptions(self):
1240 """ 1241 """
1241 Private slot for displaying the ignored exceptions dialog. 1242 Private slot for displaying the ignored exceptions dialog.
1242 """ 1243 """
1243 dlg = ExceptionsFilterDialog(self.excIgnoreList, ignore = True) 1244 dlg = ExceptionsFilterDialog(self.excIgnoreList, ignore=True)
1244 if dlg.exec_() == QDialog.Accepted: 1245 if dlg.exec_() == QDialog.Accepted:
1245 self.excIgnoreList = dlg.getExceptionsList()[:] # keep a copy 1246 self.excIgnoreList = dlg.getExceptionsList()[:] # keep a copy
1246 1247
1247 def __toggleBreakpoint(self): 1248 def __toggleBreakpoint(self):
1248 """ 1249 """
1298 bpSuffix = " : {0:d}{1}".format(line, formattedCond) 1299 bpSuffix = " : {0:d}{1}".format(line, formattedCond)
1299 act = self.breakpointsMenu.addAction( 1300 act = self.breakpointsMenu.addAction(
1300 "{0}{1}".format( 1301 "{0}{1}".format(
1301 Utilities.compactPath( 1302 Utilities.compactPath(
1302 filename, 1303 filename,
1303 self.ui.maxMenuFilePathLen - len(bpSuffix)), 1304 self.ui.maxMenuFilePathLen - len(bpSuffix)),
1304 bpSuffix)) 1305 bpSuffix))
1305 act.setData([filename, line]) 1306 act.setData([filename, line])
1306 1307
1307 def __breakpointSelected(self, act): 1308 def __breakpointSelected(self, act):
1308 """ 1309 """
1354 if runProject: 1355 if runProject:
1355 cap = self.trUtf8("Coverage of Project") 1356 cap = self.trUtf8("Coverage of Project")
1356 else: 1357 else:
1357 cap = self.trUtf8("Coverage of Script") 1358 cap = self.trUtf8("Coverage of Script")
1358 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1359 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory,
1359 self.exceptions, self.ui, 2, autoClearShell = self.autoClearShell) 1360 self.exceptions, self.ui, 2, autoClearShell=self.autoClearShell)
1360 if dlg.exec_() == QDialog.Accepted: 1361 if dlg.exec_() == QDialog.Accepted:
1361 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1362 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData()
1362 eraseCoverage = dlg.getCoverageData() 1363 eraseCoverage = dlg.getCoverageData()
1363 1364
1364 if runProject: 1365 if runProject:
1369 self.trUtf8("There is no main script defined for the" 1370 self.trUtf8("There is no main script defined for the"
1370 " current project. Aborting")) 1371 " current project. Aborting"))
1371 return 1372 return
1372 1373
1373 if Preferences.getDebugger("Autosave") and \ 1374 if Preferences.getDebugger("Autosave") and \
1374 not self.project.saveAllScripts(reportSyntaxErrors = True): 1375 not self.project.saveAllScripts(reportSyntaxErrors=True):
1375 doNotStart = True 1376 doNotStart = True
1376 1377
1377 # save the info for later use 1378 # save the info for later use
1378 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1379 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1379 self.excIgnoreList, clearShell) 1380 self.excIgnoreList, clearShell)
1380 1381
1381 self.lastStartAction = 6 1382 self.lastStartAction = 6
1382 self.clientType = "" 1383 self.clientType = ""
1383 else: 1384 else:
1384 editor = self.viewmanager.activeWindow() 1385 editor = self.viewmanager.activeWindow()
1385 if editor is None: 1386 if editor is None:
1386 return 1387 return
1387 1388
1388 if not self.viewmanager.checkDirty(editor, 1389 if not self.viewmanager.checkDirty(editor,
1389 Preferences.getDebugger("Autosave")) or \ 1390 Preferences.getDebugger("Autosave")) or \
1390 editor.getFileName() is None: 1391 editor.getFileName() is None:
1391 return 1392 return
1392 1393
1393 fn = editor.getFileName() 1394 fn = editor.getFileName()
1423 if runProject and self.project.getProjectType() == "E4Plugin": 1424 if runProject and self.project.getProjectType() == "E4Plugin":
1424 argv = '--plugin="{0}" {1}'.format(fn, argv) 1425 argv = '--plugin="{0}" {1}'.format(fn, argv)
1425 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1426 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1426 1427
1427 # Ask the client to open the new program. 1428 # Ask the client to open the new program.
1428 self.debugServer.remoteCoverage(fn, argv, wd, env, 1429 self.debugServer.remoteCoverage(fn, argv, wd, env,
1429 autoClearShell = self.autoClearShell, erase = eraseCoverage, 1430 autoClearShell=self.autoClearShell, erase=eraseCoverage,
1430 forProject = runProject, runInConsole = console, 1431 forProject=runProject, runInConsole=console,
1431 clientType = self.clientType) 1432 clientType=self.clientType)
1432 1433
1433 self.stopAct.setEnabled(True) 1434 self.stopAct.setEnabled(True)
1434 1435
1435 def __profileScript(self): 1436 def __profileScript(self):
1436 """ 1437 """
1461 cap = self.trUtf8("Profile of Project") 1462 cap = self.trUtf8("Profile of Project")
1462 else: 1463 else:
1463 cap = self.trUtf8("Profile of Script") 1464 cap = self.trUtf8("Profile of Script")
1464 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1465 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory,
1465 self.exceptions, self.ui, 3, 1466 self.exceptions, self.ui, 3,
1466 autoClearShell = self.autoClearShell) 1467 autoClearShell=self.autoClearShell)
1467 if dlg.exec_() == QDialog.Accepted: 1468 if dlg.exec_() == QDialog.Accepted:
1468 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1469 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData()
1469 eraseTimings = dlg.getProfilingData() 1470 eraseTimings = dlg.getProfilingData()
1470 1471
1471 if runProject: 1472 if runProject:
1476 self.trUtf8("There is no main script defined for the" 1477 self.trUtf8("There is no main script defined for the"
1477 " current project. Aborting")) 1478 " current project. Aborting"))
1478 return 1479 return
1479 1480
1480 if Preferences.getDebugger("Autosave") and \ 1481 if Preferences.getDebugger("Autosave") and \
1481 not self.project.saveAllScripts(reportSyntaxErrors = True): 1482 not self.project.saveAllScripts(reportSyntaxErrors=True):
1482 doNotStart = True 1483 doNotStart = True
1483 1484
1484 # save the info for later use 1485 # save the info for later use
1485 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1486 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1486 self.excIgnoreList, clearShell) 1487 self.excIgnoreList, clearShell)
1490 else: 1491 else:
1491 editor = self.viewmanager.activeWindow() 1492 editor = self.viewmanager.activeWindow()
1492 if editor is None: 1493 if editor is None:
1493 return 1494 return
1494 1495
1495 if not self.viewmanager.checkDirty(editor, 1496 if not self.viewmanager.checkDirty(editor,
1496 Preferences.getDebugger("Autosave")) or \ 1497 Preferences.getDebugger("Autosave")) or \
1497 editor.getFileName() is None: 1498 editor.getFileName() is None:
1498 return 1499 return
1499 1500
1500 fn = editor.getFileName() 1501 fn = editor.getFileName()
1531 argv = '--plugin="{0}" {1}'.format(fn, argv) 1532 argv = '--plugin="{0}" {1}'.format(fn, argv)
1532 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1533 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1533 1534
1534 # Ask the client to open the new program. 1535 # Ask the client to open the new program.
1535 self.debugServer.remoteProfile(fn, argv, wd, env, 1536 self.debugServer.remoteProfile(fn, argv, wd, env,
1536 autoClearShell = self.autoClearShell, erase = eraseTimings, 1537 autoClearShell=self.autoClearShell, erase=eraseTimings,
1537 forProject = runProject, runInConsole = console, 1538 forProject=runProject, runInConsole=console,
1538 clientType = self.clientType) 1539 clientType=self.clientType)
1539 1540
1540 self.stopAct.setEnabled(True) 1541 self.stopAct.setEnabled(True)
1541 1542
1542 def __runScript(self): 1543 def __runScript(self):
1543 """ 1544 """
1566 # exception reporting flag. 1567 # exception reporting flag.
1567 if runProject: 1568 if runProject:
1568 cap = self.trUtf8("Run Project") 1569 cap = self.trUtf8("Run Project")
1569 else: 1570 else:
1570 cap = self.trUtf8("Run Script") 1571 cap = self.trUtf8("Run Script")
1571 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1572 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory,
1572 self.exceptions, self.ui, 1, 1573 self.exceptions, self.ui, 1,
1573 autoClearShell = self.autoClearShell, 1574 autoClearShell=self.autoClearShell,
1574 autoFork = self.forkAutomatically, 1575 autoFork=self.forkAutomatically,
1575 forkChild = self.forkIntoChild) 1576 forkChild=self.forkIntoChild)
1576 if dlg.exec_() == QDialog.Accepted: 1577 if dlg.exec_() == QDialog.Accepted:
1577 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1578 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData()
1578 forkAutomatically, forkIntoChild = dlg.getRunData() 1579 forkAutomatically, forkIntoChild = dlg.getRunData()
1579 1580
1580 if runProject: 1581 if runProject:
1585 self.trUtf8("There is no main script defined for the" 1586 self.trUtf8("There is no main script defined for the"
1586 " current project. Aborting")) 1587 " current project. Aborting"))
1587 return 1588 return
1588 1589
1589 if Preferences.getDebugger("Autosave") and \ 1590 if Preferences.getDebugger("Autosave") and \
1590 not self.project.saveAllScripts(reportSyntaxErrors = True): 1591 not self.project.saveAllScripts(reportSyntaxErrors=True):
1591 doNotStart = True 1592 doNotStart = True
1592 1593
1593 # save the info for later use 1594 # save the info for later use
1594 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1595 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1595 self.excIgnoreList, clearShell) 1596 self.excIgnoreList, clearShell)
1599 else: 1600 else:
1600 editor = self.viewmanager.activeWindow() 1601 editor = self.viewmanager.activeWindow()
1601 if editor is None: 1602 if editor is None:
1602 return 1603 return
1603 1604
1604 if not self.viewmanager.checkDirty(editor, 1605 if not self.viewmanager.checkDirty(editor,
1605 Preferences.getDebugger("Autosave")) or \ 1606 Preferences.getDebugger("Autosave")) or \
1606 editor.getFileName() is None: 1607 editor.getFileName() is None:
1607 return 1608 return
1608 1609
1609 fn = editor.getFileName() 1610 fn = editor.getFileName()
1641 argv = '--plugin="{0}" {1}'.format(fn, argv) 1642 argv = '--plugin="{0}" {1}'.format(fn, argv)
1642 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1643 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1643 1644
1644 # Ask the client to open the new program. 1645 # Ask the client to open the new program.
1645 self.debugServer.remoteRun(fn, argv, wd, env, 1646 self.debugServer.remoteRun(fn, argv, wd, env,
1646 autoClearShell = self.autoClearShell, forProject = runProject, 1647 autoClearShell=self.autoClearShell, forProject=runProject,
1647 runInConsole = console, autoFork = forkAutomatically, 1648 runInConsole=console, autoFork=forkAutomatically,
1648 forkChild = forkIntoChild, clientType = self.clientType) 1649 forkChild=forkIntoChild, clientType=self.clientType)
1649 1650
1650 self.stopAct.setEnabled(True) 1651 self.stopAct.setEnabled(True)
1651 1652
1652 def __debugScript(self): 1653 def __debugScript(self):
1653 """ 1654 """
1676 # exception reporting flag. 1677 # exception reporting flag.
1677 if debugProject: 1678 if debugProject:
1678 cap = self.trUtf8("Debug Project") 1679 cap = self.trUtf8("Debug Project")
1679 else: 1680 else:
1680 cap = self.trUtf8("Debug Script") 1681 cap = self.trUtf8("Debug Script")
1681 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory, 1682 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, self.envHistory,
1682 self.exceptions, self.ui, 0, tracePython = self.tracePython, 1683 self.exceptions, self.ui, 0, tracePython=self.tracePython,
1683 autoClearShell = self.autoClearShell, autoContinue = self.autoContinue, 1684 autoClearShell=self.autoClearShell, autoContinue=self.autoContinue,
1684 autoFork = self.forkAutomatically, forkChild = self.forkIntoChild) 1685 autoFork=self.forkAutomatically, forkChild=self.forkIntoChild)
1685 if dlg.exec_() == QDialog.Accepted: 1686 if dlg.exec_() == QDialog.Accepted:
1686 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData() 1687 argv, wd, env, exceptions, clearShell, clearHistories, console = dlg.getData()
1687 tracePython, autoContinue, forkAutomatically, forkIntoChild = \ 1688 tracePython, autoContinue, forkAutomatically, forkIntoChild = \
1688 dlg.getDebugData() 1689 dlg.getDebugData()
1689 1690
1695 self.trUtf8("There is no main script defined for the" 1696 self.trUtf8("There is no main script defined for the"
1696 " current project. No debugging possible.")) 1697 " current project. No debugging possible."))
1697 return 1698 return
1698 1699
1699 if Preferences.getDebugger("Autosave") and \ 1700 if Preferences.getDebugger("Autosave") and \
1700 not self.project.saveAllScripts(reportSyntaxErrors = True): 1701 not self.project.saveAllScripts(reportSyntaxErrors=True):
1701 doNotStart = True 1702 doNotStart = True
1702 1703
1703 # save the info for later use 1704 # save the info for later use
1704 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1705 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1705 self.excIgnoreList, clearShell, tracePython = tracePython, 1706 self.excIgnoreList, clearShell, tracePython=tracePython,
1706 autoContinue = self.autoContinue) 1707 autoContinue=self.autoContinue)
1707 1708
1708 self.lastStartAction = 2 1709 self.lastStartAction = 2
1709 self.clientType = "" 1710 self.clientType = ""
1710 else: 1711 else:
1711 editor = self.viewmanager.activeWindow() 1712 editor = self.viewmanager.activeWindow()
1712 if editor is None: 1713 if editor is None:
1713 return 1714 return
1714 1715
1715 if not self.viewmanager.checkDirty(editor, 1716 if not self.viewmanager.checkDirty(editor,
1716 Preferences.getDebugger("Autosave")) or \ 1717 Preferences.getDebugger("Autosave")) or \
1717 editor.getFileName() is None: 1718 editor.getFileName() is None:
1718 return 1719 return
1719 1720
1720 fn = editor.getFileName() 1721 fn = editor.getFileName()
1755 1756
1756 if not doNotStart: 1757 if not doNotStart:
1757 if debugProject and self.project.getProjectType() == "E4Plugin": 1758 if debugProject and self.project.getProjectType() == "E4Plugin":
1758 argv = '--plugin="{0}" {1}'.format(fn, argv) 1759 argv = '--plugin="{0}" {1}'.format(fn, argv)
1759 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1760 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1760 tracePython = True # override flag because it must be true 1761 tracePython = True # override flag because it must be true
1761 1762
1762 # Ask the client to open the new program. 1763 # Ask the client to open the new program.
1763 self.debugServer.remoteLoad(fn, argv, wd, env, 1764 self.debugServer.remoteLoad(fn, argv, wd, env,
1764 autoClearShell = self.autoClearShell, tracePython = tracePython, 1765 autoClearShell=self.autoClearShell, tracePython=tracePython,
1765 autoContinue = autoContinue, forProject = debugProject, 1766 autoContinue=autoContinue, forProject=debugProject,
1766 runInConsole = console, autoFork = forkAutomatically, 1767 runInConsole=console, autoFork=forkAutomatically,
1767 forkChild = forkIntoChild, clientType = self.clientType) 1768 forkChild=forkIntoChild, clientType=self.clientType)
1768 1769
1769 # Signal that we have started a debugging session 1770 # Signal that we have started a debugging session
1770 self.debuggingStarted.emit(fn) 1771 self.debuggingStarted.emit(fn)
1771 1772
1772 self.stopAct.setEnabled(True) 1773 self.stopAct.setEnabled(True)
1780 1781
1781 # first save any changes 1782 # first save any changes
1782 if self.lastStartAction in [1, 3, 5, 7, 9]: 1783 if self.lastStartAction in [1, 3, 5, 7, 9]:
1783 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile) 1784 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile)
1784 if editor and \ 1785 if editor and \
1785 not self.viewmanager.checkDirty(editor, 1786 not self.viewmanager.checkDirty(editor,
1786 Preferences.getDebugger("Autosave")): 1787 Preferences.getDebugger("Autosave")):
1787 return 1788 return
1788 forProject = False 1789 forProject = False
1789 elif self.lastStartAction in [2, 4, 6, 8, 10]: 1790 elif self.lastStartAction in [2, 4, 6, 8, 10]:
1790 if Preferences.getDebugger("Autosave") and \ 1791 if Preferences.getDebugger("Autosave") and \
1791 not self.project.saveAllScripts(reportSyntaxErrors = True): 1792 not self.project.saveAllScripts(reportSyntaxErrors=True):
1792 doNotStart = True 1793 doNotStart = True
1793 self.__compileChangedProjectFiles() 1794 self.__compileChangedProjectFiles()
1794 forProject = True 1795 forProject = True
1795 else: 1796 else:
1796 return # should not happen 1797 return # should not happen
1809 argv = '--plugin="{0}" {1}'.format(fn, argv) 1810 argv = '--plugin="{0}" {1}'.format(fn, argv)
1810 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1811 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1811 1812
1812 if self.lastStartAction in [1, 2]: 1813 if self.lastStartAction in [1, 2]:
1813 # Ask the client to debug the new program. 1814 # Ask the client to debug the new program.
1814 self.debugServer.remoteLoad(fn, argv, wd, env, 1815 self.debugServer.remoteLoad(fn, argv, wd, env,
1815 autoClearShell = self.autoClearShell, tracePython = self.tracePython, 1816 autoClearShell=self.autoClearShell, tracePython=self.tracePython,
1816 autoContinue = self.autoContinue, forProject = forProject, 1817 autoContinue=self.autoContinue, forProject=forProject,
1817 runInConsole = self.runInConsole, autoFork = self.forkAutomatically, 1818 runInConsole=self.runInConsole, autoFork=self.forkAutomatically,
1818 forkChild = self.forkIntoChild, clientType = self.clientType) 1819 forkChild=self.forkIntoChild, clientType=self.clientType)
1819 1820
1820 # Signal that we have started a debugging session 1821 # Signal that we have started a debugging session
1821 self.debuggingStarted.emit(fn) 1822 self.debuggingStarted.emit(fn)
1822 1823
1823 elif self.lastStartAction in [3, 4]: 1824 elif self.lastStartAction in [3, 4]:
1824 # Ask the client to run the new program. 1825 # Ask the client to run the new program.
1825 self.debugServer.remoteRun(fn, argv, wd, env, 1826 self.debugServer.remoteRun(fn, argv, wd, env,
1826 autoClearShell = self.autoClearShell, forProject = forProject, 1827 autoClearShell=self.autoClearShell, forProject=forProject,
1827 runInConsole = self.runInConsole, autoFork = self.forkAutomatically, 1828 runInConsole=self.runInConsole, autoFork=self.forkAutomatically,
1828 forkChild = self.forkIntoChild, clientType = self.clientType) 1829 forkChild=self.forkIntoChild, clientType=self.clientType)
1829 1830
1830 elif self.lastStartAction in [5, 6]: 1831 elif self.lastStartAction in [5, 6]:
1831 # Ask the client to coverage run the new program. 1832 # Ask the client to coverage run the new program.
1832 self.debugServer.remoteCoverage(fn, argv, wd, env, 1833 self.debugServer.remoteCoverage(fn, argv, wd, env,
1833 autoClearShell = self.autoClearShell, erase = self.eraseCoverage, 1834 autoClearShell=self.autoClearShell, erase=self.eraseCoverage,
1834 forProject = forProject, runInConsole = self.runInConsole, 1835 forProject=forProject, runInConsole=self.runInConsole,
1835 clientType = self.clientType) 1836 clientType=self.clientType)
1836 1837
1837 elif self.lastStartAction in [7, 8]: 1838 elif self.lastStartAction in [7, 8]:
1838 # Ask the client to profile run the new program. 1839 # Ask the client to profile run the new program.
1839 self.debugServer.remoteProfile(fn, argv, wd, env, 1840 self.debugServer.remoteProfile(fn, argv, wd, env,
1840 autoClearShell = self.autoClearShell, erase = self.eraseTimings, 1841 autoClearShell=self.autoClearShell, erase=self.eraseTimings,
1841 forProject = forProject, runInConsole = self.runInConsole, 1842 forProject=forProject, runInConsole=self.runInConsole,
1842 clientType = self.clientType) 1843 clientType=self.clientType)
1843 1844
1844 self.stopAct.setEnabled(True) 1845 self.stopAct.setEnabled(True)
1845 1846
1846 def __stopScript(self): 1847 def __stopScript(self):
1847 """ 1848 """
1923 """ 1924 """
1924 self.lastAction = 0 1925 self.lastAction = 0
1925 aw = self.viewmanager.activeWindow() 1926 aw = self.viewmanager.activeWindow()
1926 line = aw.getCursorPosition()[0] + 1 1927 line = aw.getCursorPosition()[0] + 1
1927 self.__enterRemote() 1928 self.__enterRemote()
1928 self.debugServer.remoteBreakpoint(aw.getFileName(), 1929 self.debugServer.remoteBreakpoint(aw.getFileName(),
1929 line, 1, None, 1) 1930 line, 1, None, 1)
1930 self.debugServer.remoteContinue() 1931 self.debugServer.remoteContinue()
1931 1932
1932 def __eval(self): 1933 def __eval(self):
1933 """ 1934 """

eric ide

mercurial