gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sat Sep 12 09:31:38 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/63ec05d0 (commit)
via https://github.com/Gnucash/gnucash/commit/d0b8cd27 (commit)
from https://github.com/Gnucash/gnucash/commit/a0f2ccc9 (commit)
commit 63ec05d0dd117ca5b5a0548290569904d3f56f12
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Sep 12 20:58:55 2020 +0800
[reports] rendering is more responsive by pulsing progressbar
previously the renderer (html-document object to html-string) would
attempt to update progressbar. However the html-object is a deeply
nested hierarchical object, (length object) is not suitable to
calculate progressbar fraction. Therefore we change update by pulsing
progressbar instead every 2500 loops in html-document, html-table and
html-text renderers.
diff --git a/gnucash/report/html-document.scm b/gnucash/report/html-document.scm
index daf15dfa6..be2c95929 100644
--- a/gnucash/report/html-document.scm
+++ b/gnucash/report/html-document.scm
@@ -110,8 +110,6 @@
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(objs (gnc:html-document-objects doc))
- (work-to-do (length objs))
- (work-done 0)
(title (gnc:html-document-title doc)))
;; compile the doc style
(gnc:html-style-table-compile (gnc:html-document-style doc)
@@ -144,8 +142,7 @@
(for-each
(lambda (child)
(push (gnc:html-object-render child doc))
- (set! work-done (+ 1 work-done))
- (gnc:report-percent-done (* 100 (/ work-done work-to-do))))
+ (gnc:pulse-progress-bar))
objs)
(when headers?
diff --git a/gnucash/report/html-table.scm b/gnucash/report/html-table.scm
index 40e12d7ec..be1af8d14 100644
--- a/gnucash/report/html-table.scm
+++ b/gnucash/report/html-table.scm
@@ -168,6 +168,7 @@
(format #f "colspan=\"~a\"" (gnc:html-table-cell-colspan cell))))
(for-each
(lambda (child)
+ (gnc:pulse-progress-bar)
(push (gnc:html-object-render child doc)))
cell-data)
(push (gnc:html-document-markup-end doc cell-tag))
@@ -475,6 +476,7 @@
(push (gnc:html-document-markup-end doc rowmarkup))
(when rowstyle (gnc:html-document-pop-style doc))
+ (gnc:pulse-progress-bar)
(rowloop (cdr rows) (1+ rownum)))))
(push (gnc:html-document-markup-end doc "tbody"))
diff --git a/gnucash/report/html-text.scm b/gnucash/report/html-text.scm
index 94a04d420..67c2c4172 100644
--- a/gnucash/report/html-text.scm
+++ b/gnucash/report/html-text.scm
@@ -202,6 +202,7 @@
(gnc:html-document-push-style doc (gnc:html-text-style p))
(for-each
(lambda (elt)
+ (gnc:pulse-progress-bar)
(cond ((procedure? elt)
(push (elt doc)))
(#t
diff --git a/gnucash/report/report-utilities.scm b/gnucash/report/report-utilities.scm
index 1a2336cf6..90a064717 100644
--- a/gnucash/report/report-utilities.scm
+++ b/gnucash/report/report-utilities.scm
@@ -623,6 +623,14 @@
(gnc:warn "report more than 100% finished. " percent))
(gnc-window-show-progress "" percent))
+(define-public gnc:pulse-progress-bar
+ (let ((pulse-idx 0))
+ (lambda ()
+ (set! pulse-idx (1+ pulse-idx))
+ (when (= pulse-idx 2500)
+ (set! pulse-idx 0)
+ (gnc-window-show-progress "" 105)))))
+
(define (gnc:report-finished)
(gnc-window-show-progress "" -1))
commit d0b8cd27c59f72350eb223cf626f1e3b11775b9f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Sep 12 20:07:43 2020 +0800
[register] reduce tempo of updating progressbar
every 200 splits instead of every split
diff --git a/gnucash/report/reports/standard/register.scm b/gnucash/report/reports/standard/register.scm
index 156fe008a..4773d1c47 100644
--- a/gnucash/report/reports/standard/register.scm
+++ b/gnucash/report/reports/standard/register.scm
@@ -573,9 +573,6 @@
(work-done 0)
(odd-row? #t))
- (unless (zero? work-to-do)
- (gnc:report-percent-done (* 100 (/ work-done work-to-do))))
-
(cond
;; ----------------------------------
@@ -611,6 +608,9 @@
;; process the splits list
;; ----------------------------------
(else
+ (when (zero? (modulo work-done 200))
+ (gnc:report-percent-done (* 100 (/ work-done work-to-do))))
+
(let* ((current (car splits))
(current-row-style (if (or multi-rows? odd-row?)
"normal-row"
Summary of changes:
gnucash/report/html-document.scm | 5 +----
gnucash/report/html-table.scm | 2 ++
gnucash/report/html-text.scm | 1 +
gnucash/report/report-utilities.scm | 8 ++++++++
gnucash/report/reports/standard/register.scm | 6 +++---
5 files changed, 15 insertions(+), 7 deletions(-)
More information about the gnucash-changes
mailing list