Dynamically adding reports

Andrew Sackville-West andrew at swclan.homelinux.org
Thu Jun 11 16:54:58 EDT 2009


On Thu, Jun 11, 2009 at 07:08:18AM -0700, Phil Longstaff wrote:
> I played around last night with how reports are loaded in the system.  I basically replaced:
> 
> (use-module (gnucash report report-A))
> (use-module (gnucash report report-B))
> 
> which appears in standard-reports.scm, with
> 
> (define (get-report-list) (list
>     'report-A
>     'report-B
> ))
> (for-each (lambda (x) (resolve-module (append '(gnucash report) x))) (get-report-list))
> 
> which does nothing new, but does allow me to replace (get-report-list) with a function which returns the names of all .scm files.  This will then allow a user/developer to just drop a new report file into the reports directory, restart gnucash, and it will be picked up.  Or, (get-report-list) could read the list of report file names from a standard-report-names.txt file, which would allow the user/developer to drop a report file into the reports directory, add the file name to the standard-report-names.txt, then restart.  My preference is for the former (fewer steps), but a little more difficult.
> 
> The reports directory currently holds all of the report files (both standard and business) as well as some support files.  I think what I will do is create a 'standard-reports' subdirectory to the reports directory, and put the standard reports (or symlinks) there.  get-report-list will then have a single directory from which to get all of the file names.
> 
> Comments?

is it reasonable to take my custom reports interface work and expand
that to the entire report structure? Then the reports list could be
truly dynamic at runtime (not that there's all that much call for it,
probably). Instead of just parsing the saved-reports file, it could
also iterate over the .scm files in the report directory and build
them into a tree within one dialog. We could theoretically drop the
whole report menu and replace it with a single toolbar button at that
point.

just .02 and note that I'm not volunteering to do any of this. sorry.

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20090611/96fd5b55/attachment.bin>


More information about the gnucash-devel mailing list