Re: [GNC] What is wrong with this custom stylesheet code?

2023-07-04 Thread Robert Heller
At Tue,  4 Jul 2023 09:56:59 -0400 (EDT) Robert Heller  
wrote:

> 
> OK, I've given up.  I'm going to write a Tcl program to post process the 
> default HTML export and create a LaTeX file.  There is some serious things 
> broken that I cannot figure out.

Actually, I am going to write a Python program (yech) to create the LaTeX 
file and totally give up on printing Invoices from the GnuCash GUI.

> 
> At Mon, 3 Jul 2023 18:57:17 -0700 Vincent Dawans  wrote:
> 
> > 
> > HI Robert:
> > 
> > Here are a few things you need to change:
> > 
> > That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
> > "DWS Stylesheet")) the first parameter is actually the template name
> > defined just above, so it should be "DWS Stylesheet" without the
> > underscore. The second parameter is the name of the default stylesheet
> > created based on that template. You can use the same name as the template
> > or you could call your Template "DWS Template" both here and above, as in:
> > 
> > (gnc:define-html-style-sheet
> >  'version 3.0
> >  'name (N_ "DWS Template")
> >  'renderer dws-renderer
> >  'options-generator dws-options)
> > 
> > (gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))
> > 
> > I would also advise you put your code in a separate scm file, for instance
> > dws.scm, then store it in the USER_DATA directory .local/share/gnucash and
> > load it from config-user.scm by adding
> > 
> > (load (gnc-build-userdata-path "dws.scm"))
> > 
> > Finally, possibly you are hitting a bug with the inability to save or there
> > is something I don't know about loading the template because I have the
> > same problem. Actually it's saving fine, you can see it in
> > local/share/gnucash/stylesheets-2.0. It's the loading that's not working. I
> > am wondering if it's not trying to load the saved stylesheet before running
> > config-user.scm and therefore not finding it or something like that. But if
> > I put the scm file directly in the main template directory under gnucash
> > then it works, it's loading the saved settings, so that's a work-around.
> > You don't load it in config-user.scm; instead you copy the file to
> > 
> >  > dir>/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/
> > 
> > Sincerely,
> > 
> > Vincent Dawans
> > 
> > Then it saves fine for me.
> > 
> > 
> > 
> > 
> > On Mon, Jul 3, 2023 at 
> > 7:17 AM Robert Heller 
> >  wrote:
> > 
> > >
> > > I have written a style sheet module and it *seems* to be loading now, but
> > > things are wonky any I don't know why.
> > >
> > > What I am *trying to go:
> > >
> > > 1) Put my company letterhead across the top of the invoice
> > > 2) Put a "button image" (Payments by PayPal) under the invoice table.
> > >
> > > My custom stylesheet code adds two options: the button image and some
> > > (optional) text to put under the button image (typically the e-mail
> > > address to
> > > use as the payment target).
> > >
> > > Several things are not working:
> > >
> > > If I use the Edit->Style Sheets options and create a new stylesheet from 
> > > my
> > > template, the addition options are not available (why?) If I just edit the
> > > template itselt (with Edit->Style Sheets) I can set the header image and
> > > the
> > > button image, and the header image shows up, but not the button image
> > > (why?),
> > > and the options not saved across runs (why?).
> > >
> > > This code used to work just fine with V 2.6.  What has changed?  What do I
> > > need to change?  The attached code was copied and modified from the V4.14
> > > source tree (footer.scm), but obviously something is wrong somewhere.
> > >
> > >
> > > ;;*
> > > ;;
> > > ;;  System:
> > > ;;  Module:
> > > ;;  Object Name   : $RCSfile$
> > > ;;  Revision  : $Revision$
> > > ;;  Date  : $Date$
> > > ;;  Author: $Author$
> > > ;;  Created By: Robert Heller
> > > ;;  Created   : Sun Jul 2 15:09:23 2023
> > > ;;  Last Modified : <230703.1014>
> > > ;;
> > > ;;  Description
> > > ;;
> > > ;;  Notes
> > > ;;
> > > ;;  History
> > > ;;
> > >
> > > ;;*
> > > ;;# @copyright
> > > ;;Copyright (C) 2023  Robert Heller D/B/A Deepwoods Software
> > > ;;  51 Locke Hill Road
> > > ;;  Wendell, MA 01379-9728
> > > ;;
> > > ;;This program is free software; you can redistribute it and/or modify
> > > ;;it under the terms of the GNU General Public License as published by
> > > ;;the Free Software Foundation; either version 2 of the License, or
> > > ;;(at your option) any later version.
> > > ;;
> > > ;;This program is distributed in the hope that it will be useful,
> > > ;;but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > ;;MERCHANTABILITY or FITNESS FOR A PARTICULAR 

