Changes

Jump to: navigation, search

Using database API

No change in size, 06:31, 20 January 2013
m
Gramps
{{man warn|If you are a looking for documentation on how to use the GRAMPS Gramps system as a user instead of as a program developer, it can be found on the [[Portal:Using_GRAMPSUsing_Gramps|GRAMPS Gramps documentation web page]].}}
Explanation of the basics, underlying GRAMPS Gramps database. This is not intended to be a reference manual, but an introductory programmer's guide to using the GRAMPS Gramps database access routines.
Separate [http://www.gramps-project.org/docs/ API Reference Documentation for version 3.3.0 of GRAMPSGramps] and simple [[Media:API.svg|UML (svg) for 3.4.x]] are available.
GRAMPS Gramps is written in the [http://www.python.org Python] language. A basic familiarity with Python is required before the database objects can be effectively used. If you are new to Python, you may wish to check out the [http://docs.python.org/tut/tut.html Python tutorial].
== Database API ==
==Primary Objects==
Primary objects are the fundamental objects in the GRAMPS Gramps database. These objects are:
* [http://www.gramps-project.org/docs/gen/gen_lib.html#module-gen.lib.person Person] - Contains the information specific to an individual person.
* [http://www.gramps-project.org/docs/gen/gen_lib.html#module-gen.lib.family Family] - Contains the information specific to relationships between people. This typically contains one or two parents and zero or more children.
===Getting notification of changes to the database===
If you have widgets that are displaying the content of the database tables you need to be aware that the database can change. Records may be added, removed or updated by other parts of GRAMPS Gramps and your widget must show these changes. The GRAMPS Gramps database provides a signalling mechanism that can be used to notify your widget of changes to the database. The documentation for the ((GrampsDBCallback)) class provides a description of the signalling mechanism. For most code that uses the GRAMPS Gramps database all that is required is for callback functions to be connected to the correct signals. For example:
database.connect('person-add',self.update_view)
database.connect('person-update',self.update_view)

Navigation menu