Dear all
On 04/09/2016 09:34 PM, Jeremy Sanders wrote:
I'm afraid labels can't currently include any dynamic content, though it
sounds a good idea.
I've actually just implemented evaluation of Python code within labels.
It was reasonably straightforward. Code is given with the special format
%{{ EXPR }}%, e.g. %{{sin(pi/2)}}%. The return of the code is converted
to text, replacing the original expression.
I've also added some special useful functions/objects.
* DATA(name, [part]) - return dataset with name and optional part (i.e.
'data', 'serr', 'perr', 'nerr'). Allows sum of dataset to be shown with
%{{ sum(DATA('dataset')) }}%
* SETTING(path) - return setting with full path, e.g.
SETTING('/page1/width')
* ENVIRON: the os.environ dict, to get environment variables, e.g.
ENVIRON['USER']
* DATE([fmt]) the current date (with optional format)
* TIME([fmt]) the current date/time (optional format)
* FILENAME() - escaped filename, with directory
* BASENAME() - escaped filename, without directory
* ESCAPE(txt) - escape any latex within txt
** Note that these functions are also available in normal expression
evaluation ** , so you could plot a function which is based on a value
of a fit parameter, or based on a dataset, e.g. mean(DATA('mydata')). It
also allows Veusz functions to use environment variables, e.g.
float(ENVIRON['MYVAR']).
Cheers
Jeremy
_______________________________________________
Veusz-discuss mailing list
Veusz-discuss@gna.org
https://mail.gna.org/listinfo/veusz-discuss