openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00725
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Lots of cleanups
- remove unneeded TranslationContexts
- reduce the strings we create (improving maintainability) by passing variables and making use of existing if is None checks
i18n for Plugin.about()
FIX: The above patches uncovered the fact we were double loading the mediaitems through the hook_media_manager and through the initialise() functions. I've removed the superfluous initialise() entries.
BUG: I think the above FIX also uncovered a bug in setting Plugin.media_item so the commented test in insert_toolbox_item didn't work to prevent double loading. Can someone who knows this code better than I check this please?
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/14233
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2009-10-29 01:48:43 +0000
+++ openlp/core/lib/mediamanageritem.py 2009-10-30 18:10:25 +0000
@@ -58,18 +58,13 @@
When creating a descendant class from this class for your plugin,
the following member variables should be set.
- ``self.TranslationContext``
- This sets the translation context of all the text in the
- Media Manager item.
-
``self.PluginNameShort``
The shortened (usually singular) name for the plugin e.g. *'Song'*
for the Songs plugin.
``self.PluginNameVisible``
The user visible name for a plugin which should use a suitable
- translation function. This should normally be
- ``self.trUtf8(self.PluginNameShort)``.
+ translation function.
``self.ConfigSection``
The section in the configuration where the items in the media
@@ -117,6 +112,7 @@
if title is not None:
self.title = title
self.Toolbar = None
+ self.ServiceItemIconName = None
self.PageLayout = QtGui.QVBoxLayout(self)
self.PageLayout.setSpacing(0)
self.PageLayout.setContentsMargins(4, 0, 4, 0)
@@ -228,7 +224,8 @@
if self.hasEditIcon:
self.addToolbarButton(
u'Edit %s' % self.PluginNameShort,
- u'%s %s' % (self.trUtf8(u'Edit the selected'), self.PluginNameVisible),
+ u'%s %s' % (self.trUtf8(u'Edit the selected'),
+ self.PluginNameVisible),
u':%s_edit.png' % self.IconPath, self.onEditClick,
u'%sEditItem' % self.PluginNameShort)
## Delete Button ##
@@ -320,7 +317,7 @@
def onFileClick(self):
files = QtGui.QFileDialog.getOpenFileNames(
- self, self.trUtf8(self.OnNewPrompt),
+ self, self.OnNewPrompt,
self.parent.config.get_last_dir(), self.OnNewFileMasks)
log.info(u'New files(s)%s', unicode(files))
if len(files) > 0:
@@ -382,8 +379,10 @@
Common method for generating a service item
"""
service_item = ServiceItem(self.parent)
- service_item.addIcon(
- u':/media/media_' + self.PluginNameShort.lower() + u'.png')
+ if self.ServiceItemIconName is not None:
+ service_item.addIcon(self.ServiceItemIconName)
+ else:
+ service_item.addIcon(self.icon)
if self.generateSlideData(service_item):
self.ListView.clearSelection()
return service_item
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-10-21 16:11:58 +0000
+++ openlp/core/lib/plugin.py 2009-10-30 18:10:25 +0000
@@ -35,7 +35,7 @@
Inactive = 1
Disabled = 2
-class Plugin(object):
+class Plugin(QtCore.QObject):
"""
Base class for openlp plugins to inherit from.
@@ -91,7 +91,7 @@
log = logging.getLogger(u'Plugin')
log.info(u'loaded')
- def __init__(self, name=None, version=None, plugin_helpers=None):
+ def __init__(self, name, version=None, plugin_helpers=None):
"""
This is the constructor for the plugin object. This provides an easy
way for descendent plugins to populate common data. This method *must*
@@ -110,10 +110,8 @@
``plugin_helpers``
Defaults to *None*. A list of helper objects.
"""
- if name is not None:
- self.name = name
- else:
- self.name = u'Plugin'
+ QtCore.QObject.__init__(self)
+ self.name = name
if version is not None:
self.version = version
self.icon = None
@@ -129,7 +127,7 @@
self.settings = plugin_helpers[u'settings']
self.mediadock = plugin_helpers[u'toolbox']
QtCore.QObject.connect(Receiver.get_receiver(),
- QtCore.SIGNAL(u'%s_add_service_item'% self.name),
+ QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.process_add_service_event)
def check_pre_conditions(self):
@@ -258,6 +256,7 @@
"""
Called by plugin to replace toolbar
"""
+ # Not sure self.media_item is being set properly
if self.media_item is not None:
self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
if self.settings_tab is not None:
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2009-10-17 19:13:11 +0000
+++ openlp/core/lib/pluginmanager.py 2009-10-30 18:10:25 +0000
@@ -93,7 +93,6 @@
log.exception(u'Failed to import module %s on path %s for reason %s',
modulename, path, e.args[0])
plugin_classes = Plugin.__subclasses__()
- self.plugins = []
plugin_objects = []
for p in plugin_classes:
try:
=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py 2009-10-29 15:20:28 +0000
+++ openlp/core/lib/settingstab.py 2009-10-30 18:10:25 +0000
@@ -31,7 +31,7 @@
SettingsTab is a helper widget for plugins to define Tabs for the settings
dialog.
"""
- def __init__(self, title=None, section=None):
+ def __init__(self, title, section=None):
"""
Constructor to create the Settings tab item.
=== modified file 'openlp/core/ui/alertstab.py'
--- openlp/core/ui/alertstab.py 2009-10-28 21:52:13 +0000
+++ openlp/core/ui/alertstab.py 2009-10-30 18:10:25 +0000
@@ -31,7 +31,7 @@
AlertsTab is the alerts settings tab in the settings dialog.
"""
def __init__(self):
- SettingsTab.__init__(self, u'Alerts', u'Alerts')
+ SettingsTab.__init__(self, u'Alerts')
self.font_color = '#ffffff'
self.bg_color = '#660000'
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2009-10-28 21:52:13 +0000
+++ openlp/core/ui/generaltab.py 2009-10-30 18:10:25 +0000
@@ -32,7 +32,7 @@
"""
def __init__(self, screen_list):
self.screen_list = screen_list
- SettingsTab.__init__(self, u'General', u'General')
+ SettingsTab.__init__(self, u'General')
def setupUi(self):
self.setObjectName(u'GeneralTab')
=== modified file 'openlp/core/ui/mediadockmanager.py'
--- openlp/core/ui/mediadockmanager.py 2009-10-18 14:53:04 +0000
+++ openlp/core/ui/mediadockmanager.py 2009-10-30 18:10:25 +0000
@@ -33,8 +33,7 @@
def add_dock(self, media_item, icon, weight):
log.info(u'Adding %s dock' % media_item.title)
- id = self.media_dock.addItem(
- media_item, icon, media_item.title)
+ self.media_dock.addItem(media_item, icon, media_item.title)
def insert_dock(self, media_item, icon, weight):
"""
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2009-10-28 21:52:13 +0000
+++ openlp/core/ui/themestab.py 2009-10-30 18:10:25 +0000
@@ -32,7 +32,7 @@
"""
def __init__(self, parent):
self.parent = parent
- SettingsTab.__init__(self, u'Themes', u'Themes')
+ SettingsTab.__init__(self, u'Themes')
def setupUi(self):
self.setObjectName(u'ThemesTab')
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2009-10-24 16:40:36 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2009-10-30 18:10:25 +0000
@@ -35,10 +35,8 @@
log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'Bibles', u'1.9.0', plugin_helpers)
self.weight = -9
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_bible.png')
#Register the bible Manager
self.biblemanager = None
@@ -51,7 +49,6 @@
if self.biblemanager is None:
self.biblemanager = BibleManager(self.config)
Plugin.initialise(self)
- self.insert_toolbox_item()
self.ImportBibleItem.setVisible(True)
self.ExportBibleItem.setVisible(True)
@@ -63,11 +60,11 @@
self.ExportBibleItem.setVisible(False)
def get_settings_tab(self):
- return BiblesTab()
+ return BiblesTab(self.name)
def get_media_manager_item(self):
# Create the BibleManagerItem object
- return BibleMediaItem(self, self.icon, u'Bibles')
+ return BibleMediaItem(self, self.icon, self.name)
def add_import_menu_item(self, import_menu):
self.ImportBibleItem = QtGui.QAction(import_menu)
@@ -91,8 +88,7 @@
self.media_item.onNewClick()
def about(self):
- about_text = u'<strong>Bible Plugin</strong><br />This plugin allows '\
- u'bible verse from different sources to be displayed on the '\
- u'screen during the service.<br /><br /><strong>This is a core '\
- u'plugin and cannot be made inactive</strong>'
+ about_text = self.trUtf8(u'<strong>Bible Plugin</strong><br />This '
+ u'plugin allows bible verses from different sources to be '
+ u'displayed on the screen during the service.')
return about_text
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-10-28 21:04:14 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-10-30 18:10:25 +0000
@@ -37,11 +37,11 @@
log = logging.getLogger(u'BibleTab')
log.info(u'Bible Tab loaded')
- def __init__(self):
+ def __init__(self, title, section=None):
self.paragraph_style = True
self.show_new_chapters = False
self.display_style = 0
- SettingsTab.__init__(self, u'Bibles', u'Bibles')
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'BiblesTab')
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2009-10-27 20:52:30 +0000
+++ openlp/plugins/bibles/lib/manager.py 2009-10-30 18:10:25 +0000
@@ -283,7 +283,7 @@
count = self.bible_db_cache[bible].get_max_bible_book_verses(
book, chapter)
if count == 0:
- text = self.get_verse_text(bible, book, chapter, chapter, 1, 1)
+ #text = self.get_verse_text(bible, book, chapter, chapter, 1, 1)
count = self.bible_db_cache[bible].get_max_bible_book_verses(
book, chapter)
return count
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-10-29 15:20:28 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -46,12 +46,10 @@
log.info(u'Bible Media Item loaded')
def __init__(self, parent, icon, title):
- self.TranslationContext = u'BiblePlugin'
self.PluginNameShort = u'Bible'
- self.ConfigSection = u'bibles'
+ self.ConfigSection = title
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView
- self.ServiceItemIconName = u':/media/bible_image.png'
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
# place to store the search results
@@ -60,7 +58,7 @@
QtCore.SIGNAL(u'openlpreloadbibles'), self.reloadBibles)
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Bible')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@@ -89,14 +87,16 @@
self.QuickVersionLabel.setObjectName(u'QuickVersionLabel')
self.QuickLayout.addWidget(self.QuickVersionLabel, 0, 0, 1, 1)
self.QuickVersionComboBox = QtGui.QComboBox(self.QuickTab)
- self.QuickVersionComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+ self.QuickVersionComboBox.setSizeAdjustPolicy(
+ QtGui.QComboBox.AdjustToMinimumContentsLength)
self.QuickVersionComboBox.setObjectName(u'VersionComboBox')
self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2)
self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab)
self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel')
self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1)
self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab)
- self.QuickSecondBibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+ self.QuickSecondBibleComboBox.setSizeAdjustPolicy(
+ QtGui.QComboBox.AdjustToMinimumContentsLength)
self.QuickSecondBibleComboBox.setObjectName(u'SecondBible')
self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2)
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab)
@@ -147,16 +147,20 @@
self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel')
self.AdvancedLayout.addWidget(self.AdvancedVersionLabel, 0, 0, 1, 1)
self.AdvancedVersionComboBox = QtGui.QComboBox(self.AdvancedTab)
- self.AdvancedVersionComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+ self.AdvancedVersionComboBox.setSizeAdjustPolicy(
+ QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
- self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.AdvancedSecondBibleComboBox.setObjectName(u'AdvancedSecondBibleComboBox')
- self.AdvancedLayout.addWidget(self.AdvancedSecondBibleComboBox, 1, 1, 1, 2)
+ self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
+ QtGui.QComboBox.AdjustToMinimumContentsLength)
+ self.AdvancedSecondBibleComboBox.setObjectName(
+ u'AdvancedSecondBibleComboBox')
+ self.AdvancedLayout.addWidget(
+ self.AdvancedSecondBibleComboBox, 1, 1, 1, 2)
self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel')
self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1)
@@ -198,14 +202,16 @@
self.AdvancedSearchButtonLayout = QtGui.QHBoxLayout()
self.AdvancedSearchButtonLayout.setMargin(0)
self.AdvancedSearchButtonLayout.setSpacing(0)
- self.AdvancedSearchButtonLayout.setObjectName(u'AdvancedSearchButtonLayout')
+ self.AdvancedSearchButtonLayout.setObjectName(
+ u'AdvancedSearchButtonLayout')
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton)
- self.AdvancedLayout.addLayout(self.AdvancedSearchButtonLayout, 7, 0, 1, 3)
+ self.AdvancedLayout.addLayout(
+ self.AdvancedSearchButtonLayout, 7, 0, 1, 3)
self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab)
self.AdvancedMessage.setObjectName(u'AdvancedMessage')
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3)
@@ -475,10 +481,12 @@
for book in book_data:
row = self.AdvancedBookComboBox.count()
self.AdvancedBookComboBox.addItem(book[u'book'])
- self.AdvancedBookComboBox.setItemData(row, QtCore.QVariant(book[u'total']))
+ self.AdvancedBookComboBox.setItemData(
+ row, QtCore.QVariant(book[u'total']))
if first:
first = False
- self.initialiseChapterVerse(bible, book[u'book'], book[u'total'])
+ self.initialiseChapterVerse(
+ bible, book[u'book'], book[u'total'])
def initialiseChapterVerse(self, bible, book, chapters):
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
=== modified file 'openlp/plugins/custom/customplugin.py'
--- openlp/plugins/custom/customplugin.py 2009-10-29 13:48:50 +0000
+++ openlp/plugins/custom/customplugin.py 2009-10-30 18:10:25 +0000
@@ -44,17 +44,15 @@
log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'Custom', u'1.9.0', plugin_helpers)
self.weight = -5
self.custommanager = CustomManager(self.config)
self.edit_custom_form = EditCustomForm(self.custommanager)
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_custom.png')
def get_media_manager_item(self):
# Create the CustomManagerItem object
- return CustomMediaItem(self, self.icon, u'Custom')
+ return CustomMediaItem(self, self.icon, self.name)
def can_be_disabled(self):
return True
@@ -62,11 +60,14 @@
def initialise(self):
log.info(u'Plugin Initialising')
Plugin.initialise(self)
- self.insert_toolbox_item()
def finalise(self):
log.info(u'Plugin Finalise')
self.remove_toolbox_item()
def about(self):
- return u'<b>Custom Plugin</b> <br>This plugin allows slides to be displayed on the screen in the same way songs are. The difference between this plugin and songs is this plugin provides greater freedom.<br>'
+ about_text = self.trUtf8(u'<b>Custom Plugin</b><br>This plugin '
+ u'allows slides to be displayed on the screen in the same way '
+ u'songs are. This plugin provides greater freedom over the '
+ u'songs plugin.<br>')
+ return about_text
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2009-10-29 15:20:28 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -42,17 +42,14 @@
log.info(u'Custom Media Item loaded')
def __init__(self, parent, icon, title):
- self.TranslationContext = u'CustomPlugin'
self.PluginNameShort = u'Custom'
- self.ConfigSection = u'custom'
+ self.ConfigSection = title
self.IconPath = u'custom/custom'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = CustomListView
- self.ServiceItemIconName = u':/custom/custom_image.png'
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
- self.parent = parent
self.fromServiceManager = -1
def addEndHeaderBar(self):
@@ -64,7 +61,7 @@
QtCore.SIGNAL(u'load_custom_list'), self.initialise)
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Custom')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
=== modified file 'openlp/plugins/images/imageplugin.py'
--- openlp/plugins/images/imageplugin.py 2009-10-03 19:02:40 +0000
+++ openlp/plugins/images/imageplugin.py 2009-10-30 18:10:25 +0000
@@ -33,10 +33,8 @@
log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'Images', u'1.9.0', plugin_helpers)
self.weight = -7
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_image.png')
def can_be_disabled(self):
@@ -45,18 +43,24 @@
def initialise(self):
log.info(u'Plugin Initialising')
Plugin.initialise(self)
- self.insert_toolbox_item()
def finalise(self):
log.info(u'Plugin Finalise')
self.remove_toolbox_item()
def get_settings_tab(self):
- return ImageTab()
+ return ImageTab(self.name)
def get_media_manager_item(self):
# Create the MediaManagerItem object
- return ImageMediaItem(self, self.icon, u'Images')
+ return ImageMediaItem(self, self.icon, self.name)
def about(self):
- return u'<b>Image Plugin</b><br>Allows images of all types to be displayed. If a number of images are selected together and presented on the live controller it is possible to turn them into a timed loop.<br> From the plugin if the <i>Override background</i> is chosen and an image is selected any somgs which are rendered will use the selected image from the background instead of the one provied by the theme.<br>'
+ about_text = self.trUtf8(u'<b>Image Plugin</b><br>Allows images of '
+ u'all types to be displayed. If a number of images are selected '
+ u'together and presented on the live controller it is possible '
+ u'to turn them into a timed loop.<br>From the plugin if the '
+ u'<i>Override background</i> is chosen and an image is selected '
+ u'any somgs which are rendered will use the selected image from '
+ u'the background instead of the one provied by the theme.<br>')
+ return about_text
=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py 2009-10-28 21:04:14 +0000
+++ openlp/plugins/images/lib/imagetab.py 2009-10-30 18:10:25 +0000
@@ -30,8 +30,8 @@
"""
ImageTab is the Image settings tab in the settings dialog.
"""
- def __init__(self):
- SettingsTab.__init__(self, u'Images', u'Images')
+ def __init__(self, title, section=None):
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'ImageTab')
@@ -42,7 +42,7 @@
self.ImageSettingsGroupBox.setObjectName(u'ImageSettingsGroupBox')
self.TimeoutLayout = QtGui.QHBoxLayout(self.ImageSettingsGroupBox)
self.TimeoutLayout.setSpacing(8)
- self.TimeoutLayout.setMargin(0)
+ self.TimeoutLayout.setMargin(8)
self.TimeoutLayout.setObjectName(u'TimeoutLayout')
self.TimeoutLabel = QtGui.QLabel(self.ImageSettingsGroupBox)
self.TimeoutLabel.setObjectName(u'TimeoutLabel')
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2009-10-29 01:48:43 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -44,20 +44,18 @@
log.info(u'Image Media Item loaded')
def __init__(self, parent, icon, title):
- self.TranslationContext = u'ImagePlugin'
self.PluginNameShort = u'Image'
- self.ConfigSection = u'images'
+ self.ConfigSection = title
self.IconPath = u'images/image'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = ImageListView
- self.ServiceItemIconName = u':/media/media_image.png'
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
self.overrideActive = False
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Image')
def retranslateUi(self):
self.OnNewPrompt = self.trUtf8(u'Select Image(s)')
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2009-10-29 01:48:43 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -43,22 +43,20 @@
log.info(u'Media Media Item loaded')
def __init__(self, parent, icon, title):
- self.TranslationContext = u'MediaPlugin'
self.PluginNameShort = u'Media'
self.IconPath = u'images/image'
- self.ConfigSection = u'media'
- self.OnNewPrompt = u'Select Media(s)'
+ self.ConfigSection = title
+ self.OnNewPrompt = self.trUtf8(u'Select Media')
self.OnNewFileMasks = \
u'Videos (*.avi *.mpeg *.mpg *.mp4);;Audio (*.ogg *.mp3 *.wma);;All files (*)'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = MediaListView
- #self.ServiceItemIconName = u':/media/media_image.png'
self.PreviewFunction = self.video_get_preview
MediaManagerItem.__init__(self, parent, icon, title)
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Media')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@@ -67,13 +65,10 @@
self.hasEditIcon = False
def video_get_preview(self, filename):
- #
# For now cross platform is an icon. Phonon does not support
# individual frame access (yet?) and GStreamer is not available
# on Windows
- #
- image = QtGui.QPixmap(u':/media/media_video.png').toImage()
- return image
+ return QtGui.QPixmap(u':/media/media_video.png').toImage()
def generateSlideData(self, service_item):
indexes = self.ListView.selectedIndexes()
=== modified file 'openlp/plugins/media/lib/mediatab.py'
--- openlp/plugins/media/lib/mediatab.py 2009-10-28 21:04:14 +0000
+++ openlp/plugins/media/lib/mediatab.py 2009-10-30 18:10:25 +0000
@@ -30,8 +30,8 @@
"""
mediaTab is the media settings tab in the settings dialog.
"""
- def __init__(self):
- SettingsTab.__init__(self, u'Media', u'Media')
+ def __init__(self, title, section=None):
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'MediaTab')
=== modified file 'openlp/plugins/media/mediaplugin.py'
--- openlp/plugins/media/mediaplugin.py 2009-10-08 05:02:39 +0000
+++ openlp/plugins/media/mediaplugin.py 2009-10-30 18:10:25 +0000
@@ -33,16 +33,14 @@
log.info(u'Media Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'Media', u'1.9.0', plugin_helpers)
self.weight = -6
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_video.png')
# passed with drag and drop messages
self.dnd_id = u'Media'
def get_settings_tab(self):
- return MediaTab()
+ return MediaTab(self.name)
def can_be_disabled(self):
return True
@@ -50,7 +48,6 @@
def initialise(self):
log.info(u'Plugin Initialising')
Plugin.initialise(self)
- self.insert_toolbox_item()
def finalise(self):
log.info(u'Plugin Finalise')
@@ -58,7 +55,9 @@
def get_media_manager_item(self):
# Create the MediaManagerItem object
- return MediaMediaItem(self, self.icon, u'Media')
+ return MediaMediaItem(self, self.icon, self.name)
def about(self):
- return u'<b>Media Plugin</b> <br> One day this may provide access to video and audio clips'
+ about_text = self.trUtf8(u'<b>Media Plugin</b><br>This plugin '
+ u'allows the playing of audio and video media')
+ return about_text
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2009-10-29 01:48:43 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -48,11 +48,10 @@
def __init__(self, parent, icon, title, controllers):
self.controllers = controllers
- self.TranslationContext = u'PresentationPlugin'
self.PluginNameShort = u'Presentation'
- self.ConfigSection = u'presentations'
+ self.ConfigSection = title
self.IconPath = u'presentations/presentation'
- self.OnNewPrompt = u'Select Presentation(s)'
+ self.OnNewPrompt = self.trUtf8(u'Select Presentation(s)')
self.OnNewFileMasks = u'Presentations (*.ppt *.pps *.odp)'
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
@@ -61,7 +60,7 @@
self.message_listener = MessageListener(controllers)
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Presentation')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@@ -110,8 +109,8 @@
(path, filename) = os.path.split(unicode(file))
if titles.count(filename) > 0:
QtGui.QMessageBox.critical(
- self, self.trUtf8(u'File exists'),
- self.trUtf8(u'A presentation with that filename already exists.'),
+ self, self.trUtf8(u'File exists'), self.trUtf8(
+ u'A presentation with that filename already exists.'),
QtGui.QMessageBox.Ok)
else:
item_name = QtGui.QListWidgetItem(filename)
=== modified file 'openlp/plugins/presentations/lib/presentationtab.py'
--- openlp/plugins/presentations/lib/presentationtab.py 2009-10-28 21:04:14 +0000
+++ openlp/plugins/presentations/lib/presentationtab.py 2009-10-30 18:10:25 +0000
@@ -30,9 +30,9 @@
"""
PresentationsTab is the Presentations settings tab in the settings dialog.
"""
- def __init__(self, controllers):
+ def __init__(self, title, controllers, section=None):
self.controllers = controllers
- SettingsTab.__init__(self, u'Presentations', u'Presentations')
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'PresentationTab')
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2009-10-28 22:22:35 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2009-10-30 18:10:25 +0000
@@ -25,9 +25,7 @@
import os
import logging
-from PyQt4 import QtGui
-
-from openlp.core.lib import Plugin
+from openlp.core.lib import Plugin, buildIcon
from openlp.plugins.presentations.lib import *
class PresentationPlugin(Plugin):
@@ -36,21 +34,17 @@
log = logging.getLogger(u'PresentationPlugin')
def __init__(self, plugin_helpers):
- # Call the parent constructor
log.debug(u'Initialised')
self.controllers = {}
Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
self.weight = -8
- # Create the plugin icon
- self.icon = QtGui.QIcon()
- self.icon.addPixmap(QtGui.QPixmap(u':/media/media_presentation.png'),
- QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.icon = buildIcon(u':/media/media_presentation.png')
def get_settings_tab(self):
"""
Create the settings Tab
"""
- return PresentationTab(self.controllers)
+ return PresentationTab(self.name, self.controllers)
def can_be_disabled(self):
return True
@@ -58,7 +52,6 @@
def initialise(self):
log.info(u'Presentations Initialising')
Plugin.initialise(self)
- self.insert_toolbox_item()
def finalise(self):
log.info(u'Plugin Finalise')
@@ -74,7 +67,7 @@
Create the Media Manager List
"""
return PresentationMediaItem(
- self, self.icon, u'Presentations', self.controllers)
+ self, self.icon, self.name, self.controllers)
def registerControllers(self, controller):
self.controllers[controller.name] = controller
@@ -110,4 +103,8 @@
return False
def about(self):
- return u'<b>Presentation Plugin</b> <br> Delivers the ability to show presentations using a number of different programs. The choice of available presentaion programs is available in a drop down.'
+ about_text = self.trUtf8(u'<b>Presentation Plugin</b> <br> Delivers '
+ u'the ability to show presentations using a number of different '
+ u'programs. The choice of available presentation programs is '
+ u'available to the user in a drop down box.')
+ return about_text
=== modified file 'openlp/plugins/remotes/lib/remotetab.py'
--- openlp/plugins/remotes/lib/remotetab.py 2009-10-30 01:26:45 +0000
+++ openlp/plugins/remotes/lib/remotetab.py 2009-10-30 18:10:25 +0000
@@ -30,8 +30,8 @@
"""
RemoteTab is the Remotes settings tab in the settings dialog.
"""
- def __init__(self):
- SettingsTab.__init__(self, u'Remotes', u'Remotes')
+ def __init__(self, title, section=None):
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'RemoteTab')
=== modified file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py 2009-10-30 01:26:45 +0000
+++ openlp/plugins/remotes/remoteplugin.py 2009-10-30 18:10:25 +0000
@@ -36,7 +36,6 @@
log.info(u'Remote Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'Remotes', u'1.9.0', plugin_helpers)
self.weight = -1
self.server = None
@@ -47,7 +46,6 @@
def initialise(self):
log.debug(u'initialise')
Plugin.initialise(self)
- self.insert_toolbox_item()
self.server = QtNetwork.QUdpSocket()
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
QtCore.QObject.connect(self.server,
@@ -59,14 +57,11 @@
if self.server is not None:
self.server.close()
- def about(self):
- return u'<b>Remote Plugin</b> <br>This plugin provides the ability to send messages to a running version of openlp on a different computer.<br> The Primary use for this would be to send alerts from a creche'
-
def get_settings_tab(self):
"""
Create the settings Tab
"""
- return RemoteTab()
+ return RemoteTab(self.name)
def readData(self):
log.info(u'Remoted data has arrived')
@@ -83,3 +78,10 @@
Receiver().send_message(u'alert_text', unicode(datagram[pos + 1:]))
if event == u'next_slide':
Receiver().send_message(u'live_slide_next')
+
+ def about(self):
+ about_text = self.trUtf8(u'<b>Remote Plugin</b><br>This plugin '
+ u'provides the ability to send messages to a running version of '
+ u'openlp on a different computer.<br>The Primary use for this '
+ u'would be to send alerts from a creche')
+ return about_text
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-10-30 01:27:30 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-10-30 18:10:25 +0000
@@ -44,12 +44,10 @@
log.info(u'Song Media Item loaded')
def __init__(self, parent, icon, title):
- self.TranslationContext = u'SongPlugin'
self.PluginNameShort = u'Song'
- self.ConfigSection = u'songs'
+ self.ConfigSection = title
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView
- self.ServiceItemIconName = u':/media/media_song.png'
self.servicePath = None
MediaManagerItem.__init__(self, parent, icon, title)
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
@@ -59,7 +57,7 @@
self.fromServiceManager = -1
def initPluginNameVisible(self):
- self.PluginNameVisible = self.trUtf8(self.PluginNameShort)
+ self.PluginNameVisible = self.trUtf8(u'Song')
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@@ -314,5 +312,7 @@
raw_footer.append(unicode(
self.trUtf8(u'CCL Licence: ') + ccl))
service_item.raw_footer = raw_footer
- service_item.audit = [song.title, author_audit, song.copyright, song.ccli_number]
+ service_item.audit = [
+ song.title, author_audit, song.copyright, song.ccli_number
+ ]
return True
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2009-10-28 21:04:14 +0000
+++ openlp/plugins/songs/lib/songstab.py 2009-10-30 18:10:25 +0000
@@ -30,8 +30,8 @@
"""
SongsTab is the Songs settings tab in the settings dialog.
"""
- def __init__(self):
- SettingsTab.__init__(self, u'Songs', u'Songs')
+ def __init__(self, title, section=None):
+ SettingsTab.__init__(self, title, section)
def setupUi(self):
self.setObjectName(u'SongsTab')
@@ -61,8 +61,10 @@
def retranslateUi(self):
self.SongsModeGroupBox.setTitle(self.trUtf8(u'Songs Mode'))
- self.SearchAsTypeCheckBox.setText(self.trUtf8(u'Enable search as you type:'))
- self.SongBarActiveCheckBox.setText(self.trUtf8(u'Display Verses on Live Tool bar:'))
+ self.SearchAsTypeCheckBox.setText(
+ self.trUtf8(u'Enable search as you type:'))
+ self.SongBarActiveCheckBox.setText(
+ self.trUtf8(u'Display Verses on Live Tool bar:'))
def onSearchAsTypeCheckBoxChanged(self, check_state):
self.song_search = False
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2009-10-29 09:18:26 +0000
+++ openlp/plugins/songs/songsplugin.py 2009-10-30 18:10:25 +0000
@@ -48,7 +48,6 @@
"""
Create and set up the Songs plugin.
"""
- # Call the parent constructor
Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
self.weight = -10
self.songmanager = SongManager(self.config)
@@ -56,21 +55,19 @@
self.opensong_import_form = OpenSongImportForm()
self.openlp_export_form = OpenLPExportForm()
self.opensong_export_form = OpenSongExportForm()
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_song.png')
def can_be_disabled(self):
return True
def get_settings_tab(self):
- return SongsTab()
+ return SongsTab(self.name)
def initialise(self):
log.info(u'Songs Initialising')
#if self.songmanager is None:
# self.songmanager = SongManager(self.config)
Plugin.initialise(self)
- self.insert_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(True)
self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.songmanager.get_songs())
@@ -87,7 +84,7 @@
Create the MediaManagerItem object, which is displaed in the
Media Manager.
"""
- return SongMediaItem(self, self.icon, 'Songs')
+ return SongMediaItem(self, self.icon, self.name)
def add_import_menu_item(self, import_menu):
"""
@@ -180,4 +177,6 @@
self.opensong_export_form.show()
def about(self):
- return u'<b>Song Plugin</b> <br>This plugin allows Songs to be managed and displayed.<br>'
+ about_text = self.trUtf8(u'<b>Song Plugin</b> <br>This plugin allows '
+ u'Songs to be managed and displayed.<br>')
+ return about_text
=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py 2009-10-27 08:38:02 +0000
+++ openlp/plugins/songusage/songusageplugin.py 2009-10-30 18:10:25 +0000
@@ -38,10 +38,8 @@
log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers):
- # Call the parent constructor
Plugin.__init__(self, u'SongUsage', u'1.9.0', plugin_helpers)
self.weight = -4
- # Create the plugin icon
self.icon = buildIcon(u':/media/media_image.png')
self.songusagemanager = None
self.songusageActive = False
@@ -63,17 +61,19 @@
self.SongUsageMenu = QtGui.QMenu(tools_menu)
self.SongUsageMenu.setObjectName(u'SongUsageMenu')
self.SongUsageMenu.setTitle(tools_menu.trUtf8(u'&Song Usage'))
- #SongUsage Delete
+ #SongUsage Delete
self.SongUsageDelete = QtGui.QAction(tools_menu)
- self.SongUsageDelete.setText(tools_menu.trUtf8(u'&Delete recorded data'))
+ self.SongUsageDelete.setText(
+ tools_menu.trUtf8(u'&Delete recorded data'))
self.SongUsageDelete.setStatusTip(
- tools_menu.trUtf8(u'Delete sing usage to sepecified date'))
+ tools_menu.trUtf8(u'Delete song usage to specified date'))
self.SongUsageDelete.setObjectName(u'SongUsageDelete')
#SongUsage Report
self.SongUsageReport = QtGui.QAction(tools_menu)
- self.SongUsageReport.setText(tools_menu.trUtf8(u'&Extract recoreded data'))
+ self.SongUsageReport.setText(
+ tools_menu.trUtf8(u'&Extract recorded data'))
self.SongUsageReport.setStatusTip(
- tools_menu.trUtf8(u'Generate Extracts on Song Usage'))
+ tools_menu.trUtf8(u'Generate report on Song Usage'))
self.SongUsageReport.setObjectName(u'SongUsageReport')
#SongUsage activation
SongUsageIcon = buildIcon(u':/tools/tools_alert.png')
@@ -153,6 +153,7 @@
self.SongUsagedetailform.exec_()
def about(self):
- about_text = u'<b>SongUsage Plugin</b><br />This plugin records the use '\
- u'of songs and when they have been used during a live service'
+ about_text = self.trUtf8(u'<b>SongUsage Plugin</b><br>This plugin '
+ u'records the use of songs and when they have been used during '
+ u'a live service')
return about_text
Follow ups