Debugger/DebugViewer.py

changeset 945
8cd4d08fa9f6
parent 821
4c4a4525e69a
child 1112
8a7d1b9d18db
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
32 32
33 import UI.PixmapCache 33 import UI.PixmapCache
34 34
35 from E5Gui.E5TabWidget import E5TabWidget 35 from E5Gui.E5TabWidget import E5TabWidget
36 36
37
37 class DebugViewer(QWidget): 38 class DebugViewer(QWidget):
38 """ 39 """
39 Class implementing a widget conatining various debug related views. 40 Class implementing a widget conatining various debug related views.
40 41
41 The individual tabs contain the interpreter shell (optional), 42 The individual tabs contain the interpreter shell (optional),
42 the filesystem browser (optional), the two variables viewers (global and local), 43 the filesystem browser (optional), the two variables viewers (global and local),
43 a breakpoint viewer, a watch expression viewer and the exception logger. Additionally 44 a breakpoint viewer, a watch expression viewer and the exception logger. Additionally
44 a list of all threads is shown. 45 a list of all threads is shown.
45 46
46 @signal sourceFile(string, int) emitted to open a source file at a line 47 @signal sourceFile(string, int) emitted to open a source file at a line
47 """ 48 """
48 sourceFile = pyqtSignal(str, int) 49 sourceFile = pyqtSignal(str, int)
49 50
50 def __init__(self, debugServer, docked, vm, parent = None, 51 def __init__(self, debugServer, docked, vm, parent=None,
51 embeddedShell = True, embeddedBrowser = True): 52 embeddedShell=True, embeddedBrowser=True):
52 """ 53 """
53 Constructor 54 Constructor
54 55
55 @param debugServer reference to the debug server object 56 @param debugServer reference to the debug server object
56 @param docked flag indicating a dock window 57 @param docked flag indicating a dock window
80 81
81 self.embeddedShell = embeddedShell 82 self.embeddedShell = embeddedShell
82 if embeddedShell: 83 if embeddedShell:
83 # add the interpreter shell 84 # add the interpreter shell
84 self.shell = Shell(debugServer, vm) 85 self.shell = Shell(debugServer, vm)
85 index = self.__tabWidget.addTab(self.shell, 86 index = self.__tabWidget.addTab(self.shell,
86 UI.PixmapCache.getIcon("shell.png"), '') 87 UI.PixmapCache.getIcon("shell.png"), '')
87 self.__tabWidget.setTabToolTip(index, self.shell.windowTitle()) 88 self.__tabWidget.setTabToolTip(index, self.shell.windowTitle())
88 89
89 self.embeddedBrowser = embeddedBrowser 90 self.embeddedBrowser = embeddedBrowser
90 if embeddedBrowser: 91 if embeddedBrowser:
91 from UI.Browser import Browser 92 from UI.Browser import Browser
92 # add the browser 93 # add the browser
93 self.browser = Browser() 94 self.browser = Browser()
94 index = self.__tabWidget.addTab(self.browser, 95 index = self.__tabWidget.addTab(self.browser,
95 UI.PixmapCache.getIcon("browser.png"), '') 96 UI.PixmapCache.getIcon("browser.png"), '')
96 self.__tabWidget.setTabToolTip(index, self.browser.windowTitle()) 97 self.__tabWidget.setTabToolTip(index, self.browser.windowTitle())
97 98
98 # add the global variables viewer 99 # add the global variables viewer
99 self.glvWidget = QWidget() 100 self.glvWidget = QWidget()
194 UI.PixmapCache.getIcon("watchpoints.png"), '') 195 UI.PixmapCache.getIcon("watchpoints.png"), '')
195 self.__tabWidget.setTabToolTip(index, self.watchpointViewer.windowTitle()) 196 self.__tabWidget.setTabToolTip(index, self.watchpointViewer.windowTitle())
196 197
197 # add the exception logger 198 # add the exception logger
198 self.exceptionLogger = ExceptionLogger() 199 self.exceptionLogger = ExceptionLogger()
199 index = self.__tabWidget.addTab(self.exceptionLogger, 200 index = self.__tabWidget.addTab(self.exceptionLogger,
200 UI.PixmapCache.getIcon("exceptions.png"), '') 201 UI.PixmapCache.getIcon("exceptions.png"), '')
201 self.__tabWidget.setTabToolTip(index, self.exceptionLogger.windowTitle()) 202 self.__tabWidget.setTabToolTip(index, self.exceptionLogger.windowTitle())
202 203
203 if self.embeddedShell: 204 if self.embeddedShell:
204 self.__tabWidget.setCurrentWidget(self.shell) 205 self.__tabWidget.setCurrentWidget(self.shell)
209 self.__tabWidget.setCurrentWidget(self.lvWidget) 210 self.__tabWidget.setCurrentWidget(self.lvWidget)
210 211
211 # add the threads viewer 212 # add the threads viewer
212 self.__mainLayout.addWidget(QLabel(self.trUtf8("Threads:"))) 213 self.__mainLayout.addWidget(QLabel(self.trUtf8("Threads:")))
213 self.__threadList = QTreeWidget() 214 self.__threadList = QTreeWidget()
214 self.__threadList.setHeaderLabels([self.trUtf8("ID"), self.trUtf8("Name"), 215 self.__threadList.setHeaderLabels([self.trUtf8("ID"), self.trUtf8("Name"),
215 self.trUtf8("State"), ""]) 216 self.trUtf8("State"), ""])
216 self.__threadList.setSortingEnabled(True) 217 self.__threadList.setSortingEnabled(True)
217 self.__mainLayout.addWidget(self.__threadList) 218 self.__mainLayout.addWidget(self.__threadList)
218 219
219 self.__doThreadListUpdate = True 220 self.__doThreadListUpdate = True
409 for thread in threadList: 410 for thread in threadList:
410 if thread['broken']: 411 if thread['broken']:
411 state = self.trUtf8("waiting at breakpoint") 412 state = self.trUtf8("waiting at breakpoint")
412 else: 413 else:
413 state = self.trUtf8("running") 414 state = self.trUtf8("running")
414 itm = QTreeWidgetItem(self.__threadList, 415 itm = QTreeWidgetItem(self.__threadList,
415 ["{0:d}".format(thread['id']), thread['name'], state]) 416 ["{0:d}".format(thread['id']), thread['name'], state])
416 if thread['id'] == currentID: 417 if thread['id'] == currentID:
417 citm = itm 418 citm = itm
418 419
419 self.__threadList.header().resizeSections(QHeaderView.ResizeToContents) 420 self.__threadList.header().resizeSections(QHeaderView.ResizeToContents)

eric ide

mercurial