Help with plugin - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Help with plugin (/Thread-Help-with-plugin) |
Help with plugin - carmen - 10-10-2019 Hello! My first attempt in phyton, and... plugin doesn't register. Suspect fault is something very basic... Can somebody help, please? Many thanks! RE: Help with plugin - Ofnuts - 10-10-2019 (10-10-2019, 05:33 PM)carmen Wrote: Hello! First thing to do is to run your script outside of Gimp. This weeds out the worst mistakes: Code: 22:17:31 @ python/ : >python group-text2path.py So, pitfall #1: the doc for Python is a somewhat verbatim copy of the Scheme doc. But if in Scheme you can have symbols-with-dashes, these are not allowed in Python (undistinguishable from a subtraction). So in the Python API, symbols-with-dashes are really symbols_with_underscores. Use the Apply button in the PDB browser to get a Python-acceptable version of the call copied to the Python console. Other problems:
RE: Help with plugin - carmen - 10-10-2019 Ofnuts--First: many, many thanks! Following your kind explanations, I have got the plugin installed and running. Maybe tomorrow I can post an example of its use (small fonts in maps / 'single path' fonts...) Now, you say Quote:Use the Apply button in the PDB browser to get a Python-acceptable version of the call copied to the Python console. Just discovered that the Apply button appears when one calls the PDB browser with phyton console opened. New hitch: editing Code: import sys Code: import sys Code: Traceback (most recent call last): Thanks, gracias, merci... RE: Help with plugin - Ofnuts - 10-11-2019 (10-10-2019, 10:03 PM)carmen Wrote: Ofnuts--First: many, many thanks! Following your kind explanations, I have got the plugin installed and running. Maybe tomorrow I can post an example of its use (small fonts in maps / 'single path' fonts...)The substitution works in all cases. The PDB browser is you reference because it contains all the help for the plugins you installed, assuming the other put relevant strings in the registration data. (10-10-2019, 10:03 PM)carmen Wrote: New hitch: editing You have to do import os before you can use os. Personallu, I start my scripts with: Code: debug='OFN_DEBUG' in os.environ And I use the trace() instead of print in the code. trace() only prints something if the variable OFN_DEBUG is set in the environment, and this variable is set automatically in the terminal that is associated with my code editor. RE: Help with plugin - carmen - 10-11-2019 Interesting! Now I understand better the beginnings of your plugins--I need some kind of template to launch from, but can use only the parts I understand more or less. If I do some more phyton coding (being also an user of calibre and sigil) I may check (someday) if notepad++ can do something of the sort. And, as I threatened, 2 examples of what I want the plugin for. [attachment=3257] 1. In this map I have used font Almendra Display for the text, all in it's own group. The font itself renders almost transparent in Gimp (reported bug, affecting all small/fine fonts: Bernard Mode, Architect..) so *I did a group_text2path, and stroked the result at line 1px in a new transparent layer*. Voilá! 2. As the symbols are also text, all save one taken from webdings (although all entered as Times New Roman) they both platform-dependant and subject to sudden change by windows update: so, another global conversion to path for backup. [attachment=3259] Here, I duplicated the text layer group in 1, toggled visibility for the original, and on the copy made a group_changefont (thanks again, Ofnuts!) to 1CamBam_Stick_5: which, being a 'wire' font, renders in Gimp only as dots for o and d (the only closed paths in the whole text). Repeated *...*, made the group layer invisible, and behold! Of course, it needs some changes: seeing the result, one would decrease letter-spacing and increase line-height, although I didn't bother... To Do: plugin to change the whole font-style in the group in one fell swoop... |