Re: py_func.py



On Tue, May 13, 2003 at 11:01:32PM +1000, Charles R. Twardy wrote:
I have been able to change the descriptions for py_capwords and py_printf,
but have been unable to figure out how to add a new function. I tried a
simple py_square function. I've had two responses:
   1) The function-chooser GUI used to complain 'Bad description'
   2) Now it just ignores the function entirely.
It APPEARS that one registers new functions in the "test_functions"
list. If that is so, any ideas what I've done wrong below?

1) edit plugins.xml.in and add the name

# Hrm... what's going on here? 
# It appears you can use both a short and a long form.
# The long form provides extra info to the function-chooser GUI. If you
# don't do that, the GUI will just say "Any" for type, and will keep
# prompting you for more parameters. Otherwise it will prompt you with
# the name and type of the parameter, and stop prompting when you have
# them all.
#
# Short form: 'py_capwords': func_capwords
# Long form : 'py_capwords': ('s', 'string', func_capwords)
#


2)  Its not a short vs a long.  As documented in
doc/developer/writing-functions.sgml there are 2 types of funtions.
    a) functions with variable numbers of arguments
        eg SUM
    b) functions with explicitly named potentially optional
       arguments
        eg DATE

# Where 's' is the gnumeric type (string) and 'string' is the name of
# the variable (confusing, here).

3) We want to know both the type and the name of the parameter.
Call it 'text' to make it clearer that 'string' is not a type decl.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]