inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.97k stars 229 forks source link

Adding a Watch expression using AutoKey (documentation suggestion) #582

Closed mnieber closed 1 year ago

mnieber commented 1 year ago

I just figured out a fast way to add variables to the Watch section, using AutoKey. I don't know if this is of interest, but the following script adds the current selection as a new Watch entry (perhaps it's worth adding this to the documentation as a productivity hint)

import time
def pause():
    time.sleep(0.1)

text = clipboard.get_selection()
keyboard.send_key('<right>')
pause()
keyboard.send_key('<insert>')
pause()
keyboard.send_keys(text)
pause()
keyboard.send_key('<enter>')
pause()
keyboard.send_key('<left>')
inducer commented 1 year ago

Thanks for pointing this out. I'm not totally sure what to do with this, since it goes quite a ways beyond pudb's current UI paradigm, and it is, for better or worse, a bit brittle and bolted-on (not a criticism), so I don't know if I'd like to encourage it. :slightly_smiling_face:

That said, there are some valid questions that arise out of this:

I think I'll push this over to discussions for the time being.