-
Notifications
You must be signed in to change notification settings - Fork 54
How to use Eclipse with PyDev
jaga-mcstas edited this page Sep 15, 2015
·
7 revisions
- download & install Eclipse:
- Select a version here (perhaps the C/C++ version) http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/marsr
- install PyDev:
- Start up Eclipse and open this link in a browser: http://www.pydev.org/manual_101_install.html
- On the website, scroll down and follow the instructions in the section,,,,,,,,, "Installing with the update site".
- set up PyDev (must be done for each new workspace):
- Start eclipse and select a workspace at start-up: This is the root development folder for this session. The settings are kept in a hidden sub-folder (.metadata) which you can delete if things go wrong.
- Click "Workbench".
- Click Window -> Preferences.
- Go to PyDev -> Interpreters -> Python Interpreter
- Click the button on the right called "Quick Auto-Config".
- Apply and OK.
- develop a mcstas program with PyDev:
- Start eclipse and select a workspace which is one step above the project you want to work on. For example, McCode/tools/Python/ if you want to work on mcrun or mcgui.
- Go to File -> New -> Other...
- Select PyDev -> Pydev Project and click Next.
- Select the "Project name" equal to the mcstas folder that you want to work in, for example, "mcrun". The project name must match the folder structure exactly!
- You will be prompted if you want to open the PyDev perspective - Yes! Now you can open the folder on your left and access the McCode python files.
- run Python with command-line options:
- Open a python file and use Run -> Run As -> "Python Run".
- If your script hasn't stopped on it's own: Click the red square icon somewhere in the eclipse UI, to stop it.
- Now, go to Run -> Run Configurations.
- In the left, go to "Python Run", and click on the only sub-option there. This should be a new "Python Run" configuration, that was just automatically created in step 1. above.
- In the middle, you should now see a couple of tabs, including "Arguments"
- Configure your command-line arguments for this run configuration in the "Arguments tab" (remember that "python " is handled by eclipse...).
- Also rename this Python Run configuration to reflect the changes you have made, since you may have multiple run configs for this project.