Open main menu

Gramps β

Changes

Addons development

24 bytes added, 13:44, 14 October 2019
no edit summary
*** /listings
** /gramps50
*** /download
*** /listings
** /gramps51
*** /download
*** /listings
The '''addon-source''' repository holds the source code for the addons with branches holding the version for different gramps. If you are working on an addon for gramps for gramps42gramps51, be sure to use the gramps42 gramps51 git branch, as the default is master branch (currently gramsp gramps 5.x2, which is not used). Example commands are shown below.
Once you have your addon working in one branch, (say gramps42), then you will also want to copy it The developers are currently merging changes to the other most recent maintenance branch (into master)as necessary, after so you don't have tested it to work properly and edited the '.gpr.py' file appropriatelydo anything for that unless you are in a hurry.
=== Get a local copy of Gramps and its addons ===
This will create a copy of the addons-source tree in your home directory at "~/addons-source", and the other trees at their respective locations as well.
To switch to a local copy of the gramps42 gramps51 branch:
cd addons-source
git checkout -b gramps42 gramps51 origin/maintenance/gramps42gramps51
or to work in the master branch:
cd addons-source
git checkout -b gramps42 gramps52 origin/master
=== Other pre-requisites ===
To test your addon as you develop it is suggested that you insert your NewProjectName plugin into your Gramps user plugin directory with a link to your addon development directory, like so:
cd ~/.gramps/gramps42gramps51/plugins
ln -s ~/addons-source/NewProjectName NewProjectName
* Remove the files using the ''clean'' command that should not be added to GitHub (eg files(template.pot/ locale etc)):
: <code>./make.py gramps42 gramps51 clean NewProjectName</code>
* Add the project to the repository:
: <code>git add NewProjectName</code>
* to make sure that outside changes do not affect your commit
: <code>git pull --rebase</code>
: <code>git push origin gramps42gramps51</code>
Also you may want to [[Addons_development#Package_your_addon |Package your addon]] so it can be downloaded via the plugin manager.
<pre>
register(PTYPE,
gramps_target_version = "45.21",
version = "1.0.0",
ATTR = value,
description = _("Attaches a shared source to multiple objects."),
version = '1.0.0',
gramps_target_version = '45.21',
status = STABLE,
fname = 'AttachSourceTool.py',
description = _("Provides a library for doing something."),
version = '1.0',
gramps_target_version = '45.21',
status = STABLE,
fname = 'library.py',
category = "WEBSTUFF",
version = '1.0',
gramps_target_version = '5.01',
data = ["a", "b", "c"],
)
description = _("Provides a collection of stylesheets for the web"),
version = '1.0',
gramps_target_version = '5.01',
fname = "stylesheet.py",
load_on_reg = True,
* Initialize and update the <code>template.pot</code> for your addon:
: <code>cd ~/addons-source</code>
: <code>./make.py gramps42 gramps51 init NewProjectName</code>
* You should edit the header of <code>template.pot</code> with your information, so it gets copied to individual language files.
* Initialize a language for your addon (say French, fr):
: <code>./make.py gramps42 gramps51 init NewProjectName fr</code>
* Update it from gramps and other addons:
: <code>./make.py gramps42 gramps51 update NewProjectName fr</code>
* Edit the translations file manually:
: <code>/NewProjectName/po/fr-local.po</code>
* Compile the language:
: <code>./make.py gramps42 gramps51 compile NewProjectName</code>
* Add or update your local language file, and commit changes:
: <code>git add NewProjectName/po/fr-local.po</code>
: <code>git commit NewProjectName/po/fr-local.po -m "Added fr po file"</code>
* If you have been given 'push' rights to GitHub 'gramps-project/addons-source', then;
: <code>git push origin gramps42gramps51</code>
== Package your addon ==
To create a downloadable package:
: <code>./make.py gramps42 gramps51 build NewProjectName</code> or: <code>./make.py gramps50 gramps52 build NewProjectName</code> for the master branch.
Note that the
<pre> cd '~/addons'
git add gramps42gramps51/download/NewProjectName.addon.tgz
git commit -m "Added new plugin: NewProjectName"</pre>
or (for the master branch);
<pre> cd '~/addons'
git add gramps50gramps52/download/NewProjectName.addon.tgz
git commit -m " Added new plugin: NewProjectName"</pre>
== List your addon in the Gramps Plugin Manager==
{{man warn|Gramps needs to have been built|Make sure you have already built gramps42 gramps51 or master. Change to the appropriate git branch in your gramps directory, and run 'python3 setup.py build' See [[Linux:Build_from_source]]}}
To create a listing:
: <code>cd '~/gramps-addons'</code> or wherever you have built your addon
: <code>GRAMPSPATH=path/to/your/gramps/install ./make.py gramps42 gramps51 listing NewProjectName</code>
or (for the master branch);
: <code>cd '~/gramps-addons'</code> or wherever you have built your addon
: <code>GRAMPSPATH=path/to/your/gramps/install ./make.py gramps50 gramps52 listing NewProjectName</code>
That will create a series of files in the <tt>../listings/</tt> directory.
<pre> cd '~/addons'
git add gramps42gramps51/listings/*
git commit -m "Added new plugin to listings: NewProjectName"</pre>
or (for the master branch);
<pre> cd '~/addons'
git add gramps50gramps52/listings/*
git commit -m " Added new plugin to listings: NewProjectName"</pre>
Document the addon in the wiki using the name {{man menu|Addon:NewProjectName}}.
Edit [[45.2_Addons1_Addons]] or [[5.0_Addons2_Addons]] and describe your addon.
You can point to the addon.tgz in GitHub as the downloadable file.
To build and compile translations for all projects to their download/Addon.addon.tgz files:
: <code>python3 make.py gramps42 gramps51 build all</code>
To compile translations for all projects :
: <code>python3 make.py gramps42 gramps51 compile all</code>
== Support it through issue tracker ==
266
edits