Changes

Jump to: navigation, search

Addons development

2,696 bytes added, 17:11, 24 June 2015
m
Gramps 4.2 and later
{{out of date}}
{{man warn|Warning:|This page documents the API, methods, and best practices for developing a 3rd-party addon for Gramps 3.2 and later }}
# Package your addon
# List and document your addon
# Support it through the issue tracker
# Maintain the code as Gramps continues to evolve
== Develop your addon ==
 
===Gramps 4.1 and earlier===
The [http://svn.code.sf.net/p/gramps-addons/code/ gramps-addons] subversion repository has the following structure:
The contrib subdirectories hold the source code for the addons for a particular version. If you are working on a addon for gramps{{stable_branch}} then you should be working in gramps-addons/branches/gramps{{stable_branch}}/contrib. If you are working in gramps/trunk then you should use gramps-addons/trunk/contrib.
===Gramps 4.2 and later=== The [http://github.com/gramps-project/addons-source addons-source] git repository has the following structure: * /addons-source The [http://github.com/gramps-project/addons addons] git repository has the following structure: * /addons** /gramps42*** /download*** /listings** /gramps50*** /download*** /listings addon-source holds the source code for the addons with branches holding the version for different gramps. If you are working on a addon for gramps for gramps42 or later then you should be working in addons-source.  ==== Setup the addon development toolsfor Gramps 4.1 and earlier ==== 
These steps show how to download and work with the addon development tools.
=== Commit your changes ===
 To commit your changes so that others can use your addon, .====Gramps 4.1 and earlier====For Gramps 4.1 and earlier follow these steps:
# Get an http://sourceforge.net account if you don't already have one.
Also you may want to [[Addons_development#Package_your_addon |Package your addon]] so it can be downloaded via the plugin manager.
 
====Gramps 4.2 and later====
For Gramps 4.2 and later follow these steps:
# Get an https://github.com/join account if you don't already have one.
# Request GIT write access for the https://github.com/gramps-project/addons-source project by emailing the [[Contact#Mailing_lists|gramps-devel mailing list]]
See also [[Brief_introduction_to_Git|git introduction]].
 
git clone [email protected]:gramps-project/addons-source.git addons-source
 
or if you do not have a Github account:
 
git clone https://github.com/gramps-project/addons-source.git addons-source
 
To switch to a local copy of the gramps42 branch:
 
git checkout -b gramps42 origin/maintenance/gramps42
=== Config ===
== Get translators to translate your addon into multiple languages ==
# * Initialize and update the template.pot for your addon:## ** <pre>./make.py init NewProjectName</pre># * Initialize a language for your addon (say French, fr):## ** <pre>./make.py init NewProjectName fr</pre># * Update it from gramps and other addons:## ** <pre>./make.py update NewProjectName fr</pre># * Edit <pre>contrib/NewProjectName/po/fr-local.po</pre># * Compile the language:## ** <pre>./make.py compile NewProjectName</pre># * Add or update your local language file, and commit changes:## ** <pre>svn add NewProjectName/po/fr-local.po</pre>## ** <pre>svn commit NewProjectName/po/fr-local.po -m "Added fr po file"</pre>
== Package your addon ==
python make.py build NewProjectName
That This will automatically include the following files in your build and copy : * *.py* *.glade* *.xml* *.txt* locale/*/LC_MESSAGES/*.mo Starting with Gramp 5.0, if you have additional files beyond those listed above, you should create a MANIFEST file in the root of your addon to folder listing the files (or pattern) one per line, like this sample MANIFEST file:  <pre>README.mdextra_dir/*help_files/docs/help.html</downloadpre>
{{man note|Note:|Running the command '''make.py build''' will increment the third number in your dotted version number of all addons in the gpr.py file. Consider this number to be a "build number".}}
 
Then add the package to SVN:
 
svn add ../download/NewProjectName.addon.tgz
cd ..
svn commit -m "Message describing changes"
== List your addon in the Gramps Plugin Manager==
To create a listing:
cd gramps-addons/branches/gramps40gramps41/contrib # or wherever you have built your addon
GRAMPSPATH=path/to/your/gramps/install python make.py listing NewProjectName
That will create a series of files in the <tt>../listings/</tt> directory.
Then add the package updated listing to SVN:
svn add ../download/NewProjectName.addon.tgz ../listings/*
cd ..
svn commit -m "Message describing changes"
== Maintain the code as Gramps continues to evolve ==
 
Remember that Gramps addons exist for many reasons and there are many
Gramps developers that do support addons in various ways (translations,
triage, keeping in sync with master, download infrastructure, etc).
 
Some reasons why the addons exist; they provide:
* A quick way for anyone to share their work; the Gramps-project has never denied adding a addon.
* A method to continuously update and develop a stand-alone component, often before being officially accepted.
* A place for controversial plugins that will never be accepted into core, but are loved by many users (eg, Data Entry Gramplet).
* A place for experimental components to live.
= Resources =
* https://sourceforge.net/p/gramps-addons/ - Gramps Addons site
* https://github.com/gramps-project/addons-source
* https://github.com/gramps-project/addons
* [[Brief_introduction_to_Git|Git introduction]]
 
[[Category:Developers/General]]

Navigation menu