Hi!

I'm trying learn Jython scripting for PyDev in order to implement feature request #1450378 (mine :-).

http://sourceforge.net/tracker/index.php?func=detail&aid=1450378&group_id=85796&atid=577332

Fabio gave me a neat starter guide and a code example from the cvs java source (see feature request page above), but I've got a few questions before I can start getting productive.

1) How do I find out PyEdit object methods and data members?
What is the best way of finding out the available members and data methods of an object in Jython scripts for PyDev? I'm a CPython programmer and I'm used to having dir(), help() and the inspect module for peeking into strange objects, but none of them seems to do me any good here. Afaik the help() function is not implemented in Jython 2.1, but why can't I import the inspect module? Also, why does dir(editor) return an empty list? (example at the end) What's the recommended way of finding out information on object methods and data members in Jython?


2) Where do I find the source for the relevant superclasses?
I tried browsing the PyDev source cvs for the answer to my previous question, but as I'm not a java black belt I feel a little disoriented. PyEdit objects apparently have a .getSite() method (line 32 in pyedit_example2.py in the starter guide), but the org.python.pydev.editor.PyEdit class does not define it.

http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java?rev=1.91&view=markup

PyEdit implements IPyEdit, but how do I get to the source for it (or some docs)?


3) How do I affect code in the editor with only a PyEdit object?
From the starter guide I understand that Pydev scripts communicate with PyDev using an editor object, but the code example I got from Fabio apparently does not. Instead it uses a PySelection object that it gets as its first argument. The PyEdit argument is apparently not used.


This Jython scripting thing seems really powerful and I hope I'll be able to produce some nifty things with it once I'm up to speed.

Cheers!
/Joel Hedlund
IFM Bioinformatics
Linköping University



Example:
$PYEDIT_SCRIPTS/pyedit_test.py:
---------------------------------------------------------------------
assert cmd is not None
assert editor is not None
dir(editor)
import inspect
---------------------------------------------------------------------

Console output on save:
---------------------------------------------------------------------
--->  reloading /.../pyedit_test.py
[]
Traceback (innermost last):
  File "<string>", line 1, in ?
  File "/<PATH_SNIPPED>/pyedit_test.py", line 4, in ?
ImportError: no module named inspect
---------------------------------------------------------------------


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to