Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Installing Python scripts
#1
Hello,
W10 gimp 2.10.22
How to install any python plugin.
Would like a working small example
e.g. from WW
Code:
import gimp

def python_message(image, drawable, message):
    gimp.message(message)

register(
        "python_fu_message",
        "Show message",
        "Show message",
        "Pin-Chou Liu",
        "Pin-Chou Liu",
        "2019",
        "<Image>/Filters/Hello World...",
        "",
        [
            (PF_STRING, "message", "message", "Hello World"),
        ],
        [],
        python_message)

main()
Reply
#2
  • Go to Filters>Python-fu>Console, and enter print gimp.directory.
  • Using your explorer, navigate to the directory in the answer. It should contain a plug-ins subdirectory.
  • Put your Python file in that plug-ins subdirectory (or in any subdirectory under it).
  • Restart Gimp.
If your plug-in doesn't appear, see https://www.gimp-forum.net/Thread-Debugg...in-Windows

If you need script examples, see http://sourceforge.net/projects/gimp-too...s/scripts/
Reply
#3
Thanks, Ofnuts,
Trying Gimp2.8 now, deleted gimp 2.20.22
Old plugins example, old guideloab with extensions was (is I hope reviable).
This is different to gimp 2.10. 22
Code:
class arakneguideLab(gimpplugin.plugin):
    def start(self):
        gimp.main(self.init, self.quit, self.query, self._run)
    def init(self):
        pass
    def quit(self):
        pass
    def query(self):
        cright = "jfgarcia"
        date = "2013-2014"
        plug_descr = _("Admin")
        plug_params = [(PDB_INT32, "run_mode", "Run mode"), (PDB_IMAGE, "image", "Input image"),]
        gimp.install_procedure("arakne_guide_lab", plug_descr, plug_descr, "jfgarcia", cright, date, "<Image>/GTK/Guides lab...", "RGB*, GRAY*", PLUGIN, plug_params,[])

    def arakne_guide_lab(self, runmode, img):
        gLabUtls(runmode, img)
    
if __name__ == '__main__':
    arakneguideLab().start()

Especially this line: <Image>/GTK/Guides lab...", "RGB*, GRAY*", PLUGIN, plug_params,[])

Such that I got (get in 2.8) the GTK tab!!!!

How to do that in 2.10,22 ??? if at all?

Will stay a while with 2.8

Greets
Peter
Reply
#4
AFAIK nothing has changed for this between 2.8 and 2.10. But the example you show is the "complicated" registration. Could be overkill. What kind of parameters do you need for your plugin?
Reply
#5
Looking at this as a non-coding type person.

The arakne-guide-lab.py / drawUI.py combination works in my linux kubuntu 18.04 Gimp 2.10.22
Not so in a Win10 VM / Gimp 2.10.22 Gives nondescript wire-read errors, looks like drawUI.py is the culprit.

There is another (extended) version guidelab_paint which incorporates drawUI in the plugin code. That does work in Win10 / Gimp 2.10.22. screenshot. https://i.imgur.com/nO06xsm.jpg

That plugin attached, maybe you can dig something out of the code.


Attached Files
.zip   guidelab_paint.zip (Size: 18.18 KB / Downloads: 7)
Reply


Forum Jump: