Jump to: navigation, search


1,194 bytes added, 27 May
GUI Options: just list them all
gramplet = 'init',
gramplet_title=_("Sample Gramplet"),
help_url="Sample Gramplet"
=== Explanation ===
The main work of a Gramplet is performed in a function, or a class. In this very simple example, a function '''<code>init''' </code> is defined that takes a single argument, <code>gui</code>. The function simply sets the gui's text area to be "Hello World!", and that's it. It does this just once, and never changes.
Before a plugin can be used, it needs to be "registered". You call the register function with a number of named-arguments. There are a number of named-arguments that you can provide, including: name, height, content, title, expand, state, and data. We will explore those in detail, below.
If you wanted to put an arbitrary gtk object into the main area of a Gramplet, then you need to replace the standard textview object with your own. Here is the basic structure:
# File:
from gettext import gettext as _
from gramps.gen.plug import Gramplet
from gi.repository import Gtk
class WidgetGramplet(Gramplet):
def init(self):
self.gui.WIDGET = ### Some Widget Constructor ###
# File:
id= "Widget Gramplet",
name=_("Widget Gramplet"),
description = _("Widget Gramplet example"),
gramplet = 'WidgetGramplet',
version = '0.0.1',
gramps_target_version = "5.1",
====Gramps 3.x and older====
# File:
===Cairo Clock Example===
Here is an example adding a Cairo Clock (which really keeps time)
* With GTK+3 & Gramps 5.1** Github code: [ ClockGramplet]** Manual Download: [ ClockGramplet.addon.tgz]
* '''add_option(OPTION)'''
** OPTION is one of the menu optionsin [ gramps/gen/plug/menu] eg:
*** NumberOption
*** EnumeratedListOption
*** NoteOption
*** MediaOption
*** see src/gen/plug/menu/ for othersPersonListOption*** PlaceListOption*** SurnameColorOption*** DestinationOption*** StyleOption*** BooleanListOption
* '''build_options()'''
* '''save_options()'''

Navigation menu