← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/plugin-api into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/plugin-api into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~googol/openlp/plugin-api/+merge/212295

Hello,

- moved things to Plugin class
-- 
https://code.launchpad.net/~googol/openlp/plugin-api/+merge/212295
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2014-03-18 20:36:02 +0000
+++ openlp/core/lib/plugin.py	2014-03-22 19:15:26 +0000
@@ -35,6 +35,7 @@
 from PyQt4 import QtCore
 
 from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings
+from openlp.core.lib import build_icon
 from openlp.core.utils import get_application_version
 
 log = logging.getLogger(__name__)
@@ -120,7 +121,8 @@
     """
     log.info('loaded')
 
-    def __init__(self, name, default_settings, media_item_class=None, settings_tab_class=None, version=None):
+    def __init__(self, name, default_settings, icon_path, media_item_class=None,
+                 settings_tab_class=None, version=None):
         """
         This is the constructor for the plugin object. This provides an easy way for descendant plugins to populate
          common data. This method *must*
@@ -134,6 +136,7 @@
         :param name: Defaults to *None*. The name of the plugin.
         :param default_settings: A dict containing the plugin's settings. The value to each key is the default value
         to be used.
+        :param icon_path: The path to the plugin's icon. For example ':/plugins/plugin_songs.png'
         :param media_item_class: The class name of the plugin's media item.
         :param settings_tab_class: The class name of the plugin's settings tab.
         :param version: Defaults to *None*, which means that the same version number is used as OpenLP's version number.
@@ -149,7 +152,8 @@
         else:
             self.version = get_application_version()['version']
         self.settings_section = self.name
-        self.icon = None
+        self.icon_path = icon_path
+        self.icon = build_icon(self.icon_path)
         self.media_item_class = media_item_class
         self.settings_tab_class = settings_tab_class
         self.settings_tab = None

=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py	2014-03-16 21:25:23 +0000
+++ openlp/plugins/alerts/alertsplugin.py	2014-03-22 19:15:26 +0000
@@ -32,7 +32,7 @@
 from PyQt4 import QtGui
 
 from openlp.core.common import Settings, translate
-from openlp.core.lib import Plugin, StringContent, build_icon
+from openlp.core.lib import Plugin, StringContent
 from openlp.core.lib.db import Manager
 from openlp.core.lib.ui import create_action, UiStrings
 from openlp.core.lib.theme import VerticalType
@@ -136,12 +136,11 @@
         """
         Class __init__ method
         """
-        super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab)
+        super(AlertsPlugin, self).__init__(
+            'alerts', __default_settings__, ':/plugins/plugin_alerts.png', settings_tab_class=AlertsTab)
         self.weight = -3
-        self.icon_path = ':/plugins/plugin_alerts.png'
-        self.icon = build_icon(self.icon_path)
+        self.manager = Manager('alerts', init_schema)
         AlertsManager(self)
-        self.manager = Manager('alerts', init_schema)
         self.alert_form = AlertForm(self)
 
     def add_tools_menu_item(self, tools_menu):

=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py	2014-03-17 19:05:55 +0000
+++ openlp/plugins/bibles/bibleplugin.py	2014-03-22 19:15:26 +0000
@@ -31,7 +31,7 @@
 
 from PyQt4 import QtGui
 
-from openlp.core.lib import Plugin, StringContent, build_icon, translate
+from openlp.core.lib import Plugin, StringContent, translate
 from openlp.core.lib.ui import UiStrings, create_action
 from openlp.core.utils.actions import ActionList
 from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
@@ -73,10 +73,9 @@
     log.info('Bible Plugin loaded')
 
     def __init__(self):
-        super(BiblePlugin, self).__init__('bibles', __default_settings__, BibleMediaItem, BiblesTab)
+        super(BiblePlugin, self).__init__(
+            'bibles', __default_settings__, ':/plugins/plugin_bibles.png', BibleMediaItem, BiblesTab)
         self.weight = -9
-        self.icon_path = ':/plugins/plugin_bibles.png'
-        self.icon = build_icon(self.icon_path)
         self.manager = BibleManager(self)
 
     def initialise(self):

=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py	2014-03-17 19:05:55 +0000
+++ openlp/plugins/custom/customplugin.py	2014-03-22 19:15:26 +0000
@@ -33,7 +33,7 @@
 
 import logging
 
-from openlp.core.lib import Plugin, StringContent, build_icon, translate
+from openlp.core.lib import Plugin, StringContent, translate
 from openlp.core.lib.db import Manager
 from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
 from openlp.plugins.custom.lib.db import CustomSlide, init_schema
@@ -59,11 +59,10 @@
     log.info('Custom Plugin loaded')
 
     def __init__(self):
-        super(CustomPlugin, self).__init__('custom', __default_settings__, CustomMediaItem, CustomTab)
+        super(CustomPlugin, self).__init__(
+            'custom', __default_settings__, ':/plugins/plugin_custom.png', CustomMediaItem, CustomTab)
         self.weight = -5
         self.db_manager = Manager('custom', init_schema)
