... | ... | @@ -4,6 +4,9 @@ don't expect any code based on the page to work. The examples on this |
|
|
page need updating before they will be functional.**</span>
|
|
|
|
|
|
## Plugin Architecture
|
|
|
There are two types of Plugins post 3.1:
|
|
|
- Core Plugins which reside within the main OpenLP code base and are supported by the COred Development team.
|
|
|
- Community Plugins which are optional and can be developed by anyone and are optional. These Plugins reside in the <data-Dir>/community/contrib directory and follow the standard plugin structure.
|
|
|
|
|
|
### Directory Structure
|
|
|
|
... | ... | @@ -17,7 +20,7 @@ Each plugin has a directory within the openlp.org "plugins" directory. |
|
|
This directory is named the same as the plugin's name. Within the `name`
|
|
|
directory there will be a `nameplugin.py` file that contains the
|
|
|
`NamePlugin` class. This plugin class extends the builtin openlp.org
|
|
|
Plugin class. This provides your plugin with a number of key methods to
|
|
|
Plugin class. This provides your plugin with several key methods to
|
|
|
override.
|
|
|
|
|
|
### Naming Conventions
|
... | ... | @@ -33,7 +36,7 @@ override. |
|
|
The base Plugin class is shown below, with all the hooks that you need
|
|
|
to provide if you want to make use of its functionality.
|
|
|
|
|
|
**Note:** This is a cut down version of the [Plugin
|
|
|
**Note:** This is a cut-down version of the [Plugin
|
|
|
class](Classes_Plugin "wikilink").
|
|
|
|
|
|
``` python numberLines
|
... | ... | @@ -115,16 +118,26 @@ import os |
|
|
|
|
|
from openlp.core.lib import Plugin, MediaManagerItem
|
|
|
|
|
|
# Add custom icons to the Icon Cache
|
|
|
my_icons = {
|
|
|
'my_icon': {'icon': 'mdi.midi'},
|
|
|
'my_icon_port': {'icon': 'mdi.midi-port'}
|
|
|
}
|
|
|
|
|
|
# Extend the settings setup with the plugin specific values.
|
|
|
my_settings = {
|
|
|
'HelloWorldPlugin/status': PluginStatus.Inactive,
|
|
|
}
|
|
|
|
|
|
class HelloWorldPlugin(Plugin):
|
|
|
def __init__(self):
|
|
|
# Call the parent constructor
|
|
|
Plugin.__init__(self, 'HelloWorld', '1.9.0')
|
|
|
# Create the plugin icon
|
|
|
self.icon = QtGui.QIcon()
|
|
|
self.icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(
|
|
|
os.path.join(os.path.asbpath(os.path.basename(__file__)),
|
|
|
'resources', 'images', 'helloworld.png'))), QtGui.QIcon.Normal,
|
|
|
QtGui.QIcon.Off)
|
|
|
UiIcons().load_icons(my_icons)
|
|
|
self.icon_path = UiIcons().my-icon
|
|
|
self.icon = build_icon(self.icon_path)
|
|
|
self.settings.extend_default_settings(my_settings)
|
|
|
|
|
|
def get_media_manager_item(self):
|
|
|
# Create the MediaManagerItem object
|
... | ... | |