Hi Sean,
the usage message is generated by introspection, so with your implicit
arguments declaration it's not possible to get an informative usage
message. But you can add a docstring which will be displayed with "help
test" instead of "test ?".
def test(*args, **kwargs):
'''
DESCRIPTION
Some description.
USAGE
test [ x1, x2, ..., xn, [ var1=0 [, selection="" ]]]
'''
var1 = kwargs.get('var1', 0)
sel = kwargs.get('selection', '')
for x in args:
pass
Hope that helps.
Cheers,
Thomas
On 06/14/2012 06:00 PM, Sean Law wrote:
> Hi PyMOL Community,
>
> I have a PyMOL script that I have written that starts with the following
> kind of format:
>
> -----------------
> from pymol import cmd
> from re import *
>
> def test(*args, **kwargs):
>
> var1=0
> sel=""
>
> for key in kwargs:
> if (key == "var1"):
> var1=int(kwargs["var1"])
> elif (key == "selection"):
> sel=kwargs["selection"]
> else:
> continue
>
> while (len(args)>=1):
> args.pop(0)
>
> return
> cmd.extend("test", test)
>
> ----------------------
>
>
> I've noticed that in this format the usage output (i.e. if I do "test
> ?") does not contain any valuable information:
>
> test ?
> Usage: test
>
> Thus, I was hoping that there was an easy way that I can directly
> specify what the Usage output says. I was hoping that it would say
> something like:
>
> Usage: test [var1=0 [, selection=""]]
>
> Any suggestions would be greatly appreciated. Thanks.
>
> Sean
--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]