Dave Peticolas <[EMAIL PROTECTED]> writes:
> Ok, I finally got this working. Rob, maybe you can see an
> easier way. Anyway, it seems the new reporting stuff requires
> slib 2c6, right?
Hmm, I had no idea. We can probably eliminate the dependency on any
particular version of slib if we like. I just used it for the sprintf
statement so I'd have an easy translation from the perl, but we could
do something else if need be.
> 4. It seems that guile (or slib?) needs the file slibcat in
> /usr/share/guile in order to work. This file is automatically
> generated. However, if you have guile installed in a root-owned
> directory (which is the case for the guile rpm), you will need
> to be root in order to generate the file. I found that by running
> guile as root and then loading the command:
> (primitive-load "gnucash/src/scm/srfi/srfi-8.guile.scm")
> that the slibcat file was generated. After that, I could run
> gnucash as a regular user and everything worked.
Right. The debian package handles this for you generally, though
there was a problem during the recent reorganization where you needed
to run 'guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)"'
as root to generate the new slib catalog...
> Anyway Rob, now that I have this working, can you tell me how I can
> get the scheme reports to pass the html to gnome as one large string?
Well, I don't offhand about the gnome bit, but to get the output as a
long string instead of having it display (which I presumed we'd need
to do eventually), you just need to redefine the gnc:run-report
function. As I mention in the comment in the current code,
call-with-output-string will let us use the normal output functions to
build a string. Perhaps something like this (I haven't tested it, so
let me know if it doesn't work):
(define (gnc:run-report report-name)
;; Return a string consisting of the contents of the report.
(define (display-report-list-item item port)
(cond
((string? item) (display item port))
((null? item) #t)
((list? item) (map display-report-list-item item))
(else (gnc:warn "gnc:run-report - " item " is the wrong type."))))
(let ((rendering-thunk (hash-ref *gnc:_report-info_* report-name)))
(if (not rendering-thunk)
#f
(call-with-output-string
(lambda (port)
(for-each
(lambda (item) (display-report-list-item item port))
(rendering-thunk)))))))
--
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930
--
Gnucash Developer's List
To unsubscribe send empty email to: [EMAIL PROTECTED]