Skip to content

Commit

Permalink
Macros: Save last used debugger (FreeCAD#18946)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
davesrocketshop authored Jan 17, 2025
1 parent 49c7730 commit a977fad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Gui/RemoteDebugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,18 @@ def __init__(self, parent=None):
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()
Expand All @@ -47,6 +56,8 @@ def accept(self):
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

Expand Down

0 comments on commit a977fad

Please sign in to comment.