Re: Python


I work as a structural engineer in Australia, and the design of steel,
concrete, timber, etc, is dictated by a set of codes.  Design codes are
different between countries, and often states within the country, and
they tend to use slightly different equations to determine the capacity
of any given member.  For example, the effective stiffness of a concrete
member experiencing in service deflection, as proposed by Branson is

Ief = Icr + (Ig + Icr)(Mcr / M*)^3

This relationship is specific to an assumption employed by the
Australian concrete design codes and as such is probably not really
suitable for inclusion in the set of Gnumeric functions.  But the
ability to create a simple function to perform this equation makes
debugging the spreadsheet much easier.

The above example is a relatively straight forward one, they certainly
become more complex (if you're not careful) and often involve iteration
through a set of data points.

This said, the python plugin feature allows a cell within the
spreadsheet to pass variables to an external python function.  The cell
will display the python function's returned result.  This is good and is
pretty much what I'm looking for.  However plugins become a global
setting for every sheet opened with Gnumeric, and I'm hoping to be able
to write separate functions for separate sheets.  The help manual has a
page that hints of the possibility.

By the way, If I could work out how to do this kind of thing, I'd be
happy to write some stuff for the help manual.

Oh, one other point regarding the help system.  It is possible to return
to the earlier system - pre-gnome2 - where help opened immediately
without the delay we are currently experiencing.


On Fri, 2003-12-05 at 00:00, Andreas J. Guelzow wrote:
On Wed, 2003-12-03 at 21:16, pasty wrote:
 Not sure if this is the best place to ask these questions, but here goes.
 As new comer to Gnumeric, I'm trying hard to leave Microsoft's Excel 
behind.  Unfortunately, I've become rather reliant on a number of functions 
written in visual basic.  Transfering excel workbooks really means re- 
writing a number of functions.
 When adding user defined functions, is it best to write python plugin 
modules (as described in the help manual) or is there another method?
 If python plugins are the most suitable, is there a way of having gnumeric 
re-read the python plugin file without closing and re-opening?

Functions written in python plugin work real well.  It would be nice 
however, if Gnumeric could load a python function definition set written 
for a specific workbook, maybe embedded in the Gnumeric file, or saved to 
the same directory with the workbook's name and the .py file extension
 Can user defined functions be called by the button wigets?

There is an entry in the Gnumeric manual under extending Gnumeric called 
"defining new functions".  Is this page empty because the feature hasn't 
been documented yet, or because the feature hasn't been implemented yet.


I don't know much about the python plugin and the ability to write new
functions using it. Hopefully Jon-Kåre or Adrian will reply to your
message. I would be interested in knowing though, what functions you
need to add that aren't already provided by gnumeric. I don't find it
hard to write plugins in C that add additional functions. And if there
are any generic functions that would be nice to be added to gnumeric we
would proba;y like to do that.


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