38 @signal debuggingStarted(filename) emitted when a debugging session was started |
38 @signal debuggingStarted(filename) emitted when a debugging session was started |
39 @signal resetUI() emitted to reset the UI |
39 @signal resetUI() emitted to reset the UI |
40 @signal exceptionInterrupt() emitted after the execution was interrupted by an |
40 @signal exceptionInterrupt() emitted after the execution was interrupted by an |
41 exception and acknowledged by the user |
41 exception and acknowledged by the user |
42 """ |
42 """ |
|
43 clientStack = pyqtSignal(list) |
|
44 |
43 def __init__(self, ui, vm, debugServer, debugViewer, project): |
45 def __init__(self, ui, vm, debugServer, debugViewer, project): |
44 """ |
46 """ |
45 Constructor |
47 Constructor |
46 |
48 |
47 @param ui reference to the main UI |
49 @param ui reference to the main UI |
99 self.__stepQuit, self.__runToCursor] |
101 self.__stepQuit, self.__runToCursor] |
100 self.localsVarFilter, self.globalsVarFilter = Preferences.getVarFilters() |
102 self.localsVarFilter, self.globalsVarFilter = Preferences.getVarFilters() |
101 self.debugViewer.setVariablesFilter(self.globalsVarFilter, self.localsVarFilter) |
103 self.debugViewer.setVariablesFilter(self.globalsVarFilter, self.localsVarFilter) |
102 |
104 |
103 # Connect the signals emitted by the debug-server |
105 # Connect the signals emitted by the debug-server |
104 self.connect(debugServer, SIGNAL('clientGone'), self.__clientGone) |
106 debugServer.clientGone.connect(self.__clientGone) |
105 self.connect(debugServer, SIGNAL('clientLine'), self.__clientLine) |
107 debugServer.clientLine.connect(self.__clientLine) |
106 self.connect(debugServer, SIGNAL('clientExit(int)'), self.__clientExit) |
108 debugServer.clientExit.connect(self.__clientExit) |
107 self.connect(debugServer, SIGNAL('clientSyntaxError'), self.__clientSyntaxError) |
109 debugServer.clientSyntaxError.connect(self.__clientSyntaxError) |
108 self.connect(debugServer, SIGNAL('clientException'), self.__clientException) |
110 debugServer.clientException.connect(self.__clientException) |
109 self.connect(debugServer, SIGNAL('clientVariables'), self.__clientVariables) |
111 debugServer.clientVariables.connect(self.__clientVariables) |
110 self.connect(debugServer, SIGNAL('clientVariable'), self.__clientVariable) |
112 debugServer.clientVariable.connect(self.__clientVariable) |
111 self.connect(debugServer, SIGNAL('clientBreakConditionError'), |
113 debugServer.clientBreakConditionError.connect(self.__clientBreakConditionError) |
112 self.__clientBreakConditionError) |
114 debugServer.clientWatchConditionError.connect(self.__clientWatchConditionError) |
113 self.connect(debugServer, SIGNAL('clientWatchConditionError'), |
115 debugServer.passiveDebugStarted.connect(self.__passiveDebugStarted) |
114 self.__clientWatchConditionError) |
116 debugServer.clientThreadSet.connect(self.__clientThreadSet) |
115 self.connect(debugServer, SIGNAL('passiveDebugStarted'), |
117 |
116 self.__passiveDebugStarted) |
118 debugServer.clientRawInput.connect(debugViewer.handleRawInput) |
117 self.connect(debugServer, SIGNAL('clientThreadSet'), self.__clientThreadSet) |
119 debugServer.clientRawInputSent.connect(debugViewer.restoreCurrentPage) |
118 |
120 debugServer.clientThreadList.connect(debugViewer.showThreadList) |
119 self.connect(debugServer, SIGNAL('clientRawInput'), debugViewer.handleRawInput) |
|
120 self.connect(debugServer, SIGNAL('clientRawInputSent'), |
|
121 debugViewer.restoreCurrentPage) |
|
122 self.connect(debugServer, SIGNAL('clientThreadList'), debugViewer.showThreadList) |
|
123 |
121 |
124 # Connect the signals emitted by the viewmanager |
122 # Connect the signals emitted by the viewmanager |
125 self.connect(vm, SIGNAL('editorOpened'), self.__editorOpened) |
123 self.connect(vm, SIGNAL('editorOpened'), self.__editorOpened) |
126 self.connect(vm, SIGNAL('lastEditorClosed'), self.__lastEditorClosed) |
124 self.connect(vm, SIGNAL('lastEditorClosed'), self.__lastEditorClosed) |
127 self.connect(vm, SIGNAL('checkActions'), self.__checkActions) |
125 self.connect(vm, SIGNAL('checkActions'), self.__checkActions) |
1039 if res == QMessageBox.Yes: |
1037 if res == QMessageBox.Yes: |
1040 self.emit(SIGNAL('exceptionInterrupt')) |
1038 self.emit(SIGNAL('exceptionInterrupt')) |
1041 stack = [] |
1039 stack = [] |
1042 for fn, ln in stackTrace: |
1040 for fn, ln in stackTrace: |
1043 stack.append((fn, ln, '')) |
1041 stack.append((fn, ln, '')) |
1044 self.emit(SIGNAL('clientStack'), stack) |
1042 self.clientStack.emit(stack) |
1045 self.__getClientVariables() |
1043 self.__getClientVariables() |
1046 self.ui.setDebugProfile() |
1044 self.ui.setDebugProfile() |
1047 return |
1045 return |
1048 elif res == QMessageBox.Ignore: |
1046 elif res == QMessageBox.Ignore: |
1049 if exceptionType not in self.excIgnoreList: |
1047 if exceptionType not in self.excIgnoreList: |
1055 else: |
1053 else: |
1056 self.debugActions[self.lastAction]() |
1054 self.debugActions[self.lastAction]() |
1057 else: |
1055 else: |
1058 self.__continue() |
1056 self.__continue() |
1059 |
1057 |
1060 def __clientGone(self,unplanned): |
1058 def __clientGone(self, unplanned): |
1061 """ |
1059 """ |
1062 Private method to handle the disconnection of the debugger client. |
1060 Private method to handle the disconnection of the debugger client. |
1063 |
1061 |
1064 @param unplanned 1 if the client died, 0 otherwise |
1062 @param unplanned True if the client died, False otherwise |
1065 """ |
1063 """ |
1066 self.__resetUI() |
1064 self.__resetUI() |
1067 if unplanned: |
1065 if unplanned: |
1068 QMessageBox.information(self.ui,Program, |
1066 QMessageBox.information(self.ui,Program, |
1069 self.trUtf8('The program being debugged has terminated unexpectedly.')) |
1067 self.trUtf8('The program being debugged has terminated unexpectedly.')) |