Re: [GNC] What is wrong with this custom stylesheet code?

2023-07-04 Thread Vincent Dawans
I'll try to do a trace later today.
--Vincent

On Tue, Jul 4, 2023 at 7:59 AM Geert Janssens 
wrote:

> Any error messages in gnucash.trace when the loading fails ?
>
> Regards,
>
> Geert
>
> Op dinsdag 4 juli 2023 03:57:17 CEST schreef Vincent Dawans:
>
> > HI Robert:
>
> >
>
> > Here are a few things you need to change:
>
> >
>
> > That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
>
> > "DWS Stylesheet")) the first parameter is actually the template name
>
> > defined just above, so it should be "DWS Stylesheet" without the
>
> > underscore. The second parameter is the name of the default stylesheet
>
> > created based on that template. You can use the same name as the template
>
> > or you could call your Template "DWS Template" both here and above, as
> in:
>
> >
>
> > (gnc:define-html-style-sheet
>
> >  'version 3.0
>
> >  'name (N_ "DWS Template")
>
> >  'renderer dws-renderer
>
> >  'options-generator dws-options)
>
> >
>
> > (gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))
>
> >
>
> > I would also advise you put your code in a separate scm file, for
> instance
>
> > dws.scm, then store it in the USER_DATA directory .local/share/gnucash
> and
>
> > load it from config-user.scm by adding
>
> >
>
> > (load (gnc-build-userdata-path "dws.scm"))
>
> >
>
> > Finally, possibly you are hitting a bug with the inability to save or
> there
>
> > is something I don't know about loading the template because I have the
>
> > same problem. Actually it's saving fine, you can see it in
>
> > local/share/gnucash/stylesheets-2.0. It's the loading that's not
> working. I
>
> > am wondering if it's not trying to load the saved stylesheet before
> running
>
> > config-user.scm and therefore not finding it or something like that. But
> if
>
> > I put the scm file directly in the main template directory under gnucash
>
> > then it works, it's loading the saved settings, so that's a work-around.
>
> > You don't load it in config-user.scm; instead you copy the file to
>
> >
>
> > 
> > dir>/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/
>
> >
>
> > Sincerely,
>
> >
>
> > Vincent Dawans
>
> >
>
> > Then it saves fine for me.
>
> >
>
> > On Mon, Jul 3, 2023 at 7:17 AM Robert Heller 
> wrote:
>
> > > I have written a style sheet module and it *seems* to be loading now,
> but
>
> > > things are wonky any I don't know why.
>
> > >
>
> > > What I am *trying to go:
>
> > >
>
> > > 1) Put my company letterhead across the top of the invoice
>
> > > 2) Put a "button image" (Payments by PayPal) under the invoice table.
>
> > >
>
> > > My custom stylesheet code adds two options: the button image and some
>
> > > (optional) text to put under the button image (typically the e-mail
>
> > > address to
>
> > > use as the payment target).
>
> > >
>
> > > Several things are not working:
>
> > >
>
> > > If I use the Edit->Style Sheets options and create a new stylesheet
> from
>
> > > my
>
> > > template, the addition options are not available (why?) If I just edit
> the
>
> > > template itselt (with Edit->Style Sheets) I can set the header image
> and
>
> > > the
>
> > > button image, and the header image shows up, but not the button image
>
> > > (why?),
>
> > > and the options not saved across runs (why?).
>
> > >
>
> > > This code used to work just fine with V 2.6.  What has changed?  What
> do I
>
> > > need to change?  The attached code was copied and modified from the
> V4.14
>
> > > source tree (footer.scm), but obviously something is wrong somewhere.
>
> > >
>
> > >
>
> > >
> ;;
>
> > > * ;;
>
> > > ;;  System:
>
> > > ;;  Module:
>
> > > ;;  Object Name   : $RCSfile$
>
> > > ;;  Revision  : $Revision$
>
> > > ;;  Date  : $Date$
>
> > > ;;  Author: $Author$
>
> > > ;;  Created By: Robert Heller
>
> > > ;;  Created   : Sun Jul 2 15:09:23 2023
>
> > > ;;  Last Modified : <230703.1014>
>
> > > ;;
>
> > > ;;  Description
>
> > > ;;
>
> > > ;;  Notes
>
> > > ;;
>
> > > ;;  History
>
> > > ;;
>
> > >
>
> > >
> ;;
>
> > > * ;;# @copyright
>
> > > ;;Copyright (C) 2023  Robert Heller D/B/A Deepwoods Software
>
> > > ;;  51 Locke Hill Road
>
> > > ;;  Wendell, MA 01379-9728
>
> > > ;;
>
> > > ;;This program is free software; you can redistribute it and/or
> modify
>
> > > ;;it under the terms of the GNU General Public License as
> published by
>
> > > ;;the Free Software Foundation; either version 2 of the License, or
>
> > > ;;(at your option) any later version.
>
> > > ;;
>
> > > ;;This program is distributed in the hope that it will be useful,
>
> > > ;;but WITHOUT ANY WARRANTY; without even the implied warranty of
>
> > > ;;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>
> > > ;;GNU General Public License for 

