Vendor debugpy for VS Code attach debugging
Bundles debugpy 1.7.0 directly in python/ so "Maya: Attach (debugpy)" works with no per-machine pip install step. Installed via Maya 2022's own pip so it resolved a version actually compatible with Python 3.7 (Maya 2022's interpreter), then verified import + listen() succeeds under all three target Maya Python versions (3.7/3.9/3.10). Also fixes a latent __file__-under-exec() bug in start_debug_server.py (same pitfall as Maya's own plugin loader, never hit until this exercised it) and corrects the README's Maya Python version claim -- 2022 ships Python 3.7, not 3.9 as previously stated, which was never independently verified until now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple GLUT example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for glut
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
4) run: gl.glClearColor(1,1,1,1)
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import OpenGL.GL as gl
|
||||
import OpenGL.GLUT as glut
|
||||
|
||||
def close():
|
||||
glut.glutDestroyWindow(glut.glutGetWindow())
|
||||
|
||||
def display():
|
||||
gl.glClear (gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
|
||||
glut.glutSwapBuffers()
|
||||
|
||||
def resize(width,height):
|
||||
gl.glViewport(0, 0, width, height+4)
|
||||
gl.glMatrixMode(gl.GL_PROJECTION)
|
||||
gl.glLoadIdentity()
|
||||
gl.glOrtho(0, width, 0, height+4, -1, 1)
|
||||
gl.glMatrixMode(gl.GL_MODELVIEW)
|
||||
|
||||
if glut.glutGetWindow() > 0:
|
||||
interactive = True
|
||||
glut.glutInit(sys.argv)
|
||||
glut.glutInitDisplayMode(glut.GLUT_DOUBLE |
|
||||
glut.GLUT_RGBA |
|
||||
glut.GLUT_DEPTH)
|
||||
else:
|
||||
interactive = False
|
||||
|
||||
glut.glutCreateWindow('gui-glut')
|
||||
glut.glutDisplayFunc(display)
|
||||
glut.glutReshapeFunc(resize)
|
||||
# This is necessary on osx to be able to close the window
|
||||
# (else the close button is disabled)
|
||||
if sys.platform == 'darwin' and not bool(glut.HAVE_FREEGLUT):
|
||||
glut.glutWMCloseFunc(close)
|
||||
gl.glClearColor(0,0,0,1)
|
||||
|
||||
if not interactive:
|
||||
glut.glutMainLoop()
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple GTK example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for gtk
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
|
||||
|
||||
def hello_world(wigdet, data=None):
|
||||
print("Hello World")
|
||||
|
||||
def delete_event(widget, event, data=None):
|
||||
return False
|
||||
|
||||
def destroy(widget, data=None):
|
||||
gtk.main_quit()
|
||||
|
||||
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
window.connect("delete_event", delete_event)
|
||||
window.connect("destroy", destroy)
|
||||
button = gtk.Button("Hello World")
|
||||
button.connect("clicked", hello_world, None)
|
||||
|
||||
window.add(button)
|
||||
button.show()
|
||||
window.show()
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple Gtk example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for gtk3
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
def hello_world(wigdet, data=None):
|
||||
print("Hello World")
|
||||
|
||||
def delete_event(widget, event, data=None):
|
||||
return False
|
||||
|
||||
def destroy(widget, data=None):
|
||||
Gtk.main_quit()
|
||||
|
||||
window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
|
||||
window.connect("delete_event", delete_event)
|
||||
window.connect("destroy", destroy)
|
||||
button = Gtk.Button("Hello World")
|
||||
button.connect("clicked", hello_world, None)
|
||||
|
||||
window.add(button)
|
||||
button.show()
|
||||
window.show()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple pyglet example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for pyglet
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
import pyglet
|
||||
|
||||
|
||||
window = pyglet.window.Window()
|
||||
label = pyglet.text.Label('Hello, world',
|
||||
font_name='Times New Roman',
|
||||
font_size=36,
|
||||
x=window.width//2, y=window.height//2,
|
||||
anchor_x='center', anchor_y='center')
|
||||
@window.event
|
||||
def on_close():
|
||||
window.close()
|
||||
|
||||
@window.event
|
||||
def on_draw():
|
||||
window.clear()
|
||||
label.draw()
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple Qt4 example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for qt
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
|
||||
Ref: Modified from http://zetcode.com/tutorials/pyqt4/firstprograms/
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
class SimpleWindow(QtGui.QWidget):
|
||||
def __init__(self, parent=None):
|
||||
QtGui.QWidget.__init__(self, parent)
|
||||
|
||||
self.setGeometry(300, 300, 200, 80)
|
||||
self.setWindowTitle('Hello World')
|
||||
|
||||
quit = QtGui.QPushButton('Close', self)
|
||||
quit.setGeometry(10, 10, 60, 35)
|
||||
|
||||
self.connect(quit, QtCore.SIGNAL('clicked()'),
|
||||
self, QtCore.SLOT('close()'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QtCore.QCoreApplication.instance()
|
||||
if app is None:
|
||||
app = QtGui.QApplication([])
|
||||
|
||||
sw = SimpleWindow()
|
||||
sw.show()
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
"""Simple Tk example to manually test event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for tk
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
try:
|
||||
from Tkinter import *
|
||||
except:
|
||||
# Python 3
|
||||
from tkinter import *
|
||||
|
||||
class MyApp:
|
||||
|
||||
def __init__(self, root):
|
||||
frame = Frame(root)
|
||||
frame.pack()
|
||||
|
||||
self.button = Button(frame, text="Hello", command=self.hello_world)
|
||||
self.button.pack(side=LEFT)
|
||||
|
||||
def hello_world(self):
|
||||
print("Hello World!")
|
||||
|
||||
root = Tk()
|
||||
|
||||
app = MyApp(root)
|
||||
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
A Simple wx example to test PyDev's event loop integration.
|
||||
|
||||
To run this:
|
||||
1) Enable the PyDev GUI event loop integration for wx
|
||||
2) do an execfile on this script
|
||||
3) ensure you have a working GUI simultaneously with an
|
||||
interactive console
|
||||
|
||||
Ref: Modified from wxPython source code wxPython/samples/simple/simple.py
|
||||
"""
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import wx
|
||||
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
"""
|
||||
This is MyFrame. It just shows a few controls on a wxPanel,
|
||||
and has a simple menu.
|
||||
"""
|
||||
def __init__(self, parent, title):
|
||||
wx.Frame.__init__(self, parent, -1, title,
|
||||
pos=(150, 150), size=(350, 200))
|
||||
|
||||
# Create the menubar
|
||||
menuBar = wx.MenuBar()
|
||||
|
||||
# and a menu
|
||||
menu = wx.Menu()
|
||||
|
||||
# add an item to the menu, using \tKeyName automatically
|
||||
# creates an accelerator, the third param is some help text
|
||||
# that will show up in the statusbar
|
||||
menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")
|
||||
|
||||
# bind the menu event to an event handler
|
||||
self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT)
|
||||
|
||||
# and put the menu on the menubar
|
||||
menuBar.Append(menu, "&File")
|
||||
self.SetMenuBar(menuBar)
|
||||
|
||||
self.CreateStatusBar()
|
||||
|
||||
# Now create the Panel to put the other controls on.
|
||||
panel = wx.Panel(self)
|
||||
|
||||
# and a few controls
|
||||
text = wx.StaticText(panel, -1, "Hello World!")
|
||||
text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
text.SetSize(text.GetBestSize())
|
||||
btn = wx.Button(panel, -1, "Close")
|
||||
funbtn = wx.Button(panel, -1, "Just for fun...")
|
||||
|
||||
# bind the button events to handlers
|
||||
self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn)
|
||||
self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn)
|
||||
|
||||
# Use a sizer to layout the controls, stacked vertically and with
|
||||
# a 10 pixel border around each
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(text, 0, wx.ALL, 10)
|
||||
sizer.Add(btn, 0, wx.ALL, 10)
|
||||
sizer.Add(funbtn, 0, wx.ALL, 10)
|
||||
panel.SetSizer(sizer)
|
||||
panel.Layout()
|
||||
|
||||
|
||||
def on_time_to_close(self, evt):
|
||||
"""Event handler for the button click."""
|
||||
print("See ya later!")
|
||||
self.Close()
|
||||
|
||||
def on_fun_button(self, evt):
|
||||
"""Event handler for the button click."""
|
||||
print("Having fun yet?")
|
||||
|
||||
|
||||
class MyApp(wx.App):
|
||||
def OnInit(self):
|
||||
frame = MyFrame(None, "Simple wxPython App")
|
||||
self.SetTopWindow(frame)
|
||||
|
||||
print("Print statements go to this stdout window by default.")
|
||||
|
||||
frame.Show(True)
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = wx.GetApp()
|
||||
if app is None:
|
||||
app = MyApp(redirect=False, clearSigInt=False)
|
||||
else:
|
||||
frame = MyFrame(None, "Simple wxPython App")
|
||||
app.SetTopWindow(frame)
|
||||
print("Print statements go to this stdout window by default.")
|
||||
frame.Show(True)
|
||||
|
||||
Reference in New Issue
Block a user