Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-04 Thread saulgoode
Quoting Alan Campbell gimp-u...@alancampbelllists.ukfsn.org:


  Always got the Woodrat folder under File | Create menu, no
  shortcut key indicated.

 On 3 Oct 2010 at 11:17:05, Sven Neumann wrote:

 I am pretty sure that it theoretically should work this way. After
 all the Script-Fu extension itself creates sub-menus this way and
 those sub-menus do have mnemonics. You definitely should not use
 the underscore in the menu-register call.

 I was calling (gimp-plugin-menu-branch-register from top level, i.e.
 it was a statement in scm file along with many (defines.

 So how does that work?  script-fu interpreter processes defines
 first, then any (script-fu-register*) statements, nothing else? Any
 other precedence rules?

It is not a problem with the branch register command not being  
processed, but that branch registration seems to require that plug-in  
be associated with it (see 'plugin_menu_branch_register_invoker()' in  
app/pdb/plug-in-cmds.c). Apparently, when processed at the top level  
of a Script-fu, there is no current-active-plugin; and this leads to  
'gimp_marshal_VOID__STRING_STRING_STRING' failing because it is  
missing one of its parameters (the plug-in name).

 I did this:

 (define (wrf_register_menu_branch)
  (gimp-plugin-menu-branch-register Image/File/Create W_oodrat)
  _Finger...
 )

 (script-fu-register  wrf_create_template_finger
   (wrf_register_menu_branch); menu label
 

 which works.  (script-fu-register when it runs has to call
 (wrf_register_menu_branch), which does the register thing.

A clever solution. However, I was unable to make it work with GIMP  
2.6.10+. What version of GIMP are you using?

 Anyway, my kludge seems to work.  Thanks for pointer on how to do it.

I'm not sure how robust your kludge is. If it is not version specific  
then it may be working for you (and not me) because of something other  
going on than just the code you posted here (multiple procedure  
registrations in the same file perhaps). Could you provide a complete  
listing of your script?

Regards.



___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-04 Thread Alan Campbell
On 4 Oct 2010 at 10:21:16 PDT 
saulgoode at flashingtwelve.brickfilms.com wrote:

 It is not a problem with the branch register command not being
 processed, but that branch registration seems to require that
 plug-in be associated with it (see
 'plugin_menu_branch_register_invoker()' in 
 app/pdb/plug-in-cmds.c). Apparently, when processed at the top
 level of a Script-fu, there is no current-active-plugin; and
 this leads to  'gimp_marshal_VOID__STRING_STRING_STRING' failing
 because it is  missing one of its parameters (the plug-in name). 

Don't have source code, so I'll pass on the c.  But I get the idea.

  I did this:

   (define (wrf_register_menu_branch)
(gimp-plugin-menu-branch-register 
  Image/File/Create/W_oodrat)
_Finger...
   )

   (script-fu-register  wrf_create_template_finger
  (wrf_register_menu_branch); menu label
   

  which works.  (script-fu-register when it runs has to call
  (wrf_register_menu_branch), which does the register thing.

 A clever solution. However, I was unable to make it work with GIMP  
 2.6.10+. What version of GIMP are you using? 

2.6.10 win32 on XP.

   Anyway, my kludge seems to work.  
   Thanks for pointer on how to do it.

 I'm not sure how robust your kludge is. If it is not version
 specific  then it may be working for you (and not me) because of
 something other  going on than just the code you posted here
 (multiple procedure  registrations in the same file perhaps).
 Could you provide a complete listing of your script? 

2000 lines overall, 1200 lines of code.  Perhaps a bit excessive to 
paste into a posting here.  So for moment it's in woodrat.zip at

https://docs.google.com/leaf?id=0B6M_pjcD-
RRwNTZjODc0NzQtYjliMy00ZDBlLTgzZWItNDAyNDExMTA2YzU3hl=enauthkey=CMGn
5i4

or

http://bit.ly/btzFxD

or

http://www.freedrive.com/folder/282054


In version posted I invoke (wr_register_menu_branch) 3 times, with 
argument (the value to return each time).  It also worked for me when 
I just invoked it once (on the first (script-fu-register)).  

Any comments or crits on code very welcome, e.g. if you happen to 
notice me doing anything wildly inefficient.  To actually run the 
script you need the pattern file included in the zip.

Yrs,

Alan 

Never put anything smaller than your elbow
into your ear.


= +  =



___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Alan Campbell
One of uses of an underscore is to pick out the shortcut character in 
a menu item:

(script-fu-register  wrdhb_create_half_blind_dovetail
  _Half blind dovetail...   ;menu label
  Create Template for Half blind Dovetail 

)

There also appears to be

(script-fu-register  wrdhb_create_half_blind_dovetail
  _Half blind dovetail...   ;menu label
...
)

whch I gather has something to do with translation: I assume it would 
have no effect in this particular case because it's sadly 
unreasonable to expect translation dictionaries (po files??) to know 
blind or dovetail.  That so?

==

script-fu-register  wrdhb_create_half_blind_dovetail
  _Half blind dovetail...   ;menu label

)

Also, I've been using this style of getting a script registered for 
use in create menu:

(script-fu-menu-register wrdhb_create_template_half_blind_dovetail 
Image/File/Create/Woodrat)

(a)  Can I combine the two, putting path in second parameter of 
script-fu-register?

(b) Is there anyway of getting a letter of the submenu Woodrat to 
be a shortcut key?  I've tried variations of underscore in the 
Image/File/Create/Woodrat parameter, doesn't work.


Yrs,

Alan 

Never accept a drink from a urologist.

-- Erma Bombeck


= +  =



___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Sven Neumann
On Sun, 2010-10-03 at 12:59 +, Alan Campbell wrote:
 One of uses of an underscore is to pick out the shortcut character in 
 a menu item:
 
 (script-fu-register  wrdhb_create_half_blind_dovetail
   _Half blind dovetail...   ;menu label
   Create Template for Half blind Dovetail 
 
 )
 
 There also appears to be
 
 (script-fu-register  wrdhb_create_half_blind_dovetail
   _Half blind dovetail...   ;menu label
 ...
 )
 
 whch I gather has something to do with translation: I assume it would 
 have no effect in this particular case because it's sadly 
 unreasonable to expect translation dictionaries (po files??) to know 
 blind or dovetail.  That so?

If you want your scripts to be translated, then you need to put your
scripts into a separate translation domain and ship the translations
with them. You can of course not expect the strings from your scripts to
be part of the standard script-fu translation domain.


 Also, I've been using this style of getting a script registered for 
 use in create menu:
 
 (script-fu-menu-register wrdhb_create_template_half_blind_dovetail 
 Image/File/Create/Woodrat)
 
 (a)  Can I combine the two, putting path in second parameter of 
 script-fu-register?

Using a path in the script-fu-register call is deprecated. Please use
script-fu-menu-register.

 (b) Is there anyway of getting a letter of the submenu Woodrat to 
 be a shortcut key?  I've tried variations of underscore in the 
 Image/File/Create/Woodrat parameter, doesn't work.

You need to explicitly create the submenu using
gimp-plugin-menu-branch-register. This procedure should accept mnemonics
marked with an underscore.


Sven


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Alan Campbell


Hi Sven,

On 3 Oct 2010 at 14:19, Sven Neumann wrote:

 On Sun, 2010-10-03 at 12:59 +, Alan Campbell wrote:
  One of uses of an underscore is to pick out the shortcut character
  in a menu item:
  
  (script-fu-register  wrdhb_create_half_blind_dovetail
_Half blind dovetail...   ;menu label
Create Template for Half blind Dovetail 
  
  )
  
  There also appears to be
  
  (script-fu-register  wrdhb_create_half_blind_dovetail
_Half blind dovetail...   ;menu label
  ...
  )
  
  whch I gather has something to do with translation: I assume it
  would have no effect in this particular case because it's sadly
  unreasonable to expect translation dictionaries (po files??) to know
  blind or dovetail.  That so?
 
 If you want your scripts to be translated, then you need to put your
 scripts into a separate translation domain and ship the translations
 with them. You can of course not expect the strings from your scripts
 to be part of the standard script-fu translation domain.

Yikes.  Okay, will now go find out what a translation domain is.  
However, since woodrats I think are only sold only with English 
instructions, I guess their owners will probably read engish...
 
  Also, I've been using this style of getting a script registered for
  use in create menu:
  
  (script-fu-menu-register wrdhb_create_template_half_blind_dovetail
  Image/File/Create/Woodrat)
  
  (a)  Can I combine the two, putting path in second parameter of
  script-fu-register?
 
 Using a path in the script-fu-register call is deprecated. Please use
 script-fu-menu-register.

Have done, thanks.

  (b) Is there anyway of getting a letter of the submenu Woodrat to
  be a shortcut key?  I've tried variations of underscore in the
  Image/File/Create/Woodrat parameter, doesn't work.
 
 You need to explicitly create the submenu using
 gimp-plugin-menu-branch-register. This procedure should accept
 mnemonics marked with an underscore.
 

Tried
(gimp-plugin-menu-branch-register Image/File/Create W_oodrat)
(gimp-plugin-menu-branch-register Image/File/Create _Woodrat) 

followed by 

(script-fu-menu-register wrdhb_create_half_blind_dovetail
  Image/File/Create/W_oodrat)

or

(script-fu-menu-register wrdhb_create_half_blind_dovetail
  Image/File/Create/_Woodrat)

or

(script-fu-menu-register wrdhb_create_half_blind_dovetail
  Image/File/Create/Woodrat)


Always got the Woodrat folder under File | Create menu, no shortcut 
key indicated.




Yrs,

Alan 

Law of Cybernetic Entomology:

   There is always one more bug.


= +  =



___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Sven Neumann
On Sun, 2010-10-03 at 13:42 +, Alan Campbell wrote:

  You need to explicitly create the submenu using
  gimp-plugin-menu-branch-register. This procedure should accept
  mnemonics marked with an underscore.
  
 
 Tried
 (gimp-plugin-menu-branch-register Image/File/Create W_oodrat)
 (gimp-plugin-menu-branch-register Image/File/Create _Woodrat) 
 
 followed by 
 
 (script-fu-menu-register wrdhb_create_half_blind_dovetail
   Image/File/Create/W_oodrat)
 
 or
 script-fu-menu-
 (script-fu-menu-register wrdhb_create_half_blind_dovetail
   Image/File/Create/_Woodrat)
 
 or
 
 (script-fu-menu-register wrdhb_create_half_blind_dovetail
   Image/File/Create/Woodrat)
 
 
 Always got the Woodrat folder under File | Create menu, no shortcut 
 key indicated.

I am pretty sure that it theoretically should work this way. After all
the Script-Fu extension itself creates sub-menus this way and those
sub-menus do have mnemonics. You definitely should not use the
underscore in the menu-register call.

However the problem is most likely that Script-Fu doesn't provide you
any means to call this procedure before the menu-register call is
executed. There would probably have to be a
script-fu-menu-branch-register() wrapper added for this purpose.

A possible solution would be to write your scripts in Python.


Sven


___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] script-fu: underscore?; script-fu-register; script-fu-menu-register

2010-10-03 Thread Alan Campbell

  Always got the Woodrat folder under File | Create menu, no
  shortcut key indicated.

On 3 Oct 2010 at 11:17:05, Sven Neumann wrote:

 I am pretty sure that it theoretically should work this way. After
 all the Script-Fu extension itself creates sub-menus this way and
 those sub-menus do have mnemonics. You definitely should not use
 the underscore in the menu-register call. 

I was calling (gimp-plugin-menu-branch-register from top level, i.e. 
it was a statement in scm file along with many (defines.  

So how does that work?  script-fu interpreter processes defines 
first, then any (script-fu-register*) statements, nothing else? Any 
other precedence rules?

 However the problem is most likely that Script-Fu doesn't provide
 you any means to call this procedure before the menu-register call
 is executed. There would probably have to be a
 script-fu-menu-branch-register() wrapper added for this purpose. 

I did this:

(define (wrf_register_menu_branch)
 (gimp-plugin-menu-branch-register Image/File/Create W_oodrat)
 _Finger...
) 

(script-fu-register  wrf_create_template_finger
  (wrf_register_menu_branch); menu label


which works.  (script-fu-register when it runs has to call 
(wrf_register_menu_branch), which does the register thing.

 A possible solution would be to write your scripts in Python.

Oh dear.  I've had enough mental exercise for this year learning 
script-fu.  Not sure by brain could take relearning python.

Also that would require that end users of script, generally assumed 
not to be highly computer literate, would have to install python as 
well as GIMP. 

Anyway, my kludge seems to work.  Thanks for pointer on how to do it.

Yrs,

Alan 

Never say anything on the phone that you
wouldn't want your mother to hear at your
trial.

-- Sydney Biddle Barrows 
   the Mayflower Madam


= +  =



___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user