The gramps.gen.plug Module¶
The “plug” package for handling plugins in Gramps.
Plugin¶
This module provides the base class for plugins.
-
class
gramps.gen.plug._plugin.Plugin(name, description, module_name)[source]¶ Bases:
objectThis class serves as a base class for all plugins that can be registered with the plugin manager
-
get_description()[source]¶ Get the description of this plugin.
- Returns
a string that describes the plugin
-
BaseManager¶
The core of the Gramps plugin system. This module provides capability to load plugins from specified directories and provide information about the loaded plugins.
Plugins are divided into several categories. These are: reports, tools, importers, exporters, quick reports, and document generators.
-
class
gramps.gen.plug._manager.BasePluginManager[source]¶ Bases:
objectunique singleton storage class for a
PluginManager.-
empty_managed_plugins()[source]¶ For some plugins, managed Plugin are used. These are only reobtained from the registry if this method is called
-
get_docgen_names()[source]¶ Get the list of docgen plugin names.
- Returns
a list of
DocGenPluginnames
-
get_docgen_plugins()[source]¶ Get the list of docgen plugins.
- Returns
DocGenPlugin(a list of DocGenPlugin instances)
-
get_export_plugins()[source]¶ Get the list of export plugins.
- Returns
ExportPlugin(a list of ExportPlugin instances)
-
get_import_plugins()[source]¶ Get the list of import plugins.
- Returns
ImportPlugin(a list of ImportPlugin instances)
-
get_plugin(id)[source]¶ Returns a plugin object from
PluginRegisterby id.
-
get_plugin_data(category)[source]¶ Gets all of the data from general plugins of type category. plugin.data may be a single item, an iterable, or a callable.
>>> PLUGMAN.get_plugin_data('CSS') <a list of raw data items>
-
get_reg_reports(gui=True)[source]¶ Return list of registered reports :param gui: bool indicating if GUI reports or CLI reports must be returned
Return list of registered sidebars.
-
get_reg_tools(gui=True)[source]¶ Return list of registered tools :aram gui: bool indicating if GUI reports or CLI reports must be returned
-
import_plugin(pdata)[source]¶ Rather than just __import__(id), this will add the pdata.fpath to sys.path first (if needed), import, and then reset path.
-
load_plugin(pdata)[source]¶ Load a
PluginDataobject. This means import of the python module. Plugin directories are added to sys path, so files are found
-
process_plugin_data(category)[source]¶ Gathers all of the data from general plugins of type category, and pass it to a single process function from one of those plugins.
>>> PLUGMAN.process_plugin_data('CSS') <a list of processed data items>
-
reg_plugins(direct, dbstate=None, uistate=None, load_on_reg=False, rescan=False)[source]¶ Searches the specified directory, and registers python plugin that are being defined in gpr.py files.
If a relationship calculator for env var LANG is present, it is immediately loaded so it is available for all.
-
register_option(option, guioption)[source]¶ Register an external option.
Register a mapping from option to guioption for an option that is not native to Gramps but provided by the plugin writer. This should typically be called during initialisation of a
ReportOptionsclass.- Parameters
option (class that inherits from gen.plug.menu.Option) – the option class
guioption (class that inherits from Gtk.Widget.) – the gui-option class
-
Export¶
This module provides the Plugin class for export plugins.
-
class
gramps.gen.plug._export.ExportPlugin(name, description, export_function, extension, config=None)[source]¶ Bases:
gramps.gen.plug._plugin.PluginThis class represents a plugin for exporting data from Gramps
Gramplet¶
-
class
gramps.gen.plug._gramplet.Gramplet(gui, nav_group=0)[source]¶ Bases:
objectBase class for non-graphical gramplet code.
-
active_changed(handle)[source]¶ Developers should put their code that occurs when the active person is changed.
-
append_text(text, scroll_to='end')[source]¶ Append the text to the textview. Additionally, move the cursor to the position given. Positions are:
Position
Description
‘start’
start of textview
‘end’
end of textview
‘begin’
begin of line, before setting the text.
-
connect_signal(nav_type, method)[source]¶ Connect the given method to the active-changed signal for the navigation type requested.
-
get_active_object(nav_type)[source]¶ Return the object of the active handle for the given navigation type.
A list of widgets to keep hidden. Needed because Gramps uses show_all() in some places.
-
init()[source]¶ External constructor for developers to put their initialization code. Designed to be overridden.
-
link(text, link_type, data, size=None, tooltip=None)[source]¶ Creates a clickable link in the textview area.
-
load_data_to_text(pos=0)[source]¶ Load information from the data portion of the saved Gramplet to the textview.
-
main()[source]¶ The main place for the gramplet’s code. This is a generator. Generator which will be run in the background, through
update().
-
no_wrap()[source]¶ The view in gramplet should not wrap. DEPRICATED: use
set_wrap()instead.
-
on_load()[source]¶ Gramplets should override this to take care of loading previously their special data.
-
render_text(text)[source]¶ Render the given text, given that
set_use_markup()is on.
-
set_active(nav_type, handle)[source]¶ Change the handle of the active object for the given navigation type.
-
set_text(text, scroll_to='start')[source]¶ Clear and set the text to the given text. Additionally, move the cursor to the position given. Positions are:
Position
Description
‘start’
start of textview
‘end’
end of textview
‘begin’
begin of line, before setting the text.
-
Import¶
This module provides the Plugin class for import plugins.
-
class
gramps.gen.plug._import.ImportPlugin(name, description, import_function, extension)[source]¶ Bases:
gramps.gen.plug._plugin.PluginThis class represents a plugin for importing data into Gramps
Reports¶
Report option handling, including saving and parsing.
-
class
gramps.gen.plug.report._options.DocOptionHandler(module_name, options_dict)[source]¶ Bases:
gramps.gen.plug._options.OptionHandlerImplements handling of the docgen options for the plugins.
-
class
gramps.gen.plug.report._options.DocOptionListCollection(filename)[source]¶ Bases:
gramps.gen.plug._options.OptionListCollectionImplements a collection of option lists.
-
parse()[source]¶ Loads the
OptionListfrom the associated file, if it exists.
-
-
class
gramps.gen.plug.report._options.DocOptionParser(collection)[source]¶ Bases:
gramps.gen.plug._options.OptionParserSAX parsing class for the DocOptionListCollection XML file.
-
class
gramps.gen.plug.report._options.DocOptions(name)[source]¶ Bases:
gramps.gen.plug._options.MenuOptionsDefines options and provides handling interface.
-
class
gramps.gen.plug.report._options.MenuReportOptions(name, dbase)[source]¶ Bases:
gramps.gen.plug._options.MenuOptions,gramps.gen.plug.report._options.ReportOptionsThe MenuReportOptions class implements the
ReportOptionsfunctionality in a generic way so that the user does not need to be concerned with the actual representation of the options.The user should inherit the MenuReportOptions class and override the add_menu_options function. The user can add options to the menu and the MenuReportOptions class will worry about setting up the UI.
-
class
gramps.gen.plug.report._options.OptionHandler(module_name, options_dict)[source]¶ Bases:
gramps.gen.plug._options.OptionHandlerImplements handling of the options for the plugins.
-
class
gramps.gen.plug.report._options.OptionList[source]¶ Bases:
gramps.gen.plug._options.OptionListImplements a set of options to parse and store for a given report.
-
get_css_filename()[source]¶ Return the template name of the OptionList.
- Returns
template name
- Return type
str
-
get_custom_paper_size()[source]¶ Return the custom paper size for the OptionList.
- Returns
returns the custom paper size in cm
- Return type
[float, float]
-
get_format_name()[source]¶ Return the format name of the OptionList.
- Returns
returns the format name
- Return type
str
-
get_margin(pos)[source]¶ Return a margin for the OptionList.
- Parameters
pos (int) – Position of margin [left, right, top, bottom]
- Returns
float cm of margin
- Return type
float
-
get_margins()[source]¶ Return the margins for the OptionList.
- Returns margins
returns the margins, floats in cm
- Rtype margins
[float, float, float, float]
-
get_orientation()[source]¶ Return the orientation for the OptionList.
- Returns
returns the selected orientation. Valid values are PAPER_LANDSCAPE or PAPER_PORTRAIT
- Return type
int
-
get_output()[source]¶ Return the output of the OptionList.
- Returns
returns the output name
- Return type
str
-
get_paper_metric()[source]¶ Return the paper metric of the OptionList.
- Returns
returns whether to use metric
- Return type
boolean
-
get_paper_name()[source]¶ Return the paper name of the OptionList.
- Returns
returns the paper name
- Return type
str
-
get_style_name()[source]¶ Return the style name of the OptionList.
- Returns
string representing the style name
- Return type
str
-
set_css_filename(css_filename)[source]¶ Set the template name for the OptionList.
- Parameters
template_name (str) – name of the template to set.
-
set_custom_paper_size(paper_size)[source]¶ Set the custom paper size for the OptionList.
- Parameters
paper_size ([float, float]) – paper size to set in cm.
-
set_format_name(format_name)[source]¶ Set the format name for the OptionList.
- Parameters
format_name (str) – name of the format to set.
-
set_margin(pos, value)[source]¶ Set a margin for the OptionList.
- Parameters
pos (int) – Position of margin [left, right, top, bottom]
value (float) – floating point in cm
-
set_margins(margins)[source]¶ Set the margins for the OptionList.
- Parameters
margins ([float, float, float, float]) – margins to set. Possible values are floats in cm
-
set_orientation(orientation)[source]¶ Set the orientation for the OptionList.
- Parameters
orientation (int) – orientation to set. Possible values are PAPER_LANDSCAPE or PAPER_PORTRAIT
-
set_output(output)[source]¶ Set the output for the OptionList.
- Parameters
output (str) – name of the output to set.
-
set_paper_metric(paper_metric)[source]¶ Set the paper metric for the OptionList.
- Parameters
paper_metric – whether to use metric.
-
-
class
gramps.gen.plug.report._options.OptionListCollection(filename)[source]¶ Bases:
gramps.gen.plug._options.OptionListCollectionImplements a collection of option lists.
-
get_last_custom_paper_size()[source]¶ Return the last custom paper size used for any report in this collection.
- Returns
list of last custom paper size used in cm (width, height)
- Return type
[float, float]
-
get_last_margin(pos)[source]¶ Return the last margins used for any report in this collection.
- Parameters
pos (int) – position in margins list
- Returns
last margin used in pos
- Return type
float
-
get_last_margins()[source]¶ Return the last margins used for any report in this collection.
- Returns
list of last margins used in cm (left, right, top, bottom)
- Return type
[float, float, float, float]
-
get_last_orientation()[source]¶ Return the last orientation used for any report in this collection.
- Returns
last orientation used
- Return type
int
-
get_last_paper_metric()[source]¶ Return the last paper metric used for any report in this collection.
- Returns
returns whether or not to use metric
- Return type
boolean
-
get_last_paper_name()[source]¶ Return the last paper name used for any report in this collection.
- Returns
returns the name of the paper
- Return type
str
-
parse()[source]¶ Loads the
OptionListfrom the associated file, if it exists.
-
set_last_css_filename(css_filename)[source]¶ Set the last css used for any report in this collection.
- Parameters
css_filename – name of the style to set.
-
set_last_custom_paper_size(custom_paper_size)[source]¶ Set the last custom paper size used for any report in this collection.
- Parameters
custom_paper_size ([float, float]) – size to set in cm (width, height)
-
set_last_format_name(format_name)[source]¶ Set the last format used for any report in this collection.
- Parameters
format_name – name of the format to set.
-
set_last_margin(pos, value)[source]¶ Set the last margin used for any report in this collection.
- Parameters
pos (int) – pos to set (0-4) (left, right, top, bottom)
value (float) – value to set the margin to in cm
-
set_last_margins(margins)[source]¶ Set the last margins used for any report in this collection.
- Parameters
margins ([float, float, float, float]) – margins to set in cm (left, right, top, bottom)
-
set_last_orientation(orientation)[source]¶ Set the last orientation used for any report in this collection.
- Parameters
orientation (int) – orientation to set.
-
set_last_paper_metric(paper_metric)[source]¶ Set the last paper metric used for any report in this collection.
- Parameters
paper_metric – whether to use metric.
-
-
class
gramps.gen.plug.report._options.OptionParser(collection)[source]¶ Bases:
gramps.gen.plug._options.OptionParserSAX parsing class for the OptionListCollection XML file.
-
class
gramps.gen.plug.report._options.ReportOptions(name, dbase)[source]¶ Bases:
gramps.gen.plug._options.OptionsDefines options and provides handling interface.
This is a base Options class for the reports. All reports, options classes should derive from it.
-
get_document()[source]¶ Return document instance.
Warning
This method MUST NOT be overridden by subclasses.
-
get_output()[source]¶ Return document output destination.
Warning
This method MUST NOT be overridden by subclasses.
-
load_previous_values()[source]¶ Modifies all options to have the value they were last used as. Call this function after all options have been added.
-
make_default_style(default_style)[source]¶ Defines default style for this report.
This method MUST be overridden by reports that use the user-adjustable paragraph styles.
Note
Unique names MUST be used for all style names, otherwise the styles will collide when making a book with duplicate style names. A rule of safety is to prepend style name with the acronym based on report name.
The following acronyms are already taken:
Code
Report
AC
Ancestor Chart
AC2
Ancestor Chart 2 (Wall Chart)
AHN
Ahnentafel Report
AR
Comprehensive Ancestors report
CBT
Custom Book Text
DG
Descendant Graph
DR
Descendant Report
DAR
Detailed Ancestral Report
DDR
Detailed Descendant Report
FGR
Family Group Report
FC
Fan Chart
FTA
FTM Style Ancestral report
FTD
FTM Style Descendant report
IDS
Individual Complete Report
IDX
Alphabetical Index
IVS
Individual Summary Report
PLC
Place Report
SBT
Simple Book Title
TLG
Timeline Graph
TOC
Table Of Contents
-
Contain and organize bibliographic information.
-
class
gramps.gen.plug.report._bibliography.Bibliography(mode=31)[source]¶ Bases:
objectStore and organize multiple citations into a bibliography.
-
MODE_ALL= 31¶
-
MODE_CONF= 4¶
-
MODE_DATE= 1¶
-
MODE_MEDIA= 16¶
-
MODE_NOTE= 8¶
-
MODE_PAGE= 2¶
-
add_reference(lib_citation)[source]¶ Add a reference to a source to this bibliography. If the source already exists, don’t add it again. If a similar reference exists, don’t add another one.
- Parameters
citation (
Citation) – Citation object- Returns
A tuple containing the index of the source among all the sources and the key of the reference among all the references. If there is no reference information, the second element will be None.
- Return type
(int,char) or (int,None)
Note
Within this file, the name ‘citation’ is used both for gen.lib.Citation, and for _bibliography.Citation. It is not clear how best to rename the concepts in this file to avoid the clash, so the names have been retained. In this function, lib_citation is used for gen.lib.Citation instances, and citation for _bibliography.Citation instances. Elsewhere in this file, source_ref is used for gen.lib.Citation instances.
-
-
class
gramps.gen.plug.report._bibliography.Citation[source]¶ Bases:
objectStore information about a citation and all of its references.
-
add_reference(source_ref)[source]¶ Add a reference to this citation. If a similar reference exists, don’t add another one.
- Parameters
source_ref (
Citation) – Source Reference- Returns
The key of the added reference among all the references.
- Return type
char
-
get_ref_list()[source]¶ List all the references to this citation.
- Returns
a list of references
- Return type
list of
Citationobjects
-
Report Generation Framework
Provide utilities for printing endnotes in text reports.
-
gramps.gen.plug.report.endnotes.add_endnote_styles(style_sheet)[source]¶ Add paragraph styles to a style sheet to be used for displaying endnotes.
- Parameters
style_sheet (
StyleSheet) – Style sheet
-
gramps.gen.plug.report.endnotes.cite_source(bibliography, database, obj, elocale=<gramps.gen.utils.grampslocale.GrampsLocale object>)[source]¶ Cite any sources for the object and add them to the bibliography.
- Parameters
bibliography (
Bibliography) – The bibliography to contain the citations.obj (
CitationBase) – An object with source references.elocale (a
GrampsLocaleinstance) – allow deferred translation of dates and strings
-
gramps.gen.plug.report.endnotes.write_endnotes(bibliography, database, doc, printnotes=False, links=False, elocale=<gramps.gen.utils.grampslocale.GrampsLocale object>)[source]¶ Write all the entries in the bibliography as endnotes.
If elocale is passed in (a
GrampsLocale), then (insofar as possible) the translated values will be returned instead.- Parameters
bibliography (
Bibliography) – The bibliography that contains the citations.database (DbBase) – The database that the sources come from.
doc (
TextDoc) – The document to write the endnotes into.printnotes (bool) – Indicate if the notes attached to a source must be written too.
links (bool) – Indicate if URL links should be makde ‘clickable’.
elocale (a
GrampsLocaleinstance) – allow deferred translation of dates and strings
-
class
gramps.gen.plug.report._paper.PageSizeParser(paper_list)[source]¶ Bases:
xml.sax.handler.ContentHandlerParses the XML file and builds the list of page sizes
-
setDocumentLocator(locator)[source]¶ Called by the parser to give the application a locator for locating the origin of document events.
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface.
The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application’s business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
-
-
class
gramps.gen.plug.report._reportbase.Report(database, options_class, user)[source]¶ Bases:
objectThe Report base class. This is a base class for generating customized reports. It cannot be used as is, but it can be easily sub-classed to create a functional report generator.
A collection of utilities to aid in the generation of reports.
-
gramps.gen.plug.report.utils.cm2pt(cm_)[source]¶ Convert centimeters to points. Fonts are typically specified in points, but the
BaseDocclasses use centimeters.- Parameters
cm (float or int) – centimeters
- Returns
equivalent units in points
- Return type
float
-
gramps.gen.plug.report.utils.get_address_str(addr)[source]¶ Return a string that combines the elements of an address
- Parameters
addr – the Gramps address instance
-
gramps.gen.plug.report.utils.get_family_filters(database, family, include_single=True, name_format=None)[source]¶ Return a list of filters that are relevant for the given family
- Parameters
database (DbBase) – The database that the family is in.
family (
Family) – the family the filters should apply to.include_single (boolean) – include a filter to include the single family
name_format (None or int) – optional format to control display of person’s name
-
gramps.gen.plug.report.utils.get_person_filters(person, include_single=True, name_format=None)[source]¶ Return a list of filters that are relevant for the given person
- Parameters
person (
Person) – the person the filters should apply to.include_single (boolean) – include a filter to include the single person
name_format (None or int) – optional format to control display of person’s name
-
gramps.gen.plug.report.utils.get_person_mark(dbase, person)[source]¶ Return a IndexMark that can be used to index a person in a report
- Parameters
dbase – the Gramps database instance
person – the key is for
-
gramps.gen.plug.report.utils.insert_image(database, doc, photo, user, w_cm=4.0, h_cm=4.0, alt='', style_name=None, align='right')[source]¶ Insert pictures of a person into the document.
- Parameters
alt – an alternative text to use. Useful for eg html reports
style_name – style to use for the “alternative text” or captions
align – image alignment: ‘left’, ‘right’, ‘center’, or ‘single’
-
gramps.gen.plug.report.utils.place_name(dbase, place_handle)[source]¶ returns a place string given a handle
-
gramps.gen.plug.report.utils.pt2cm(pt_)[source]¶ Convert points to centimeters. Fonts are typically specified in points, but the
BaseDocclasses use centimeters.- Parameters
pt (float or int) – points
- Returns
equivalent units in centimeters
- Return type
float
-
gramps.gen.plug.report.utils.rgb_color(color)[source]¶ Convert color value from 0-255 integer range into 0-1 float range.
- Parameters
color (int) – list or tuple of integer values for red, green, and blue
- Returns
(red, green, blue) tuple of floating point color values
- Return type
3-tuple
-
gramps.gen.plug.report.utils.roman(num)[source]¶ Integer to Roman numeral converter for 0 < num < 4000
Docgen¶
This module provides the Plugin class for document generator plugins.
-
class
gramps.gen.plug._docgenplugin.DocGenPlugin(name, description, basedoc, paper, style, extension, docoptclass, basedocname)[source]¶ Bases:
gramps.gen.plug._plugin.PluginThis class represents a plugin for generating documents from Gramps
-
get_basedoc()[source]¶ Get the
BaseDocclass for this plugin.- Returns
the
BaseDocclass passed into__init__()
-
get_basedocname()[source]¶ Get the
BaseDocname for this plugin.- Returns
the
BaseDocname passed into__init__()
-
get_doc_option_class()[source]¶ Get the
DocOptionssubclass for this plugin, if any- Returns
the
DocOptionssubclass passed into__init__()
-
get_paper_used()[source]¶ Get the paper flag for this plugin.
- Returns
bool - True = use paper; False = do not use paper
-
Generators¶
Provide base interface to text based documents. Specific document interfaces should be derived from the core classes.
-
class
gramps.gen.plug.docgen.basedoc.BaseDoc(styles, paper_style, track=[], uistate=None)[source]¶ Bases:
objectBase class for document generators. Different output formats, such as OpenOffice, AbiWord, and LaTeX are derived from this base class, providing a common interface to all document generators.
-
get_style_sheet()[source]¶ Return the
StyleSheetof the document.
-
abstract
open(filename)[source]¶ Opens the file so that it can be generated.
- Parameters
filename – path name of the file to create
-
set_style_sheet(style_sheet)[source]¶ Set the
StyleSheetof the document.- Parameters
style_sheet (
StyleSheet) – The new style sheet for the document
-
-
class
gramps.gen.plug.docgen.drawdoc.DrawDoc[source]¶ Bases:
objectAbstract Interface for graphical document generators. Output formats for graphical reports must implement this interface to be used by the report system.
-
abstract
center_text(style, text, x1, y1, mark=None)[source]¶ - Parameters
mark –
IndexMarkto use for indexing (if supported)
-
abstract
draw_box(style, text, x, y, w, h, mark=None)[source]¶ - Parameters
mark –
IndexMarkto use for indexing (if supported)
-
abstract
draw_text(style, text, x1, y1, mark=None)[source]¶ - Parameters
mark –
IndexMarkto use for indexing (if supported)
-
get_usable_height()[source]¶ Return the height of the text area in centimeters. The value is the page height less the margins.
-
get_usable_width()[source]¶ Return the width of the text area in centimeters. The value is the page width less the margins.
-
abstract
rotate_text(style, text, x, y, angle, mark=None)[source]¶ - Parameters
mark –
IndexMarkto use for indexing (if supported)
-
abstract
Provide a rough estimate of the width of a text string.
-
gramps.gen.plug.docgen.fontscale.string_trim(font, text, width, ellipses='...')[source]¶ Like string_width, but this makes sure the length of the string is <= width. Optionally, add ellipses (…).
-
gramps.gen.plug.docgen.fontscale.string_width(font, text)[source]¶ returns with width of a string in the specified font
-
class
gramps.gen.plug.docgen.fontstyle.FontStyle(style=None)[source]¶ Bases:
objectDefines a font style. Controls the font face, size, color, and attributes. In order to remain generic, the only font faces available are FONT_SERIF and FONT_SANS_SERIF. Document formatters should convert these to the appropriate fonts for the target format.
The FontStyle represents the desired characteristics. There are no guarentees that the document format generator will be able implement all or any of the characteristics.
-
set(face=None, size=None, italic=None, bold=None, underline=None, color=None)[source]¶ Set font characteristics.
- Parameters
face – font type face, either FONT_SERIF or FONT_SANS_SERIF
size – type face size in points
italic – True enables italics, False disables italics
bold – True enables bold face, False disables bold face
underline – True enables underline, False disables underline
color – an RGB color representation in the form of three integers in the range of 0-255 represeting the red, green, and blue components of a color.
-
Graphviz adapter for Graphs
-
class
gramps.gen.plug.docgen.graphdoc.GVDoc[source]¶ Bases:
objectAbstract Interface for Graphviz document generators. Output formats for Graphviz reports must implement this interface to be used by the report system.
-
abstract
add_comment(comment)[source]¶ Add a comment to the source file.
- Parameters
comment (string) – A text string to add as a comment. Example: “Next comes the individuals.”
- Returns
nothing
-
abstract
add_link(id1, id2, style='', head='', tail='', comment='')[source]¶ Add a link between two nodes.
- Parameters
id1 (string) – The unique identifier of the starting node. Example: “p55”
id2 (string) – The unique identifier of the ending node. Example: “p55”
comment (string) – A text string displayed at the end of the link line. Example: “person C is the son of person A and person B”
- Returns
nothing
-
abstract
add_node(node_id, label, shape='', color='', style='', fillcolor='', url='', htmloutput=False)[source]¶ Add a node to this graph. Nodes can be different shapes like boxes and circles.
- Parameters
node_id (string) – A unique identification value for this node. Example: “p55”
label (string) – The text to be displayed in the node. Example: “John Smith”
shape (string) – The shape for the node. Examples: “box”, “ellipse”, “circle”
color (string) – The color of the node line. Examples: “blue”, “lightyellow”
style (string) – The style of the node.
fillcolor (string) – The fill color for the node. Examples: “blue”, “lightyellow”
url (string) – A URL for the node.
htmloutput (boolean) – Whether the label contains HTML.
- Returns
nothing
-
abstract
add_samerank(id1, id2)[source]¶ Force the same line for two linked nodes.
- Parameters
id1 (string) – The unique identifier of the starting node. Example: “p55”
id2 (string) – The unique identifier of the ending node. Example: “p55”
- Returns
nothing
-
abstract
end_subgraph()[source]¶ End a subgraph that was previously started in this graph.
- Returns
nothing
-
abstract
-
class
gramps.gen.plug.docgen.graphdoc.GVDocBase(options, paper_style, uistate=None)[source]¶ Bases:
gramps.gen.plug.docgen.basedoc.BaseDoc,gramps.gen.plug.docgen.graphdoc.GVDocBase document generator for all Graphviz document generators. Classes that inherit from this class will only need to implement the close function. The close function will generate the actual file of the appropriate type.
-
add_link(id1, id2, style='', head='', tail='', comment='')[source]¶ Add a link between two nodes.
Implements GVDocBase.add_link().
-
add_node(node_id, label, shape='', color='', style='', fillcolor='', url='', htmloutput=False)[source]¶ Add a node to this graph. Nodes can be different shapes like boxes and circles.
Implements GVDocBase.add_node().
-
add_samerank(id1, id2)[source]¶ Force the same line for two linked nodes.
Implements GVDocBase.add_samerank().
-
-
class
gramps.gen.plug.docgen.graphdoc.GVDotDoc(options, paper_style, uistate=None)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .gv text file.
-
class
gramps.gen.plug.docgen.graphdoc.GVGifDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .gif file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVJpegDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .jpg file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVOptions[source]¶ Bases:
objectDefines all of the controls necessary to configure the graph reports.
Add all graph related options to the menu.
- Parameters
menu (
Menu) – The menu the options should be added to.- Returns
nothing
-
class
gramps.gen.plug.docgen.graphdoc.GVPdfGsDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .pdf file using Ghostscript.
-
class
gramps.gen.plug.docgen.graphdoc.GVPdfGvDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .pdf file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVPngDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .png file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVPsDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .ps file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVSvgDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .svg file using Graphviz.
-
class
gramps.gen.plug.docgen.graphdoc.GVSvgzDoc(options, paper_style)[source]¶ Bases:
gramps.gen.plug.docgen.graphdoc.GVDocBaseGVDoc implementation that generates a .svg file using Graphviz.
-
class
gramps.gen.plug.docgen.graphicstyle.GraphicsStyle(obj=None)[source]¶ Bases:
objectDefines the properties of graphics objects, such as line width, color, fill, ect.
-
class
gramps.gen.plug.docgen.paperstyle.PaperSize(name, height, width)[source]¶ Bases:
objectDefines the dimensions of a sheet of paper. All dimensions are in centimeters.
-
class
gramps.gen.plug.docgen.paperstyle.PaperStyle(size, orientation, lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54)[source]¶ Bases:
objectDefine the various options for a sheet of paper.
-
get_bottom_margin()[source]¶ Return the bottom margin.
- Returns
Bottom margin in centimeters
- Return type
float
-
get_left_margin()[source]¶ Return the left margin.
- Returns
Left margin in centimeters
- Return type
float
-
get_orientation()[source]¶ Return the orientation of the page.
- Returns
PAPER_PORTRIAT or PAPER_LANDSCAPE
- Return type
int
-
get_right_margin()[source]¶ Return the right margin.
- Returns
Right margin in centimeters
- Return type
float
-
get_size()[source]¶ Return the size of the paper.
- Returns
object indicating the paper size
- Return type
-
get_top_margin()[source]¶ Return the top margin.
- Returns
Top margin in centimeters
- Return type
float
-
-
class
gramps.gen.plug.docgen.paragraphstyle.ParagraphStyle(source=None)[source]¶ Bases:
objectDefines the characteristics of a paragraph. The characteristics are: font (a
FontStyleinstance), right margin, left margin, first indent, top margin, bottom margin, alignment, level, top border, bottom border, right border, left border, padding, and background color.-
get_alignment_text()[source]¶ Return a text string representing the alignment, either ‘left’, ‘right’, ‘center’, or ‘justify’
-
get_background_color()[source]¶ Return a tuple indicating the RGB components of the background color
-
set(rmargin=None, lmargin=None, first_indent=None, tmargin=None, bmargin=None, align=None, tborder=None, bborder=None, rborder=None, lborder=None, pad=None, bgcolor=None, font=None)[source]¶ Allows the values of the object to be set.
- Parameters
rmargin – right indent in centimeters
lmargin – left indent in centimeters
first_indent – first line indent in centimeters
tmargin – space above paragraph in centimeters
bmargin – space below paragraph in centimeters
align – alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
tborder – non zero indicates that a top border should be used
bborder – non zero indicates that a bottom border should be used
rborder – non zero indicates that a right border should be used
lborder – non zero indicates that a left border should be used
pad – padding in centimeters
bgcolor – background color of the paragraph as an RGB tuple.
font – FontStyle instance that defines the font
-
set_alignment(align)[source]¶ Set the paragraph alignment.
- Parameters
align – PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY
-
set_background_color(color)[source]¶ Set the background color of the paragraph.
- Parameters
color – tuple representing the RGB components of a color (0,0,0) to (255,255,255)
-
set_bottom_border(val)[source]¶ Set the presence or absence of bottom border.
- Parameters
val – True indicates a border should be used, False indicates no border.
-
set_font(font)[source]¶ Set the font style of the paragraph.
- Parameters
font –
FontStyleobject containing the font definition to use.
-
set_header_level(level)[source]¶ Set the header level for the paragraph. This is useful for numbered paragraphs. A value of 1 indicates a header level format of X, a value of two implies X.X, etc. A value of zero means no header level.
-
set_left_border(val)[source]¶ Set the presence or absence of left border.
- Parameters
val – True indicates a border should be used, False indicates no border.
-
set_padding(val)[source]¶ Set the paragraph padding in centimeters
- Parameters
val – floating point value indicating the padding in centimeters
-
set_right_border(val)[source]¶ Set the presence or absence of rigth border.
- Parameters
val – True indicates a border should be used, False indicates no border.
-
-
class
gramps.gen.plug.docgen.stylesheet.SheetParser(sheetlist)[source]¶ Bases:
xml.sax.handler.ContentHandlerSAX parsing class for the StyleSheetList XML file.
-
class
gramps.gen.plug.docgen.stylesheet.StyleSheet(obj=None)[source]¶ Bases:
objectA collection of named paragraph styles.
-
add_cell_style(name, style)[source]¶ Add a cell style to the style sheet.
- Parameters
name – The name of the
TableCellStylestyle –
TableCellStyleinstance to be added.
-
add_draw_style(name, style)[source]¶ Add a draw style to the style sheet.
- Parameters
name – The name of the
GraphicsStylestyle –
GraphicsStyleinstance to be added.
-
add_paragraph_style(name, style)[source]¶ Add a paragraph style to the style sheet.
- Parameters
name – The name of the
ParagraphStylestyle –
ParagraphStyleinstance to be added.
-
add_table_style(name, style)[source]¶ Add a table style to the style sheet.
- Parameters
name – The name of the
TableStylestyle –
TableStyleinstance to be added.
-
get_cell_style(name)[source]¶ Return the
TableCellStyleassociated with the name- Parameters
name – name of the
TableCellStylethat is wanted
-
get_draw_style(name)[source]¶ Return the
GraphicsStyleassociated with the name- Parameters
name – name of the
GraphicsStylethat is wanted
-
get_paragraph_style(name)[source]¶ Return the
ParagraphStyleassociated with the name- Parameters
name – name of the
ParagraphStylethat is wanted
-
get_table_style(name)[source]¶ Return the
TableStyleassociated with the name- Parameters
name – name of the
TableStylethat is wanted
-
-
class
gramps.gen.plug.docgen.stylesheet.StyleSheetList(filename, defstyle)[source]¶ Bases:
objectInterface into the user’s defined style sheets. Each StyleSheetList has a predefined default style specified by the report. Additional styles are loaded from a specified XML file if it exists.
-
delete_style_sheet(name)[source]¶ Remove a style from the list. Since each style must have a unique name, the name is used to delete the stylesheet.
name - Name of the style to delete
-
get_style_sheet(name)[source]¶ Return the StyleSheet associated with the name
name - name associated with the desired StyleSheet.
-
-
gramps.gen.plug.docgen.stylesheet.cnv2color(text)[source]¶ converts a hex value in the form of #XXXXXX into a tuple of integers representing the RGB values
-
class
gramps.gen.plug.docgen.tablestyle.TableCellStyle(obj=None)[source]¶ Bases:
objectDefines the style of a particular table cell. Characteristics are: right border, left border, top border, bottom border, and padding.
-
set_borders(val)[source]¶ Defines if a border is used
- Parameters
val – if True, a border is used, if False, it is not
-
set_bottom_border(val)[source]¶ Defines if a bottom border in used
- Parameters
val – if 1, a bottom border is used, if 0, it is not
-
set_left_border(val)[source]¶ Defines if a left border in used
- Parameters
val – if True, a left border is used, if False, it is not
-
-
class
gramps.gen.plug.docgen.tablestyle.TableStyle(obj=None)[source]¶ Bases:
objectSpecifies the style or format of a table. The TableStyle contains the characteristics of table width (in percentage of the full width), the number of columns, and the width of each column as a percentage of the width of the table.
-
get_column_width(index)[source]¶ Return the column width of the specified column as a percentage of the entire table width.
- Parameters
index – column to return (index starts at 0)
-
set_column_width(index, width)[source]¶ Set the width of a specified column to the specified width.
- Parameters
index – column being set (index starts at 0)
width – percentage of the table width assigned to the column
-
set_column_widths(clist)[source]¶ Set the width of all the columns at once, taking the percentages from the passed list.
-
-
class
gramps.gen.plug.docgen.textdoc.IndexMark(key='', itype=0, level=1)[source]¶ Bases:
objectDefines a mark to be associated with text for indexing.
-
class
gramps.gen.plug.docgen.textdoc.TextDoc[source]¶ Bases:
objectAbstract Interface for text document generators. Output formats for text reports must implement this interface to be used by the report system.
-
abstract
add_media(name, align, w_cm, h_cm, alt='', style_name=None, crop=None)[source]¶ Add a photo of the specified width (in centimeters).
- Parameters
name – filename of the image to add
align – alignment of the image. Valid values are ‘left’, ‘right’, ‘center’, and ‘single’
w_cm – width in centimeters
h_cm – height in centimeters
alt – an alternative text to use. Useful for eg html reports
style_name – style to use for captions
crop – image cropping parameters
-
insert_index()[source]¶ Insert an Alphabetical Index at this point in the document. This passes without error so that docgen types are not required to have this.
-
insert_toc()[source]¶ Insert a Table of Contents at this point in the document. This passes without error so that docgen types are not required to have this.
-
abstract
start_cell(style_name, span=1)[source]¶ Starts a new table cell, using the paragraph style specified.
- Parameters
style_name –
TableCellStyleto use for the cellspan – number of columns to span
-
start_link(link)[source]¶ Start a link section. This defaults to underlining.
- Parameters
link – should be an item that makes sense in this docgen type, if it implements linking.
-
abstract
start_paragraph(style_name, leader=None)[source]¶ Starts a new paragraph, using the specified style name.
- Parameters
style_name – name of the
ParagraphStyleto use for the paragraph.leader – Leading text for a paragraph. Typically used for numbering.
-
abstract
start_table(name, style_name)[source]¶ Starts a new table.
- Parameters
name – Unique name of the table.
style_name –
TableStyleto use for the new table
-
start_underline()[source]¶ Start a section of underlining. This passes without error so that docgen types are not required to have this.
-
stop_link()[source]¶ Stop the link section. Defaults to stopping the underlining for docgen types that don’t support links.
-
stop_underline()[source]¶ Stops a section of underlining. This passes without error so that docgen ntypes are not required to have this.
-
write_markup(text, s_tags, mark=None)[source]¶ Writes the text in the current paragraph. Should only be used after a start_paragraph and before an end_paragraph. Not all backends support s_tags, then the same happens as with write_text. Backends supporting write_markup will overwrite this method
- Parameters
text – text to write. The text is assumed to be _not_ escaped
s_tags – assumed to be list of styledtexttags to apply to the text
mark –
IndexMarkto use for indexing (if supported)
-
write_styled_note(styledtext, format, style_name, contains_html=False, links=False)[source]¶ Convenience function to write a styledtext to the cairo doc.
- Parameters
styledtext – assumed a
StyledTextobject to writeformat – 0 = Flowed, 1 = Preformatted
style_name – name of the style to use for default presentation
contains_html – bool, the backend should not check if html is present. If contains_html=True, then the textdoc is free to handle that in some way. Eg, a textdoc could remove all tags, or could make sure a link is clickable.
links – bool, make URLs in the text clickable (if supported)
overwrite this method if the backend supports styled notes
-
abstract
write_text(text, mark=None, links=False)[source]¶ Writes the text in the current paragraph. Should only be used after a start_paragraph and before an end_paragraph.
- Parameters
text – text to write.
mark –
IndexMarkto use for indexing (if supported)links – make URLs in the text clickable (if supported)
-
abstract
Doc Backend¶
File and File format management for the different reports
-
class
gramps.gen.plug.docbackend.cairobackend.CairoBackend(filename=None)[source]¶ Bases:
gramps.gen.plug.docbackend.docbackend.DocBackendImplementation for cairo docs
-
ESCAPE_FUNC()¶
-
STYLETAG_MARKUP= {0: ('<b>', '</b>'), 1: ('<i>', '</i>'), 2: ('<u>', '</u>'), 7: ('<sup>', '</sup>')}¶
-
STYLETAG_TO_PROPERTY= {3: 'face', 4: 'size', 5: 'foreground', 6: 'background'}¶
-
SUPPORTED_MARKUP= [0, 1, 2, 3, 4, 5, 6, 7]¶
-
File and File format management for the different reports
-
class
gramps.gen.plug.docbackend.docbackend.DocBackend(filename=None)[source]¶ Bases:
objectBase class for text document backends. The DocBackend manages a file to which it writes. It further knowns enough of the file format to be able to translate between the BaseDoc API and the file format. Specifically for text reports a translation of styled notes to the file format usage is done.
-
BOLD= 0¶
-
CLASSMAP= None¶
-
ESCAPE_FUNC()¶
-
FONTCOLOR= 5¶
-
FONTFACE= 3¶
-
FONTSIZE= 4¶
-
HIGHLIGHT= 6¶
-
ITALIC= 1¶
-
LINK= 8¶
-
STYLETAG_MARKUP= {0: ('', ''), 1: ('', ''), 2: ('', ''), 7: ('', ''), 8: ('', '')}¶
-
STYLETYPE_MAP= {}¶
-
SUPERSCRIPT= 7¶
-
SUPPORTED_MARKUP= []¶
-
UNDERLINE= 2¶
-
add_markup_from_styled(text, s_tags, split='', escape=True)[source]¶ Input is plain text, output is text with markup added according to the s_tags which are assumed to be styledtexttags. When split is given the text will be split over the value given, and tags applied in such a way that it the text can be safely splitted in pieces along split.
- Parameters
text – str, a piece of text
s_tags – styledtexttags that must be applied to the text
split – str, optional. A string along which the output can be safely split without breaking the styling.
As adding markup means original text must be escaped, ESCAPE_FUNC is used. This can be used to convert the text of a styledtext to the format needed for a document backend. Do not call this method in a report, use the
write_markup()method.Note
the algorithm is complex as it assumes mixing of tags is not allowed: eg <b>text<i> here</b> not</i> is assumed invalid as markup. If the s_tags require such a setup, what is returned is <b>text</b><i><b> here</b> not</i> overwrite this method if this complexity is not needed.
-
escape(preformatted=False)[source]¶ The escape func on text for this file format.
- Parameters
preformatted (bool) – some formats can have different escape function for normal text and preformatted text
-
property
filename¶ The filename the backend works on
-
find_tag_by_stag(s_tag)[source]¶ - Parameters
s_tag – object: assumed styledtexttag
s_tagvalue – None/int/str: value associated with the tag
A styled tag is type with a value. Every styled tag must be converted to the tags used in the corresponding markup for the backend, eg <b>text</b> for bold in html. These markups are stored in STYLETAG_MARKUP. They are tuples for begin and end tag. If a markup is not present yet, it is created, using the
_create_xmltag()method you can overwrite.
-
format_link(value)[source]¶ Default format for links. Override for better support.
value is: “TYPE DATA” where TYPE is ‘url’ or ‘ref’.
-
setf(value)[source]¶ Set the filename on which the backend writes, changing the value passed on initialization. Can only be done if the previous filename is not open.
-
Register¶
This module provides the base class for plugin registration. It provides an object containing data about the plugin (version, filename, …) and a register for the data of all plugins .
-
class
gramps.gen.plug._pluginreg.PluginData[source]¶ Bases:
objectThis is the base class for all plugin data objects. The workflow is:
plugin manager reads all register files, and stores plugin data objects in a plugin register
when plugin is needed, the plugin register creates the plugin, and the manager stores this, after which it can be executed.
Attributes present for all plugins
-
id¶ -
A unique identifier for the plugin. This is eg used to store the plugin -
settings. MUST be in ASCII, with only "_- ().,'" special characters.
-
name¶ -
A friendly name to call this plugin (normally translated)
-
name_accell¶ -
A friendly name to call this plugin (normally translated), with an -
accellerator present (eg '_Descendant report', with D to be accellerator -
key¶
-
description¶ -
A friendly description of what the plugin does
-
version¶ -
The version of the plugin
-
status¶ -
The status of the plugin, STABLE or UNSTABLE -
UNSTABLE is only visible in development code, not in release
-
fname¶ -
The python file where the plugin implementation can be found
-
fpath¶ -
The python path where the plugin implementation can be found
-
ptype¶ -
The plugin type. One of REPORT , QUICKREPORT, TOOL, IMPORT, -
EXPORT, DOCGEN, GENERAL, MAPSERVICE, VIEW, GRAMPLET, DATABASE, RULE
-
List of authors of the plugin, default=[]
-
List of emails of the authors of the plugin, default=[]
-
supported¶ -
Bool value indicating if the plugin is still supported, default=True
-
load_on_reg¶ -
bool value, if True, the plugin is loaded on Gramps startup. Some -
plugins. Only set this value if for testing you want the plugin to be -
loaded immediately on startup. default=False
Attributes for RELCALC plugins:
-
relcalcclass¶ -
The class in the module that is the relationcalc class
-
lang_list¶ -
List of languages this plugin handles
Attributes for REPORT plugins:
-
require_active¶ -
Bool, If the reports requries an active person to be set or not
-
reportclass¶ -
The class in the module that is the report class
-
report_modes¶ -
The report modes: list of REPORT_MODE_GUI ,REPORT_MODE_BKI,REPORT_MODE_CLI
Attributes for REPORT and TOOL and QUICKREPORT and VIEW plugins
-
category¶ -
Or the report category the plugin belongs to, default=CATEGORY_TEXT -
or the tool category a plugin belongs to, default=TOOL_UTILS -
or the quickreport category a plugin belongs to, default=CATEGORY_QR_PERSON -
or the view category a plugin belongs to, -
default=("Miscellaneous", _("Miscellaneous"))
Attributes for REPORT and TOOL and DOCGEN plugins
-
optionclass¶ -
The class in the module that is the option class
Attributes for TOOL plugins
-
toolclass¶ -
The class in the module that is the tool class
-
tool_modes¶ -
The tool modes: list of TOOL_MODE_GUI, TOOL_MODE_CLI
Attributes for DOCGEN plugins
-
docclass¶ -
The class in the module that is the BaseDoc defined
-
paper¶ -
bool, Indicates whether the plugin uses paper or not, default=True
-
style¶ -
bool, Indicates whether the plugin uses styles or not, default=True
Attribute for DOCGEN, EXPORT plugins
-
extension¶ -
str, The file extension to use for output produced by the docgen/export, -
default=''
Attributes for QUICKREPORT plugins
-
runfunc¶ -
The function that executes the quick report
Attributes for MAPSERVICE plugins
-
mapservice¶ -
The class in the module that is a mapservice
Attributes for EXPORT plugins
-
export_function¶ -
Function that produces the export
-
export_options¶ -
Class to set options
-
export_options_title¶ -
Title for the option page
Attributes for IMPORT plugins
-
import_function¶ -
Function that starts an import
Attributes for GRAMPLET plugins
-
gramplet¶ -
The function or class that defines the gramplet.
-
height¶ -
The height the gramplet should have in a column on GrampletView, -
default = 200
-
detached_height¶ -
The height the gramplet should have detached, default 300
-
detached_width¶ -
The width the gramplet should have detached, default 400
-
expand¶ -
If the attributed should be expanded on start, default False
-
gramplet_title¶ -
Title to use for the gramplet, default = _('Gramplet')
-
Navigation types that the gramplet is appropriate for, default = []
-
help_url¶ -
The URL where documentation for the URL can be found
Attributes for VIEW plugins
-
viewclass¶ -
A class of type ViewCreator that holds the needed info of the -
view to be created: icon, viewclass that derives from pageview, ...
-
stock_icon¶ -
The icon in the toolbar or sidebar used to select the view
Attributes for SIDEBAR plugins
-
The class that defines the sidebar.
-
A label to use on the seltion menu.
Attributes for VIEW and SIDEBAR plugins
-
order¶ -
order can be START or END. Default is END. For END, on registering, -
the plugin is appended to the list of plugins. If START, then the -
plugin is prepended. Only set START if you want a plugin to be the -
first in the order of plugins
Attributes for DATABASE plugins
-
databaseclass¶ -
The class in the module that is the database class
-
reset_system¶ -
Boolean to indicate that the system (sys.modules) should -
be reset.
Attributes for RULE plugins
-
namespace¶ -
The class (Person, Event, Media, etc.) the rule applies to.
-
ruleclass¶ -
The exact class name of the rule; ex: HasSourceParameter
-
property
authors¶
-
property
authors_email¶
-
property
category¶
-
property
data¶
-
property
databaseclass¶
-
property
depends_on¶
-
property
description¶
-
property
detached_height¶
-
property
detached_width¶
-
property
expand¶
-
property
export_function¶
-
property
export_options¶
-
property
export_options_title¶
-
property
extension¶
-
property
fname¶
-
property
fpath¶
-
property
gramplet¶
-
property
gramplet_title¶
-
property
gramps_target_version¶
-
property
height¶
-
property
help_url¶
-
property
icondir¶
-
property
icons¶
-
property
id¶
-
property
import_function¶
-
property
include_in_listing¶
-
property
lang_list¶
-
property
load_on_reg¶
-
property
mapservice¶
-
property
menu_label¶
-
property
name¶
-
property
name_accell¶
-
property
namespace¶
-
property
navtypes¶
-
property
optionclass¶
-
property
order¶
-
property
orientation¶
-
property
paper¶
-
property
process¶
-
property
ptype¶
-
property
relcalcclass¶
-
property
report_modes¶
-
property
reportclass¶
-
property
require_active¶
-
property
reset_system¶
-
property
ruleclass¶
-
property
runfunc¶
-
property
sidebarclass¶
-
property
status¶
-
property
stock_icon¶
-
property
style¶
-
property
supported¶
-
property
tool_modes¶
-
property
toolclass¶
-
property
version¶
-
property
viewclass¶
-
class
gramps.gen.plug._pluginreg.PluginRegister[source]¶ Bases:
objectPluginRegister is a Singleton which holds plugin data
-
add_plugindata(plugindata)[source]¶ This is used to add an entry to the registration list. The way it is used, this entry is not yet filled in, so we cannot use the id to add to the __id_to_pdata dict at this time.
-
bookitem_plugins()[source]¶ Return a list of REPORT
PluginDatathat are can be used as bookitem
-
database_plugins()[source]¶ Return a list of
PluginDatathat are of type DATABASE
-
docgen_plugins()[source]¶ Return a list of
PluginDatathat are of type DOCGEN
-
export_plugins()[source]¶ Return a list of
PluginDatathat are of type EXPORT
-
filter_load_on_reg()[source]¶ Return a list of
PluginDatathat have load_on_reg == True
-
general_plugins(category=None)[source]¶ Return a list of
PluginDatathat are of type GENERAL
-
get_plugin(id)[source]¶ Return the
PluginDatafor the plugin with id
-
gramplet_plugins()[source]¶ Return a list of
PluginDatathat are of type GRAMPLET
-
import_plugins()[source]¶ Return a list of
PluginDatathat are of type IMPORT
-
mapservice_plugins()[source]¶ Return a list of
PluginDatathat are of type MAPSERVICE
-
quickreport_plugins()[source]¶ Return a list of
PluginDatathat are of type QUICKREPORT
-
relcalc_plugins()[source]¶ Return a list of
PluginDatathat are of type RELCALC
-
report_plugins(gui=True)[source]¶ Return a list of gui or cli
PluginDatathat are of type REPORT- Parameters
gui – bool, if True then gui plugin, otherwise cli plugin
-
rule_plugins()[source]¶ Return a list of
PluginDatathat are of type RULE
-
scan_dir(dir, filenames, uistate=None)[source]¶ The dir name will be scanned for plugin registration code, which will be loaded in
PluginDataobjects if they satisfy some checks.- Returns
A list with
PluginDataobjects
Return a list of
PluginDatathat are of type SIDEBAR
-
tool_plugins(gui=True)[source]¶ Return a list of
PluginDatathat are of type TOOL
-
type_plugins(ptype)[source]¶ Return a list of
PluginDatathat are of type ptype
-
view_plugins()[source]¶ Return a list of
PluginDatathat are of type VIEW
-
-
gramps.gen.plug._pluginreg.newplugin()[source]¶ Function to create a new plugindata object, add it to list of registered plugins
- Returns
a newly created PluginData which is already part of the register
-
gramps.gen.plug._pluginreg.register(ptype, **kwargs)[source]¶ Convenience function to register a new plugin using a dictionary as input. The register functions will call newplugin() function, and use the dictionary kwargs to assign data to the PluginData newplugin() created, as in: plugindata.key = data
- Parameters
ptype – the plugin type, one of REPORT, TOOL, …
kwargs – dictionary with keys attributes of the plugin, and data the value
- Returns
a newly created PluginData which is already part of the register and which has kwargs assigned as attributes
Utils¶
General utility functions useful for the generic plugin system
-
class
gramps.gen.plug.utils.OpenFileOrStdin(filename, add_mode='', encoding=None)[source]¶ Bases:
objectContext manager to open a file or stdin for reading.
-
class
gramps.gen.plug.utils.OpenFileOrStdout(filename, encoding=None, errors=None, newline=None)[source]¶ Bases:
objectContext manager to open a file or stdout for writing.
-
class
gramps.gen.plug.utils.Zipfile(buffer)[source]¶ Bases:
objectClass to duplicate the methods of tarfile.TarFile, for Python 2.5.
-
gramps.gen.plug.utils.load_addon_file(path, callback=None)[source]¶ Load an addon from a particular path (from URL or file system).
-
gramps.gen.plug.utils.register(ptype, **kwargs)[source]¶ Fake registration. Side-effect sets register_results to kwargs.