gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Apr 6 15:22:11 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/882fd22c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e2c37359 (commit)
	from  https://github.com/Gnucash/gnucash/commit/fdfaca55 (commit)



commit 882fd22ca10460642ef7a84eb83b581d93764f00
Merge: fdfaca557 e2c37359e
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Apr 6 12:17:03 2020 -0700

    Merge Christoph Holtermann's 'python-app-utils' into maint.


commit e2c37359ef07132e5bb8568fa9c06ac68202e5f8
Author: c-holtermann <mail at c-holtermann.net>
Date:   Thu Apr 2 17:40:01 2020 +0200

    high level python wrappers for app-utils

diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 83509209c..7bf91641b 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -1,7 +1,7 @@
 add_subdirectory(example_scripts)
 add_subdirectory(tests)
 
-set(PYEXEC_FILES  __init__.py function_class.py gnucash_business.py gnucash_core.py)
+set(PYEXEC_FILES  __init__.py function_class.py gnucash_business.py gnucash_core.py app_utils.py)
 
 set(SWIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i ${CMAKE_CURRENT_SOURCE_DIR}/time64.i)
 set(GNUCASH_CORE_C_INCLUDES
diff --git a/bindings/python/app_utils.py b/bindings/python/app_utils.py
new file mode 100644
index 000000000..82d809ce6
--- /dev/null
+++ b/bindings/python/app_utils.py
@@ -0,0 +1,16 @@
+# app_utils.py -- High level python wrapper for app-utils
+#
+# @author Christoph Holtermann <mail at c-holtermann.net>
+## @file
+#  @brief High level python wrapper for app-utils
+#  @ingroup python_bindings 
+
+from gnucash import _sw_app_utils
+
+def gnc_get_current_session():
+    from gnucash import Session
+    return Session(instance=_sw_app_utils.gnc_get_current_session())
+
+# further functions in _sw_app_utils
+# _gnc_get_current_book is availabe through Session.get_book()
+# _gnc_get_current_root_account is available through Session.get_root_account()



Summary of changes:
 bindings/python/CMakeLists.txt |  2 +-
 bindings/python/app_utils.py   | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 bindings/python/app_utils.py



More information about the gnucash-changes mailing list