gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon May 13 04:56:24 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/7b1a262e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/67830a0e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/668b1f6b (commit)
	from  https://github.com/Gnucash/gnucash/commit/c38c4557 (commit)



commit 7b1a262eea619dfea7126c3ef5dbd3e252a65f1a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri May 10 23:50:14 2019 +0800

    [balsheet-pnl] refinements to barchart
    
    * barchart should inherit the period selected. this requires
      redefining the periodlist - we need the exact symbol to set the
      barchart's period option.
    
    * balsheet: disable barchart if period is disabled - it makes no sense
      to create link to networth barchart for single-date balsheet
    
    * reorder some options for better usability
    
    * note this may affect saved-reports / saved-tabs but only those
      running bleeding edge maint. I do not intend to make any further
      options changes on this report.

diff --git a/gnucash/report/standard-reports/balsheet-pnl.scm b/gnucash/report/standard-reports/balsheet-pnl.scm
index 1c37c0e6e..8d493a3cf 100644
--- a/gnucash/report/standard-reports/balsheet-pnl.scm
+++ b/gnucash/report/standard-reports/balsheet-pnl.scm
@@ -129,37 +129,30 @@ also show overall period profit & loss."))
 (define periodlist
   (list
    (list #f
-         (cons 'delta #f)
          (cons 'text (_ "Disabled"))
          (cons 'tip (_ "Disabled")))
 
-   (list 'year
-         (cons 'delta YearDelta)
+   (list 'YearDelta
          (cons 'text (_ "Year"))
          (cons 'tip (_ "One year.")))
 
-   (list 'halfyear
-         (cons 'delta HalfYearDelta)
+   (list 'HalfYearDelta
          (cons 'text (_ "Half Year"))
          (cons 'tip (_ "Half Year.")))
 
-   (list 'quarter
-         (cons 'delta QuarterDelta)
+   (list 'QuarterDelta
          (cons 'text (_ "Quarter"))
          (cons 'tip (_ "One Quarter.")))
 
-   (list 'month
-         (cons 'delta MonthDelta)
+   (list 'MonthDelta
          (cons 'text (_ "Month"))
          (cons 'tip (_ "One Month.")))
 
-   (list 'twoweek
-         (cons 'delta TwoWeekDelta)
+   (list 'TwoWeekDelta
          (cons 'text (_ "2Week"))
          (cons 'tip (_ "Two Weeks.")))
 
-   (list 'week
-         (cons 'delta WeekDelta)
+   (list 'WeekDelta
          (cons 'text (_ "Week"))
          (cons 'tip (_ "One Week.")))))
 
@@ -203,13 +196,17 @@ also show overall period profit & loss."))
          options
          gnc:pagename-general optname-dual-columns
          (not x))
-        (gnc-option-db-set-option-selectable-by-name
-         options
-         gnc:pagename-general
-         (case report-type
-           ((balsheet) optname-startdate)
-           ((pnl) optname-include-overall-period))
-         x))))
+        (case report-type
+          ((balsheet)
+           (gnc-option-db-set-option-selectable-by-name
+            options gnc:pagename-general optname-include-chart x)
+
+           (gnc-option-db-set-option-selectable-by-name
+            options gnc:pagename-general optname-startdate x))
+
+          ((pnl)
+           (gnc-option-db-set-option-selectable-by-name
+            options gnc:pagename-general optname-include-overall-period x))))))
 
     (add-option
      (gnc:make-simple-boolean-option
@@ -219,7 +216,7 @@ also show overall period profit & loss."))
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-general optname-include-chart
-      "d" opthelp-include-chart #f))
+      "c5" opthelp-include-chart #f))
 
     (add-option
      (gnc:make-simple-boolean-option
@@ -339,7 +336,7 @@ also show overall period profit & loss."))
       (add-option
        (gnc:make-simple-boolean-option
         gnc:pagename-general optname-include-overall-period
-        "e" opthelp-include-overall-period #f))
+        "c6" opthelp-include-overall-period #f))
 
       ;; closing entry match criteria
       (add-option
@@ -717,9 +714,7 @@ also show overall period profit & loss."))
                                optname-enddate)))
          (disable-account-indent? (get-option gnc:pagename-display
                                               optname-account-full-name))
-         (incr (let ((period (get-option gnc:pagename-general optname-period)))
-                 (and period
-                      (keylist-get-info periodlist period 'delta))))
+         (incr (get-option gnc:pagename-general optname-period))
          (disable-amount-indent? (and (not incr)
                                       (get-option gnc:pagename-general
                                                   optname-disable-amount-indent)))
@@ -770,7 +765,8 @@ also show overall period profit & loss."))
                                 gnc:time64-end-day-time
                                 gnc:time64-start-day-time)
                             (if incr
-                                (gnc:make-date-list startdate enddate incr)
+                                (gnc:make-date-list
+                                 startdate enddate (gnc:deltasym-to-delta incr))
                                 (if (eq? report-type 'balsheet)
                                     (list enddate)
                                     (list startdate enddate)))))
@@ -951,7 +947,7 @@ also show overall period profit & loss."))
                       (map
                        gnc:monetary-neg
                        (income-expense-balance 'format gnc:make-gnc-monetary #f))))))
-             (chart (and include-chart?
+             (chart (and include-chart? incr
                          (gnc:make-report-anchor
                           networth-barchart-uuid report-obj
                           (list (list "General" "Start Date" (cons 'absolute startdate))
@@ -959,6 +955,7 @@ also show overall period profit & loss."))
                                 (list "General" "Report's currency"
                                       (or common-currency
                                           (gnc-default-report-currency)))
+                                (list "General" "Step Size" incr)
                                 (list "General" "Price Source"
                                       (or price-source 'pricedb-nearest))
                                 (list "Accounts" "Accounts"
@@ -1039,7 +1036,7 @@ also show overall period profit & loss."))
                           #:show-accounts? #f
                           #:show-total? #f))
 
-        (if include-chart?
+        (if (and include-chart? incr)
             (gnc:html-document-add-object!
              doc
              (gnc:make-html-text
@@ -1125,6 +1122,7 @@ also show overall period profit & loss."))
                                 (list "General" "Report's currency"
                                       (or common-currency
                                           (gnc-default-report-currency)))
+                                (list "General" "Step Size" (or incr 'MonthDelta))
                                 (list "General" "Price Source"
                                       (or price-source 'pricedb-nearest))
                                 (list "Accounts" "Accounts"

commit 67830a0e35ef479d436ba90cad2043ad48a3e05a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun May 12 00:13:39 2019 +0800

    [report-gnome] compact functions
    
    * inline single-use functions
    * use srfi-1 list processing functions
    * minimise set! calls

diff --git a/gnucash/report/report-gnome/report-gnome.scm b/gnucash/report/report-gnome/report-gnome.scm
index a837ddb00..94af04771 100644
--- a/gnucash/report/report-gnome/report-gnome.scm
+++ b/gnucash/report/report-gnome/report-gnome.scm
@@ -45,54 +45,30 @@
 (define (gnc:add-report-template-menu-items)
   (define *template-items* '())
 
-  (define (add-template-menu-item name template)
-    (if (gnc:report-template-in-menu? template)
-        (let ((title (string-append (_ "Report") ": " (_ name)))
-              (menu-path (gnc:report-template-menu-path template))
-              (menu-tip (gnc:report-template-menu-tip template))
-              (item #f))
+  (gnc:report-templates-for-each
+   (lambda (report-guid template)
+     (let ((name (or (gnc:report-template-menu-name template)
+                     (gnc:report-template-name template))))
+       (set! *template-items* (cons (cons name template) *template-items*)))))
 
-          ;;(if (not menu-path)
-              ;;(set! menu-path '(""))
-              ;;(set! menu-path
-              ;; (append menu-path '(""))))
-
-          (if (not menu-path)
-              (set! menu-path '()))
-
-          (set! menu-path (append (list gnc:menuname-reports) menu-path))
-
-          (if (not menu-tip)
-              (set! menu-tip
-                    (format #f (_ "Display the ~a report") (_ name))))
-
-          (set! item
-                (gnc:make-menu-item
-                 name
-                 (gnc:report-template-report-guid template)
-                 menu-tip
-                 menu-path
-                 (lambda (window)
-                   (let ((report (gnc:make-report
-                                  (gnc:report-template-report-guid template))))
-                     (gnc-main-window-open-report report window)))))
-          (gnc-add-scm-extension item))))
-
-  (define (add-template report-guid template)
-    (let ((name (gnc:report-template-name template))
-	  (menu-name (gnc:report-template-menu-name template)))
-      (if menu-name (set! name menu-name))
-      (set! *template-items* (cons (cons name template) *template-items*))))
-
-  (define (sort-templates a b)
-    (string>? (car a) (car b)))
-
-  (gnc:report-templates-for-each add-template)
   (for-each
    (lambda (item)
-     (add-template-menu-item (car item) (cdr item)))
-   (sort *template-items* sort-templates)))
-
+     (let* ((menu-name (car item))
+            (template (cdr item))
+            (report-guid (gnc:report-template-report-guid template))
+            (menu-tip (or (gnc:report-template-menu-tip template)
+                          (format #f (_ "Display the ~a report") (_ menu-name))))
+            (menu-path (append (list gnc:menuname-reports)
+                               (or (gnc:report-template-menu-path template)
+                                   '()))))
+       (gnc-add-scm-extension
+        (gnc:make-menu-item
+         menu-name report-guid menu-tip menu-path
+         (lambda (window)
+           (gnc-main-window-open-report
+            (gnc:make-report report-guid) window))))))
+   (sort (filter (compose gnc:report-template-in-menu? cdr) *template-items*)
+         (lambda (a b) (string>? (car a) (car b))))))
 
 (define (gnc:report-menu-setup)
   (define asset-liability-menu
@@ -142,10 +118,4 @@
     (N_ "Welcome-to-GnuCash report screen")
     (list gnc:menuname-reports gnc:menuname-utility "")
     (lambda (window)
-      (gnc-main-window-open-report (gnc:make-welcome-report) window))))
-  
-)
-
-(define (gnc:spawn-custom-report-dialog window)
-  (gnc:debug "called into custom report dialog, window is " window)
-  (gnc-ui-custom-report window))
+      (gnc-main-window-open-report (gnc:make-welcome-report) window)))))

commit 668b1f6b7be36fa6e2ad781c2ba87f740e4417a2
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun May 12 00:12:43 2019 +0800

    [report-gnome] fix whitespace

diff --git a/gnucash/gnome-utils/gnome-utils.scm b/gnucash/gnome-utils/gnome-utils.scm
index b903e4596..7d5e56edb 100644
--- a/gnucash/gnome-utils/gnome-utils.scm
+++ b/gnucash/gnome-utils/gnome-utils.scm
@@ -19,12 +19,12 @@
 
 (define-module (gnucash gnome-utils))
 
-(use-modules (gnucash utilities)) 
+(use-modules (gnucash utilities))
 (use-modules (gnucash gnc-module))
 
-(eval-when
-      (compile load eval expand)
-      (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
+(eval-when (compile load eval expand)
+  (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
+
 (use-modules (sw_gnome_utils))
 (gnc:module-load "gnucash/app-utils" 0)
 
diff --git a/gnucash/report/report-gnome/report-gnome.scm b/gnucash/report/report-gnome/report-gnome.scm
index 6d6748bc0..a837ddb00 100644
--- a/gnucash/report/report-gnome/report-gnome.scm
+++ b/gnucash/report/report-gnome/report-gnome.scm
@@ -25,16 +25,15 @@
 
 
 (define-module (gnucash report report-gnome))
-(use-modules (gnucash utilities)) 
+(use-modules (gnucash utilities))
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash gnome-utils))
 (use-modules (gnucash gettext))
 (use-modules (gnucash report utility-reports))
 
-(eval-when
-      (compile load eval expand)
-      (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")
-      (load-extension "libgncmod-report-gnome" "scm_init_sw_report_gnome_module"))
+(eval-when (compile load eval expand)
+  (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")
+  (load-extension "libgncmod-report-gnome" "scm_init_sw_report_gnome_module"))
 (use-modules (sw_report_gnome))
 
 (gnc:module-load "gnucash/gnome-utils" 0)
@@ -106,19 +105,20 @@
     (gnc:make-menu gnc:menuname-utility (list gnc:menuname-reports)))
   (define experimental-menu
     (gnc:make-menu gnc:menuname-experimental (list gnc:menuname-reports)))
-  (define tax-menu 
+  (define tax-menu
     (gnc:make-menu gnc:menuname-taxes (list gnc:menuname-reports)))
-  (define business-menu 
+  (define business-menu
     (gnc:make-menu gnc:menuname-business-reports (list gnc:menuname-reports)))
 
-  (gnc-add-scm-extension 
+  (gnc-add-scm-extension
    (gnc:make-menu-item
-   (N_ "Saved Report Configurations")
-   "4d3dcdc8890b11df99dd94cddfd72085"
-   (N_ "Manage and run saved report configurations")
-   (list "Reports/SavedReportConfigs")
-   (lambda (window)
-     (gnc:spawn-custom-report-dialog window))))
+    (N_ "Saved Report Configurations")
+    "4d3dcdc8890b11df99dd94cddfd72085"
+    (N_ "Manage and run saved report configurations")
+    (list "Reports/SavedReportConfigs")
+    (lambda (window)
+      (gnc:debug "called into custom report dialog, window is " window)
+      (gnc-ui-custom-report window))))
 
   ;; (gnc-add-scm-extension tax-menu)
   (gnc-add-scm-extension income-expense-menu)
@@ -136,7 +136,7 @@
 
   ;; the Welcome to GnuCash "extravaganza" report
   (gnc-add-scm-extension
-   (gnc:make-menu-item 
+   (gnc:make-menu-item
     (N_ "Welcome Sample Report")
     "ad80271c890b11dfa79f2dcedfd72085"
     (N_ "Welcome-to-GnuCash report screen")



Summary of changes:
 gnucash/gnome-utils/gnome-utils.scm              |   8 +-
 gnucash/report/report-gnome/report-gnome.scm     | 104 ++++++++---------------
 gnucash/report/standard-reports/balsheet-pnl.scm |  54 ++++++------
 3 files changed, 67 insertions(+), 99 deletions(-)



More information about the gnucash-changes mailing list