It is currently Sun Jul 21, 2024 4:13 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: I have an idea
PostPosted: Mon Apr 18, 2011 3:42 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
I constantly need to look to see what the name of a certain script is (SCM). Always wanting to know what the heck does this script do or what is the file name?
So i had an idea to place comment on the name of the script like this.
(script-fu-register "registered name"
_"_menu name"
_"pop up text" <----- put the pop up text and the script name.scm here.
"creator name <creators@mailAddress>"
"creator name"
"creation year"
""
)

This way all i have to do is scroll over the menu filter and up pops the name of the script.
Now i can easily find the bugger in my scripts directory. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


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: I have an idea
PostPosted: Mon Apr 18, 2011 4:12 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I'm liking this idea a lot. It does require a degree of discipline on the behalf of the developer to make sure it's consistent though.

Kevin

update:
I've had a quick play, and this leads on to a situation where I have defined a number of scripts in the same file, but I only want to have to specify the file name in one place so I've done something that extends from something else I did:

; constants for the GUIs
(define kpScaleSteps '(3 1 10 1 10 0 1))
(define kpSharpenModes '(_"Refocus" _"Sharpen" _"Unsharp" _"None"))
(define kp24_websize_filename (string-append "\n\n" "kp24_websize.scm"))
.
.
.

(script-fu-register "script-fu-kp24_size_thumbnail"
                    _"<Image>/Script-Fu/Kevin/Sizes/Thumbnail..."
                    (string-append "Shrink an image" kp24_websize_filename)
                    "Kevin Payne <my e-mail>"
                    "Kevin Payne"
                    "03/05/2008"
                    "RGB* GRAY*"
                    SF-IMAGE "Input Image" 0
                    SF-DRAWABLE "Input Drawable" 0
                    SF-ADJUSTMENT _"Width" '(120 1 250 1 10 0 1)
                    SF-ADJUSTMENT _"Height" '(120 1 250 1 10 0 1)
                    SF-OPTION _"Use Width/Height" '(_"Width" _"Height")
                    SF-TOGGLE _"Auto Detect Bigger" TRUE
                    SF-ADJUSTMENT _"Scaling Steps" kpScaleSteps
                    SF-OPTION _"Sharp Type" kpSharpenModes
                    SF-TOGGLE _"Change name?" TRUE
                    SF-STRING _"Name addition" "_tn"
                    )


So I've defined kp24_websize_filename to hold the file name, then built the pop-up comments to include that.


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 5:11 am  (#3) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
That is a cool idea, may help also to spot clones (identical script but with different file names)

_________________
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: I have an idea
PostPosted: Mon Apr 18, 2011 5:30 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4757
Excellent idea, bad implementation... You don't really know if the file isn't going to be renamed, or even moved around. The string used for registration has to be dynamic, if possible with a full path. In python, that would be something like:

whoiam=os.path.abspath(sys.argv[0])

register(
   ....
   "What I do... "+whoiam,
   ...
)

_________________
Image


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 7:51 am  (#5) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
ofnuts wrote:
Excellent idea, bad implementation... You don't really know if the file isn't going to be renamed, or even moved around. The string used for registration has to be dynamic, if possible with a full path. In python, that would be something like:

whoiam=os.path.abspath(sys.argv[0])

register(
   ....
   "What I do... "+whoiam,
   ...
)


AFAIK that can't be done in scheme as all scripts are loaded up initially and then reside in memory (hence the need to "reload" scripts when they are changed on disk).

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 12:16 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
I went ahead and changed all mine by just adding to the pop up comment. :)
All my scm scripts now have a pop up that gives me the script name.This is going to be very handy for getting rid of deprecated scripts and duplicates.

Image

368 scripts i edited in 3 hours :lol
I'll do the python next.Not today though my eyes hurt. :P

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 3:06 pm  (#7) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
how is that helpful ?
when refreshing script you already get warning about duplicates,but that is no so helpful if the script file name do not begin with the same letters to of the script name as registered by gimp

Would be needed something to ...as example automatically rename the script file names using their register name, that will immediatly reveal the clones

_________________
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: I have an idea
PostPosted: Mon Apr 18, 2011 3:09 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Rod wrote:
I went ahead and changed all mine by just adding to the pop up comment. :)
All my scm scripts now have a pop up that gives me the script name.This is going to be very handy for getting rid of deprecated scripts and duplicates.

368 scripts i edited in 3 hours :lol
I'll do the python next.Not today though my eyes hurt. :P


If it's not too late to suggest this, how about you write some python to automatically insert the filenames into the scripts - if you can be patient then I'll have a go tomorrow.

Kevin


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 3:17 pm  (#9) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
insert sort of help
but the real solution will be rename the script file

i doubt that a python gimp script may do it, but a more generical python script maybe coulde solve :
extract the "register" script name and use to rename, use it for the new "file" script name.

_________________
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: I have an idea
PostPosted: Mon Apr 18, 2011 4:30 pm  (#10) 
Offline
Script Coder

Joined: Apr 10, 2011
Posts: 532
PhotoComix wrote:
i doubt that a python gimp script may do it, but a more generical python script maybe could


Why not a python gimp script? As far as I can tell, python gimp scripts are just regular python programs that are executed under gimp...


Top
 Post subject: Re: I have an idea
PostPosted: Mon Apr 18, 2011 6:06 pm  (#11) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
It was a doubt:
because may be locks preventing to edit files of a program in use

sorry i can't find the right word but i hope you got the meaning, but again i am not sure and that may depend also from the OS

For sure it is hard edit everything in win 7 if is inside the Program Files directory

For some kind of edit (i.e.move files in and out a program folder) is asked a "admin" authorization, that is not a problem ,
but in many other cases (as modify the files) changes simply are not applied. and there is not a visible way to authorize the changes (usual workaround is move the files in another directory, edit, and move back the edited files, that anyway require 2 admin authorizations)

And still in 7 edit files of a program in use is even more complicated, maybe is more simple in linux where nothing prevent a root user to do what he wish including delete all system files

_________________
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: I have an idea
PostPosted: Tue Apr 19, 2011 5:04 am  (#12) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I haven't thought about how to automatically alter the scripts but I have found that I can get python to insert the file name into the popup without having to maintain the file name inside the file by using the __file__ value:

for example:
register(
        "python_fu_kjp_align_images",
        "Align Images"+"\n- "+__file__,
        "Align Images",
        "Kevin Payne (paynekj hotmail com)",
        "Copyright 2011 Kevin Payne",
        "2011",
        "<Image>/contributed/Align Images...",
        "*",
        [ (PF_RADIO, "visible", "Layer:", 1, (("new from visible", 1),("current layer",0))),
          (PF_STRING, "prefix", "Prefix", "align")
        ],
        [],
        plugin_main,
)

On my Windows XP system this puts the full file path into the popup.

Kevin


Top
 Post subject: Re: I have an idea
PostPosted: Tue Apr 19, 2011 8:54 am  (#13) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
for path you mean the registration path or the path to the file ?
(the last will be very useful )

_________________
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: I have an idea
PostPosted: Tue Apr 19, 2011 9:28 am  (#14) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Path to the file i.e. C:\Documents and Settings\Profiles\username\.gimp-2.6\plug-ins\pygtk_add_multiple_guides.py


Top
 Post subject: Re: I have an idea
PostPosted: Tue Apr 19, 2011 11:59 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
PC the reason it is useful to me is because there is no real way to tell which script it is you are running.
Now i do know.If it turns out to be a script i really do not need, i can find it quickly and remove it.
Or i can find it quickly edit it to go somewhere else in the menu and refresh scripts.

I'd say that's pretty helpful.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: I have an idea
PostPosted: Tue Apr 19, 2011 12:19 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
I think you guys are doing something totally different then what i was suggesting. :lol
All i wanted to do was add the file name to the pop up not the path to it.
With just the file name added to the script in the pop up.. i e... "thisScript.scm" i can still find the script no matter where it is. :)

Here is another way it can help tremendously - in tutorials
Real easy to point out which script your viewers need for the tutorial by mousing over it in your menu.
I could think of a few more helpful uses too.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: I have an idea
PostPosted: Tue Apr 19, 2011 4:51 pm  (#17) 
Offline
GimpChat Member

Joined: Mar 29, 2011
Posts: 346
Location: Wisconsin
I really like this ideal Rod.

I just edited all of my user scripts and it really helps because file names often don't match the script menu entry text.

I find that many of the script file names are already too long and adding the file system verbosity makes things worse. After all, there are only a couple of places an active script can be hiding, so it isn't hard to find it with just the filename.

_________________
Image


Top
 Post subject: Re: I have an idea
PostPosted: Tue Apr 19, 2011 6:03 pm  (#18) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
Hey Rod, just a small suggestion: Could you make a small video that shows the idea in action. Pictures and videos seem to drive home the idea a lot better than words. Plus, I wouldn't mind seeing your idea, myself. I'm thinking of doing it, but after eyeballing all my scripts, I was like, whoa!

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: I have an idea
PostPosted: Wed Apr 20, 2011 5:11 am  (#19) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Rod wrote:
PC the reason it is useful to me is because there is no real way to tell which script it is you are running.
Now i do know.If it turns out to be a script i really do not need, i can find it quickly and remove it.
Or i can find it quickly edit it to go somewhere else in the menu and refresh scripts.

I'd say that's pretty helpful.


I suggested __file__ because it's like me, simple ;) . If you want the only file name then you could do this:
        "Call an external program"+"\n- "+os.path.basename(__file__),

Of course you will have to be sure the script has import os

Kevin


Top
 Post subject: Re: I have an idea
PostPosted: Wed Apr 20, 2011 12:56 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14715
Location: USA
mahvin wrote:
Hey Rod, just a small suggestion: Could you make a small video that shows the idea in action. Pictures and videos seem to drive home the idea a lot better than words. Plus, I wouldn't mind seeing your idea, myself. I'm thinking of doing it, but after eyeballing all my scripts, I was like, whoa!


I do not have a microphone to record audio in my tutorials yet so i thought it best to go with PDF for now.
i attached the file.it isn't the best for quality but it was a quicky.Still readable and easy to follow i believe.
Once you have all your scripts edited you can then do them as you add them.

As i said before it took me about 3 hours to finish mine opening 25 in Notepad++ at a time.
It's a long job, but i thought it was worth it. :)
Attachment:
File comment: A PDF tutorial on adding the full script name to Gimps pop-up menu to be able to find installed scripts easier.
Adding-Script-Names-to-Gimps-Popup-menus.pdf [1.83 MiB]
Downloaded 151 times

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) @mahvin: an idea for a new animated brush

24

No new posts Attachment(s) GEGL Outline Glow Types - potential plugin idea

1



* Login  



Powered by phpBB3 © phpBB Group