mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[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.
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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"))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user