Re: [GNC] What is wrong with this custom stylesheet code?

2023-07-04 Thread Geert Janssens
Any error messages in gnucash.trace when the loading fails ?

Regards,

Geert

Op dinsdag 4 juli 2023 03:57:17 CEST schreef Vincent Dawans:
> HI Robert:
> 
> Here are a few things you need to change:
> 
> That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
> "DWS Stylesheet")) the first parameter is actually the template name
> defined just above, so it should be "DWS Stylesheet" without the
> underscore. The second parameter is the name of the default stylesheet
> created based on that template. You can use the same name as the template
> or you could call your Template "DWS Template" both here and above, as in:
> 
> (gnc:define-html-style-sheet
>  'version 3.0
>  'name (N_ "DWS Template")
>  'renderer dws-renderer
>  'options-generator dws-options)
> 
> (gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))
> 
> I would also advise you put your code in a separate scm file, for instance
> dws.scm, then store it in the USER_DATA directory .local/share/gnucash and
> load it from config-user.scm by adding
> 
> (load (gnc-build-userdata-path "dws.scm"))
> 
> Finally, possibly you are hitting a bug with the inability to save or there
> is something I don't know about loading the template because I have the
> same problem. Actually it's saving fine, you can see it in
> local/share/gnucash/stylesheets-2.0. It's the loading that's not working. I
> am wondering if it's not trying to load the saved stylesheet before running
> config-user.scm and therefore not finding it or something like that. But if
> I put the scm file directly in the main template directory under gnucash
> then it works, it's loading the saved settings, so that's a work-around.
> You don't load it in config-user.scm; instead you copy the file to
> 
>  dir>/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/
> 
> Sincerely,
> 
> Vincent Dawans
> 
> Then it saves fine for me.
> 
> On Mon, Jul 3, 2023 at 7:17 AM Robert Heller  wrote:
> > I have written a style sheet module and it *seems* to be loading now, but
> > things are wonky any I don't know why.
> > 
> > What I am *trying to go:
> > 
> > 1) Put my company letterhead across the top of the invoice
> > 2) Put a "button image" (Payments by PayPal) under the invoice table.
> > 
> > My custom stylesheet code adds two options: the button image and some
> > (optional) text to put under the button image (typically the e-mail
> > address to
> > use as the payment target).
> > 
> > Several things are not working:
> > 
> > If I use the Edit->Style Sheets options and create a new stylesheet from
> > my
> > template, the addition options are not available (why?) If I just edit the
> > template itselt (with Edit->Style Sheets) I can set the header image and
> > the
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
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.


Re: [GNC] What is wrong with this custom stylesheet code?

2023-07-04 Thread Robert Heller
OK, I've given up.  I'm going to write a Tcl program to post process the 
default HTML export and create a LaTeX file.  There is some serious things 
broken that I cannot figure out.

At Mon, 3 Jul 2023 18:57:17 -0700 Vincent Dawans  wrote:

