Re: Adding Simple Feature to Gnumeric



Thanks for the tips, Morten. I will do some work in the next few days to compile current Git versions of Goffice, GSL (suggested by Andreas) and Gnumeric together. 

In the meantime, I got distracted by your suggestion of using Python scripting to address the problem which also seems like a viable mechanism. The python API is very solid, exposing all the C functions I have seen and allowing exploration using the Tools->Plugins->Python Console via things like '>>> dir(Gnm)' to see what functions and fields are exposed. I have been stumbled a bit on finding an exact angle of attack so I will ask a couple questions.

1. Is there any way to access a notion of the 'currently active sheet'?  I have found by going through the Python 'Gnm.App' (the global 'GnmApp *app' field from src/application.c I expect) one can access the list of workbooks via 
  >>> wb=Gnm.App.workbook_get_by_index(0)
and other function. This leads to access to sheets managed by the Gnumeric instance.
The ideal behavior for me is to 
- select an area of Cells on a Sheet 
- apply some functionality cells in the selected area.  
This requires some notion of the most recently used or 'active' Sheet/Workbook, functionality which I can't seem to find.  Perhaps it's not present at all in the global program state due to such accesses being through the GTK GUI and thus not tracked by the internal model of Gnumeric but any insight on how one might figure this out would be appreciated.

2. Ideally I would like this 'replace blank cells' functionality to have a GUI interface perhaps implemented using the Plugin architecture.  In the plugins/ source directory, I see examples of (A) C plugins with similar ideas, (B) a plugin to load python code using C (python-loader), and (C) cell functions written in python (py-func). I don't see any pure python plugins with GUIs. 
Is it possible to write a Python plugin that will have a GUI menu (like in the plugins/uihello directory, perhaps using some of the XML files there) and operate on cells or would this require use of the C interface?

Cheers,
Chris

On Wed, Aug 21, 2019 at 12:51 PM Morten Welinder <mortenw gnome org> wrote:
To build Gnumeric from github you will need Goffice from github.

You could probably hack around it ("#define go_format_has_year(fmt)
0")  if you don't mind potential problems with text import.

Search and replace never sees empty cells so it won't do what you need.
Python scripting -- see test/t3001-introspection-simple.py -- certainly can.

M.


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