Skip to content

Commit 18ac421

Browse files
author
David Hampton
committed
Give user feedback during the rendering of a report.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7691 57a11ea4-9604-0410-9ed3-97b8803252fd
1 parent 66b943f commit 18ac421

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/report/report-system/html-document.scm

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,17 @@
115115

116116
;; otherwise, do the trivial render.
117117
(let* ((retval '())
118-
(push (lambda (l) (set! retval (cons l retval)))))
118+
(push (lambda (l) (set! retval (cons l retval))))
119+
(objs (gnc:html-document-objects doc))
120+
(work-to-do (length objs))
121+
(work-done 0))
119122
;; compile the doc style
120123
(gnc:html-style-table-compile (gnc:html-document-style doc)
121124
(gnc:html-document-style-stack doc))
122125
;; push it
123126
(gnc:html-document-push-style doc (gnc:html-document-style doc))
124127

128+
(gnc:report-render-starting (gnc:html-document-title doc))
125129
(if (not (null? headers?))
126130
(begin
127131
(push "<html>\n")
@@ -138,14 +142,18 @@
138142
;; now render the children
139143
(for-each
140144
(lambda (child)
141-
(push (gnc:html-object-render child doc)))
142-
(gnc:html-document-objects doc))
145+
(begin
146+
(push (gnc:html-object-render child doc))
147+
(set! work-done (+ 1 work-done))
148+
(gnc:report-percent-done (* 100 (/ work-done work-to-do)))))
149+
objs)
143150

144151
(if (not (null? headers?))
145152
(begin
146153
(push "</body>\n")
147154
(push "</html>\n")))
148155

156+
(gnc:report-finished)
149157
(gnc:html-document-pop-style doc)
150158
(gnc:html-style-table-uncompile (gnc:html-document-style doc))
151159

src/report/report-system/report-system.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@
545545
(export gnc:query-set-match-voids-only!)
546546
(export gnc:split-voided?)
547547
(export gnc:report-starting)
548+
(export gnc:report-render-starting)
548549
(export gnc:report-percent-done)
549550
(export gnc:report-finished)
550551
(export gnc:accounts-count-splits)

src/report/report-system/report-utilities.scm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,14 @@
674674
(gnc:gettext report-name))
675675
0))
676676

677+
(define (gnc:report-render-starting report-name)
678+
(gnc:mdi_show_progress (sprintf #f
679+
(_ "Rendering '%s' report ...")
680+
(if (string-null? report-name)
681+
(gnc:gettext "Untitled")
682+
(gnc:gettext report-name)))
683+
0))
684+
677685
(define (gnc:report-percent-done percent)
678686
(gnc:mdi_show_progress #f (truncate percent)))
679687

0 commit comments

Comments
 (0)