Re: [Pydev-code] Getting started with PyDev scripting
Brought to you by:
fabioz
From: Don T. <nos...@gm...> - 2006-04-13 00:44:43
|
Joel Hedlund wrote: > Alright... These are my first stumbling steps into the glorious realm of > pydev scripting. > > It's supposed to be a little helper for assigning the values of method > parameters to attributes of self with the same names, and it's activated > through "Ctrl-2" followed by "a<Enter>" ("a" for "assign"). Today it > quite happily displaces docstrings and probably also behaves badly by > other fascinating means which I still haven't discovered. > > I'd appreciate any and all pointers I can get on all this, so I can > continue in the right direction. > Hi Joel: I have just installed your script and I guess I do not understand the use case. I place my mouse pointer in a function definition, hit ctrl-2, a, <enter> and I always get the message: "So far, only one-liner method def lines are recognised by this script. The current line is not such a line." I tried a one-liner: def fun(fred): foo = fred and still get the same result. In addition, Pydev extensions on my machine complains about lots of undefined symbols (cmd, editor, PySelection, PyAction, True and False). Sticking Fabio's trick if False: from org.python.pydev.editor import PyEdit #@UnresolvedImport cmd = 'command string' editor = PyEdit sorts out cmd and editor, but at the expense of another False failure. Adding #@UnresolvedImport to the ends of a couple of from lines fixes PySelection and PyAction. Fabio: I am pretty uneasy about these tricks to kill undefined symbols. I don't understand what is going on here, but it seems to work. It looks too much like magic. I don't understand why we have to lie on the from lines, or is this always the case with Jython and Pydev extensions? I don't think that True/False appeared in Python until 2.3 or 2.4 and Jython is 2.1. So, what is going on here? Do these scripts already have a bunch of things defined that is not apparant until they are executed, but the compiler cannot be told about them? Don. |