def __init__(self, options): self.options = options self.main_window = MainWindow(self) self.session_manager = debugsession.SessionManager(self) self.console = Console(self) self.main_window.console = self.console self.stack = StackViewer(self) self.namespace = AllNamespaceViewer(self) self.threads = ThreadsViewer(self) self.source = SourceViewer(self) self.status = StatusBar(self) self.breaks = BreakpointViewer(self) self.toolbar = Toolbar(self) debugsession.connect_events(self)
def __createLayout( self ): " Creates the widget layout " verticalLayout = QVBoxLayout( self ) verticalLayout.setContentsMargins( 1, 1, 1, 1 ) self.splitter = QSplitter( Qt.Vertical ) self.variablesViewer = VariablesViewer( self.__debugger, self.splitter ) self.stackViewer = StackViewer( self.__debugger, self.splitter ) self.threadsViewer = ThreadsViewer( self.__debugger, self.splitter ) self.splitter.addWidget( self.variablesViewer ) self.splitter.addWidget( self.stackViewer ) self.splitter.addWidget( self.threadsViewer ) self.splitter.setCollapsible( 0, False ) self.splitter.setCollapsible( 1, False ) self.splitter.setCollapsible( 2, False ) verticalLayout.addWidget( self.splitter ) return
class Application(object): def __init__(self, options): self.options = options self.main_window = MainWindow(self) self.session_manager = debugsession.SessionManager(self) self.console = Console(self) self.main_window.console = self.console self.stack = StackViewer(self) self.namespace = AllNamespaceViewer(self) self.threads = ThreadsViewer(self) self.source = SourceViewer(self) self.status = StatusBar(self) self.breaks = BreakpointViewer(self) self.toolbar = Toolbar(self) debugsession.connect_events(self) def launch(self, filename): def _l(filename): import threading if filename is not None: def _t(): self.session_manager.launch(True, filename) t = threading.Thread(target=_t) t.start() gobject.idle_add(_l, filename) def update_threads(self, event): current_thread = event.m_current_thread threads_list = event.m_thread_list def _u(threads_list, current_thread): self.threads.update_threads(threads_list, current_thread) gobject.idle_add(_u, threads_list, current_thread) def update_thread_broken(self, event): print 'threadbroken' tid = event.m_tid def _u(tid): self.threads.broken_thread(tid) gobject.idle_add(_u, tid) def update_no_threads(self, event): print 'nothreads' def update_state(self, event): state = event.m_state print 'state', state def _u(state): self.status.update_running_status(state) def _u2(state): self.toolbar.update_state(state) def _u3(state): self.source.update_state(state) gobject.idle_add(_u, state) gobject.idle_add(_u2, state) def update_frame(self, event): print 'frame', event.m_frame_index index = event.m_frame_index def _u(index): self.stack.select_frame(index) gobject.idle_add(_u, index) self.update_source(-index - 1) def update_stack(self, event): print 'updatestack' stack = event.m_stack self._last_stack = stack def _u(stack): self.stack.update_stack(stack) gobject.idle_add(_u, stack) self.update_source(-1) def update_source(self, index): def _u(index): si = StackItem(index, *self._last_stack['stack'][index]) self.source.goto(si.filename, si.linenumber) gobject.idle_add(_u, index) def update_namespace(self, event): def _u(): self.namespace.update_namespace() gobject.idle_add(_u) def update_bp(self, event): def _u(event): act = event.m_action if event.m_bp is not None: filename = event.m_bp.m_filename linenumber = event.m_bp.m_lineno index = event.m_bp.m_id indices = None else: filename = None linenumber = None index = None indices = event.m_id_list self.breaks.update_bp(act, index, indices, filename, linenumber) gobject.idle_add(_u, event)
class Application(object): def __init__(self, options): self.options = options self.main_window = MainWindow(self) self.session_manager = debugsession.SessionManager(self) self.console = Console(self) self.main_window.console = self.console self.stack = StackViewer(self) self.namespace = AllNamespaceViewer(self) self.threads = ThreadsViewer(self) self.source = SourceViewer(self) self.status = StatusBar(self) self.breaks = BreakpointViewer(self) self.toolbar = Toolbar(self) debugsession.connect_events(self) def launch(self, filename): def _l(filename): import threading if filename is not None: def _t(): self.session_manager.launch(True, filename) t = threading.Thread(target=_t) t.start() gobject.idle_add(_l, filename) def update_threads(self, event): current_thread = event.m_current_thread threads_list = event.m_thread_list def _u(threads_list, current_thread): self.threads.update_threads(threads_list, current_thread) gobject.idle_add(_u, threads_list, current_thread) def update_thread_broken(self, event): print 'threadbroken' tid = event.m_tid def _u(tid): self.threads.broken_thread(tid) gobject.idle_add(_u, tid) def update_no_threads(self, event): print 'nothreads' def update_state(self, event): state = event.m_state print 'state', state def _u(state): self.status.update_running_status(state) def _u2(state): self.toolbar.update_state(state) def _u3(state): self.source.update_state(state) gobject.idle_add(_u, state) gobject.idle_add(_u2, state) def update_frame(self, event): print 'frame', event.m_frame_index index = event.m_frame_index def _u(index): self.stack.select_frame(index) gobject.idle_add(_u, index) self.update_source(-index - 1) def update_stack(self, event): print 'updatestack' stack = event.m_stack self._last_stack = stack def _u(stack): self.stack.update_stack(stack) gobject.idle_add(_u, stack) self.update_source(-1) def update_source(self, index): def _u(index): si =StackItem(index, *self._last_stack['stack'][index]) self.source.goto(si.filename, si.linenumber) gobject.idle_add(_u, index) def update_namespace(self, event): def _u(): self.namespace.update_namespace() gobject.idle_add(_u) def update_bp(self, event): def _u(event): act = event.m_action if event.m_bp is not None: filename = event.m_bp.m_filename linenumber = event.m_bp.m_lineno index = event.m_bp.m_id indices = None else: filename = None linenumber = None index = None indices = event.m_id_list self.breaks.update_bp(act, index, indices, filename, linenumber) gobject.idle_add(_u, event)
class DebuggerContext( QWidget ): " Implements the debugger context viewer " def __init__( self, debugger, parent = None ): QWidget.__init__( self, parent ) self.__debugger = debugger self.connect( self.__debugger, SIGNAL( 'ClientLine' ), self.__onClientLine ) self.connect( self.__debugger, SIGNAL( 'ClientStack' ), self.onClientStack ) self.connect( self.__debugger, SIGNAL( 'ClientThreadList' ), self.__onClientThreadList ) self.connect( self.__debugger, SIGNAL( 'ClientVariables' ), self.__onClientVariables ) self.connect( self.__debugger, SIGNAL( 'ClientVariable' ), self.__onClientVariable ) self.connect( self.__debugger, SIGNAL( 'ClientThreadSet' ), self.__onClientThreadSet ) self.currentStack = None self.__createLayout() return def __createLayout( self ): " Creates the widget layout " verticalLayout = QVBoxLayout( self ) verticalLayout.setContentsMargins( 1, 1, 1, 1 ) self.splitter = QSplitter( Qt.Vertical ) self.variablesViewer = VariablesViewer( self.__debugger, self.splitter ) self.stackViewer = StackViewer( self.__debugger, self.splitter ) self.threadsViewer = ThreadsViewer( self.__debugger, self.splitter ) self.splitter.addWidget( self.variablesViewer ) self.splitter.addWidget( self.stackViewer ) self.splitter.addWidget( self.threadsViewer ) self.splitter.setCollapsible( 0, False ) self.splitter.setCollapsible( 1, False ) self.splitter.setCollapsible( 2, False ) verticalLayout.addWidget( self.splitter ) return def clear( self ): " Clears everything " self.variablesViewer.clear() self.stackViewer.clear() self.threadsViewer.clear() return def __onClientLine( self, fileName, line, forStack ): " Handles the signal from the debugged program " if not forStack: self.__debugger.remoteThreadList() self.__debugger.remoteClientVariables( 1, 0 ) # globals self.__debugger.remoteClientVariables( 0, 0 ) # locals return def onClientStack( self, stack ): " Handles the signal from the debugged program " self.stackViewer.populate( stack ) return def __onClientThreadList( self, currentThreadID, threadList ): " Handles the thread list from the remote client " self.threadsViewer.populate( currentThreadID, threadList ) return def __onClientVariables( self, scope, variables ): " Handles the client variables lists " frameNumber = self.stackViewer.getFrameNumber() if scope in [ -1, 0 ]: # Empty list for local variables self.variablesViewer.updateVariables( False, frameNumber, variables ) else: self.variablesViewer.updateVariables( True, frameNumber, variables ) return def __onClientVariable( self, scope, variables ): " Handles the client variable list " if scope in [ -1, 0 ]: self.variablesViewer.updateVariable( False, variables ) else: self.variablesViewer.updateVariable( True, variables ) return def __onClientThreadSet( self ): " Handles the event of setting the current thread by the client " self.__debugger.remoteClientVariables( 1, 0 ) # globals self.__debugger.remoteClientVariables( 0, 0 ) # locals return def switchControl( self, isInIDE ): " Switches the UI depending where the control flow is " self.variablesViewer.switchControl( isInIDE ) self.stackViewer.switchControl( isInIDE ) self.threadsViewer.switchControl( isInIDE ) return def getCurrentFrameNumber( self ): " Provides the current frame number " return self.stackViewer.getFrameNumber()