> 
> HI Robert:
> 
> Here are a few things you need to change:
> 
> That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
> "DWS Stylesheet")) the first parameter is actually the template name
> defined just above, so it should be "DWS Stylesheet" without the
> underscore. The second parameter is the name of the default stylesheet
> created based on that template. You can use the same name as the template
> or you could call your Template "DWS Template" both here and above, as in:
> 
> (gnc:define-html-style-sheet
>  'version 3.0
>  'name (N_ "DWS Template")
>  'renderer dws-renderer
>  'options-generator dws-options)
> 
> (gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))
> 
> I would also advise you put your code in a separate scm file, for instance
> dws.scm, then store it in the USER_DATA directory .local/share/gnucash and
> load it from config-user.scm by adding
> 
> (load (gnc-build-userdata-path "dws.scm"))
> 
> Finally, possibly you are hitting a bug with the inability to save or there
> is something I don't know about loading the template because I have the
> same problem. Actually it's saving fine, you can see it in
> local/share/gnucash/stylesheets-2.0. It's the loading that's not working. I
> am wondering if it's not trying to load the saved stylesheet before running
> config-user.scm and therefore not finding it or something like that. But if
> I put the scm file directly in the main template directory under gnucash
> then it works, it's loading the saved settings, so that's a work-around.
> You don't load it in config-user.scm; instead you copy the file to
> 
>  dir>/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/
> 
> Sincerely,
> 
> Vincent Dawans
> 
> Then it saves fine for me.
> 
> 
> 
> 
> On Mon, Jul 3, 2023 at 7:17 AM Robert Heller  
> wrote:
> 
> >
> > I have written a style sheet module and it *seems* to be loading now, but
> > things are wonky any I don't know why.
> >
> > What I am *trying to go:
> >
> > 1) Put my company letterhead across the top of the invoice
> > 2) Put a "button image" (Payments by PayPal) under the invoice table.
> >
> > My custom stylesheet code adds two options: the button image and some
> > (optional) text to put under the button image (typically the e-mail
> > address to
> > use as the payment target).
> >
> > Several things are not working:
> >
> > If I use the Edit->Style Sheets options and create a new stylesheet from my
> > template, the addition options are not available (why?) If I just edit the
> > template itselt (with Edit->Style Sheets) I can set the header image and
> > the
> > button image, and the header image shows up, but not the button image
> > (why?),
> > and the options not saved across runs (why?).
> >
> > This code used to work just fine with V 2.6.  What has changed?  What do I
> > need to change?  The attached code was copied and modified from the V4.14
> > source tree (footer.scm), but obviously something is wrong somewhere.
> >
> >
> > ;;*
> > ;;
> > ;;  System:
> > ;;  Module:
> > ;;  Object Name   : $RCSfile$
> > ;;  Revision  : $Revision$
> > ;;  Date  : $Date$
> > ;;  Author: $Author$
> > ;;  Created By: Robert Heller
> > ;;  Created   : Sun Jul 2 15:09:23 2023
> > ;;  Last Modified : <230703.1014>
> > ;;
> > ;;  Description
> > ;;
> > ;;  Notes
> > ;;
> > ;;  History
> > ;;
> >
> > ;;*
> > ;;# @copyright
> > ;;Copyright (C) 2023  Robert Heller D/B/A Deepwoods Software
> > ;;  51 Locke Hill Road
> > ;;  Wendell, MA 01379-9728
> > ;;
> > ;;This program is free software; you can redistribute it and/or modify
> > ;;it under the terms of the GNU General Public License as published by
> > ;;the Free Software Foundation; either version 2 of the License, or
> > ;;(at your option) any later version.
> > ;;
> > ;;This program is distributed in the hope that it will be useful,
> > ;;but WITHOUT ANY WARRANTY; without even the implied warranty of
> > ;;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > ;;GNU General Public License for more details.
> > ;;
> > ;;You should have received a copy of the GNU General Public License
> > ;;along with this program; if not, write to the Free Software
> > ;;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> > ;; @file dws-stylesheet.scm
> > ;; @author Robert Heller
> > ;; @date Sun Jul 2 15:09:23 2023
> > ;;
> > ;;
> >
> > ;;*
> >
> 

Re: [GNC] What is wrong with this custom stylesheet code?

