GnuCash 7574033+
Loading...
Searching...
No Matches
gnucash_core.py File Reference

High level python wrapper classes for the core parts of GnuCash. More...

Go to the source code of this file.

Data Structures

class  python.gnucash_core.GnuCashCoreClass
class  python.gnucash_core.GnuCashBackendException
class  python.gnucash_core.SessionOpenMode
class  python.gnucash_core.PriceSource
class  python.gnucash_core.Session
class  python.gnucash_core.Book
class  python.gnucash_core.GncNumeric
class  python.gnucash_core.GncPrice
class  python.gnucash_core.GncPriceDB
class  python.gnucash_core.GncCommodity
class  python.gnucash_core.GncCommodityTable
class  python.gnucash_core.GncCommodityNamespace
class  python.gnucash_core.GncLot
class  python.gnucash_core.Transaction
class  python.gnucash_core.Split
class  python.gnucash_core.Account
class  python.gnucash_core.GUID
class  python.gnucash_core.GUIDString
class  python.gnucash_core.Query
class  python.gnucash_core.QueryStringPredicate
class  python.gnucash_core.QueryBooleanPredicate
class  python.gnucash_core.QueryInt32Predicate
class  python.gnucash_core.QueryDatePredicate
class  python.gnucash_core.QueryGuidPredicate
class  python.gnucash_core.QueryNumericPredicate

Functions

 python.gnucash_core._ (s)
 python.gnucash_core._deprecated_set_source_string (self, source)
 python.gnucash_core.gnc_pricedb_lookup_latest_before_t64 (self, commodity, currency, date)
 python.gnucash_core.decorate_monetary_list_returning_function (orig_function)
 python.gnucash_core.one_arg_default_none (function)

Variables

 python.gnucash_core._localedir = _sw_core_utils.gnc_path_get_localedir()
 python.gnucash_core.exc_type
 python.gnucash_core.exc_value
 python.gnucash_core.exc_traceback
 python.gnucash_core._gnc_price_set_source_string = GncPrice.set_source_string
 python.gnucash_core.set_source_string
 python.gnucash_core.lookup_latest_before_t64
dict python.gnucash_core.PriceDB_dict
 python.gnucash_core.None
 python.gnucash_core.mode
 python.gnucash_core.get_book
 python.gnucash_core.book
 python.gnucash_core.this_module_dict = globals()
dict python.gnucash_core.backend_error_dict = {}
 python.gnucash_core.get_root_account
 python.gnucash_core.get_table
 python.gnucash_core.get_price_db
dict python.gnucash_core.gncnumeric_dict
dict python.gnucash_core.gnc_commodity_dict
dict python.gnucash_core.gnc_price_dict
dict python.gnucash_core.commoditytable_dict
 python.gnucash_core.get_commodity_list
dict python.gnucash_core.gnclot_dict
dict python.gnucash_core.trans_dict
dict python.gnucash_core.split_dict
 python.gnucash_core.account
 python.gnucash_core.parent
dict python.gnucash_core.account_dict
 python.gnucash_core.name
dict python.gnucash_core.guid_dict
 define addition methods for GUID object - do we need these

Detailed Description

High level python wrapper classes for the core parts of GnuCash.

Author
Mark Jenkins, ParIT Worker Co-operative mark@.nosp@m.pari.nosp@m.t.ca
Jeff Green, ParIT Worker Co-operative jeff@.nosp@m.pari.nosp@m.t.ca

Definition in file gnucash_core.py.

Function Documentation

◆ _()

python.gnucash_core._ ( s)
protected
Null translator function, gettext not available

Definition at line 205 of file gnucash_core.py.

205 def _(s):
206 """Null translator function, gettext not available"""
207 return s
208

◆ _deprecated_set_source_string()

python.gnucash_core._deprecated_set_source_string ( self,
source )
protected
Deprecated: use set_source() with a PriceSource member.

Still raises ValueError if `source` is not a recognized PriceSource string
(the underlying C setter would otherwise leave the source unchanged).

Definition at line 780 of file gnucash_core.py.

780def _deprecated_set_source_string(self, source):
781 """Deprecated: use set_source() with a PriceSource member.
782
783 Still raises ValueError if `source` is not a recognized PriceSource string
784 (the underlying C setter would otherwise leave the source unchanged)."""
785 _gnc_price_set_source_string(self, source)
786 if self.get_source_string() != source:
787 raise ValueError(
788 "%r is not a recognized price source string, so set_source_string() "
789 "left the source unchanged. Use set_source() with a PriceSource "
790 "member, e.g. set_source(PriceSource.FINANCE_QUOTE)." % (source,))
791# Report the deprecation under the public method name, not the wrapper's.

◆ decorate_monetary_list_returning_function()

python.gnucash_core.decorate_monetary_list_returning_function ( orig_function)

Definition at line 897 of file gnucash_core.py.