-        self.icon_path = ':/plugins/plugin_custom.png'
-        self.icon = build_icon(self.icon_path)
 
     def about(self):
         about_text = translate('CustomPlugin', '<strong>Custom Slide Plugin </strong><br />The custom slide plugin '

=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py	2014-03-18 20:36:02 +0000
+++ openlp/plugins/images/imageplugin.py	2014-03-22 19:15:26 +0000
@@ -32,7 +32,7 @@
 import logging
 
 from openlp.core.common import Registry, Settings, translate
-from openlp.core.lib import Plugin, StringContent, ImageSource, build_icon
+from openlp.core.lib import Plugin, StringContent, ImageSource
 from openlp.core.lib.db import Manager
 from openlp.plugins.images.lib import ImageMediaItem, ImageTab
 from openlp.plugins.images.lib.db import init_schema
@@ -49,11 +49,10 @@
     log.info('Image Plugin loaded')
 
     def __init__(self):
-        super(ImagePlugin, self).__init__('images', __default_settings__, ImageMediaItem, ImageTab)
+        super(ImagePlugin, self).__init__(
+            'images', __default_settings__, ':/plugins/plugin_images.png', ImageMediaItem, ImageTab)
+        self.weight = -7
         self.manager = Manager('images', init_schema)
-        self.weight = -7
-        self.icon_path = ':/plugins/plugin_images.png'
-        self.icon = build_icon(self.icon_path)
 
     def about(self):
         about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'

=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py	2014-03-17 07:14:51 +0000
+++ openlp/plugins/media/mediaplugin.py	2014-03-22 19:15:26 +0000
@@ -50,10 +50,9 @@
     log.info('%s MediaPlugin loaded', __name__)
 
     def __init__(self):
-        super(MediaPlugin, self).__init__('media', __default_settings__, MediaMediaItem)
+        super(MediaPlugin, self).__init__(
+            'media', __default_settings__, ':/plugins/plugin_media.png', MediaMediaItem)
         self.weight = -6
-        self.icon_path = ':/plugins/plugin_media.png'
-        self.icon = build_icon(self.icon_path)
         # passed with drag and drop messages
         self.dnd_id = 'Media'
 

=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py	2014-03-04 18:49:30 +0000
+++ openlp/plugins/presentations/presentationplugin.py	2014-03-22 19:15:26 +0000
@@ -65,12 +65,9 @@
         """
         PluginPresentation constructor.
         """
-        log.debug('Initialised')
+        Plugin.__init__(self, 'presentations', __default_settings__, ':/plugins/plugin_presentations.png')
         self.controllers = {}
-        Plugin.__init__(self, 'presentations', __default_settings__, __default_settings__)
         self.weight = -8
-        self.icon_path = ':/plugins/plugin_presentations.png'
-        self.icon = build_icon(self.icon_path)
 
     def create_settings_tab(self, parent):
         """

=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py	2014-03-17 19:05:55 +0000
+++ openlp/plugins/remotes/remoteplugin.py	2014-03-22 19:15:26 +0000
@@ -54,9 +54,8 @@
         """
         remotes constructor
         """
-        super(RemotesPlugin, self).__init__('remotes', __default_settings__, settings_tab_class=RemoteTab)
-        self.icon_path = ':/plugins/plugin_remote.png'
-        self.icon = build_icon(self.icon_path)
+        super(RemotesPlugin, self).__init__(
+            'remotes', __default_settings__, ':/plugins/plugin_remote.png', settings_tab_class=RemoteTab)
         self.weight = -1
         self.server = None
 

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2014-03-11 20:17:18 +0000
+++ openlp/plugins/songs/songsplugin.py	2014-03-22 19:15:26 +0000
@@ -82,11 +82,10 @@
         """
         Create and set up the Songs plugin.
         """
-        super(SongsPlugin, self).__init__('songs', __default_settings__, SongMediaItem, SongsTab)
+        super(SongsPlugin, self).__init__(
+            'songs', __default_settings__, ':/plugins/plugin_songs.png', SongMediaItem, SongsTab)
         self.manager = Manager('songs', init_schema, upgrade_mod=upgrade)
         self.weight = -10
-        self.icon_path = ':/plugins/plugin_songs.png'
-        self.icon = build_icon(self.icon_path)
         self.songselect_form = None
 
     def check_pre_conditions(self):

=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py	2014-01-11 22:01:41 +0000
+++ openlp/plugins/songusage/songusageplugin.py	2014-03-22 19:15:26 +0000
@@ -64,10 +64,9 @@
     log.info('SongUsage Plugin loaded')
 
     def __init__(self):
-        super(SongUsagePlugin, self).__init__('songusage', __default_settings__)
+        super(SongUsagePlugin, self).__init__('songusage', __default_settings__, ':/plugins/plugin_songusage.png')
         self.manager = Manager('songusage', init_schema, upgrade_mod=upgrade)
         self.weight = -4
-        self.icon = build_icon(':/plugins/plugin_songusage.png')
         self.active_icon = build_icon(':/songusage/song_usage_active.png')
         self.inactive_icon = build_icon(':/songusage/song_usage_inactive.png')
         self.song_usage_active = False


References