Setting up EventGhost in Eclipse
Posted: Fri Jan 20, 2012 10:36 am
Hi
I was trying to set up a development environment for developing EventGhost plugins using Eclipse / PyDev and I was nearby giving up... but finally I managed to get it working. Since I didn't find much information on how to set up such an environment, I decided to publish here my insights.
Disclaimer: I'm new to Python (however, not new to programming overall), therefore I'm not sure if all information given here is true and relevant! If you know it better, please correct me and provide better instructions!
Note: for simple developments, even simple Plugin development, I guess it's not necessary to install a full fledged development environment. However, if you require source level debugging and code refactoring facilities for example, installing a dev env would be recommended.
Be warned: It's a long and complicate installation procedure! Leave it if you don't have basic development experience. But once you're done, you've all the goodies and benefits of an Eclipse environment.
? However, you're almost done!
So far I didn't manage to resolve these issues:
Troubleshooting
Any comments / corrections / additions to these instructions are welcome, especially if someone finds solutions for the open issues!
I was trying to set up a development environment for developing EventGhost plugins using Eclipse / PyDev and I was nearby giving up... but finally I managed to get it working. Since I didn't find much information on how to set up such an environment, I decided to publish here my insights.
Disclaimer: I'm new to Python (however, not new to programming overall), therefore I'm not sure if all information given here is true and relevant! If you know it better, please correct me and provide better instructions!
Note: for simple developments, even simple Plugin development, I guess it's not necessary to install a full fledged development environment. However, if you require source level debugging and code refactoring facilities for example, installing a dev env would be recommended.
Be warned: It's a long and complicate installation procedure! Leave it if you don't have basic development experience. But once you're done, you've all the goodies and benefits of an Eclipse environment.
- Download and Install TortoiseSVN from http://tortoisesvn.net/downloads.html
- Download and install the following (all download links are examples and point to today's latest versions. Except for Python, which must be 2.6, I guess you can use latest version for the additions)
- Python 2.6 stackless from http://www.stackless.com/binaries/pytho ... ckless.msi
- makes sure to pick 2.6
- Installation path is C:\Python26
- Python for Windows extensions from http://sourceforge.net/projects/pywin32 ... e/download
- wxPython from http://downloads.sourceforge.net/wxpyth ... 1-py26.exe
- PIL from http://effbot.org/downloads/PIL-1.1.7.win32-py2.6.exe
- comtypes from http://sourceforge.net/projects/comtype ... urce=files
- docutils from http://prdownloads.sourceforge.net/docu ... z?download
- create a (temporary) folder ctypeslib (somewhere outside the future EventGhost Eclipse project)
- Using TortoiseSVN, checkout 'ctypeslib' from http://svn.python.org/projects/ctypes/trunk/ctypeslib
- open cmd prompt, then run 'setup.py build' and then 'setup.py install'
- maybe there are other essential modules which are not listed here
- Python 2.6 stackless from http://www.stackless.com/binaries/pytho ... ckless.msi
- Download and install Eclipse from http://www.eclipse.org/downloads/
- I assume 'Eclipse Classic' should be sufficient, however, for other reasons I downloaded Eclipse J2EE.
- Download and install Aptana Studio 3 from http://aptana.com/products/studio3/download
- Make sure to select the 'Eclipse Plugin Version'
- then follow the instructions to install the Eclipse Plugin
- Create a PyDev project in Eclipse, you might call it 'EventGhost'
- create a source folder 'trunk' in this project
- Using TortoiseSVN, checkout EventGhost trunk (EG sources) from https://eventghost.svn.sourceforge.net/ ... host/trunk
- checkout into previously created 'trunk' folder
- Open Eclipse project properties (right click on the project)
- goto 'Pydev - PYTHONPATH > Source Folders'
- Remove Source folder /EventGhost/trunk
- Add Source Folder /EventGhost/trunk/eg
- Add Source Folder /EventGhost/trunk/plugins
- in Eclipse, right click on 'EventGhost.pyw' > Python run
...and yes! if everything went is right, the EventGhost main window will open - goto 'Run > Run Configurations > Python > EventGhost.pyw > Arguments > Program arguments' and add '-debug' in order to get debug log output.
- Add breakpoints whereever you like. When the execution stops at a breakpoint and you started EG in Debug Mode, the Eclipse Debug perspective will open
- etc.
So far I didn't manage to resolve these issues:
- 'import eg' causes an 'Unresolved import' error in all plugins (just in the editor, not at runtime). However, code completion (like 'eg.RegisterPl' + Ctrl-Blank) works in most situations as well as open referenced source (F3)
- 'import stackless' also causes an 'Unresolved import' error
Troubleshooting
- make sure all referenced libraries are found in Eclipse's System PYTHONPATH (Preferences > Pydev > Interpreter Python > Libraries)
- after installing a new Python library (and the Eclipse setup exists already), it's often the easiest and safest to delete the Python interpreter config (Preferences > Pydev > Interpreter Python > Remove) and add it again. This should set up PYTHONPATH correctly.
- Sometimes it helps to 'Remove PyDev Project Config' and to add it again by right clicking on the project
Any comments / corrections / additions to these instructions are welcome, especially if someone finds solutions for the open issues!