- 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``
The new image height.
``background``
``background``
The background colour defaults to black.
"""
log.debug(u'resize_image - start')
if isinstance(image, QtGui.QImage):

View File

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

View File

@ -226,7 +226,7 @@ class Ui_AboutDialog(object):
'Portions copyright \xa9 2004-2011 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri,\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')
licence = translate('OpenLP.AboutForm',
'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')
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)
self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png')

View File

@ -37,7 +37,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded')
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)
self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png'

View File

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

View File

@ -47,7 +47,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded')
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)
self.weight = -5
self.manager = Manager(u'custom', init_schema)

View File

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

View File

@ -38,7 +38,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__)
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)
self.weight = -6
self.icon_path = u':/plugins/plugin_media.png'

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')
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.icon = build_icon(u':/plugins/plugin_songusage.png')
self.manager = None