Report development without the need to restart GnuCash

Torsten Edeler torsten at edeler.org
Fri May 23 03:23:48 EDT 2008


Hi Charles.

Well I didn't thing of a bug in the first place. I just thought my method
hasn't just been intended my the report framework.
I could open a bug if it is one (and not a feature) :-)

Regarding gnc-backtrace-if-exception: I don't have any clue what you are
talking about. As I wrote I'm very new to GnuCash and to Scheme. So if you
could describe your propose in more detail I could try to implement it.

btw: I currently use Kate for editing Scheme files and I'm not really
satisfied with it. First of all there seems to be a bug in the bracket
matching and second it does not support code folding for Scheme. Could
somebody out there propose another (GUI) editor to me? I'm not gonna use
Emacs :-) I would use it too less to get familiar with all that cryptic key
combinations.

Regards,
Torsten

2008/5/22 Charles Day <cedayiv at gmail.com>:

> On Thu, May 22, 2008 at 11:09 AM, Torsten Edeler <torsten at edeler.org>
> wrote:
>
>> Hi everybody.
>>
>> I'm quite new to GnuCash. Recently I felt the need to make my own report
>> adapted to my needs, since the existing reports were not suitable. After
>> taking a look to this obscure language Scheme - which I will probably
>> never
>> like :-) - the question rised how to develop reports without having the
>> need
>> to restart the whole application after a little bit of the report had to
>> be
>> changed. I searched the mailing list, but hadn't found anything usefull.
>>
>> I would like to present my solution to that problem to you. Perhaps it has
>> already been solved (probably more elegant) by some of you or I missed it
>> in
>> the ml. Anyway this is what I use at the moment for development.
>>
>> I have the report file which is load by GnuCash on Startup:
>>
>> (define pagename-general "General")
>> (define (options-generator)
>>    (load "/home/torsten/.gnucash/reports/myoptions.scm")
>>    (myoptions)
>> )
>>
>>
>> (define (renderer options)
>>    (load "/home/torsten/.gnucash/reports/renderer.scm")
>>    (myrenderer options)
>> )
>>
>>
>> (let ()
>>  (gnc:define-report
>>   'version 1
>>   'name (N_ "Trivial Example")
>>   'options-generator options-generator
>>   'renderer renderer)
>> )
>>
>> As you can see the renderer and the options-generator include a file load.
>> So everytime GnuCash executes one of the functions, a fresh version of the
>> file is loaded and executet. The files itself defines a function
>> "myoption"
>> and "myrenderer" respectively. Note that the option-generator is only
>> executed after loading the report from the menu (or on startup), whereas
>> the
>> renderer is also executet after reloading or modification of the options.
>>
>> Unfortunatly GnuCash is very sensible to errors in the option-generator,
>> since it simple terminates the whole application.
>
>
> This seems patently ungraceful. Why not include a
> gnc-backtrace-if-exception type of wrapper on options to prevent crashing?
> Is there a bug filed for this already? (Although I do a fair bit of work in
> Scheme, I plead ignorance to the report infrastructure.)
>
> Cheers,
> Charles
>
>
>> The renderer behaves more
>> nicely: Only an error message is displayed in the report window and one
>> has
>> the chance to modify the file and reload the report.
>>
>>
>> I hope this little texts helps some of you. At least it would have helped
>> me
>> :-)
>>
>> regards,
>> Torsten
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>
>
>


More information about the gnucash-user mailing list