Commit Graph

217 Commits

Author SHA1 Message Date
Christopher Lam
6f9517845a [core-utils] use custom unbound-variable exception printer
When a guile coder uses a variable but omits use-modules, this code
will scan *all* available modules and offer the appropriate module
name.

Before:
Unbound variable: gnc-build-url

After:
Unbound variable: gnc-build-url. Did you forget (use-module (sw_gnc_html))?
2020-12-14 21:54:52 +08:00
Christopher Lam
6927c12292 Bug 798039 - Using 'Consolidate Transactions' option on Consolidate Transaction Report returns Error
because (gnc:module-load "gnucash/html" 0) was meant to load the html
module and was incorrectly assumed to be present in (gnucash report)
module.
2020-12-12 07:44:14 +08:00
Christopher Lam
4910b532e0 [modularise] (gnucash engine) 2020-12-09 06:39:51 +08:00
Christopher Lam
c17ce5251c [modularise] (gnucash core-utils) 2020-12-09 06:39:51 +08:00
Christopher Lam
096be60860 [modularise] (gnucash utilities) 2020-12-09 06:39:51 +08:00
Christopher Lam
da32fb0dae [utilities] simplify addto! 2020-12-04 21:33:31 +08:00
Christopher Lam
82d3bcd394 [core-utils] N_ is identity function
N_ is mapped to the identity function. Previously N_ was defined as a
macro, which is more tricky to export.
2020-12-04 21:33:01 +08:00
Christopher Lam
a1c517b4ba [gnc_scm_to_numeric] create NaN gnc_numeric instead of runtime error
If guile calls a C function which expects gnc_numeric but sends a
non-number, it will create a gnc_numeric_error object. This will allow
error gnc_numeric to be handled elsewhere.

Also the overflow gnc_numeric was incorrectly created.
2020-11-23 21:50:05 +08:00
Christopher Lam
8f32992100 [gnc-engine-guile.c] return #f when gnc_numeric has error
otherwise it'd throw guile div/0 exception
2020-11-23 08:08:27 +08:00
Christopher Lam
6d6eff6b70 Expose ngettext as gnc:ngettext 2020-11-02 22:24:05 +08:00
Christopher Lam
8628ffa957 3/3 [engine.scm] deprecate scheme utility functions 2020-11-01 08:30:56 +08:00
Christopher Lam
25e4efc2b7 [core-utils.scm][API] gnc:string-locale<? gnc:string-locale>?
locale-sensitive string-sorting functions -- currently mirrors guile's
(ice-9 i18n) functions -- may be modified to call C code if guile code
is not reliable.
2020-11-01 08:30:56 +08:00
Geert Janssens
dae2ea8356 Expose C_ function (gettext with context string) to guile code
First use is for the document link short code (L)
2020-09-17 22:20:02 +02:00
Christopher Lam
0d10d1e234 [engine.i] swigify CLEARED-ALL
to be used by trep-engine.scm
2020-09-15 18:30:24 +08:00
Christopher Lam
cbbca47013 [test-engine-extras] Use more efficient gnc:list-flatten 2020-08-19 07:19:38 +08:00
Christopher Lam
f35a26882d Addendnum to ad20f859c -- _ must be exported 2020-08-03 23:26:29 +08:00
Christopher Lam
ad20f859cc [core-utils] define _ for guile-2.2 2020-08-03 07:11:27 +08:00
Hong Xu
e0e77ca39d Add Python example export_account_totals.py
This example exports acount totals of all accounts into a CSV file.

