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: 233)
Reply
#6
(11-13-2020, 02:09 PM)rich2005 Wrote: 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.

Ha ha, indeed, see below  in the plug-in I am mentioned in there  I think it is written by my Years ago
getting the way of working from arakneguideLab  (to learn how gtk can be used)

But to be fully working it needs another plug-in : simple_shapes_centered.py authors sveral : ofnuts , tin tan, (me?!)

The example shown is from yesterday
a special  shape used filled with ... (random)

And hereby a very strange behavior is to be seen: for each of the four 'extras'  a black rectangle Python window is shown

Interested in helping? I could  try to make a zip containing all what is needed 

 c:/Users/Eigenaar/AppData/Roaming/GIMP/2.10/plug-ins:
  total used in directory 24 available 195.8 GiB
  drwxrwxrwx  1 Eigenaar Geen 8192 02-08 18:15 ..
  drwxrwxrwx  1 Eigenaar Geen 4096 02-09 09:35 .
  drwxrwxrwx  1 Eigenaar Geen    0 02-06 08:15 arakne-guide-lab
  drwxrwxrwx  1 Eigenaar Geen    0 02-08 17:02 crop_path_0_5
  drwxrwxrwx  1 Eigenaar Geen 4096 02-06 09:14 DamPKHG6
  drwxrwxrwx  1 Eigenaar Geen    0 02-08 18:09 gimp_a_generate_bars
  drwxrwxrwx  1 Eigenaar Geen    0 02-06 08:21 gtkMINI_1feb
  drwxrwxrwx  1 Eigenaar Geen 4096 02-08 15:05 guidlab_paint
  drwxrwxrwx  1 Eigenaar Geen    0 02-08 11:28 ofn_path_to_shapes
  drwxrwxrwx  1 Eigenaar Geen 4096 02-08 18:16 simple_shapes_centered
  drwxrwxrwx  1 Eigenaar Geen    0 02-08 10:59 test_batch_invert


Only the two directories needed  : guidelab_paint and simple_shapes_centerd

Let me know (subsciption to this is set) 

Greets
   Peter

Oh here they are

The zip should be extacted at something like;
 c:/Users/Eigenaar/AppData/Roaming/GIMP/2.10/plug-ins


The new way for Gimp 2.10, the addons with name xxx.py must live in a directory xxx in plug-ins

Let me know if you can get it to work

Please check  the extension of the arakneguideLab FIRST, new e.g. is a starting point a stepsize and an amount to add either
horizontal or vertical

Who will say: ok that works nicely ;-)


Attached Files Image(s)
   

.zip   guidelabpaintshapescentered.zip (Size: 73.11 KB / Downloads: 202)
Reply


Forum Jump: