Remove HTML from CVS since it is now regenerated by MAKE
svn: r880
This commit is contained in:
@ -1,163 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Authors</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Common tasks"
|
||||
HREF="commontasks.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="License"
|
||||
HREF="license.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="commontasks.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="license.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AUTHORS"
|
||||
>Authors</A
|
||||
></H1
|
||||
><P
|
||||
> <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> was written by Don Allingham
|
||||
(<TT
|
||||
CLASS="EMAIL"
|
||||
><<A
|
||||
HREF="mailto:dallingham@users.sourceforge.net"
|
||||
>dallingham@users.sourceforge.net</A
|
||||
>></TT
|
||||
>). To find more
|
||||
information about <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>, please visit
|
||||
the <A
|
||||
HREF="http://gramps.sourceforge.net"
|
||||
TARGET="_top"
|
||||
>gramps
|
||||
web page</A
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> This manual was written by Don Allingham
|
||||
(<TT
|
||||
CLASS="EMAIL"
|
||||
><<A
|
||||
HREF="mailto:donaldallingham@home.com"
|
||||
>donaldallingham@home.com</A
|
||||
>></TT
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="commontasks.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="license.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Common tasks</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>License</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,379 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Common tasks</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Export Filters"
|
||||
HREF="writingexportfilters.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Authors"
|
||||
HREF="authors.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingexportfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="authors.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="COMMONTASKS"
|
||||
>Common tasks</A
|
||||
></H1
|
||||
><P
|
||||
> While this manual does not document the
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> database interface, this section
|
||||
shows a few common tasks.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="GETTINGNAMES"
|
||||
>Printing names of people</A
|
||||
></H2
|
||||
><P
|
||||
> This example shows how to display the name of people in the
|
||||
database. It assumes that the database is called
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>db</TT
|
||||
>. To get a list of people, it calls the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>getPersonMap</TT
|
||||
> method, which returns a map of
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> ID to
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Person</TT
|
||||
> objects. Calling the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>valus</TT
|
||||
> method of the returned map returns a
|
||||
list of people. For each person, the primary name is extracted,
|
||||
and then the <TT
|
||||
CLASS="FUNCTION"
|
||||
>Name</TT
|
||||
> object's
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>getName</TT
|
||||
> method is called to build a
|
||||
presentable name from the individual name components.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="DISPLAYNAMES"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> for person in db.getPersonMap().values():
|
||||
name = person.getPrimaryName()
|
||||
print name.getName()
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 6. Displaying names</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="LISTINGEVENTS"
|
||||
>Displaying the events of person</A
|
||||
></H2
|
||||
><P
|
||||
> This example shows how to display the public events associated
|
||||
with a person. It assumes that the person is called
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>person</TT
|
||||
>.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="EVENTEXAMPLE"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> for event in person.getEventList():
|
||||
if event.getPrivacy() == 0:
|
||||
print "Event:",event.getName()
|
||||
print "Date:",event.getDate()
|
||||
print "Place:",event.getPlaceName()
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 7. Displaying Event Information</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="PRINTFAMILY"
|
||||
>Print the members of each family</A
|
||||
></H2
|
||||
><P
|
||||
> This example shows how to display the parents and children of
|
||||
each family in the database. It assumes that the database is called
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>db</TT
|
||||
>.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="FAMILYEXAMPLE"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> for family in db.getFamilyMap().values:
|
||||
print "-------------------"
|
||||
print "Family ID:",family.getId()
|
||||
father = family.getFather()
|
||||
if father != None:
|
||||
print "Father:",father.getPrimaryName().getName()
|
||||
mother = family.getMother()
|
||||
if mother != None:
|
||||
print "Mother:",mother.getPrimaryName().getName()
|
||||
for child in family.getChildList():
|
||||
print "Child:",child.getPrimaryName().getName()
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 8. Displaying Family Information</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="PERSONSFAMILY"
|
||||
>Display the marriages/relationships of a person</A
|
||||
></H2
|
||||
><P
|
||||
> This example shows how to display the families and relationships
|
||||
in which the person is considered a spouse or parent. It assumes
|
||||
that the person is called <TT
|
||||
CLASS="FUNCTION"
|
||||
>person</TT
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> Relationships between people can be complex. Because someone is
|
||||
male, does not necessarily mean that the person will be
|
||||
considered the "Father" of a relationship. In relationships of
|
||||
type "Partners", the "father" and "mother" of the relationship
|
||||
should be of the same gender. So to determine the spouse of a
|
||||
person, it is usually best to compare the person against what is
|
||||
returned by <TT
|
||||
CLASS="FUNCTION"
|
||||
>getFather</TT
|
||||
> and
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>getMother</TT
|
||||
> to find the one that is not
|
||||
equal. It should also be noted that the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>getFather</TT
|
||||
> and
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>getMother</TT
|
||||
> methods will return None if noone
|
||||
has been associated with that role in the family.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="RELEXAMPLE"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> for family in person.getFamilyList():
|
||||
print "-------------------"
|
||||
print "Family ID:",family.getId()
|
||||
print "Relationship Type:",family.getRelationship()
|
||||
father = family.getFather()
|
||||
if father != None and father != person:
|
||||
print "Spouse:",father.getPrimaryName().getName()
|
||||
mother = family.getMother()
|
||||
if mother != None and mother != person:
|
||||
print "Spouse:",mother.getPrimaryName().getName()
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 9. Displaying Relationship Information</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingexportfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="authors.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Export Filters</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Authors</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,319 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Extentions for gramps</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Filters"
|
||||
HREF="writingfilters.html"></HEAD
|
||||
><BODY
|
||||
CLASS="ARTICLE"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="ARTICLE"
|
||||
><DIV
|
||||
CLASS="TITLEPAGE"
|
||||
><H1
|
||||
CLASS="TITLE"
|
||||
><A
|
||||
NAME="AEN2"
|
||||
>Writing Extentions for gramps</A
|
||||
></H1
|
||||
><P
|
||||
CLASS="COPYRIGHT"
|
||||
><A
|
||||
HREF="ln7.html"
|
||||
>Copyright</A
|
||||
> © 2001 by Donald N. Allingham</P
|
||||
><HR
|
||||
WIDTH="75%"
|
||||
ALIGN="CENTER"
|
||||
COLOR="#000000"
|
||||
SIZE="1"></DIV
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="index.html#INTRO"
|
||||
>Introduction</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="writingfilters.html"
|
||||
>Writing Filters</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="writingreports.html"
|
||||
>Writing Reports</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="writingtools.html"
|
||||
>Writing Tools</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="writingimportfilters.html"
|
||||
>Writing Import Filters</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="writingexportfilters.html"
|
||||
>Writing Export Filters</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="commontasks.html"
|
||||
>Common tasks</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="authors.html"
|
||||
>Authors</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="license.html"
|
||||
>License</A
|
||||
></DT
|
||||
></DL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="INTRO"
|
||||
>Introduction</A
|
||||
></H1
|
||||
><P
|
||||
> <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> was intended from the start to
|
||||
allow the user to extend it through a plugin system. Five types of
|
||||
plugins are supported - filters, reports, tools, import filters,
|
||||
and export filters. In a way, an export filter can be viewed as a
|
||||
special type of report, and an import filter can be viewed as a
|
||||
special type of tool.
|
||||
</P
|
||||
><P
|
||||
> All plugins are written in the <TT
|
||||
CLASS="APPLICATION"
|
||||
>python</TT
|
||||
>
|
||||
language.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="INTRO_FILTER"
|
||||
>Filters</A
|
||||
></H2
|
||||
><P
|
||||
> A filter is a plugin that be used to temporarily display or hide
|
||||
individuals in the <SPAN
|
||||
CLASS="INTERFACE"
|
||||
>People View</SPAN
|
||||
>. The
|
||||
filter is the simplest form of plugin, which only needs to
|
||||
determine if a person meets or fails to meet its criteria. It
|
||||
operates on a single person at a time.
|
||||
</P
|
||||
><P
|
||||
> Filters should never alter a database.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="INTRO_REPORT"
|
||||
>Reports</A
|
||||
></H2
|
||||
><P
|
||||
> A report is a plugin that generates output. The output may be in
|
||||
either a interactive, graphical form, or as an output
|
||||
file. Report plugins are passed a reference to the internal
|
||||
database and a reference to the active person, which allows the
|
||||
plugn to operate on a single person, the entire database, or
|
||||
anything in between.
|
||||
</P
|
||||
><P
|
||||
> Plugins that conform to the reportplugin interface appear in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>Reports</B
|
||||
>
|
||||
menu and in the <SPAN
|
||||
CLASS="INTERFACE"
|
||||
>Report Selection</SPAN
|
||||
> dialog
|
||||
box.
|
||||
</P
|
||||
><P
|
||||
> A report should never alter the database.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="INTRO_TOOL"
|
||||
>Tools</A
|
||||
></H2
|
||||
><P
|
||||
> A tool is a plugin that alters the database. It may perform
|
||||
something as small changing the case of some text to something
|
||||
as complex as merging redundant individuals. Tools plugins are
|
||||
passed a reference to the internal database, the active person,
|
||||
and a callback function. The callback function is used to notify
|
||||
the main program if it needs to update the display with any
|
||||
modified information.
|
||||
</P
|
||||
><P
|
||||
> Plugins that conform to the tool plugin interface appear in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>Tools</B
|
||||
>
|
||||
menu and in the <SPAN
|
||||
CLASS="INTERFACE"
|
||||
>Tool Selection</SPAN
|
||||
> dialog
|
||||
box.
|
||||
</P
|
||||
><P
|
||||
> A tool is allowed (and usually expected) to alter the database.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="INTRO_IMPORT"
|
||||
>Import Filters</A
|
||||
></H2
|
||||
><P
|
||||
> An import filter is a plugin that adds information from another
|
||||
source to the database. It is similar to a tool, but is called
|
||||
differently to allow gramps to distinguish it from a tool.
|
||||
</P
|
||||
><P
|
||||
> Plugins that conform to the import filter calling syntax appear
|
||||
in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>File</B
|
||||
>-><B
|
||||
CLASS="GUISUBMENU"
|
||||
>Import</B
|
||||
>
|
||||
menu.
|
||||
</P
|
||||
><P
|
||||
> An import filter is allowed to modify the database.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="INTRO_EXPORT"
|
||||
>Export Filters</A
|
||||
></H2
|
||||
><P
|
||||
> An export filter is a plugin that translates the gramps database
|
||||
into the format expected by another program. Since it generates
|
||||
an output file, it is similar to a report generator. However,
|
||||
its calling syntax is different, so that gramps knows how to
|
||||
distiguish it from a report generator.
|
||||
</P
|
||||
><P
|
||||
> Plugins that conform to the export filter calling syntax appear
|
||||
in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>File</B
|
||||
>-><B
|
||||
CLASS="GUISUBMENU"
|
||||
>Export</B
|
||||
>
|
||||
menu.
|
||||
</P
|
||||
><P
|
||||
> An export filter should not alter the database.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingfilters.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Writing Filters</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,187 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>License</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Authors"
|
||||
HREF="authors.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="authors.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
> </TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="LICENSE"
|
||||
>License</A
|
||||
></H1
|
||||
><P
|
||||
> This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the <A
|
||||
HREF="gnome-help:gpl"
|
||||
TARGET="_top"
|
||||
> <I
|
||||
CLASS="CITETITLE"
|
||||
>GNU General Public
|
||||
License</I
|
||||
></A
|
||||
> as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
</P
|
||||
><P
|
||||
> This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
<I
|
||||
CLASS="CITETITLE"
|
||||
>GNU General Public License</I
|
||||
> for more
|
||||
details.
|
||||
</P
|
||||
><P
|
||||
> A copy of the <I
|
||||
CLASS="CITETITLE"
|
||||
>GNU General Public License</I
|
||||
> is
|
||||
included as an appendix to the <I
|
||||
CLASS="CITETITLE"
|
||||
>GNOME Users
|
||||
Guide</I
|
||||
>. You may also obtain a copy of the
|
||||
<I
|
||||
CLASS="CITETITLE"
|
||||
>GNU General Public License</I
|
||||
> from the Free
|
||||
Software Foundation by visiting <A
|
||||
HREF="http://www.fsf.org"
|
||||
TARGET="_top"
|
||||
>their Web site</A
|
||||
> or by writing to
|
||||
<P
|
||||
CLASS="ADDRESS"
|
||||
> Free Software Foundation, Inc. <SPAN
|
||||
CLASS="STREET"
|
||||
>59 Temple Place</SPAN
|
||||
> -<br>
|
||||
Suite 330 <SPAN
|
||||
CLASS="CITY"
|
||||
>Boston</SPAN
|
||||
>, <SPAN
|
||||
CLASS="STATE"
|
||||
>MA</SPAN
|
||||
><br>
|
||||
<SPAN
|
||||
CLASS="POSTCODE"
|
||||
>02111-1307</SPAN
|
||||
> <SPAN
|
||||
CLASS="COUNTRY"
|
||||
>USA</SPAN
|
||||
><br>
|
||||
</P
|
||||
>
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="authors.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Authors</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,128 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="UP"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html#AEN2"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Filters"
|
||||
HREF="writingfilters.html"></HEAD
|
||||
><BODY
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="LEGALNOTICE"
|
||||
><A
|
||||
NAME="LEGALNOTICE"
|
||||
></A
|
||||
><P
|
||||
></P
|
||||
><P
|
||||
> Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the <A
|
||||
HREF="gnome-help:fdl"
|
||||
TARGET="_top"
|
||||
><I
|
||||
CLASS="CITETITLE"
|
||||
>GNU Free Documentation
|
||||
License</I
|
||||
></A
|
||||
>, Version 1.1 or any later version
|
||||
published by the Free Software Foundation with no Invariant
|
||||
Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy
|
||||
of the license can be found <A
|
||||
HREF="gnome-help:fdl"
|
||||
TARGET="_top"
|
||||
>here</A
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> Many of the names used by companies to distinguish their products
|
||||
and services are claimed as trademarks. Where those names appear
|
||||
in any GNOME documentation, and those trademarks are made aware to
|
||||
the members of the GNOME Documentation Project, the names have
|
||||
been printed in caps or initial caps.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html#AEN2"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,200 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Export Filters</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Import Filters"
|
||||
HREF="writingimportfilters.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Common tasks"
|
||||
HREF="commontasks.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingimportfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="commontasks.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="WRITINGEXPORTFILTERS"
|
||||
>Writing Export Filters</A
|
||||
></H1
|
||||
><P
|
||||
> Export filters are similar to report generators. They are not
|
||||
allowed to modify the database. An export filter accepts three
|
||||
arguments — a database, the filename of the file that is to
|
||||
be written, and a callback function.
|
||||
</P
|
||||
><P
|
||||
> The callback function is indentical from the callback function
|
||||
used for import filters. The export filter's callback function is
|
||||
used to indicate progress and update the status bar during the
|
||||
export process. The function takes a value between 0.0 and 1.0,
|
||||
where 0.0 represents the start of the export and 1.0 represents
|
||||
the completion of the export.
|
||||
</P
|
||||
><P
|
||||
> As with the other plugin types, an export filter must be
|
||||
registered with <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>. This is
|
||||
accomplished by calling the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_export</TT
|
||||
> task. The
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_export</TT
|
||||
> accepts two arguments
|
||||
— the function the performs the import and a string
|
||||
providing a brief description. This description is used as the
|
||||
menu entry under the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>File</B
|
||||
>-><B
|
||||
CLASS="GUISUBMENU"
|
||||
>Export</B
|
||||
>
|
||||
menu.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="EXPORTEXAMPLE"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> import Plugins
|
||||
|
||||
def gedcom_export(database,filename,callback):
|
||||
... actual code ...
|
||||
|
||||
Plugins.register_export(gedcom_export,"GEDCOM export")
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 5. Sample Export Implementation</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingimportfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="commontasks.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Import Filters</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Common tasks</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,264 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Filters</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Reports"
|
||||
HREF="writingreports.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="index.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingreports.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="WRITINGFILTERS"
|
||||
>Writing Filters</A
|
||||
></H1
|
||||
><P
|
||||
> Users can create their own filters and add them to
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>. By adding the filter to the
|
||||
user's private filter directory (<TT
|
||||
CLASS="FILENAME"
|
||||
>~/.gramps/filters</TT
|
||||
>), the filter will
|
||||
be automatically recognized the next time that the program is
|
||||
started.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CREATEFILTER"
|
||||
>Creating a filter</A
|
||||
></H2
|
||||
><P
|
||||
> Each filter is a class derived from the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Filter.Filter</TT
|
||||
> class. The
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>__init__</TT
|
||||
> task may be overridden, but if so,
|
||||
should call the <TT
|
||||
CLASS="FUNCTION"
|
||||
>__init__</TT
|
||||
> function on the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Filter.Filter</TT
|
||||
> class. The parent class
|
||||
provides the variable <TT
|
||||
CLASS="FUNCTION"
|
||||
>self.text</TT
|
||||
>, which
|
||||
contains the text string passed as the qualifier. This string
|
||||
provides additional information provided by the user. For
|
||||
example, if the filter is used to match names, the qualifier
|
||||
would be used to provide the name that is being compared
|
||||
against.
|
||||
</P
|
||||
><P
|
||||
> All filter classes must define a <TT
|
||||
CLASS="FUNCTION"
|
||||
>match</TT
|
||||
>
|
||||
function. The function takes one argument (other than
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>self</TT
|
||||
>), which is an object of type
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Person</TT
|
||||
> to compare against. The function
|
||||
should return a 1 if the person matches the filter, or a zero if
|
||||
the person does not.
|
||||
</P
|
||||
><P
|
||||
> Each filter must be registered, so that
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> knows about it. This is
|
||||
accomplished by calling the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Filter.register_filter</TT
|
||||
> function. This
|
||||
function takes three arguments - the filter class, a
|
||||
description, and flag that indicates if the qualifier string is
|
||||
needed. The description string appears in the pull down
|
||||
interface within <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>, and helps
|
||||
the user choose the appropriate filter. The qualifier flag tells
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> whether or not the filter
|
||||
needs a qualifier string. If this flag is 0,
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> will disable the entry of a
|
||||
qualifier string.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="FILTERSRC"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> import Filter
|
||||
import string
|
||||
|
||||
# class definition
|
||||
|
||||
class SubString(Filter.Filter):
|
||||
|
||||
def match(self,person):
|
||||
name = person.getPrimaryName().getName()
|
||||
return string.find(name,self.text) >= 0
|
||||
|
||||
Filter.register_filter(SubString,
|
||||
description="Names that contain a substring",
|
||||
qualifier=1)
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 1. Sample filter implementation</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingreports.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Extentions for gramps</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Writing Reports</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,205 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Import Filters</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Tools"
|
||||
HREF="writingtools.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Export Filters"
|
||||
HREF="writingexportfilters.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingtools.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingexportfilters.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="WRITINGIMPORTFILTERS"
|
||||
>Writing Import Filters</A
|
||||
></H1
|
||||
><P
|
||||
> Import filters are similar to tools, since they are allowed to
|
||||
modify the databases. An import filter is a task that accepts
|
||||
three arguments — a database, the filename of the file that
|
||||
is to be imported, and a callback function.
|
||||
</P
|
||||
><P
|
||||
> The database may or may not have data already in it. The import
|
||||
filter cannot assume that data neither already exists nor that the
|
||||
database is empty.
|
||||
</P
|
||||
><P
|
||||
> The callback function is different from the callback function used
|
||||
for tools. The import filter's callback function is used to
|
||||
indicate progress and update the status bar during the import
|
||||
process. The function takes a value between 0.0 and 1.0, where 0.0
|
||||
represents the start of the import and 1.0 represents the
|
||||
completion of the import.
|
||||
</P
|
||||
><P
|
||||
> As with the other plugin types, an import filter must be
|
||||
registered with <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>. This is
|
||||
accomplished by calling the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_import</TT
|
||||
> task. The
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_import</TT
|
||||
> accepts two arguments
|
||||
— the function the performs the import and a string
|
||||
providing a brief description. This description is used as the
|
||||
menu entry under the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>File</B
|
||||
>-><B
|
||||
CLASS="GUISUBMENU"
|
||||
>Import</B
|
||||
>
|
||||
menu.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="IMPORTEXAMPLE"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> import Plugins
|
||||
|
||||
def gedcom_import(database,filename,callback):
|
||||
... actual code ...
|
||||
|
||||
Plugins.register_import(gedcom_import,"GEDCOM import")
|
||||
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 4. Sample Import Implementation</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingtools.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingexportfilters.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Tools</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Writing Export Filters</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,347 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Reports</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Filters"
|
||||
HREF="writingfilters.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Tools"
|
||||
HREF="writingtools.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingtools.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="WRITINGREPORTS"
|
||||
>Writing Reports</A
|
||||
></H1
|
||||
><P
|
||||
> Users can create their own report generators and add them to
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>. By adding the report generator
|
||||
to the user's private plugin directory (<TT
|
||||
CLASS="FILENAME"
|
||||
>~/.gramps/plugins</TT
|
||||
>), the report
|
||||
generator will be automatically recognized the next time that the
|
||||
program is started.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CREATEREPORT"
|
||||
>Creating a report generator</A
|
||||
></H2
|
||||
><P
|
||||
> Fewer restrictions are made on report generators than on
|
||||
filters. The report generator is passed the current
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> database and the active
|
||||
person. The generator needs to take special care to make sure
|
||||
that it does not alter the database in anyway.
|
||||
</P
|
||||
><P
|
||||
> A report generator is a function that takes two arguments
|
||||
— a database (of type <TT
|
||||
CLASS="FUNCTION"
|
||||
>RelDataBase</TT
|
||||
>)
|
||||
and the currently selected person (of type
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Person</TT
|
||||
>). When called, this task should
|
||||
generate the desired report.
|
||||
</P
|
||||
><P
|
||||
> This function's implementation can be as simple as generating
|
||||
output without the user's intervention, or it could display a
|
||||
graphical interface to allow the user to select options and
|
||||
customize a report.
|
||||
</P
|
||||
><P
|
||||
> As with filters, the report generator must be registered before
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> will understand it. The report
|
||||
generator is registered using the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_report</TT
|
||||
>. This function
|
||||
takes five arguments.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The report generation task</B
|
||||
></TT
|
||||
> This task
|
||||
that generates the report.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The report category</B
|
||||
></TT
|
||||
> The category in
|
||||
which the report is grouped in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>Reports</B
|
||||
> menu and
|
||||
in the <SPAN
|
||||
CLASS="INTERFACE"
|
||||
>Report Selection</SPAN
|
||||
> dialog.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The report name</B
|
||||
></TT
|
||||
>
|
||||
The name of the report.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>A text description of the report</B
|
||||
></TT
|
||||
> The
|
||||
description appears in the report selection tool to provide
|
||||
the user with a description of what the tools does.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>A graphic logo in XPM format</B
|
||||
></TT
|
||||
> This may
|
||||
be either a path to a filename, or a list of strings
|
||||
containting the XPM data. If a filename is specified, care
|
||||
must be taken to make sure the file location is relocatable
|
||||
and can be determined at runtime.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><P
|
||||
> While only the task and report name are required, it is
|
||||
recommended to provide all five parameters.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="REPORTSRC"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> import Plugins
|
||||
|
||||
def report(database,person):
|
||||
... actual code ...
|
||||
|
||||
Plugins.register_report(
|
||||
task=report,
|
||||
category="Category",
|
||||
name="Report Name",
|
||||
description="A text descripition of the report generator",
|
||||
xpm="%s/myfile.xpm" % os.path.dirname(__file__)
|
||||
)
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 2. Sample report implementation</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="ALITTLEHELP"
|
||||
>A little help - Format Interfaces</A
|
||||
></H2
|
||||
><P
|
||||
> <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> provides some help with
|
||||
writing reports. Several generic python classes exist that aid
|
||||
in the writing of report generators. These classes provide an
|
||||
abstract interface for a type of document, such as a drawing,
|
||||
word processor document, or a spreadsheet. From these core
|
||||
classes, <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> derives interfaces to
|
||||
various document formats. This means that by coding to the
|
||||
generic word processing class (<TT
|
||||
CLASS="FUNCTION"
|
||||
>TextDoc</TT
|
||||
>), a
|
||||
report generator can instant access to multiple file formats
|
||||
(such as HTML, OpenOffice, and AbiWord).
|
||||
</P
|
||||
><P
|
||||
> This scheme of deriving a output format from a generic base
|
||||
class also makes it easier to add new formats. Creating a new
|
||||
derivied class targeting a different format (such as
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>KWord</TT
|
||||
> or
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>LaTeX</TT
|
||||
>) makes it easy for existing
|
||||
report generators to use the new formats.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingfilters.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingtools.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Filters</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Writing Tools</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
@ -1,265 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Writing Tools</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
|
||||
REL="HOME"
|
||||
TITLE="Writing Extentions for gramps"
|
||||
HREF="index.html"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Writing Reports"
|
||||
HREF="writingreports.html"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Writing Import Filters"
|
||||
HREF="writingimportfilters.html"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>Writing Extentions for gramps</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingreports.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="writingimportfilters.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="WRITINGTOOLS"
|
||||
>Writing Tools</A
|
||||
></H1
|
||||
><P
|
||||
> Users can create their own tools and add them to
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
>. By adding the tool to the
|
||||
user's private plugin directory (<TT
|
||||
CLASS="FILENAME"
|
||||
>~/.gramps/plugins</TT
|
||||
>), the tool will be
|
||||
automatically recognized the next time that
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> is started.
|
||||
</P
|
||||
><P
|
||||
> Unlike a report generator, a tool is allowed to modify the
|
||||
database. The tool is passed the current
|
||||
<TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> database, the active person,
|
||||
and a callback function. The callback function should be called
|
||||
with a non-zero argument upon completion of the tool if the
|
||||
database has been altered.
|
||||
</P
|
||||
><P
|
||||
> As with filters and report generators, tools must be registered
|
||||
before <TT
|
||||
CLASS="APPLICATION"
|
||||
>gramps</TT
|
||||
> will understand it. The
|
||||
tool is registered using the
|
||||
<TT
|
||||
CLASS="FUNCTION"
|
||||
>Plugins.register_tool</TT
|
||||
>. This function takes
|
||||
four arguments.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The tool task</B
|
||||
></TT
|
||||
> This task
|
||||
that executes the tool.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The tool category</B
|
||||
></TT
|
||||
> The category in which
|
||||
the tool is grouped in the
|
||||
<B
|
||||
CLASS="GUIMENU"
|
||||
>Tools</B
|
||||
> menu and in
|
||||
the <SPAN
|
||||
CLASS="INTERFACE"
|
||||
>Tool Selection</SPAN
|
||||
> dialog.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>The tool name</B
|
||||
></TT
|
||||
>
|
||||
The name of the tool.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <TT
|
||||
CLASS="GUILABEL"
|
||||
><B
|
||||
>A text description of the tool</B
|
||||
></TT
|
||||
> The
|
||||
description appears in the Tool Selection dialog to provide
|
||||
the user with a description of what the tool does.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><P
|
||||
> While only the task and report name are required, it is
|
||||
recommended to provide all five parameters.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="FIGURE"
|
||||
><A
|
||||
NAME="TOOLSRC"
|
||||
></A
|
||||
><TABLE
|
||||
BORDER="0"
|
||||
BGCOLOR="#E0E0E0"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
> import Plugins
|
||||
|
||||
def tool(database,person,callback):
|
||||
... actual code ...
|
||||
callback(1)
|
||||
|
||||
Plugins.register_tool(
|
||||
task=tool,
|
||||
category="Category",
|
||||
name="Tool Name",
|
||||
description="A text descripition of the tool"
|
||||
)
|
||||
</PRE
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><P
|
||||
><B
|
||||
>Figure 3. Sample tool implementation</B
|
||||
></P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingreports.html"
|
||||
><<< Previous</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="index.html"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="writingimportfilters.html"
|
||||
>Next >>></A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Writing Reports</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Writing Import Filters</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
Reference in New Issue
Block a user