[Pydev-code] Getting started with PyDev scripting
Brought to you by:
fabioz
From: Joel H. <yo...@if...> - 2006-04-04 15:25:00
|
Hi! I'm trying learn Jython scripting for PyDev in order to implement feature= =20 request #1450378 (mine :-). http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1450378&grou= p_id=3D85796&atid=3D577332 Fabio gave me a neat starter guide and a code example from the cvs java s= ource=20 (see feature request page above), but I've got a few questions before I c= an=20 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 method= s of=20 an object in Jython scripts for PyDev? I'm a CPython programmer and I'm u= sed to=20 having dir(), help() and the inspect module for peeking into strange obje= cts,=20 but none of them seems to do me any good here. Afaik the help() function = is not=20 implemented in Jython 2.1, but why can't I import the inspect module? Als= o, why=20 does dir(editor) return an empty list? (example at the end) What's the=20 recommended way of finding out information on object methods and data mem= bers=20 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 quest= ion,=20 but as I'm not a java black belt I feel a little disoriented. PyEdit obje= cts=20 apparently have a .getSite() method (line 32 in pyedit_example2.py in the= =20 starter guide), but the org.python.pydev.editor.PyEdit class does not def= ine it. http://cvs.sourceforge.net/viewcvs.py/pydev/org.python.pydev/src/org/pyth= on/pydev/editor/PyEdit.java?rev=3D1.91&view=3Dmarkup 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=20 using an editor object, but the code example I got from Fabio apparently = does=20 not. Instead it uses a PySelection object that it gets as its first argum= ent.=20 The PyEdit argument is apparently not used. This Jython scripting thing seems really powerful and I hope I'll be able= to=20 produce some nifty things with it once I'm up to speed. Cheers! /Joel Hedlund IFM Bioinformatics Link=F6ping 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 --------------------------------------------------------------------- |