mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Restructure the src directory
It is split into - /libgnucash (for the non-gui bits) - /gnucash (for the gui) - /common (misc source files used by both) - /bindings (currently only holds python bindings) This is the first step in restructuring the code. It will need much more fine tuning later on.
This commit is contained in:
25
bindings/python/example_scripts/simple_sqlite_create.py
Normal file
25
bindings/python/example_scripts/simple_sqlite_create.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
## @file
|
||||
# @brief Example Script simple sqlite create
|
||||
# @ingroup python_bindings_examples
|
||||
|
||||
from gnucash import Session, Account
|
||||
from os.path import abspath
|
||||
from gnucash.gnucash_core_c import ACCT_TYPE_ASSET
|
||||
|
||||
s = Session('sqlite3://%s' % abspath('test.blob'), is_new=True)
|
||||
# this seems to make a difference in more complex cases
|
||||
s.save()
|
||||
|
||||
book = s.book
|
||||
root = book.get_root_account()
|
||||
a = Account(book)
|
||||
root.append_child(a)
|
||||
a.SetName('wow')
|
||||
a.SetType(ACCT_TYPE_ASSET)
|
||||
|
||||
commod_table = book.get_table()
|
||||
a.SetCommodity( commod_table.lookup('CURRENCY', 'CAD') )
|
||||
s.save()
|
||||
|
||||
s.end()
|
||||
Reference in New Issue
Block a user