Macros: Save last used debugger (#18946)

* Macros: Save last used debugger

Typically users use the same debugger repeatedly. The current dialog
required users to change tabs each time the debugger is launched. This
change saves the last used debugger tab and sets that as the selected
tab when relaunching the debugger.

* Save VSCode address and port
This commit is contained in:
David Carter
2025-01-17 11:45:47 -05:00
committed by GitHub
parent 49c77303c7
commit a977fade2d

View File

@@ -34,9 +34,18 @@ class RemoteDebugger():
self.dialog.buttonBox.accepted.connect(self.accept)
self.dialog.buttonBox.rejected.connect(self.reject)
self.prefs = App.ParamGet("User parameter:BaseApp/Macro/Debugger")
index = self.prefs.GetInt("TabIndex", 0)
self.dialog.tabWidget.setCurrentIndex(index)
address = self.prefs.GetString("VSCodeAddress", "localhost")
port = self.prefs.GetInt("VSCodePort", 5678)
self.dialog.lineEditAddress.setText(address)
self.dialog.spinBoxPort.setValue(port)
def accept(self):
try:
index = self.dialog.tabWidget.currentIndex()
self.prefs.SetInt("TabIndex", index)
if index == 0: # winpdb
passwd = self.dialog.lineEditPassword.text()
@@ -47,6 +56,8 @@ class RemoteDebugger():
elif index == 1: # VS code
address = self.dialog.lineEditAddress.text()
port = self.dialog.spinBoxPort.value()
self.prefs.SetString("VSCodeAddress", address)
self.prefs.SetInt("VSCodePort", port)
import debugpy