It is currently Sun Sep 20, 2026 12:30 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 4:39 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2648
Location: Poland
GIMP Version: 2.6.11
Operating System: Windows
OS Version: XP - SP3
GIMP Experience: Beginner Level



There are a lot of guidance in pdf format for Gimp.
Only for convenience call (open pdf in another program)

For example: G'MIC The Handbook
http://gmic.sourceforge.net/gmic_reference.pdf

Place gmic_handbook.bat and gmic_handbook.pdf in the catalog C:\Gmic - or edit the path in Gmic_handbook.py and gmic_handbook.bat and Adobe Reader.

gmic_handbook.bat

@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "c:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe" "c:\\Gmic\\gmic_handbook.pdf" %1


Gmic_handbook.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-


from gimpfu import *
import shlex
import subprocess
import os, sys

def plugin_main(img, drawable):
  command = "\"C:\\Gmic\\gmic_handbook.bat\""  #<<--EDIT
  args = shlex.split(command)
  child = subprocess.Popen(args, shell=True)

register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "*",
        [],
        [],
        plugin_main,
        )

main()


Attachments:
Gimp help pdf.zip [838 Bytes]
Downloaded 75 times
Location.png
Location.png [ 2.01 KiB | Viewed 2775 times ]
In menu.png
In menu.png [ 13.22 KiB | Viewed 2775 times ]

_________________
Image
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 6:15 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
It works fine, just needed to change gmic_handbook.pdf to gmic_reference.pdf in the .bat file. Oh and open a file in Gimp first.

One more thing, I use Evince for PDFs even though I left the path to Adobe Reader, Evince opened no problem (Vista).

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 1:48 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Odinbc wrote:
It works fine, just needed to change gmic_handbook.pdf to gmic_reference.pdf in the .bat file. Oh and open a file in Gimp first.

One more thing, I use Evince for PDFs even though I left the path to Adobe Reader, Evince opened no problem (Vista).



If you replace the "*" in the register with "" then it will work with no image open.

(that parameter is the image type, "*" means any image type, but an image is required)

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 2:15 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
Thanks Rob,
You learn something new everyday.
So I had already changed gmic_handbook.bat to,
@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "c:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe" "c:\\Gmic\\gmic_reference.pdf" %1


And now Gmic_handbook.py to,
#!/usr/bin/env python
# -*- coding: utf-8 -*-


from gimpfu import *
import shlex
import subprocess
import os, sys

def plugin_main(img, drawable):
  command = "\"C:\\Gmic\\gmic_handbook.bat\""  #<<--EDIT
  args = shlex.split(command)
  child = subprocess.Popen(args, shell=True)

register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "",
        [],
        [],
        plugin_main,
        )

main()


Works like a charm!

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 6:24 pm  (#5) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
but why use a script to open a pdf ?
file/open would not work ?

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Sun Feb 26, 2012 7:20 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
Quote:
but why use a script to open a pdf ?
file/open would not work ?

file/open is a script. ;)

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 1:52 am  (#7) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16173
Cool idea. :)
Though i use GSView not Adobe Reader.
http://pages.cs.wisc.edu/~ghost/gsview/

_________________
Image


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 11:42 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2648
Location: Poland
Tutorials can be in different format *.doc,*.odt, *.htm, *.txt, and of course *.pdf.
Only for convenience - you can all these different types of documents call of the Gimp menu (by editing the file: bat and py).

For Win XP (regardless of the path "exe" in the bat file) opens the target file in combination - so the bat file can be reduced to writing:
@echo off
echo *** Do Not Close this Window ***
echo Temp File: %1
start "exe" "c:\\XYZ\\xyz.odt" %1

where xyz is the directory and file name.

_________________
Image


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 12:30 pm  (#9) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
i must try

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 3:40 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
This script was working fine for me yesterday. Today I see the following dialog pop-up if I don't have an image open first in Gimp.
Attachment:
gmic_handbook _error.png
gmic_handbook _error.png [ 13.35 KiB | Viewed 2589 times ]

I have the code changed to Robs suggestion in "gmic_handbook.py".
register(
        "python_fu_gmic_handbook",
        "gmic_handbook",
        "gmic_handbook",
        "GimpChat",
        "MrQ",
        "2012",
        "<Image>/Help/G'MIC: The Handbook",
        "",
        [],
        [],
        plugin_main,
        )

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 4:45 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2648
Location: Poland
With the current code - it does change the "*" to ""

_________________
Image


Top
 Post subject: Re: Open the book help (in pdf format) from Gimp menu
PostPosted: Mon Feb 27, 2012 5:03 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
MareroQ,
Any thoughts on the "python_fu_gmic_handbook" dialog that pops -up if you don't first open a file in Gimp, before accessing the G'MIC Handbook link.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


cron

* Login  



Powered by phpBB3 © phpBB Group