2023-07-03 Thread Vincent Dawans
HI Robert:

Here are a few things you need to change:

That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
"DWS Stylesheet")) the first parameter is actually the template name
defined just above, so it should be "DWS Stylesheet" without the
underscore. The second parameter is the name of the default stylesheet
created based on that template. You can use the same name as the template
or you could call your Template "DWS Template" both here and above, as in:

(gnc:define-html-style-sheet
 'version 3.0
 'name (N_ "DWS Template")
 'renderer dws-renderer
 'options-generator dws-options)

(gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))

I would also advise you put your code in a separate scm file, for instance
dws.scm, then store it in the USER_DATA directory .local/share/gnucash and
load it from config-user.scm by adding

(load (gnc-build-userdata-path "dws.scm"))

Finally, possibly you are hitting a bug with the inability to save or there
is something I don't know about loading the template because I have the
same problem. Actually it's saving fine, you can see it in
local/share/gnucash/stylesheets-2.0. It's the loading that's not working. I
am wondering if it's not trying to load the saved stylesheet before running
config-user.scm and therefore not finding it or something like that. But if
I put the scm file directly in the main template directory under gnucash
then it works, it's loading the saved settings, so that's a work-around.
You don't load it in config-user.scm; instead you copy the file to

/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/

Sincerely,

Vincent Dawans

Then it saves fine for me.




On Mon, Jul 3, 2023 at 7:17 AM Robert Heller  wrote:

>
> I have written a style sheet module and it *seems* to be loading now, but
> things are wonky any I don't know why.
>
> What I am *trying to go:
>
> 1) Put my company letterhead across the top of the invoice
> 2) Put a "button image" (Payments by PayPal) under the invoice table.
>
> My custom stylesheet code adds two options: the button image and some
> (optional) text to put under the button image (typically the e-mail
> address to
> use as the payment target).
>
> Several things are not working:
>
> If I use the Edit->Style Sheets options and create a new stylesheet from my
> template, the addition options are not available (why?) If I just edit the
> template itselt (with Edit->Style Sheets) I can set the header image and
> the
> button image, and the header image shows up, but not the button image
> (why?),
> and the options not saved across runs (why?).
>
> This code used to work just fine with V 2.6.  What has changed?  What do I
> need to change?  The attached code was copied and modified from the V4.14
> source tree (footer.scm), but obviously something is wrong somewhere.
>
>
> ;;*
> ;;
> ;;  System:
> ;;  Module:
> ;;  Object Name   : $RCSfile$
> ;;  Revision  : $Revision$
> ;;  Date  : $Date$
> ;;  Author: $Author$
> ;;  Created By: Robert Heller
> ;;  Created   : Sun Jul 2 15:09:23 2023
> ;;  Last Modified : <230703.1014>
> ;;
> ;;  Description
> ;;
> ;;  Notes
> ;;
> ;;  History
> ;;
>
> ;;*
> ;;# @copyright
> ;;Copyright (C) 2023  Robert Heller D/B/A Deepwoods Software
> ;;  51 Locke Hill Road
> ;;  Wendell, MA 01379-9728
> ;;
> ;;This program is free software; you can redistribute it and/or modify
> ;;it under the terms of the GNU General Public License as published by
> ;;the Free Software Foundation; either version 2 of the License, or
> ;;(at your option) any later version.
> ;;
> ;;This program is distributed in the hope that it will be useful,
> ;;but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;;GNU General Public License for more details.
> ;;
> ;;You should have received a copy of the GNU General Public License
> ;;along with this program; if not, write to the Free Software
> ;;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> ;; @file dws-stylesheet.scm
> ;; @author Robert Heller
> ;; @date Sun Jul 2 15:09:23 2023
> ;;
> ;;
>
> ;;*
>
> (define-module (gnucash report stylesheets DWS))
>
> (use-modules (gnucash engine))
> (use-modules (gnucash utilities))
> (use-modules (gnucash core-utils))
> (use-modules (gnucash app-utils))
> (use-modules (gnucash report))
> (use-modules (gnucash html))
>
> (define (dws-options)
>   (let* ((options (gnc:new-options))
>  (opt-register
>   (lambda (opt)
> (gnc:register-option options opt
>
> (opt-register
>  (gnc:make-string-option
>   (N_ "General")
>