897def decorate_monetary_list_returning_function(orig_function):
898 def new_function(self, *args):
899 """decorate function that returns list of gnc_monetary to return tuples of GncCommodity and GncNumeric
900
901 Args:
902 *args: Variable length argument list. Will get passed to orig_function
903
904 Returns:
905 array of tuples: (GncCommodity, GncNumeric)
906
907 ToDo:
908 Maybe this function should better reside in module function_class (?)"""
909 # warning, item.commodity has been shown to be None
910 # when the transaction doesn't have a currency
911 return [(GncCommodity(instance=item.commodity),
912 GncNumeric(instance=item.value))
913 for item in orig_function(self, *args) ]
914 return new_function
915
The primary numeric class for representing amounts and values.

◆ gnc_pricedb_lookup_latest_before_t64()

python.gnucash_core.gnc_pricedb_lookup_latest_before_t64 ( self,
commodity,
currency,
date )

Definition at line 816 of file gnucash_core.py.

816def gnc_pricedb_lookup_latest_before_t64(self, commodity, currency, date):
817 return self.lookup_nearest_before_t64(commodity, currency, date)
818

◆ one_arg_default_none()

python.gnucash_core.one_arg_default_none ( function)

Definition at line 954 of file gnucash_core.py.

954def one_arg_default_none(function):
955 return default_arguments_decorator(function, None, None)

Variable Documentation

◆ _gnc_price_set_source_string

python.gnucash_core._gnc_price_set_source_string = GncPrice.set_source_string
protected

Definition at line 779 of file gnucash_core.py.

◆ _localedir

python.gnucash_core._localedir = _sw_core_utils.gnc_path_get_localedir()
protected

Definition at line 194 of file gnucash_core.py.

◆ account

python.gnucash_core.account

Definition at line 1158 of file gnucash_core.py.

◆ account_dict

dict python.gnucash_core.account_dict
Initial value:
1= {
2 'get_book' : Book,
3 'Lookup' : Account,
4 'get_parent' : Account,
5 'get_root' : Account,
6 'nth_child' : Account,
7 'lookup_by_code' : Account,
8 'lookup_by_name' : Account,
9 'lookup_by_full_name' : Account,
10 'FindTransByDesc' : Transaction,
11 'FindSplitByDesc' : Split,
12 'GetBalance' : GncNumeric,
13 'GetClearedBalance' : GncNumeric,
14 'GetReconciledBalance' : GncNumeric,
15 'GetPresentBalance' : GncNumeric,
16 'GetProjectedMinimumBalance' : GncNumeric,
17 'GetBalanceAsOfDate' : GncNumeric,
18 'ConvertBalanceToCurrency' : GncNumeric,
19 'ConvertBalanceToCurrencyAsOfDate' : GncNumeric,
20 'GetBalanceInCurrency' : GncNumeric,
21 'GetClearedBalanceInCurrency' : GncNumeric,
22 'GetReconciledBalanceInCurrency' : GncNumeric,
23 'GetPresentBalanceInCurrency' : GncNumeric,
24 'GetProjectedMinimumBalanceInCurrency' : GncNumeric,
25 'GetBalanceAsOfDateInCurrency' : GncNumeric,
26 'GetBalanceChangeForPeriod' : GncNumeric,
27 'GetCommodity' : GncCommodity,
28 'get_currency_or_parent' : GncCommodity,
29 'GetGUID': GUID
30 }

Definition at line 1167 of file gnucash_core.py.

◆ backend_error_dict

dict python.gnucash_core.backend_error_dict = {}

Definition at line 975 of file gnucash_core.py.

◆ book

python.gnucash_core.book

Definition at line 966 of file gnucash_core.py.

◆ commoditytable_dict

dict python.gnucash_core.commoditytable_dict
Initial value:
1= {
2 'lookup' : GncCommodity,
3 'lookup_unique' : GncCommodity,
4 'find_full' : GncCommodity,
5 'insert' : GncCommodity,
6 'add_namespace': GncCommodityNamespace,
7 'find_namespace': GncCommodityNamespace,
8 }

Definition at line 1061 of file gnucash_core.py.

◆ exc_traceback

python.gnucash_core.exc_traceback

Definition at line 201 of file gnucash_core.py.

◆ exc_type

python.gnucash_core.exc_type

Definition at line 201 of file gnucash_core.py.

◆ exc_value

python.gnucash_core.exc_value

Definition at line 201 of file gnucash_core.py.

◆ get_book

python.gnucash_core.get_book

Definition at line 963 of file gnucash_core.py.

◆ get_commodity_list

python.gnucash_core.get_commodity_list

Definition at line 1081 of file gnucash_core.py.

◆ get_price_db

python.gnucash_core.get_price_db

Definition at line 1019 of file gnucash_core.py.

◆ get_root_account

python.gnucash_core.get_root_account

Definition at line 1013 of file gnucash_core.py.

◆ get_table

python.gnucash_core.get_table

Definition at line 1016 of file gnucash_core.py.

◆ gnc_commodity_dict

