https://github.com/kamilburda/pydev-gimp-predefined-completions
Script for generating PyDev predefined completions for GIMP 2.8/2.10
https://github.com/kamilburda/pydev-gimp-predefined-completions
gimp pydev python
Last synced: about 1 month ago
JSON representation
Script for generating PyDev predefined completions for GIMP 2.8/2.10
- Host: GitHub
- URL: https://github.com/kamilburda/pydev-gimp-predefined-completions
- Owner: kamilburda
- License: mit
- Created: 2016-12-30T20:21:37.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-08-20T14:06:07.000Z (over 1 year ago)
- Last Synced: 2025-01-21T20:22:33.507Z (3 months ago)
- Topics: gimp, pydev, python
- Language: Python
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
PyDev Predefined Completions Generator for GIMP
===============================================This Python script generates [predefined completions](http://www.pydev.org/manual_101_interpreter.html) for [PyDev](http://www.pydev.org/) for GIMP 2.8/2.10 and GTK 2 modules to improve development of GIMP plug-ins written in Python.
Development of Python GIMP plug-ins is provided by several Python modules compiled as `.pyd` files.
However, PyDev has trouble parsing such files, resulting in missing code completion and `Undefined variable from import` error messages.This script therefore mitigates this problem by generating predefined completions for GIMP modules, GTK modules and GIMP procedures/plug-ins (accessible via `gimp.pdb`).
This script is not applicable to GIMP 2.99 or later due to significant changes in the GIMP plug-in API.
Some IDEs can already automatically generate predefined completions (stubs) for compiled GIMP 2.99 and GTK 3 modules such as [PyCharm](https://www.jetbrains.com/help/pycharm/stubs.html).
For PyCharm specifically, you may need to [add missing stubs](https://github.com/kamilburda/gimp-missing-python-stubs-for-pycharm).
For general development, the [Python PDB wrapper](https://github.com/kamilburda/gimp-python-pdb-wrapper) can simplify the development of GIMP 2.99 plug-ins.Requirements
------------* GIMP 2.8 or 2.10 (will **not** work on GIMP 2.99 or later)
* [astor](https://github.com/berkerpeksag/astor) library - version 0.6 or laterInstallation
------------1. Locate the directory for plug-ins in your GIMP installation by going to `Edit → Preferences → Folders → Plug-Ins`.
2. Choose one of the listed directories there and copy `pypredefgen_gimp.py` and `pypredefgen_gimp` to that directory.
3. Download the [astor](https://github.com/berkerpeksag/astor) library and place it in the directory for plug-ins.
4. If not available in your Python distribution, install [importlib](https://pypi.org/project/importlib/) and place it in the directory for plug-ins.On Linux and possibly macOS, you may install the required libraries via `pip` instead:
pip install astor importlibRunning the Generator
---------------------To run the generator, open GIMP and choose `Filters → Python-Fu → Generate Predefined Completions for PyDev`.
You may adjust the output directory.
By default, the predefined completions are located in the `[path to GIMP user config]/pypredefs` directory.Alternatively, you may run the generator from the Python-Fu console - open GIMP, choose `Filters -> Python-Fu -> Console` and enter
pdb.python_fu_generate_predefined_completions_for_pydev(None)
Adding Predefined Completions in PyDev
--------------------------------------To add the predefined completions to PyDev, go to `Window → Preferences → PyDev → Interpreters → Python Interpreter`, choose the GIMP Python interpreter and add the directory containing the generated completions as per the [instructions](http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-PredefinedCompletions).
Note for GIMP 2.10 Users on Windows
-----------------------------------For GIMP 2.10 on Windows up to 2.10.8, predefined completions for the `gimpui` module are not generated due to crashes when accessing certain members of that module.
This issue does not occur from GIMP 2.10.10 onwards.