gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Mar 8 15:47:42 EST 2022
Updated via https://github.com/Gnucash/gnucash/commit/d841b322 (commit)
via https://github.com/Gnucash/gnucash/commit/6f28d49f (commit)
via https://github.com/Gnucash/gnucash/commit/9ad24321 (commit)
via https://github.com/Gnucash/gnucash/commit/09296dfb (commit)
via https://github.com/Gnucash/gnucash/commit/716d7463 (commit)
via https://github.com/Gnucash/gnucash/commit/c7f842c0 (commit)
from https://github.com/Gnucash/gnucash/commit/cde8f916 (commit)
commit d841b322d0bf4dde5f7ade09545a8ffbc54ca7ef
Merge: cde8f9168 6f28d49f9
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Mar 8 12:39:47 2022 -0800
Merge Frank Ellenberger's 'Bug684507' into maint.
commit 6f28d49f956d2eeee60ba9be6711a4128920e104
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Mar 1 15:30:30 2022 -0800
Add tooltip to namespace combo in security editor.
diff --git a/gnucash/gtkbuilder/dialog-commodity.glade b/gnucash/gtkbuilder/dialog-commodity.glade
index f2fcd2928..4667cd3b0 100644
--- a/gnucash/gtkbuilder/dialog-commodity.glade
+++ b/gnucash/gtkbuilder/dialog-commodity.glade
@@ -305,6 +305,8 @@
<property name="model">liststore2</property>
<property name="has-entry">True</property>
<property name="entry-text-column">0</property>
+ <property name="has-tooltip">True</property>
+ <property name="tooltip-markup" translatable="yes">Select a category for the commodity or enter a new one. One might use investment categories like STOCKS and BONDS or exchange names like NASDAQ and LSE.</property>
<signal name="changed" handler="gnc_ui_commodity_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry5">
commit 9ad24321b4708c94f363c93698097a31ee20e746
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Mar 1 15:10:02 2022 -0800
Remove investment-type namespaces.
Leave it to users to categorize their non-currency commodities. In the
QIF importer default non-classifiable commodities to
GNC_COMMODITY_NS_NONCURRENCY.
diff --git a/bindings/python/tests/test_commodity.py b/bindings/python/tests/test_commodity.py
index 36ffe6fc4..957751511 100644
--- a/bindings/python/tests/test_commodity.py
+++ b/bindings/python/tests/test_commodity.py
@@ -21,12 +21,12 @@ class TestCommodityNamespace(CommoditySession):
#print(self.table.__class__)
namespace_names = self.table.get_namespaces()
#print(namespace_names)
- self.assertEqual(namespace_names, ['BOND', 'SHARE', 'FUND', 'OPTION', 'template', 'CURRENCY'])
+ self.assertEqual(namespace_names, ['All non-currency', 'template', 'CURRENCY'])
def test_namespaces_list(self):
namespaces = self.table.get_namespaces_list()
namespace_names = [ns.get_name() for ns in namespaces]
- self.assertEqual(namespace_names, ['BOND', 'SHARE', 'FUND', 'OPTION', 'template', 'CURRENCY'])
+ self.assertEqual(namespace_names, ['All non-currency', 'template', 'CURRENCY'])
if __name__ == '__main__':
main()
diff --git a/gnucash/import-export/qif-imp/qif-dialog-utils.scm b/gnucash/import-export/qif-imp/qif-dialog-utils.scm
index 6b0a036d2..e261476fc 100644
--- a/gnucash/import-export/qif-imp/qif-dialog-utils.scm
+++ b/gnucash/import-export/qif-imp/qif-dialog-utils.scm
@@ -736,46 +736,29 @@
;; compatible with the QIF type?
(and (string=? s (caddr elt))
(not (and (string? qif-type)
- (string=? (GNC-COMMODITY-NS-MUTUAL)
+ (string=? (GNC-COMMODITY-NS-NONCURRENCY)
(cadr elt))
(or (string-ci=? qif-type "stock")
(string-ci=? qif-type "etf"))))))
prefs)
#f)))
- (cond
- ;; If a preferences match was found, use its namespace.
- (pref-match
- (cadr pref-match))
-
- ;; Guess SHARE for symbols of 1-4 characters.
- ((<= l 4)
- (GNC-COMMODITY-NS-SHARE))
-
- ;; Otherwise it's probably a fund.
- (else
- (GNC-COMMODITY-NS-MUTUAL))))
+ ;; If a preferences match was found, use its namespace.
+ (if pref-match (cadr pref-match))
;; There's no symbol. Default to a fund.
- (GNC-COMMODITY-NS-MUTUAL)))
+ (GNC-COMMODITY-NS-NONCURRENCY))))
;; Was a QIF type given?
(if (string? qif-type)
;; Yes. We might be able to definitely determine the namespace.
- (cond
- ;; Mutual fund
- ((string-ci=? qif-type "mutual fund")
- (GNC-COMMODITY-NS-MUTUAL))
-
- ;; Index
- ((string-ci=? qif-type "index")
- ;; This QIF type must be wrong; indexes aren't tradable!
- (GNC-COMMODITY-NS-MUTUAL))
-
- (else
- (guess-by-symbol qif-symbol)))
+ (if (or
+ (string-ci=? qif-type "mutual fund")
+ (string-ci=? qif-type "index"))
+ (GNC-COMMODITY-NS-NONCURRENCY)
+ (guess-by-symbol qif-symbol)))
;; No QIF type was given, so guess a
;; default namespace by symbol alone.
- (guess-by-symbol qif-symbol)))
+ (guess-by-symbol qif-symbol))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/libgnucash/engine/gnc-commodity.c b/libgnucash/engine/gnc-commodity.c
index 01b17f38e..f36a7565b 100644
--- a/libgnucash/engine/gnc-commodity.c
+++ b/libgnucash/engine/gnc-commodity.c
@@ -2510,10 +2510,7 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book)
gnc_commodity* c;
ENTER ("table=%p", table);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_BOND, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_SHARE, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_MUTUAL, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_OPTION, book);
+ gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_NONCURRENCY, book);
gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_TEMPLATE, book);
c = gnc_commodity_new(book, "template", GNC_COMMODITY_NS_TEMPLATE, "template", "template", 1);
gnc_commodity_table_insert(table, c);
diff --git a/libgnucash/engine/gnc-commodity.h b/libgnucash/engine/gnc-commodity.h
index 6336fb823..d7f475db2 100644
--- a/libgnucash/engine/gnc-commodity.h
+++ b/libgnucash/engine/gnc-commodity.h
@@ -109,14 +109,8 @@ GType gnc_commodity_namespace_get_type(void);
/* The ISO define is deprecated in favor of CURRENCY */
#define GNC_COMMODITY_NS_ISO "ISO4217"
#define GNC_COMMODITY_NS_CURRENCY "CURRENCY"
-#define GNC_COMMODITY_NS_BOND N_("BOND")
-#define GNC_COMMODITY_NS_SHARE N_("SHARE")
-#define GNC_COMMODITY_NS_MUTUAL N_("FUND")
-#define GNC_COMMODITY_NS_OPTION N_("OPTION")
-#define GNC_COMMODITY_NS_NONCURRENCY _("All non-currency")
-/* Delay translation of this one, we use it in both translated and untranslated form
- when presenting the currency related namespace to the user */
-#define GNC_COMMODITY_NS_ISO_GUI N_("Currencies")
+#define GNC_COMMODITY_NS_NONCURRENCY NC_("Commodity Type", "All non-currency")
+#define GNC_COMMODITY_NS_ISO_GUI NC_("Commodity Type", "Currencies")
/** Max fraction is 10^9 because 10^10 would require changing it to an
* int64_t.
commit 09296dfb96f2e88039c80337ad6f6d29d1040d62
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date: Fri Jul 9 18:44:06 2021 +0200
Drop commodity-table.scm, no longer required after adjusting qif-dialog-utils
diff --git a/bindings/guile/CMakeLists.txt b/bindings/guile/CMakeLists.txt
index b5446b027..0cbb7aa3f 100644
--- a/bindings/guile/CMakeLists.txt
+++ b/bindings/guile/CMakeLists.txt
@@ -85,7 +85,6 @@ gnc_add_scheme_targets(scm-core-utils
DEPENDS "${GUILE_DEPENDS}")
set (engine_SCHEME_0
- commodity-table.scm
gnc-numeric.scm
business-core.scm
)
diff --git a/bindings/guile/commodity-table.scm b/bindings/guile/commodity-table.scm
deleted file mode 100644
index 511c1eaac..000000000
--- a/bindings/guile/commodity-table.scm
+++ /dev/null
@@ -1,44 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; commodity-table.scm
-;;; load and save commodity tables
-;;;
-;;; Bill Gribble <grib at billgribble.com> 3 Aug 2000
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2 of
-;; the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, contact:
-;;
-;; Free Software Foundation Voice: +1-617-542-5942
-;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
-;; Boston, MA 02110-1301, USA gnu at gnu.org
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define-module (gnucash engine commodity-table))
-
-(export GNC_COMMODITY_NS_CURRENCY)
-(export GNC_COMMODITY_NS_NASDAQ)
-(export GNC_COMMODITY_NS_NYSE)
-(export GNC_COMMODITY_NS_AMEX)
-(export GNC_COMMODITY_NS_EUREX)
-(export GNC_COMMODITY_NS_MUTUAL)
-
-(define GNC_COMMODITY_NS_CURRENCY "CURRENCY")
-
-;; If you change the C side, change this too.
-(define GNC_COMMODITY_NS_AMEX "AMEX")
-(define GNC_COMMODITY_NS_NYSE "NYSE")
-(define GNC_COMMODITY_NS_NASDAQ "NASDAQ")
-(define GNC_COMMODITY_NS_EUREX "EUREX")
-(define GNC_COMMODITY_NS_MUTUAL "FUND")
-(define GNC_COMMODITY_NS_ASX "ASX")
-(define GNC_COMMODITY_NS_NONCURRENCY (gettext "ALL NON-CURRENCY"))
diff --git a/bindings/guile/engine.scm b/bindings/guile/engine.scm
index bc75b8172..c7697068e 100644
--- a/bindings/guile/engine.scm
+++ b/bindings/guile/engine.scm
@@ -28,7 +28,6 @@
(load-and-reexport (sw_engine)
(gnucash engine business-core)
- (gnucash engine commodity-table)
(gnucash engine gnc-numeric))
(export gnc-pricedb-lookup-latest-before-t64)
diff --git a/gnucash/import-export/qif-imp/qif-to-gnc.scm b/gnucash/import-export/qif-imp/qif-to-gnc.scm
index cc785e825..ec1040437 100644
--- a/gnucash/import-export/qif-imp/qif-to-gnc.scm
+++ b/gnucash/import-export/qif-imp/qif-to-gnc.scm
@@ -270,7 +270,7 @@
(default-currency
(gnc-commodity-table-find-full
(gnc-commodity-table-get-table (gnc-get-current-book))
- GNC_COMMODITY_NS_CURRENCY default-currency-name))
+ (GNC-COMMODITY-NS-CURRENCY) default-currency-name))
(sorted-accounts-list '())
(markable-xtns '())
(sorted-qif-files-list (sort qif-files-list
diff --git a/libgnucash/app-utils/options.scm b/libgnucash/app-utils/options.scm
index 52ab8cf3d..9e950dcfa 100644
--- a/libgnucash/app-utils/options.scm
+++ b/libgnucash/app-utils/options.scm
@@ -435,7 +435,7 @@ the option '~a'."))
(if (string? currency)
(gnc-commodity-table-lookup
(gnc-commodity-table-get-table (gnc-get-current-book))
- GNC_COMMODITY_NS_CURRENCY currency)
+ (GNC-COMMODITY-NS-CURRENCY) currency)
currency))
(let* ((value (currency->scm default-value))
@@ -561,7 +561,7 @@ the option '~a'."))
(define (commodity->scm commodity)
(if (string? commodity)
(list 'commodity-scm
- GNC_COMMODITY_NS_CURRENCY
+ (GNC-COMMODITY-NS-CURRENCY)
commodity)
(list 'commodity-scm
(gnc-commodity-get-namespace commodity)
@@ -1560,7 +1560,7 @@ the option '~a'."))
(if (string? currency-string)
(gnc-commodity-table-lookup
(gnc-commodity-table-get-table (gnc-get-current-book))
- GNC_COMMODITY_NS_CURRENCY currency-string)
+ (GNC-COMMODITY-NS-CURRENCY) currency-string)
#f))
(define (currency? val)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2194e9e5e..6a1a85fa7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,6 @@
# This is a list of files which contain translatable strings.
# This file was autogenerated by cmake.
bindings/guile/business-core.scm
-bindings/guile/commodity-table.scm
bindings/guile/core-utils.scm
bindings/guile/engine.scm
bindings/guile/glib-guile.c
commit 716d746315aa6ad0bdc5a7fdfa9c3c0c7e65eb30
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date: Thu Jul 8 21:23:17 2021 +0200
Adjust qif-dialog-utils to new namespaces
For US users it will no longer distinguish between NASDAQ and NYSE but
map both to SHARE for new commodities.
diff --git a/gnucash/import-export/qif-imp/qif-dialog-utils.scm b/gnucash/import-export/qif-imp/qif-dialog-utils.scm
index f0f81e4f6..6b0a036d2 100644
--- a/gnucash/import-export/qif-imp/qif-dialog-utils.scm
+++ b/gnucash/import-export/qif-imp/qif-dialog-utils.scm
@@ -736,7 +736,7 @@
;; compatible with the QIF type?
(and (string=? s (caddr elt))
(not (and (string? qif-type)
- (string=? GNC_COMMODITY_NS_MUTUAL
+ (string=? (GNC-COMMODITY-NS-MUTUAL)
(cadr elt))
(or (string-ci=? qif-type "stock")
(string-ci=? qif-type "etf"))))))
@@ -747,27 +747,15 @@
(pref-match
(cadr pref-match))
- ;; Guess NYSE for symbols of 1-3 characters.
- ((< l 4)
- GNC_COMMODITY_NS_NYSE)
-
- ;; Guess NYSE for symbols of 1-3 characters
- ;; followed by a dot and 1-2 characters.
- ((and d
- (< l 7)
- (< 0 d 4)
- (<= 2 (- l d) 3))
- GNC_COMMODITY_NS_NYSE)
-
- ;; Guess NASDAQ for symbols of 4 characters.
- ((= l 4)
- GNC_COMMODITY_NS_NASDAQ)
+ ;; Guess SHARE for symbols of 1-4 characters.
+ ((<= l 4)
+ (GNC-COMMODITY-NS-SHARE))
;; Otherwise it's probably a fund.
(else
- GNC_COMMODITY_NS_MUTUAL)))
+ (GNC-COMMODITY-NS-MUTUAL))))
;; There's no symbol. Default to a fund.
- GNC_COMMODITY_NS_MUTUAL))
+ (GNC-COMMODITY-NS-MUTUAL)))
;; Was a QIF type given?
(if (string? qif-type)
@@ -775,12 +763,12 @@
(cond
;; Mutual fund
((string-ci=? qif-type "mutual fund")
- GNC_COMMODITY_NS_MUTUAL)
+ (GNC-COMMODITY-NS-MUTUAL))
;; Index
((string-ci=? qif-type "index")
;; This QIF type must be wrong; indexes aren't tradable!
- GNC_COMMODITY_NS_MUTUAL)
+ (GNC-COMMODITY-NS-MUTUAL))
(else
(guess-by-symbol qif-symbol)))
commit c7f842c081ad794d2020f0b8417dfe3637c298c0
Author: Frank H. Ellenberger <frank.h.ellenberger at gmail.com>
Date: Thu Jul 8 16:15:03 2021 +0200
Bug 684507 - commodity namespace should be localized
diff --git a/bindings/python/tests/test_commodity.py b/bindings/python/tests/test_commodity.py
index 6eb2c0d2c..36ffe6fc4 100644
--- a/bindings/python/tests/test_commodity.py
+++ b/bindings/python/tests/test_commodity.py
@@ -21,12 +21,12 @@ class TestCommodityNamespace(CommoditySession):
#print(self.table.__class__)
namespace_names = self.table.get_namespaces()
#print(namespace_names)
- self.assertEqual(namespace_names, ['AMEX', 'NYSE', 'NASDAQ', 'EUREX', 'FUND', 'template', 'CURRENCY'])
+ self.assertEqual(namespace_names, ['BOND', 'SHARE', 'FUND', 'OPTION', 'template', 'CURRENCY'])
def test_namespaces_list(self):
namespaces = self.table.get_namespaces_list()
namespace_names = [ns.get_name() for ns in namespaces]
- self.assertEqual(namespace_names, ['AMEX', 'NYSE', 'NASDAQ', 'EUREX', 'FUND', 'template', 'CURRENCY'])
+ self.assertEqual(namespace_names, ['BOND', 'SHARE', 'FUND', 'OPTION', 'template', 'CURRENCY'])
if __name__ == '__main__':
main()
diff --git a/libgnucash/engine/gnc-commodity.c b/libgnucash/engine/gnc-commodity.c
index 745be68bc..01b17f38e 100644
--- a/libgnucash/engine/gnc-commodity.c
+++ b/libgnucash/engine/gnc-commodity.c
@@ -2510,11 +2510,10 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book)
gnc_commodity* c;
ENTER ("table=%p", table);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_AMEX, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_NYSE, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_NASDAQ, book);
- gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_EUREX, book);
+ gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_BOND, book);
+ gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_SHARE, book);
gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_MUTUAL, book);
+ gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_OPTION, book);
gnc_commodity_table_add_namespace(table, GNC_COMMODITY_NS_TEMPLATE, book);
c = gnc_commodity_new(book, "template", GNC_COMMODITY_NS_TEMPLATE, "template", "template", 1);
gnc_commodity_table_insert(table, c);
diff --git a/libgnucash/engine/gnc-commodity.h b/libgnucash/engine/gnc-commodity.h
index fda604590..6336fb823 100644
--- a/libgnucash/engine/gnc-commodity.h
+++ b/libgnucash/engine/gnc-commodity.h
@@ -104,21 +104,19 @@ GType gnc_commodity_namespace_get_type(void);
* only used to populate an option menu in the commodity selection
* window.
*/
-#define GNC_COMMODITY_NS_LEGACY "GNC_LEGACY_CURRENCIES"
-#define GNC_COMMODITY_NS_TEMPLATE "template"
+#define GNC_COMMODITY_NS_LEGACY "GNC_LEGACY_CURRENCIES"
+#define GNC_COMMODITY_NS_TEMPLATE "template"
/* The ISO define is deprecated in favor of CURRENCY */
-#define GNC_COMMODITY_NS_ISO "ISO4217"
-#define GNC_COMMODITY_NS_CURRENCY "CURRENCY"
-#define GNC_COMMODITY_NS_NASDAQ "NASDAQ"
-#define GNC_COMMODITY_NS_NYSE "NYSE"
-#define GNC_COMMODITY_NS_EUREX "EUREX"
-#define GNC_COMMODITY_NS_MUTUAL "FUND"
-#define GNC_COMMODITY_NS_AMEX "AMEX"
-#define GNC_COMMODITY_NS_ASX "ASX"
+#define GNC_COMMODITY_NS_ISO "ISO4217"
+#define GNC_COMMODITY_NS_CURRENCY "CURRENCY"
+#define GNC_COMMODITY_NS_BOND N_("BOND")
+#define GNC_COMMODITY_NS_SHARE N_("SHARE")
+#define GNC_COMMODITY_NS_MUTUAL N_("FUND")
+#define GNC_COMMODITY_NS_OPTION N_("OPTION")
#define GNC_COMMODITY_NS_NONCURRENCY _("All non-currency")
/* Delay translation of this one, we use it in both translated and untranslated form
when presenting the currency related namespace to the user */
-#define GNC_COMMODITY_NS_ISO_GUI N_("Currencies")
+#define GNC_COMMODITY_NS_ISO_GUI N_("Currencies")
/** Max fraction is 10^9 because 10^10 would require changing it to an
* int64_t.
Summary of changes:
bindings/guile/CMakeLists.txt | 1 -
bindings/guile/commodity-table.scm | 44 -------------------
bindings/guile/engine.scm | 1 -
bindings/python/tests/test_commodity.py | 4 +-
gnucash/gtkbuilder/dialog-commodity.glade | 2 +
gnucash/import-export/qif-imp/qif-dialog-utils.scm | 49 +++++-----------------
gnucash/import-export/qif-imp/qif-to-gnc.scm | 2 +-
libgnucash/app-utils/options.scm | 6 +--
libgnucash/engine/gnc-commodity.c | 6 +--
libgnucash/engine/gnc-commodity.h | 20 +++------
po/POTFILES.in | 1 -
11 files changed, 25 insertions(+), 111 deletions(-)
delete mode 100644 bindings/guile/commodity-table.scm
More information about the gnucash-changes
mailing list