- Moved the version to the Plugin class. If a plugin does not provide a "version" the default will be used.

- clean ups

bzr-revno: 1371
This commit is contained in:
Andreas Preikschat 2011-03-11 15:13:10 +00:00 committed by Jon Tibble
commit 2d1ab8d449
13 changed files with 18 additions and 25 deletions

View File

@ -248,9 +248,8 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
``height`` ``height``
The new image height. The new image height.
``background`` ``background``
The background colour defaults to black. The background colour defaults to black.
""" """
log.debug(u'resize_image - start') log.debug(u'resize_image - start')
if isinstance(image, QtGui.QImage): if isinstance(image, QtGui.QImage):

View File

@ -114,8 +114,8 @@ class Plugin(QtCore.QObject):
""" """
log.info(u'loaded') log.info(u'loaded')
def __init__(self, name, version=None, pluginHelpers=None, def __init__(self, name, pluginHelpers=None, mediaItemClass=None,
mediaItemClass=None, settingsTabClass=None): settingsTabClass=None, version=None):
""" """
This is the constructor for the plugin object. This provides an easy This is the constructor for the plugin object. This provides an easy
way for descendent plugins to populate common data. This method *must* way for descendent plugins to populate common data. This method *must*
@ -123,7 +123,7 @@ class Plugin(QtCore.QObject):
class MyPlugin(Plugin): class MyPlugin(Plugin):
def __init__(self): def __init__(self):
Plugin.__init__(self, u'MyPlugin', u'0.1') Plugin.__init__(self, u'MyPlugin', version=u'0.1')
``name`` ``name``
Defaults to *None*. The name of the plugin. Defaults to *None*. The name of the plugin.
@ -145,8 +145,7 @@ class Plugin(QtCore.QObject):
self.textStrings = {} self.textStrings = {}
self.setPluginTextStrings() self.setPluginTextStrings()
self.nameStrings = self.textStrings[StringContent.Name] self.nameStrings = self.textStrings[StringContent.Name]
if version: self.version = version if version else u'1.9.4'
self.version = version
self.settingsSection = self.name.lower() self.settingsSection = self.name.lower()
self.icon = None self.icon = None
self.mediaItemClass = mediaItemClass self.mediaItemClass = mediaItemClass

View File

@ -226,7 +226,7 @@ class Ui_AboutDialog(object):
'Portions copyright \xa9 2004-2011 ' 'Portions copyright \xa9 2004-2011 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri,\n' 'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri,\n'
'Meinert Jordan, Andreas Preikschat, Christian Richter, Philip\n' 'Meinert Jordan, Andreas Preikschat, Christian Richter, Philip\n'
'Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Carstenn' 'Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Carsten\n'
'Tinggaard, Frode Woldsund') 'Tinggaard, Frode Woldsund')
licence = translate('OpenLP.AboutForm', licence = translate('OpenLP.AboutForm',
'This program is free software; you can redistribute it and/or ' 'This program is free software; you can redistribute it and/or '

View File

@ -40,7 +40,7 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded') log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Alerts', plugin_helpers,
settingsTabClass=AlertsTab) settingsTabClass=AlertsTab)
self.weight = -3 self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png') self.icon = build_icon(u':/plugins/plugin_alerts.png')

View File

@ -37,7 +37,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded') log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Bibles', plugin_helpers,
BibleMediaItem, BiblesTab) BibleMediaItem, BiblesTab)
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'

View File

@ -449,8 +449,7 @@ class BibleMediaItem(MediaManagerItem):
if restore: if restore:
old_text = unicode(combo.currentText()) old_text = unicode(combo.currentText())
combo.clear() combo.clear()
for i in range(range_from, range_to + 1): combo.addItems([unicode(i) for i in range(range_from, range_to + 1)])
combo.addItem(unicode(i))
if restore and combo.findText(old_text) != -1: if restore and combo.findText(old_text) != -1:
combo.setCurrentIndex(combo.findText(old_text)) combo.setCurrentIndex(combo.findText(old_text))
@ -704,8 +703,7 @@ class BibleMediaItem(MediaManagerItem):
service_item.theme = None service_item.theme = None
else: else:
service_item.theme = self.settings.bible_theme service_item.theme = self.settings.bible_theme
for slide in raw_slides: [service_item.add_from_text(slide[:30], slide) for slide in raw_slides]
service_item.add_from_text(slide[:30], slide)
return True return True
def formatTitle(self, start_item, old_item): def formatTitle(self, start_item, old_item):
@ -744,8 +742,7 @@ class BibleMediaItem(MediaManagerItem):
else: else:
verse_range = start_chapter + verse_separator + start_verse + \ verse_range = start_chapter + verse_separator + start_verse + \
range_separator + old_chapter + verse_separator + old_verse range_separator + old_chapter + verse_separator + old_verse
title = u'%s %s (%s)' % (start_book, verse_range, bibles) return u'%s %s (%s)' % (start_book, verse_range, bibles)
return title
def checkTitle(self, item, old_item): def checkTitle(self, item, old_item):
""" """

View File

@ -47,7 +47,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded') log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Custom', plugin_helpers,
CustomMediaItem, CustomTab) CustomMediaItem, CustomTab)
self.weight = -5 self.weight = -5
self.manager = Manager(u'custom', init_schema) self.manager = Manager(u'custom', init_schema)

View File

@ -35,8 +35,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Images', plugin_helpers, ImageMediaItem)
ImageMediaItem)
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

@ -38,7 +38,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__) log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Media', plugin_helpers,
MediaMediaItem, MediaTab) MediaMediaItem, MediaTab)
self.weight = -6 self.weight = -6
self.icon_path = u':/plugins/plugin_media.png' self.icon_path = u':/plugins/plugin_media.png'

View File

@ -51,7 +51,7 @@ class PresentationPlugin(Plugin):
""" """
log.debug(u'Initialised') log.debug(u'Initialised')
self.controllers = {} self.controllers = {}
Plugin.__init__(self, u'Presentations', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'Presentations', plugin_helpers)
self.weight = -8 self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png' self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)

View File

@ -38,7 +38,7 @@ class RemotesPlugin(Plugin):
""" """
remotes constructor remotes constructor
""" """
Plugin.__init__(self, u'Remotes', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Remotes', plugin_helpers,
settingsTabClass=RemoteTab) settingsTabClass=RemoteTab)
self.icon = build_icon(u':/plugins/plugin_remote.png') self.icon = build_icon(u':/plugins/plugin_remote.png')
self.weight = -1 self.weight = -1

View File

@ -53,8 +53,7 @@ class SongsPlugin(Plugin):
""" """
Create and set up the Songs plugin. Create and set up the Songs plugin.
""" """
Plugin.__init__(self, u'Songs', u'1.9.4', plugin_helpers, Plugin.__init__(self, u'Songs', plugin_helpers, SongMediaItem, SongsTab)
SongMediaItem, SongsTab)
self.weight = -10 self.weight = -10
self.manager = Manager(u'songs', init_schema) self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'

View File

@ -42,7 +42,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded') log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', u'1.9.4', plugin_helpers) Plugin.__init__(self, u'SongUsage', plugin_helpers)
self.weight = -4 self.weight = -4
self.icon = build_icon(u':/plugins/plugin_songusage.png') self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.manager = None self.manager = None