99 super().__init__(parent) |
99 super().__init__(parent) |
100 |
100 |
101 self.debugServer = debugServer |
101 self.debugServer = debugServer |
102 self.debugUI = None |
102 self.debugUI = None |
103 |
103 |
|
104 self.__setFocusToWidget = None |
|
105 |
104 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
106 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
105 |
107 |
106 self.__mainLayout = QVBoxLayout() |
108 self.__mainLayout = QVBoxLayout() |
107 self.__mainLayout.setContentsMargins(0, 3, 0, 0) |
109 self.__mainLayout.setContentsMargins(0, 3, 0, 0) |
108 self.setLayout(self.__mainLayout) |
110 self.setLayout(self.__mainLayout) |
162 QComboBox.SizeAdjustPolicy.AdjustToContents |
164 QComboBox.SizeAdjustPolicy.AdjustToContents |
163 ) |
165 ) |
164 self.globalsFilterTypeCombo.addItems( |
166 self.globalsFilterTypeCombo.addItems( |
165 [self.tr("Don't Show"), self.tr("Show Only")] |
167 [self.tr("Don't Show"), self.tr("Show Only")] |
166 ) |
168 ) |
|
169 self.globalsFilterTypeCombo.setCurrentIndex( |
|
170 1 if Preferences.getDebugger("ShowOnlyAsDefault") else 0 |
|
171 ) |
167 self.gvvWidgetHLayout.addWidget(self.globalsFilterTypeCombo) |
172 self.gvvWidgetHLayout.addWidget(self.globalsFilterTypeCombo) |
168 |
173 |
169 self.globalsFilterEdit = QLineEdit(self.gvvWidget) |
174 self.globalsFilterEdit = QLineEdit(self.gvvWidget) |
170 self.globalsFilterEdit.setSizePolicy( |
175 self.globalsFilterEdit.setSizePolicy( |
171 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed |
176 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed |
199 ) |
204 ) |
200 |
205 |
201 self.gvvSourceButton.clicked.connect(self.__showSource) |
206 self.gvvSourceButton.clicked.connect(self.__showSource) |
202 self.setGlobalsFilterButton.clicked.connect(self.setGlobalsFilter) |
207 self.setGlobalsFilterButton.clicked.connect(self.setGlobalsFilter) |
203 self.globalsFilterEdit.returnPressed.connect(self.setGlobalsFilter) |
208 self.globalsFilterEdit.returnPressed.connect(self.setGlobalsFilter) |
|
209 self.globalsFilterEdit.textEdited.connect( |
|
210 lambda: self.__filterStringEdited(globalsFilter=True) |
|
211 ) |
|
212 self.globalsFilterTypeCombo.currentIndexChanged.connect( |
|
213 lambda: self.__filterStringEdited(globalsFilter=True) |
|
214 ) |
204 |
215 |
205 # add the local variables viewer |
216 # add the local variables viewer |
206 self.lvvWidget = QWidget() |
217 self.lvvWidget = QWidget() |
207 self.lvvWidgetVLayout = QVBoxLayout(self.lvvWidget) |
218 self.lvvWidgetVLayout = QVBoxLayout(self.lvvWidget) |
208 self.lvvWidgetVLayout.setContentsMargins(0, 0, 0, 0) |
219 self.lvvWidgetVLayout.setContentsMargins(0, 0, 0, 0) |
234 QComboBox.SizeAdjustPolicy.AdjustToContents |
245 QComboBox.SizeAdjustPolicy.AdjustToContents |
235 ) |
246 ) |
236 self.localsFilterTypeCombo.addItems( |
247 self.localsFilterTypeCombo.addItems( |
237 [self.tr("Don't Show"), self.tr("Show Only")] |
248 [self.tr("Don't Show"), self.tr("Show Only")] |
238 ) |
249 ) |
|
250 self.localsFilterTypeCombo.setCurrentIndex( |
|
251 1 if Preferences.getDebugger("ShowOnlyAsDefault") else 0 |
|
252 ) |
239 self.lvvWidgetHLayout2.addWidget(self.localsFilterTypeCombo) |
253 self.lvvWidgetHLayout2.addWidget(self.localsFilterTypeCombo) |
240 |
254 |
241 self.localsFilterEdit = QLineEdit(self.lvvWidget) |
255 self.localsFilterEdit = QLineEdit(self.lvvWidget) |
242 self.localsFilterEdit.setSizePolicy( |
256 self.localsFilterEdit.setSizePolicy( |
243 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed |
257 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed |
271 |
285 |
272 self.lvvSourceButton.clicked.connect(self.__showSource) |
286 self.lvvSourceButton.clicked.connect(self.__showSource) |
273 self.lvvStackComboBox.currentIndexChanged[int].connect(self.__frameSelected) |
287 self.lvvStackComboBox.currentIndexChanged[int].connect(self.__frameSelected) |
274 self.setLocalsFilterButton.clicked.connect(self.setLocalsFilter) |
288 self.setLocalsFilterButton.clicked.connect(self.setLocalsFilter) |
275 self.localsFilterEdit.returnPressed.connect(self.setLocalsFilter) |
289 self.localsFilterEdit.returnPressed.connect(self.setLocalsFilter) |
|
290 self.localsFilterEdit.textEdited.connect( |
|
291 lambda: self.__filterStringEdited(globalsFilter=False) |
|
292 ) |
|
293 self.localsFilterTypeCombo.currentIndexChanged.connect( |
|
294 lambda: self.__filterStringEdited(globalsFilter=False) |
|
295 ) |
276 |
296 |
277 self.preferencesChanged.connect(self.handlePreferencesChanged) |
297 self.preferencesChanged.connect(self.handlePreferencesChanged) |
278 self.preferencesChanged.connect(self.globalsViewer.preferencesChanged) |
298 self.preferencesChanged.connect(self.globalsViewer.preferencesChanged) |
279 self.preferencesChanged.connect(self.localsViewer.preferencesChanged) |
299 self.preferencesChanged.connect(self.localsViewer.preferencesChanged) |
280 |
300 |
394 Public slot to handle the preferencesChanged signal. |
414 Public slot to handle the preferencesChanged signal. |
395 """ |
415 """ |
396 self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode") |
416 self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode") |
397 self.lvvSourceButton.setVisible(not self.__autoViewSource) |
417 self.lvvSourceButton.setVisible(not self.__autoViewSource) |
398 self.gvvSourceButton.setVisible(not self.__autoViewSource) |
418 self.gvvSourceButton.setVisible(not self.__autoViewSource) |
|
419 |
|
420 if not bool(self.globalsFilterEdit.text()): |
|
421 self.globalsFilterTypeCombo.setCurrentIndex( |
|
422 1 if Preferences.getDebugger("ShowOnlyAsDefault") else 0 |
|
423 ) |
|
424 if not bool(self.localsFilterEdit.text()): |
|
425 self.localsFilterTypeCombo.setCurrentIndex( |
|
426 1 if Preferences.getDebugger("ShowOnlyAsDefault") else 0 |
|
427 ) |
399 |
428 |
400 def setDebugger(self, debugUI): |
429 def setDebugger(self, debugUI): |
401 """ |
430 """ |
402 Public method to set a reference to the Debug UI. |
431 Public method to set a reference to the Debug UI. |
403 |
432 |
482 if showGlobals: |
511 if showGlobals: |
483 self.globalsViewer.showVariables(vlist, self.framenr) |
512 self.globalsViewer.showVariables(vlist, self.framenr) |
484 else: |
513 else: |
485 self.localsViewer.showVariables(vlist, self.framenr) |
514 self.localsViewer.showVariables(vlist, self.framenr) |
486 |
515 |
|
516 if self.__setFocusToWidget is not None: |
|
517 self.__setFocusToWidget.setFocus(Qt.FocusReason.MouseFocusReason) |
|
518 self.__setFocusToWidget = None # reset it |
|
519 |
487 def showVariable(self, vlist, showGlobals): |
520 def showVariable(self, vlist, showGlobals): |
488 """ |
521 """ |
489 Public method to show the variables in the respective window. |
522 Public method to show the variables in the respective window. |
490 |
523 |
491 @param vlist list of variables to display |
524 @param vlist list of variables to display |
707 ) |
740 ) |
708 if self.currentStack: |
741 if self.currentStack: |
709 self.debugServer.remoteClientVariables( |
742 self.debugServer.remoteClientVariables( |
710 self.getSelectedDebuggerId(), 0, self.__localsFilter, self.framenr |
743 self.getSelectedDebuggerId(), 0, self.__localsFilter, self.framenr |
711 ) |
744 ) |
|
745 |
|
746 def __filterStringEdited(self, globalsFilter): |
|
747 """ |
|
748 Private method to handle the editing of the a variables filter. |
|
749 |
|
750 @param globalsFilter flag indicating the globals filter was edited |
|
751 @type bool |
|
752 """ |
|
753 if globalsFilter: |
|
754 self.__setFocusToWidget = self.globalsFilterEdit |
|
755 self.setGlobalsFilter() |
|
756 else: |
|
757 self.__setFocusToWidget = self.localsFilterEdit |
|
758 self.setLocalsFilter() |
712 |
759 |
713 def refreshVariablesLists(self): |
760 def refreshVariablesLists(self): |
714 """ |
761 """ |
715 Public slot to refresh the local and global variables lists. |
762 Public slot to refresh the local and global variables lists. |
716 """ |
763 """ |