Panda3D Code AutoCompletion on Komodo IDE

Dear all,

When learning a new library (or in an engine in this case) like Panda3D its very useful to have auto-completion features in your IDE so you won’t have to continuously go back and forth between the documentation and your code.

Komodo IDE (and its free equaivalent Komodo Edit) has a very nice auto-completion feature for the standard pythonic modules as well as all files in your project. Moreover they have an option where you can give an API catalog of a 3rd party lib so it can offer auto-completion features for that lib as well.

Therefore, I was wondering:
1)Is there some file in a standard Panda3D installation that could be used as such?
2)Has anyone managed to get autocompletion features for the P3D libraries? If so, has anyone managed to do so with Komodo’s tools?
3)I’ve looked around and haven’t gotten a clear answer so far. Is there anyway to get autocompletion of the P3D methods and members?

I am pretty sure that such a thing, if possible would help out a lot, especially people who are now starting with P3D like myself

Any advice, info or tips will be appreciated

Thanks in advance,
Adam

P.S I have to admit that WingIDE has an even better code-completion support but I didnt see anyway to include Panda’s capabilities there? Any info on that?


FOLLOW UP:

I just checked:

Komodo’s tools uses files with a .cxi extension which are practically XML files containing the code instructions.

Here is a short part of the Pythonic Win32 API:

<?xml version="1.0" encoding="UTF-8"?>
<codeintel description="Python Extensions for Windows" name="PyWin32" version="2.0">
  <file lang="Python" mtime="0" path="pywin32.cix">
    <scope ilk="blob" lang="Python" name="_win32sysloader">
      <scope ilk="function" name="GetModuleFilename" />
      <scope ilk="function" name="LoadModule" />
    </scope>
    <scope ilk="blob" lang="Python" name="_winxptheme">
      <scope ilk="function" name="CloseThemeData" />
      <scope ilk="function" name="DrawThemeBackground" />
      <scope ilk="function" name="DrawThemeText" />
      <variable citdl="int" name="ETDT_DISABLE" />
      <variable citdl="int" name="ETDT_ENABLE" />
      <variable citdl="int" name="ETDT_ENABLETAB" />
      <variable citdl="int" name="ETDT_USETABTEXTURE" />
      <scope ilk="function" name="EnableThemeDialogTexture" />
      <scope ilk="function" name="EnableTheming" />
      <scope ilk="function" name="GetCurrentThemeName" />
      <scope ilk="function" name="GetThemeAppProperties" />
      <scope ilk="function" name="GetThemeBackgroundContentRect" />
      <scope ilk="function" name="GetThemeBackgroundExtent" />
      <scope ilk="function" name="GetWindowTheme" />
      <scope ilk="function" name="IsAppThemed" />
      <scope ilk="function" name="IsThemeActive" />
      <scope ilk="function" name="IsThemeDialogTextureEnabled" />
      <scope ilk="function" name="OpenThemeData" />
      <scope ilk="function" name="SetWindowTheme" />
      <variable citdl="int" name="UNICODE" />
      <scope classrefs="Exception" ilk="class" name="error" />
    </scope>

Is there someone who knows how to extract such a thing from P3D’s source code or libraries? Is there anyone who know how to do this?

If the Komodo thing is a lost cause, can someone direct me to how I can get P3D auto completion with any other IDE?

Dear all,

Since I can tell from the vast amount of views and replies that everyone is hanging on the edge of his seat I am here to offer salvation and a small update on this issue.

I contacted the good people over at Activestate (company that makes Komodo) and they offered some insight. You can view the forum thread here:

http://community.activestate.com/forum/panda3d-komodo-ideedit-code-assistancecix-creation

and the link that explains in short how to create you own .cix code-intelligence files for your own modules here:

http://community.activestate.com/forum/komodo-python-qt-and-pyqt-catalog-files-cix#comment-9218

So using the tool named gencix which I check out from their svn repo and by changing their command a bit, like this:

ppython gencix.py --onefile=P3D.cix --name="Panda3D" --description="Panda3D"  pandac.PandaModules

I managed to get a .cix file which once placed in the API catalogs of Komodo seems to offer some auto-completion features (at least when importing pandac.PandaModules you have a nice dropdown list with all the members there).

So it seems there is hope for this thing and I’ll try a bit more to get better results.

Is there someone who can provide a list or a link to a list of all the different python modules of Panda? This way I can make a much more complete .cix file and upload it here. I am sure I am not the only one using Komodo’s tools for Panda.

Thanks in advance,
Adam