dict python.gnucash_core.gnc_commodity_dict
Initial value:
1= {
2 'clone': GncCommodity,
3 'obtain_twin': GncCommodity,
4 'get_namespace_ds': GncCommodityNamespace,
5 }

Definition at line 1043 of file gnucash_core.py.

◆ gnc_price_dict

dict python.gnucash_core.gnc_price_dict
Initial value:
1= {
2 'get_commodity': GncCommodity,
3 'get_currency': GncCommodity,
4 'clone': GncPrice,
5 'get_value': GncNumeric,
6 }

Definition at line 1051 of file gnucash_core.py.

◆ gnclot_dict

dict python.gnucash_core.gnclot_dict
Initial value:
1= {
2 'get_account' : Account,
3 'get_book' : Book,
4 'get_earliest_split' : Split,
5 'get_latest_split' : Split,
6 'get_balance' : GncNumeric,
7 'lookup' : GncLot,
8 'make_default' : GncLot
9 }

Definition at line 1088 of file gnucash_core.py.

◆ gncnumeric_dict

dict python.gnucash_core.gncnumeric_dict
Initial value:
1= {
2 'same' : GncNumeric,
3 'add' : GncNumeric,
4 'sub' : GncNumeric,
5 'mul' : GncNumeric,
6 'div' : GncNumeric,
7 'neg' : GncNumeric,
8 'abs' : GncNumeric,
9 'add_fixed' : GncNumeric,
10 'sub_fixed' : GncNumeric,
11 'convert' : GncNumeric,
12 'reduce' : GncNumeric,
13 'invert' : GncNumeric
14 }

Definition at line 1025 of file gnucash_core.py.

◆ guid_dict

dict python.gnucash_core.guid_dict
Initial value:
1= {
2 'copy' : GUID,
3 'TransLookup': Transaction,
4 'AccountLookup': Account,
5 'SplitLookup': Split
6 }

define addition methods for GUID object - do we need these

Definition at line 1218 of file gnucash_core.py.

◆ lookup_latest_before_t64

python.gnucash_core.lookup_latest_before_t64

Definition at line 821 of file gnucash_core.py.

◆ mode

python.gnucash_core.mode

Definition at line 960 of file gnucash_core.py.

◆ name

python.gnucash_core.name

Definition at line 1206 of file gnucash_core.py.

◆ None

python.gnucash_core.None

Definition at line 960 of file gnucash_core.py.

◆ parent

python.gnucash_core.parent

Definition at line 1159 of file gnucash_core.py.

◆ PriceDB_dict

dict python.gnucash_core.PriceDB_dict
Initial value:
1= {
2 'lookup_latest' : GncPrice,
3 'lookup_nearest_in_time64' : GncPrice,
4 'lookup_nearest_before_t64' : GncPrice,
5 'nth_price' : GncPrice,
6 'lookup_day_t64' : GncPrice,
7 'convert_balance_latest_price' : GncNumeric,
8 'convert_balance_nearest_price_t64' : GncNumeric,
9 'convert_balance_nearest_before_price_t64' : GncNumeric,
10 'get_latest_price' : GncNumeric,
11 'get_nearest_price' : GncNumeric,
12 'get_nearest_before_price' : GncNumeric,
13 }

Definition at line 824 of file gnucash_core.py.

◆ set_source_string

python.gnucash_core.set_source_string

Definition at line 794 of file gnucash_core.py.

◆ split_dict

dict python.gnucash_core.split_dict
Initial value:
1= {
2 'GetBook': Book,
3 'GetAccount': Account,
4 'GetParent': Transaction,
5 'Lookup': Split,
6 'GetOtherSplit': Split,
7 'GetAmount': GncNumeric,
8 'GetValue': GncNumeric,
9 'GetSharePrice': GncNumeric,
10 'ConvertAmount': GncNumeric,
11 'GetBaseValue': GncNumeric,
12 'GetBalance': GncNumeric,
13 'GetClearedBalance': GncNumeric,
14 'GetReconciledBalance': GncNumeric,
15 'VoidFormerAmount': GncNumeric,
16 'VoidFormerValue': GncNumeric,
17 'GetNoclosingBalance': GncNumeric,
18 'GetCapGains': GncNumeric,
19 'GetGUID': GUID
20 }

Definition at line 1136 of file gnucash_core.py.

◆ this_module_dict

python.gnucash_core.this_module_dict = globals()

Definition at line 969 of file gnucash_core.py.

◆ trans_dict

dict python.gnucash_core.trans_dict
Initial value:
1= {
2 'GetSplit': Split,
3 'FindSplitByAccount': Split,
4 'Clone': Transaction,
5 'Reverse': Transaction,
6 'GetReversedBy': Transaction,
7 'GetImbalanceValue': GncNumeric,
8 'GetAccountValue': GncNumeric,
9 'GetAccountAmount': GncNumeric,
10 'GetAccountConvRate': GncNumeric,
11 'GetAccountBalance': GncNumeric,
12 'GetCurrency': GncCommodity,
13 'GetGUID': GUID
14 }

Definition at line 1109 of file gnucash_core.py.