This has been asked before: https://money.stackexchange.com/questions/111786/exporting-account-totals-in-gnucash
2020-08-01 14:47:33 -07:00
Christopher Lam
fe3787c427 [gnc-numeric] use srfi-9 records for :gnc-monetary 2020-07-14 22:48:19 +08:00
Christopher Lam
428c8c501c [guile-3] change _ to G_
In guile-3 _ is a reserved symbol. Change to G_ by guile gettext
convention.
2020-07-12 19:03:26 +08:00
John Ralls
b0b238958e Merge Christoph Holtermann's 'python-sessionOpenMode' into master. 2020-07-06 12:45:07 -07:00
c-holtermann
22f91c407e use same order in comment as in definition of SessionOpenMode enum 2020-07-04 22:26:35 +02:00
c-holtermann
40cfb70fb7 fix SessionOpenMode explanation for SESSION_NORMAL_OPEN 2020-07-04 22:22:16 +02:00
Christopher Lam
851bc7f8d9 deprecations: clarify functions deprecated in 4.x. 2020-06-22 19:53:29 +08:00
Geert Janssens
1d3164bfdb Build depedency fix - build backend libararies before the guile bindings
Compiling our guile scripts will run loaded libraries. One of the libraries to
load is the engine library which expects to find the enabled backends (xml and or dbi).
If those aren't built yet, this will result in error messages printed in the build output.
2020-06-21 21:45:57 +02:00
c-holtermann
3e842a7bf6 use urllib.parse.urlparse to check for xml on python Session init 2020-06-21 16:24:53 +02:00
c-holtermann
b9c6fc2876 add some unittests for python Session
test arguments, deprecated as well as new mode arguments
test creating a session with a new xml file using __init__()
and begin(). Test raising exception when opening nonexistent
file without respective mode setting.
2020-06-21 16:23:32 +02:00
c-holtermann
0434acbe10 reformat two python example scripts with black
use black python code formatter on latex_invoices.py and gncinvoice_jinja.py
2020-06-21 16:23:32 +02:00
c-holtermann
485d8a65b0 decorate Session.begin with default mode argument 2020-06-21 16:23:32 +02:00
c-holtermann
44e61f4df2 enable Session.__init__() to be provided with existing instance or book 2020-06-21 16:23:32 +02:00
c-holtermann
5833c5afcb add unittests for function_class
add tests for some existing function_class functionality.
Add tests for the keyword argument changes.
2020-06-21 16:23:32 +02:00
c-holtermann
17d606e1f8 enable keyword arguments for default_arguments_decorator
default_arguments_decorator until now only allows positional
argument defaults. This adds keyword defaults. The keywords
can be mapped to the positional arguments by optional argument
kargs_pos so interactions between keyword and positional arg
defaults can raise a TypeError. Some more information in
the docstring is included. In addition the docstring of
the wrapped function will be modified to contain information
about the defaults.
2020-06-21 16:23:32 +02:00
c-holtermann
c222503f42 add method decorate_method to function_class.py
ClassFromFunctions.decorate_method() allows to provide positional
and keyword arguments for the decorator call besides the wrapped
method.
2020-06-21 16:23:32 +02:00
c-holtermann
ee77b713c2 update example scripts to SessionOpenMode 2020-06-21 16:23:32 +02:00
c-holtermann
b073dbc5c3 allow keyword arguments for function_class.py
allow keyword arguments for function_class methods
and functions. process_dict_convert_to_instance() is added to
mimic the behavior of the process_list_convert_to_instance()
Derived methods in gnucash_core.py like raise_backend_errors_after_call
get modified to accept being called with keyword args.
Also adds some docstrings.
2020-06-21 16:23:32 +02:00
c-holtermann
4e280b9593 adapt to use of sessionOpenMode in qof_session_begin 2020-06-20 13:40:11 +02:00
c-holtermann
48072f5a4c make SessionOpenMode enum available for python 2020-06-20 11:02:13 +02:00
c-holtermann
ee3342d2b4 introduce python submodule deprecation
the deprecation submodule will house content related to deprecation.
That is general convenience function and functions related to specific
deprecation issues. The latter starts with decorator functions to bridge
the change in qof_session_begin argument change to SessionOpenMode.
2020-06-20 10:40:54 +02:00
Christopher Lam
0b386157a1 [business-core] string-hash doesn't not guarantee unique hash
subtle bug here-- used string-hash to convert guid-string to a number
which is faster to use as hash key. but string-hash does not guarantee
that there are no hash collisions. it is best to use guid string
instead which is guaranteed to uniquely define a split.
2020-06-17 08:08:51 +08:00
John Ralls
b5aeca94b6 Bug 797746 - [reports] German umlauts not escaped
Resume using libintl directly. Guile apparently passes gettext msgstrs
through scm_from_locale_string instead of scm_from_utf8_string.
2020-06-07 10:46:01 -07:00
John Ralls
6a1cb5eecd Replace the three bool parameters to qof_session_begin to an enum.
For clarity. In so doing found the backend behavior a bit inconsistent
so it's modified to do what the enum values indicate.

In the course of changing the various calls I found some implementation
errors in the back end and corrected them.
2020-06-04 14:07:28 -07:00
John Ralls
54859eaf5b Add scm-core-utils as dependency of scm-engine-1.
Fixes build failure reported on gnucash-devel.
2020-06-01 13:43:28 -07:00
Christopher Lam
c434239b7d Upgrade split->owner to gnc:split->owner 2020-05-29 21:32:23 +08:00
c-holtermann
b13f40aeaf remove translation test 2020-05-28 20:55:15 +02:00
c-holtermann
e1701fbdd6 locale is not needed anymore (debug) 2020-05-28 20:42:27 +02:00
c-holtermann
9e678a421e remove debug stuff 2020-05-28 20:31:16 +02:00
c-holtermann
7bf38ef837 test info 2020-05-28 20:29:33 +02:00
c-holtermann
ca21f32249 remove global gettext import 2020-05-28 20:21:31 +02:00
c-holtermann
efe9b4b606 remove debug info 2020-05-28 20:19:39 +02:00
c-holtermann
f788e59318 remove debug stuff (temporarily) 2020-05-28 18:51:01 +02:00