A templated account->splits iterator, will target splits from
start_date to end_date, inclusive of date boundaries. Also optionally
include descendants.
gnc_price_set_source_string maps a source string to the PriceSource enum and
silently leaves the source unchanged for anything it doesn't recognize -- a
silent no-op a naive Python or Guile script can hit. Steer callers to
set_source() with a PriceSource member (added in #2317) instead.
Python bindings:
- Deprecate GncPrice.set_source_string(): it now emits a DeprecationWarning
pointing at set_source(PriceSource.<...>). It still works during the
deprecation period and still guards -- if the string is not recognized (the
round-tripped source no longer equals the input) it raises ValueError rather
than silently doing nothing.
- Fix the deprecated() decorator in deprecation.py: it referenced the undefined
DeprecationWarnig and inspect.current_frame(), so it raised instead of
warning (the one existing @deprecated use was latently broken).
Guile bindings:
- mark gnc-price-set-source-string deprecated in engine.i.
(Python and Guile use separate SWIG interface files, so Python is
handled separately). The only in-tree Guile caller is the QIF importer, updated to
gnc-price-set-source with PRICE-SOURCE-USER-PRICE; the redundant
set-source-string in test-engine-extras.scm's fixture helper is dropped.
Tests (test_price_and_wrapping.py):
- TestSetSourceStringGuard covers the guard (still raises on an unrecognized
string) and the new DeprecationWarning.
Removing set_source_string from the Python bindings is a follow-up.
PR #2187 made GncPrice.get_value() return a GncNumeric wrapper and clone() a
fully wrapped GncPrice. The price example scripts still used the pre-5.15 raw
_gnc_numeric idiom and broke -- reported as Bug 799796 (cloned prices silently
kept the original value).
Example scripts (bindings/python/example_scripts/):
* quotes_historic.py -- reworked to the modern idiom; it now actually runs on
5.x (it had further latent breakage beyond the reported one):
- Construct each price directly with GncPrice(book) + setters instead of
cloning an existing price, so the script no longer needs a pre-existing
price in the book. Look the pricing currency (USD) up from the commodity
table rather than deriving it from a split.
- Build the value with the double->GncNumeric constructor at GnuCash's
standard price precision -- the pricing currency's SCU * COMMODITY_DENOM_MULT
rounded HALF_UP (gnc-pricedb.h "Price policy") -- dropping the
Fraction.from_float().limit_denominator(100000) dance and its import.
- Set the source with the PriceSource enum -- set_source(PriceSource.FINANCE_QUOTE)
(the enum added in #2317). The original set_source("Finance::Quotes::Historic")
passed a string to what has been an enum setter since 2.6, which raises
TypeError on modern bindings.
- Open with Session(url), which defaults to SESSION_NORMAL_OPEN. The old
Session(url, True, False, False) passed the deprecated ignore_lock=True,
silently bypassing the book's lock file.
* priceDB_test.py, price_database_example.py -- num/denom are methods now, so
read v.num() / v.denom().
Prevent silent recurrence (gnucash_core.py):
The write path failed *silently*, which is how this slipped through review and
CI. num/denom are read-only accessor methods, so assigning to them merely
shadows the method and changes nothing. Add a GncNumeric.__setattr__ that raises
AttributeError on assignment to num/denom, pointing at the correct idiom
GncNumeric(num, denom).
Test (bindings/python/tests/test_numeric.py):
New test_num_denom_read_only covering the guard. It needs no backend, so it runs
in the existing python-bindings CTest on all platforms.
The wiki page Stocks/get_prices, which the reporter copied from, is being
updated separately.
Setting a price's source from Python meant reaching into gnucash_core_c for the
raw PRICE_SOURCE_* constants. Add a PriceSource(IntEnum) alongside SessionOpenMode,
with values sourced from the C enum (via gnucash_core_c) so they can't drift, so a
script can write price.set_source(PriceSource.FINANCE_QUOTE) with a plain top-level
import.
Add test_price_and_wrapping.TestPriceSourceEnum:
- test_values_match_c_enum asserts the Python enum covers the C PRICE_SOURCE_*
value set exactly, so adding, removing, or renumbering a C value fails CI until
PriceSource is updated to match. (Member names are a Python-side choice --
FINANCE_QUOTE spells out FQ -- so the check is on values.)
- test_set_source_accepts_enum confirms a member flows through set_source() and
round-trips.
Reorder the CLI quotes get startup sequence to load GncQuotes before
loading the session so that preconfigured quote sources don't null
out other supported sources.
Make the SQL backend create a new source when an unknown one is found in
the commodities table like the XML backend does.
Thanks to Ganesh Suriyanarayanan for diagnosing the problem and
proposing a solution.
dialogs.
Changed sorting to be natural (chunks), instead of sequential ascii-sort.
Number chunks are compared as whole numbers instead of one at a time.
Changed sorting to be natural (chunks), instead of sequential ascii-sort.
Number chunks are compared as whole numbers instead of one at a time.
After this change, customer-overview, vendor-overview and
employee-overview will naturally sort "id" columns.
The setlocale we get is from libintl which doesn't do anything for
locale "C".
This commit should be reverted immediately after merging into future.
Assisted-by: Claude Code Opus 5
Signed-off: John Ralls <jralls@ceridwen.us>
The process code page is set by the manifest created in the
previous commit. Left to its own devices msvcrt will set the
character set to the locale's DOS codepage. This commit overrides
that by setting the locale charset to the C locale's which is
always the process one.
ucrt doesn't override the process char set so this isn't necessary
and will be reverted immediately after merge.
Assisted-by: Claude Code Opus 5
Signed-off: John Ralls <jralls@ceridwen.us>
Wrap in IIFE to prevent script variables interfering with other owner
reports in multi-report scenarios. Target current report table, marked
with gensym.
Add keyboard support: Space on a focused cell (e.g. link to invoice or
register) toggles the highlight. Enter on a focused cell still opens
the invoice or register.
Wrap the script in //<![CDATA[ ... //]]> avoiding need for escaping
&&.
Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-Off: Christopher Lam
All the glossary .po files are processed by rename-glossary.py to simplify the diff of the following glossary renames.
The formatting diff includes:
* Metadata ordering is changed.
* Empty comments are deleted, due to `polib` doesn't flush empty comments to .po files.
The command used to do the formatting is:
```
cd po/glossary
./rename-glossary.py -o "" -n "" *.po --skip-check
```
* txt-to-pot.sh is updated to populate msgctxt to the .pot file and skip the header row
* The new .pot file is `msgmerge`d into the .po files
* gnc-glossary.txt is updated to provide an empty context for each glossary
* A new script `rename-glossary.py` is introduced to rename a term in both the .txt file and all the .po files
Co-authored-by: Frank H. Ellenberger <frank.h.ellenberger@gmail.com>