If you miss having auto-completion and pop-up documentation in Eclipse while working with the four xbmc modules, I have a pyhthon script that will generate Predefined Completions for them.
The README file from the project:
-------------------
August 15, 2010
PyDev Predefined Completions Creator is based on Pydoc by nuka1195 which provided a great example and starting point.
0) License and Warranty
The License is GPL. You can read a copy of the License in the root directory of this distribution in the License.txt file. As the license states, as well as the preamble to this README above, there is ABSOLUTELY NO WARRANTY.
1) What does this script do?
In short, it will generate a set of PyDev Predefined Completions for the XBMC built Python modules to be used by XBMC addon developers. PyDev Predefined Completions are a way of adding type, interface, and documentation information to the Eclipse IDE (with the PyDev plugin) for Python modules that have no ".py" file. This is typically the case for C/C++ developed Python modules (built-ins?) that are not part of the base Python implementation.
For a more detailed explanation of Pydev Predefined Completions and how to use them once you've generated them, see:
http://pydev.org/manual_101_interpreter.html#id2
Currently, it will generate Predefined Completions for the following built-in XBMC modules:
xbmc
xbmcgui
xbmcplugin
xbmcaddon
As of the branched Dharma version of XBMC (as of the date given above), these are the only 4 native modules added to Python by XBMC.
2) Why do I care?
If you're a Python XBMC script developer, and you use PyDev in Eclipse to do your development, you will be able to get "auto-completion" of the XBMC modules. This might not seem like much if you're not used to it but it's a great tool for development.
Auto-completion in Eclipse also includes the display of the documentation for the method/function/module/class that's being auto-completed. This provides a real-time immediate access to the documentation as your writing code in your code editor for the specific method/function/module/class you're using. This makes coming up to speed on what's available much easier (given the documentation doesn't suck).
3) Sound's great! How do I use this script.
This script needs to be installed as an addon in XBMC and run from inside XBMC. Once installed it should appear listed as an Addon under the "Programs" menu. The first time it's run you will be asked to identify the directory to write the Predefined Completions into. After that it will put them in the same directory.
Once you've generated the Predefined Completions follow the PyDev instructions for adding Predefined Completions to your Python interpreter definition.
4) How does it work
Python supports "introspection" of modules/libraries. From within a running addon this python program interrogates (introspects) the XBMC native modules to find out the names, types, attributes and documentation included, and generates Predefined Completions (.pypredef files) that can be loaded into the PyDev plugin for the Eclipse IDE.
Then again, if you're not developing XBMC addons in Python or you're not using PyDev in Eclipse, this wont help you.
5) What are the limitations and issues of the current implementation
Here is a short list of the current known limitations/issues:
1) It provides Predefined Completions for the XBMC native modules for the version of XBMC that the script is run from within only. This shouldn't be an issue for anyone really. Keep in mind that if you install a new version of XBMC from Python development you should rerun this script from within this newly installed version.
2) Predefined Completions provides the ability to identify the return type from a function or method. I have not figured out how to find this information through introspection so none of the function/method templates identify a return type.
3) This works on the current XBMC modules (see limitation (1) above) but it is not exhaustive in generating a Predefined Completions for every possible Python language idiosyncrasy. It is possible that future versions (or maybe even past versions) of the XBMC native modules will not generate correctly using this version of the script. When that time arrives, I'll consider fixing it then.
-----------------
The source code:
svn co http://xbmc-pydev-predefcom.googlecode.c...ypredefcom script.pypredefcom
Feedback is welcome.
Thanks
Jim
jfcarroll
Team-XBMC Developer Posts: 393 Joined: Dec 2006 Reputation: 2 Location: Philadelphia area, US |
2010-08-16 15:22
Post: #1
|
| find quote |
alshain
Senior Member Posts: 145 Joined: Jul 2010 Reputation: 3 |
2010-08-16 16:15
Post: #2
This is cool thanks. Just started developing with Pydev
![]() However, been getting a 502 on googlecode for the last few hours ![]() So I'll be looking forward to it as soon as it starts working again for me. |
| find quote |
tslayer
Team-XBMC Developer Joined: Oct 2003 Reputation: 12 |
2010-08-16 16:18
Post: #3
You need to use svn to check out that link. Not your browser.
42.7% of all statistics are made up on the spot Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. |
| find quote |
alshain
Senior Member Posts: 145 Joined: Jul 2010 Reputation: 3 |
2010-08-16 16:21
Post: #4
Yes I know. But svn gives me a 502
![]() And XBMC won't let me install plugins from googlecode either atm. But you could use the URL in a browser as well, because that particular SVN link is HTTP. |
| find quote |
tslayer
Team-XBMC Developer Joined: Oct 2003 Reputation: 12 |
2010-08-16 16:31
Post: #5
Ya, but the url may not work in browser since it may not be a browsable url if meant for svn.
But yes, something wrong with googlecode atm. 42.7% of all statistics are made up on the spot Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. |
| find quote |
jfcarroll
Team-XBMC Developer Posts: 393 Joined: Dec 2006 Reputation: 2 Location: Philadelphia area, US |
2010-08-16 16:35
Post: #6
Actually - you should be able to see it with the browser also. Something is wrong. I can use the "Browse" from the project admin but can't access the svn repo directly.
|
| find quote |
tslayer
Team-XBMC Developer Joined: Oct 2003 Reputation: 12 |
2010-08-16 16:39
Post: #7
I can use the browser here just fine now:
http://code.google.com/p/xbmc-pydev-pred...ce/browse/ Also looks like it is working now. 42.7% of all statistics are made up on the spot Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. |
| find quote |
Nuka1195
Skilled Python Coder Posts: 3,938 Joined: Dec 2004 Reputation: 17 |
2010-08-16 19:43
Post: #8
OT: which version of eclipse do you use? i did not see a version specifically for python.
i use scite where i added all the methods as keywords, but basically all this does for me is color code them. is this more like visual c++, where you hover over a method eg(addSortMethod) and it gives full details? |
| find quote |
jfcarroll
Team-XBMC Developer Posts: 393 Joined: Dec 2006 Reputation: 2 Location: Philadelphia area, US |
2010-08-16 20:03
Post: #9
I'm using Galileo (version 3.5) with PyDev installed.
It will auto-complete (sometimes referred to as "type-ahead" or "assist") - that is, if I start typing, when I get to the ".", it will give me a dropdown of possible completions (or force the dropdown when I type Ctrl-Space). If I start typing: Code: xbmc.A dropdown of all of the possible methods/attributes appears right there in-line in the editor. Plus, if I move right using the arrow keys in the dropdown list, I get the documentation (__doc__ string). If I hover over it after typing it I get the documentation. Of course, that assumes you've added the Predefined Completions for the xbmc modules to PyDev - otherwise it only does it for what it knows about. Hence the point of the script. |
| find quote |
jfcarroll
Team-XBMC Developer Posts: 393 Joined: Dec 2006 Reputation: 2 Location: Philadelphia area, US |
2010-08-16 20:15
Post: #10
Here's a "Content Assist" demo. It's for javascript but it gets the point across.
http://www.eclipse.org/atf/demos/jsdt/fl...t_swf.html You can also access the doc strings as I mentioned above. One more limitation I forgot to mention in the README. I haven't figured out how to get parameter information for methods/functions in native modules via introspection so every method/function looks like it take variable arguments. It would be nicer if there was a way to access the parameter information because the "content assist" works better if it knows it. |
| find quote |




Search
Help