Jump to: navigation, search

Report-writing tutorial

117 bytes added, 12:50, 30 October 2011
Report class
==Defining the classes==
===Report class===
The user's report class should inherit from the Report class contained within the Report module. The constructor should take two three arguments (besides class instance itself, usually denoted by 'self' name):
* GRAMPS database instance
* options class instance
* user class instanceThe first is the database to work with. The second is the instance of the options class defined in the same report, see next section. The third is an instance of the User class, used for interaction with the user. Here's an example of a report class definition:
from ReportBase import Report, ReportUtils, ReportOptions
class ReportClassName(Report):
def __init__(self, database, options_class, user): Report.__init__(self, database, options_class, user)
The Report class's constructor will initialize several variables for the user based off the passed values. They are:
;self.doc : The opened document instance ready for output. This is of the type [ / docgen], and is '''not''' a normal file object.
;self.database : The [ GrampsDbBase] database object.
;self.options_class : The [ ReportOptions] class passed to the report.

Navigation menu