Upgrade debugger to debugpy

This commit is contained in:
Pesc0
2023-11-17 01:07:54 +01:00
parent be6ed4670b
commit 6fe6cbe4b7
3 changed files with 12 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ opencamlib==2023.1.11
packaging==23.0
Pivy==0.6.8
ply==3.11
ptvsd==4.3.2
debugpy==1.6.7
pyNastran==1.3.4
pyshp==2.3.1
PySide2==5.15.2.1

View File

@@ -25,6 +25,7 @@
import FreeCAD as App
import FreeCADGui as Gui
from PySide import QtGui
from freecad.utils import get_python_exe
class RemoteDebugger():
def __init__(self, parent=None):
@@ -46,11 +47,17 @@ class RemoteDebugger():
elif index == 1: # VS code
address = self.dialog.lineEditAddress.text()
port = self.dialog.spinBoxPort.value()
redirect = self.dialog.checkRedirectOutput.isChecked()
import ptvsd
ptvsd.enable_attach(address=(address, port), redirect_output=redirect)
ptvsd.wait_for_attach()
import debugpy
# get_python_exe is needed because debugpy needs a python interpreter to work.
# It does not have to be FC embedded interpreter.
# By default it attempts to use Freecad's PID mistaking it for python.
# https://github.com/microsoft/debugpy/issues/262
debugpy.configure(python=get_python_exe())
debugpy.listen((address, port))
debugpy.wait_for_client()
except Exception as e:
QtGui.QMessageBox.warning(self.dialog, "Failed to attach", str(e))

View File

@@ -89,16 +89,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkRedirectOutput">
<property name="text">
<string>Redirect output</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">