eric6/Debugger/DebugViewer.py

branch
multi_processing
changeset 7410
401791e6f50f
parent 7407
a0b6acee2c20
child 7411
6d8dcb3551b3
equal deleted inserted replaced
7409:1413bfe73d41 7410:401791e6f50f
21 """ 21 """
22 22
23 23
24 import os 24 import os
25 25
26 from PyQt5.QtCore import pyqtSignal, Qt 26 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt
27 from PyQt5.QtWidgets import ( 27 from PyQt5.QtWidgets import (
28 QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QSizePolicy, QPushButton, 28 QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QSizePolicy, QPushButton,
29 QComboBox, QLabel, QTreeWidget, QTreeWidgetItem, QHeaderView, QFrame 29 QComboBox, QLabel, QTreeWidget, QTreeWidgetItem, QHeaderView, QFrame
30 ) 30 )
31 31
280 self.__clientLine) 280 self.__clientLine)
281 self.debugServer.clientSyntaxError.connect( 281 self.debugServer.clientSyntaxError.connect(
282 self.__clientSyntaxError) 282 self.__clientSyntaxError)
283 self.debugServer.clientException.connect( 283 self.debugServer.clientException.connect(
284 self.__clientException) 284 self.__clientException)
285 self.debugServer.clientExit.connect(
286 self.__clientExit)
285 287
286 self.debugServer.clientException.connect( 288 self.debugServer.clientException.connect(
287 self.exceptionLogger.addException) 289 self.exceptionLogger.addException)
288 self.debugServer.passiveDebugStarted.connect( 290 self.debugServer.passiveDebugStarted.connect(
289 self.exceptionLogger.debuggingStarted) 291 self.exceptionLogger.debuggingStarted)
430 @param line linenumber 432 @param line linenumber
431 @type int 433 @type int
432 @param debuggerId ID of the debugger backend 434 @param debuggerId ID of the debugger backend
433 @type str 435 @type str
434 """ 436 """
435 self.__setDebuggerIconAndState(debuggerId, "mediaPlaybackPause", 437 self.__setDebuggerIconAndState(debuggerId, "break", "broken")
436 "broken") 438 if debuggerId != self.getSelectedDebuggerId():
439 self.__debuggersCombo.setCurrentText(debuggerId)
440
441 @pyqtSlot(int, str, bool, str)
442 def __clientExit(self, status, message, quiet, debuggerId):
443 """
444 Private method to handle the debugged program terminating.
445
446 @param status exit code of the debugged program
447 @type int
448 @param message exit message of the debugged program
449 @type str
450 @param quiet flag indicating to suppress exit info display
451 @type bool
452 @param debuggerId ID of the debugger backend
453 @type str
454 """
455 self.__setDebuggerIconAndState(debuggerId, "exit", "exited")
456 if debuggerId == self.getSelectedDebuggerId():
457 # the current client has exited
458 self.globalsViewer.handleResetUI()
459 self.localsViewer.handleResetUI()
460 self.setGlobalsFilter()
461 self.setLocalsFilter()
462 self.sourceButton.setEnabled(False)
463 self.currentStack = None
464 self.stackComboBox.clear()
465 self.__threadList.clear()
437 466
438 def __clientSyntaxError(self, message, filename, lineNo, characterNo, 467 def __clientSyntaxError(self, message, filename, lineNo, characterNo,
439 debuggerId): 468 debuggerId):
440 """ 469 """
441 Private method to handle a syntax error in the debugged program. 470 Private method to handle a syntax error in the debugged program.
578 state = self.tr("waiting at exception") 607 state = self.tr("waiting at exception")
579 icon = "exceptions" 608 icon = "exceptions"
580 debugStatus = 1 609 debugStatus = 1
581 elif thread['broken']: 610 elif thread['broken']:
582 state = self.tr("waiting at breakpoint") 611 state = self.tr("waiting at breakpoint")
583 icon = "mediaPlaybackPause" 612 icon = "break"
584 if debugStatus < 1: 613 if debugStatus < 1:
585 debugStatus = 0 614 debugStatus = 0
586 else: 615 else:
587 state = self.tr("running") 616 state = self.tr("running")
588 icon = "mediaPlaybackStart" 617 icon = "mediaPlaybackStart"
606 if thread.get('except', False): 635 if thread.get('except', False):
607 debugStatus = 1 636 debugStatus = 1
608 elif thread['broken']: 637 elif thread['broken']:
609 if debugStatus < 1: 638 if debugStatus < 1:
610 debugStatus = 0 639 debugStatus = 0
640 if not threadList:
641 # empty threadlist means 'exited'
642 debugStatus = 2
611 643
612 if debugStatus == -1: 644 if debugStatus == -1:
613 icon = "mediaPlaybackStart" 645 icon = "mediaPlaybackStart"
614 state = "running" 646 state = "running"
615 elif debugStatus == 0: 647 elif debugStatus == 0:
616 icon = "mediaPlaybackPause" 648 icon = "break"
617 state = "broken" 649 state = "broken"
618 else: 650 elif debugStatus == 1:
619 icon = "exceptions" 651 icon = "exceptions"
620 state = "exception" 652 state = "exception"
653 else:
654 icon = "exit"
655 state = "exited"
621 self.__setDebuggerIconAndState("", icon, state) 656 self.__setDebuggerIconAndState("", icon, state)
622 657
623 def __threadSelected(self, current, previous): 658 def __threadSelected(self, current, previous):
624 """ 659 """
625 Private slot to handle the selection of a thread in the thread list. 660 Private slot to handle the selection of a thread in the thread list.
692 727
693 def getSelectedDebuggerState(self): 728 def getSelectedDebuggerState(self):
694 """ 729 """
695 Public method to get the currently selected debugger's state. 730 Public method to get the currently selected debugger's state.
696 731
697 @return selected debugger's state (running, broken, exception) 732 @return selected debugger's state (broken, exception, exited, running)
698 @rtype str 733 @rtype str
699 """ 734 """
700 return self.__debuggersCombo.currentData() 735 return self.__debuggersCombo.currentData()
701 736
702 def __setDebuggerIconAndState(self, debuggerId, iconName, state): 737 def __setDebuggerIconAndState(self, debuggerId, iconName, state):
706 @param debuggerId ID of the debugger backend (empty ID means the 741 @param debuggerId ID of the debugger backend (empty ID means the
707 currently selected one) 742 currently selected one)
708 @type str 743 @type str
709 @param iconName name of the icon to be used 744 @param iconName name of the icon to be used
710 @type str 745 @type str
711 @param state state of the debugger (running, broken, exception) 746 @param state state of the debugger (broken, exception, exited, running)
712 @type str 747 @type str
713 """ 748 """
714 if debuggerId: 749 if debuggerId:
715 index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) 750 index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly)
716 else: 751 else:

eric ide

mercurial