From 95e12216bfd6dcb89c97a0ced7732dc195c66ce8 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sat, 26 Apr 2014 11:31:33 +0200 Subject: [PATCH 1/5] Fix price quotes after removal of yahoo-get-historical-quotes --- src/scm/price-quotes.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scm/price-quotes.scm b/src/scm/price-quotes.scm index 354e3f1d1b..7daacd0cec 100644 --- a/src/scm/price-quotes.scm +++ b/src/scm/price-quotes.scm @@ -28,6 +28,7 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash gnc-module)) (use-modules (gnucash core-utils)) +(use-modules (srfi srfi-1)) (gnc:module-load "gnucash/gnome-utils" 0) ;; for gnucash-ui-is-running (gnc:module-load "gnucash/app-utils" 0) From 65e8e3b11d9f381899f4477eb1beffef1b6ad147 Mon Sep 17 00:00:00 2001 From: Amish Date: Fri, 25 Apr 2014 12:36:54 +0530 Subject: [PATCH 2/5] calculate num-columns-required correctly This fix, calculates num-columns-required correctly based on which columns are used/not-used/merged. Earlier code did not consider merged columns. Effectively with this fix, when you print report, on average it saves 2-3 pages per 12-15 pages. --- src/report/standard-reports/transaction.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 210722bd79..74e69d627d 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -355,7 +355,12 @@ (do ((i 0 (+ i 1)) (col-req 0 col-req)) ((>= i columns-used-size) col-req) - (if (vector-ref columns-used i) (set! col-req (+ col-req 1))))) + (if (and (not (= i 12)) (not (= i 16)) (not (= i 18)) (not (= i 19)) (vector-ref columns-used i)) + (set! col-req (+ col-req 1))) + (if (or (and (= i 14) (vector-ref columns-used 14) (vector-ref columns-used 4)) + (and (= i 15) (vector-ref columns-used 15) (vector-ref columns-used 5)) + (and (= i 18) (vector-ref columns-used 18) (vector-ref columns-used 17))) + (set! col-req (- col-req 1))))) (define (build-column-used options) (define (opt-val section name) From fb8018b374d7699f28ebc8a422e28f44ff55e357 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sat, 26 Apr 2014 18:27:45 +0200 Subject: [PATCH 3/5] Additional changes to column calculations - Add some comments to remember why this was done - Fix one error in the code --- src/report/standard-reports/transaction.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 74e69d627d..84345ebd85 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -355,11 +355,20 @@ (do ((i 0 (+ i 1)) (col-req 0 col-req)) ((>= i columns-used-size) col-req) - (if (and (not (= i 12)) (not (= i 16)) (not (= i 18)) (not (= i 19)) (vector-ref columns-used i)) + ; If column toggle is true, increase column count. But attention: + ; some toggles only change the meaning of another toggle. Don't count these modifier toggles + (if (and (not (= i 12)) ; Skip Account Full Name toggle - modifies Account Name column + (not (= i 16)) ; Skip Other Account Full Name toggle - modifies Other Account Name column + (not (= i 17)) ; Skip Sort Account Code - modifies Account Name subheading + (not (= i 18)) ; Skip Sort Account Full Name - modifies Account Name subheading + (not (= i 19)) ; Skip Note toggle - modifies Memo column + (vector-ref columns-used i)) (set! col-req (+ col-req 1))) - (if (or (and (= i 14) (vector-ref columns-used 14) (vector-ref columns-used 4)) - (and (= i 15) (vector-ref columns-used 15) (vector-ref columns-used 5)) - (and (= i 18) (vector-ref columns-used 18) (vector-ref columns-used 17))) + ; Account Code and Account Name share one column so if both were ticked the + ; the check above would have set up one column too much. The check below + ; will compensate these again. + (if (or (and (= i 14) (vector-ref columns-used 14) (vector-ref columns-used 4)) ; Account Code and Name + (and (= i 15) (vector-ref columns-used 15) (vector-ref columns-used 5))) ; Other Account Code and Name (set! col-req (- col-req 1))))) (define (build-column-used options) From 4ec1f6b724165b281842fda45769694e231c4027 Mon Sep 17 00:00:00 2001 From: Mike Alexander Date: Fri, 25 Apr 2014 23:32:25 -0400 Subject: [PATCH 4/5] Fix code that customizes parameters for specific gcc versions to agree with the comments. --- configure.ac | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 55000e3ae5..553be43549 100644 --- a/configure.ac +++ b/configure.ac @@ -1305,18 +1305,18 @@ then # -Wdeclaration-after-statement in order to preserve source code # compatibility to gcc 2.95 and other compilers. GCC_VERSION=`${CC} -dumpversion` - if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 3; then - # This is gcc >= 3.x.x + if test "`echo ${GCC_VERSION} | cut -d. -f1`" -eq 3; then + # This is gcc 3.x.x if test "`echo ${GCC_VERSION} | cut -d. -f2`" -ge 4; then # This is gcc >= 3.4.x warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement" - else if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 4; then - # This is gcc == 4.x.x - warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement -Wno-pointer-sign" - # rpmbuild on FC4 forces this flag. Can't hurt to always compile with it. - warnFLAGS="${warnFLAGS} -D_FORTIFY_SOURCE=2" - fi fi + else if test "`echo ${GCC_VERSION} | cut -d. -f1`" -ge 4; then + # This is gcc >= 4.x.x + warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement -Wno-pointer-sign" + # rpmbuild on FC4 forces this flag. Can't hurt to always compile with it. + warnFLAGS="${warnFLAGS} -D_FORTIFY_SOURCE=2" + fi fi CFLAGS="${warnFLAGS} ${CFLAGS}" else From 2c4463e77f7ab94464e1a0373037356cd139f8d7 Mon Sep 17 00:00:00 2001 From: Mike Alexander Date: Sat, 26 Apr 2014 14:38:10 -0400 Subject: [PATCH 5/5] Ignore SIGTTOU while importing Python console class. Importing it causes this signal to be sent and if GnuCash is running in the background it hangs. --- src/python/init.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python/init.py b/src/python/init.py index 81807934c5..59a49c1ddc 100644 --- a/src/python/init.py +++ b/src/python/init.py @@ -8,8 +8,17 @@ sys.path.append(os.path.dirname(__file__)) noisy = gnc_prefs_is_extra_enabled() if noisy: print "woop", os.path.dirname(__file__) +# Importing the console class causes SIGTTOU to be thrown if GnuCash is +# started in the background. This causes a hang if it is not handled, +# so ignore it for the duration +import signal +old_sigttou = signal.signal(signal.SIGTTOU, signal.SIG_IGN) + import pycons.console as cons +# Restore the SIGTTOU handler +signal.signal(signal.SIGTTOU, old_sigttou) + if noisy: print "Hello from python!" print "test", sys.modules.keys()