P.S I will try to reply to my own topic again once I get something more solid

P.S 2: Here is a nice picture showing what I am saying

Well after fumbling around I found out that this whole thing was something of a waste of time.

While the autocompletion feature does work while importing from a P3D module and while calling a function or constructor for an object, accessing the member function and variables of a class instance is not possible.

What I mean is:

from pandac.PandaModules import AmbientLight #we do have auto-completion here

alight=AmbientLight('alight') #we do have auto-completion here
alight.     #we do not get squat here

I validated that this is expected throught Activestate’s forums:

http://community.activestate.com/forum/komodo-python-qt-and-pyqt-catalog-files-cix#comment-12000

So until there is a better way to access the members of the panda modules or someone know of a way to get panda auto-completion somewhere (I saw something about Pydev offering this) this case went down the drain :smiley:

Have a good one,
Adam

Ever seen these ?

Hi,

No I cant say I have. While going through parts of the forum I did come across something about someone attempting to make some sort of Panda oriented IDE but I didnt understand much.

I have tried the whole Pydev approach for auto-completion but the results were rather dissapointing

Could you give some info on this?

Thanks,
Adam

What exactly did you fail to understand ?

discourse.panda3d.org/viewtopic.php?t=3875

Hi,

that is actually a good question. The first time I tried to use it I had trouble running it. I followed your instructions but trying to start the IDE with ‘pythonw’ gives an error about not being able to find the Panda modules while starting with ppython complains about me not using ‘pythonw’

At that point I had no idea what I was doing wrong (still dont for the most part) and gave up. Perhaps you can enlighten me.

I have an Enthough Python 2.6 distribution and the Panda 1.7.0 installed on my mac. So far I have been running all my panda code with ‘ppython’ as my normal python cannot find the modules.

Am I missing something? Is there someway to make my EPD python recognize the existence of Panda?

Thanks for your help

I don’t know about ppython complaint, what’s the exact message ?
Could you print sys.executable ?

How much EPD differs from the standard Python ?
Panda needs to be run by specific standard Python version. Other than that won’t work.

Well the EPD is a Python installation with a wide range of pre-included modules like scipy, numpy, vtk, matplotlib etc.

I have been using it for nearly 2 years and it never fell short of anything python related.

This version does contain the ‘pythonw’ executable but after installing Panda that python could never find the panda modules so I have been using ppython to run them.

What specific version of Python do I need?

It should fits then.
P3D 1.7 is compiled against Python 2.6.
To let your default python know about other library, you should create a .pth file in /site-(or dist-)packages directory which is just a text file consists of P3D installation root path and its binary files directory.

My IDE uses whatever python executable is used to run IDE_STARTER.pyw, so the error is totally confusing.

When I try with my python:

Adamos-Kyriacous-MacBook-Pro:P3D_OIDE somada141$ python IDE_STARTER.pyw 
Traceback (most recent call last):
  File "IDE_STARTER.pyw", line 5, in <module>
    from pandac.PandaModules import PandaSystem
ImportError: No module named pandac.PandaModules

When I try with ppython:

Adamos-Kyriacous-MacBook-Pro:P3D_OIDE somada141$ ppython IDE_STARTER.pyw 

This program needs access to the screen.
Please run with 'pythonw', not 'python', and only when you are logged
in on the main display of your Mac.

In my python I can print sys.executable

Well the error is not so confusing at least to my thinking.

I did not have the .pth file so my python could not find the Panda Modules.

On the other hand Panda does not have pythonw so it could not run your IDE.

Could you please tell me what paths should the .pth file include?
Is the name of the file going to be panda.pth?

geez, I don’t know about Mac.

What do you mean by unable to print sys.executable ?
panda.pth is fine.
On Linux, IIRC it’s :

/usr/share/panda3d
/usr/bin

You don’t have to run it with pythonw, here I use python or ppython just fine.

ok from what I saw things are a bit different under Mac as expected.

One has to create a ‘panda3d.pth’ file under the ‘site-packages’ folder which for mac & EPD is under:

‘/Library/Frameworks/Python.framework/Versions/5.1.1/lib/python2.5/site-packages’

at least for this Enthought version I have.
The file should include:

as at least for my current Panda Mac version (1.7.0) both the Panda libraries (modules) and the executables are under there.

Doing so, after opening a new python terminal then you should be now able to ‘import pandac’ as well as the other Panda stuff.

With the above, using ‘python’ to run you IDE it seems to work fine

Thanks for your help,
Adam

Good. :smiley:
Don’t forget to build the TextDrawer extension.