This commit is contained in:
Tim Bentley 2010-10-06 05:47:29 +01:00
commit 85dd394e25
32 changed files with 594 additions and 188 deletions

View File

@ -313,7 +313,7 @@ def expand_tags(text):
from spelltextedit import SpellTextEdit
from eventreceiver import Receiver
from settingsmanager import SettingsManager
from plugin import PluginStatus, Plugin
from plugin import PluginStatus, StringContent, Plugin
from pluginmanager import PluginManager
from settingstab import SettingsTab
from serviceitem import ServiceItem

View File

@ -32,7 +32,8 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import context_menu_action, context_menu_separator, \
SettingsManager, OpenLPToolbar, ServiceItem, build_icon, translate
SettingsManager, OpenLPToolbar, ServiceItem, StringContent, build_icon, \
translate
log = logging.getLogger(__name__)
@ -51,26 +52,19 @@ class MediaManagerItem(QtGui.QWidget):
The parent widget. Usually this will be the *Media Manager*
itself. This needs to be a class descended from ``QWidget``.
``plugin``
The plugin widget. Usually this will be the *Plugin*
itself. This needs to be a class descended from ``Plugin``.
``icon``
Either a ``QIcon``, a resource path, or a file name. This is
the icon which is displayed in the *Media Manager*.
``title``
The title visible on the item in the *Media Manager*.
**Member Variables**
When creating a descendant class from this class for your plugin,
the following member variables should be set.
``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.
``self.OnNewPrompt``
Defaults to *'Select Image(s)'*.
@ -93,13 +87,17 @@ class MediaManagerItem(QtGui.QWidget):
"""
log.info(u'Media Item loaded')
def __init__(self, parent=None, icon=None, title=None):
def __init__(self, parent=None, plugin=None, icon=None):
"""
Constructor to create the media manager item.
"""
QtGui.QWidget.__init__(self)
self.parent = parent
self.settingsSection = title.lower()
#TODO: plugin should not be the parent in future
self.plugin = parent#plugin
visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = visible_title[u'title']
self.settingsSection = self.plugin.name.lower()
if isinstance(icon, QtGui.QIcon):
self.icon = icon
elif isinstance(icon, basestring):
@ -107,8 +105,6 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QIcon.Normal, QtGui.QIcon.Off)
else:
self.icon = None
if title:
self.title = title
self.toolbar = None
self.remoteTriggered = None
self.serviceItemIconName = None
@ -208,64 +204,58 @@ class MediaManagerItem(QtGui.QWidget):
"""
## Import Button ##
if self.hasImportIcon:
import_string = self.plugin.getString(StringContent.Import)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Import %s')) %
self.PluginNameShort,
unicode(translate('OpenLP.MediaManagerItem', 'Import a %s')) %
self.pluginNameVisible,
import_string[u'title'],
import_string[u'tooltip'],
u':/general/general_import.png', self.onImportClick)
## File Button ##
## Load Button ##
if self.hasFileIcon:
load_string = self.plugin.getString(StringContent.Load)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Load %s')) %
self.PluginNameShort,
unicode(translate('OpenLP.MediaManagerItem', 'Load a new %s')) %
self.pluginNameVisible,
load_string[u'title'],
load_string[u'tooltip'],
u':/general/general_open.png', self.onFileClick)
## New Button ##
if self.hasNewIcon:
new_string = self.plugin.getString(StringContent.New)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'New %s')) %
self.PluginNameShort,
unicode(translate('OpenLP.MediaManagerItem', 'Add a new %s')) %
self.pluginNameVisible,
new_string[u'title'],
new_string[u'tooltip'],
u':/general/general_new.png', self.onNewClick)
## Edit Button ##
if self.hasEditIcon:
edit_string = self.plugin.getString(StringContent.Edit)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Edit %s')) %
self.PluginNameShort,
unicode(translate(
'OpenLP.MediaManagerItem', 'Edit the selected %s')) %
self.pluginNameVisible,
edit_string[u'title'],
edit_string[u'tooltip'],
u':/general/general_edit.png', self.onEditClick)
## Delete Button ##
if self.hasDeleteIcon:
delete_string = self.plugin.getString(StringContent.Delete)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Delete %s')) %
self.PluginNameShort,
translate('OpenLP.MediaManagerItem',
'Delete the selected item'),
delete_string[u'title'],
delete_string[u'tooltip'],
u':/general/general_delete.png', self.onDeleteClick)
## Separator Line ##
self.addToolbarSeparator()
## Preview ##
preview_string = self.plugin.getString(StringContent.Preview)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Preview %s')) %
self.PluginNameShort,
translate('OpenLP.MediaManagerItem', 'Preview the selected item'),
preview_string[u'title'],
preview_string[u'tooltip'],
u':/general/general_preview.png', self.onPreviewClick)
## Live Button ##
live_string = self.plugin.getString(StringContent.Live)
self.addToolbarButton(
u'Go Live',
translate('OpenLP.MediaManagerItem', 'Send the selected item live'),
live_string[u'title'],
live_string[u'tooltip'],
u':/general/general_live.png', self.onLiveClick)
## Add to service Button ##
service_string = self.plugin.getString(StringContent.Service)
self.addToolbarButton(
unicode(translate('OpenLP.MediaManagerItem', 'Add %s to Service')) %
self.PluginNameShort,
translate('OpenLP.MediaManagerItem',
'Add the selected item(s) to the service'),
service_string[u'title'],
service_string[u'tooltip'],
u':/general/general_add.png', self.onAddClick)
def addListViewToToolBar(self):
@ -281,17 +271,18 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QAbstractItemView.ExtendedSelection)
self.listView.setAlternatingRowColors(True)
self.listView.setDragEnabled(True)
self.listView.setObjectName(u'%sListView' % self.PluginNameShort)
self.listView.setObjectName(u'%sListView' % self.plugin.name)
#Add to pageLayout
self.pageLayout.addWidget(self.listView)
#define and add the context menu
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
name_string = self.plugin.getString(StringContent.Name)
if self.hasEditIcon:
self.listView.addAction(
context_menu_action(
self.listView, u':/general/general_edit.png',
unicode(translate('OpenLP.MediaManagerItem', '&Edit %s')) %
self.pluginNameVisible,
name_string[u'singular'],
self.onEditClick))
self.listView.addAction(context_menu_separator(self.listView))
if self.hasDeleteIcon:
@ -300,14 +291,14 @@ class MediaManagerItem(QtGui.QWidget):
self.listView, u':/general/general_delete.png',
unicode(translate('OpenLP.MediaManagerItem',
'&Delete %s')) %
self.pluginNameVisible,
name_string[u'singular'],
self.onDeleteClick))
self.listView.addAction(context_menu_separator(self.listView))
self.listView.addAction(
context_menu_action(
self.listView, u':/general/general_preview.png',
unicode(translate('OpenLP.MediaManagerItem', '&Preview %s')) %
self.pluginNameVisible,
name_string[u'singular'],
self.onPreviewClick))
self.listView.addAction(
context_menu_action(
@ -447,7 +438,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem',
'You must select one or more items to preview.'))
else:
log.debug(self.PluginNameShort + u' Preview requested')
log.debug(self.plugin.name + u' Preview requested')
service_item = self.buildServiceItem()
if service_item:
service_item.from_plugin = True
@ -464,7 +455,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem',
'You must select one or more items to send live.'))
else:
log.debug(self.PluginNameShort + u' Live requested')
log.debug(self.plugin.name + u' Live requested')
service_item = self.buildServiceItem()
if service_item:
service_item.from_plugin = True
@ -483,7 +474,7 @@ class MediaManagerItem(QtGui.QWidget):
#Is it posssible to process multiple list items to generate multiple
#service items?
if self.singleServiceItem or self.remoteTriggered:
log.debug(self.PluginNameShort + u' Add requested')
log.debug(self.plugin.name + u' Add requested')
service_item = self.buildServiceItem()
if service_item:
service_item.from_plugin = False
@ -507,7 +498,7 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem',
'You must select one or more items'))
else:
log.debug(self.PluginNameShort + u' Add requested')
log.debug(self.plugin.name + u' Add requested')
service_item = self.parent.serviceManager.getServiceItem()
if not service_item:
QtGui.QMessageBox.information(self,

View File

@ -42,6 +42,18 @@ class PluginStatus(object):
Inactive = 0
Disabled = -1
class StringContent(object):
Name = u'name'
Import = u'import'
Load = u'load'
New = u'new'
Edit = u'edit'
Delete = u'delete'
Preview = u'preview'
Live = u'live'
Service = u'service'
VisibleName = u'visible_name'
class Plugin(QtCore.QObject):
"""
Base class for openlp plugins to inherit from.
@ -117,6 +129,8 @@ class Plugin(QtCore.QObject):
"""
QtCore.QObject.__init__(self)
self.name = name
self.textStrings = {}
self.setPluginTextStrings()
if version:
self.version = version
self.settingsSection = self.name.lower()
@ -257,9 +271,9 @@ class Plugin(QtCore.QObject):
Called by the plugin to remove toolbar
"""
if self.mediaItem:
self.mediadock.remove_dock(self.name)
self.mediadock.remove_dock(self.mediaItem)
if self.settings_tab:
self.settingsForm.removeTab(self.name)
self.settingsForm.removeTab(self.settings_tab)
def insertToolboxItem(self):
"""
@ -289,3 +303,15 @@ class Plugin(QtCore.QObject):
The new name the plugin should now use.
"""
pass
def getString(self, name):
"""
encapsulate access of plugins translated text strings
"""
return self.textStrings[name]
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
pass

View File

@ -30,7 +30,7 @@ import os
import sys
import logging
from openlp.core.lib import Plugin, PluginStatus
from openlp.core.lib import Plugin, StringContent, PluginStatus
log = logging.getLogger(__name__)
@ -152,12 +152,13 @@ class PluginManager(object):
for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled:
plugin.settings_tab = plugin.getSettingsTab()
visible_title = plugin.getString(StringContent.VisibleName)
if plugin.settings_tab:
log.debug(u'Inserting settings tab item from %s' %
plugin.name)
settingsform.addTab(plugin.name, plugin.settings_tab)
visible_title[u'title'])
settingsform.addTab(visible_title[u'title'], plugin.settings_tab)
else:
log.debug(u'No tab settings in %s' % plugin.name)
log.debug(u'No tab settings in %s' % visible_title[u'title'])
def hook_import_menu(self, import_menu):
"""

View File

@ -31,16 +31,19 @@ class SettingsTab(QtGui.QWidget):
SettingsTab is a helper widget for plugins to define Tabs for the settings
dialog.
"""
def __init__(self, title):
def __init__(self, title, visible_title=None):
"""
Constructor to create the Settings tab item.
``title``
The title of the tab, which is used internally for the tab handling.
``visible_title``
The title of the tab, which is usually displayed on the tab.
"""
QtGui.QWidget.__init__(self)
self.tabTitle = title
self.tabTitleVisible = None
self.tabTitleVisible = visible_title
self.settingsSection = self.tabTitle.lower()
self.setupUi()
self.retranslateUi()

View File

@ -175,19 +175,13 @@ class Ui_MainWindow(object):
QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
# Create the menu items
self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
u'New Service'))
self.FileNewItem.setIcon(build_icon(u':/general/general_new.png'))
self.FileNewItem.setObjectName(u'FileNewItem')
self.FileOpenItem = QtGui.QAction(MainWindow)
self.FileOpenItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
u'Open Service'))
self.FileOpenItem.setIcon(build_icon(u':/general/general_open.png'))
self.FileOpenItem.setObjectName(u'FileOpenItem')
self.FileSaveItem = QtGui.QAction(MainWindow)
self.FileSaveItem.setIcon(
self.ServiceManagerContents.toolbar.getIconFromTitle(
u'Save Service'))
self.FileSaveItem.setIcon(build_icon(u':/general/general_save.png'))
self.FileSaveItem.setObjectName(u'FileSaveItem')
self.FileSaveAsItem = QtGui.QAction(MainWindow)
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')
@ -343,7 +337,6 @@ class Ui_MainWindow(object):
Set up the translation system
"""
MainWindow.mainTitle = translate('OpenLP.MainWindow', 'OpenLP 2.0')
# MainWindow.language = translate('OpenLP.MainWindow', 'English')
MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))

View File

@ -26,6 +26,8 @@
import logging
from openlp.core.lib import StringContent
log = logging.getLogger(__name__)
class MediaDockManager(object):
@ -48,8 +50,9 @@ class MediaDockManager(object):
``icon``
An icon for this dock item
"""
log.info(u'Adding %s dock' % media_item.title)
self.media_dock.addItem(media_item, icon, media_item.title)
visible_title = media_item.plugin.getString(StringContent.VisibleName)
log.info(u'Adding %s dock' % visible_title)
self.media_dock.addItem(media_item, icon, visible_title[u'title'])
def insert_dock(self, media_item, icon, weight):
"""
@ -57,27 +60,29 @@ class MediaDockManager(object):
This does not work as it gives a Segmentation error.
For now add at end of stack if not present
"""
log.debug(u'Inserting %s dock' % media_item.title)
visible_title = media_item.plugin.getString(StringContent.VisibleName)
log.debug(u'Inserting %s dock' % visible_title[u'title'])
match = False
for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index).settingsSection == \
media_item.title.lower():
media_item.plugin.name.lower():
match = True
break
if not match:
self.media_dock.addItem(media_item, icon, media_item.title)
self.media_dock.addItem(media_item, icon, visible_title[u'title'])
def remove_dock(self, name):
def remove_dock(self, media_item):
"""
Removes a MediaManagerItem from the dock
``name``
The item to remove
``media_item``
The item to add to the dock
"""
log.debug(u'remove %s dock' % name)
visible_title = media_item.plugin.getString(StringContent.VisibleName)
log.debug(u'remove %s dock' % visible_title[u'title'])
for dock_index in range(0, self.media_dock.count()):
if self.media_dock.widget(dock_index):
if self.media_dock.widget(dock_index).settingsSection == \
name.lower():
media_item.plugin.name.lower():
self.media_dock.widget(dock_index).hide()
self.media_dock.removeItem(dock_index)

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, translate
from openlp.core.lib import PluginStatus, StringContent, translate
from plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
@ -78,7 +78,8 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
elif plugin.status == PluginStatus.Disabled:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)'))
item.setText(status_text % plugin.name)
name_string = plugin.getString(StringContent.Name)
item.setText(status_text % name_string[u'plural'])
# If the plugin has an icon, set it!
if plugin.icon:
item.setIcon(plugin.icon)
@ -106,10 +107,11 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
if self.pluginListWidget.currentItem() is None:
self._clearDetails()
return
plugin_name = self.pluginListWidget.currentItem().text().split(u' ')[0]
plugin_name_plural = self.pluginListWidget.currentItem().text().split(u' ')[0]
self.activePlugin = None
for plugin in self.parent.plugin_manager.plugins:
if plugin.name == plugin_name:
name_string = plugin.getString(StringContent.Name)
if name_string[u'plural'] == plugin_name_plural:
self.activePlugin = plugin
break
if self.activePlugin:
@ -137,5 +139,6 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
elif self.activePlugin.status == PluginStatus.Disabled:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)'))
name_string = self.activePlugin.getString(StringContent.Name)
self.pluginListWidget.currentItem().setText(
status_text % self.activePlugin.name)
status_text % name_string[u'plural'])

View File

@ -72,14 +72,15 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self.settingsTabWidget.insertTab(
location + 14, tab, tab.tabTitleVisible)
def removeTab(self, name):
def removeTab(self, tab):
"""
Remove a tab from the form
"""
log.debug(u'remove %s tab' % name)
log.debug(u'remove %s tab' % tab.tabTitleVisible)
for tabIndex in range(0, self.settingsTabWidget.count()):
if self.settingsTabWidget.widget(tabIndex):
if self.settingsTabWidget.widget(tabIndex).tabTitle == name:
if self.settingsTabWidget.widget(tabIndex).tabTitleVisible == \
tab.tabTitleVisible:
self.settingsTabWidget.removeTab(tabIndex)
def accept(self):

View File

@ -179,19 +179,24 @@ class SlideController(QtGui.QWidget):
self.HideMenu.setMenu(QtGui.QMenu(
translate('OpenLP.SlideController', 'Hide'), self.Toolbar))
self.BlankScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
u':/slides/slide_blank.png'),
translate('OpenLP.SlideController',
'Blank Screen'), self.HideMenu)
self.BlankScreen.setCheckable(True)
QtCore.QObject.connect(self.BlankScreen,
QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
u':/slides/slide_theme.png'),
translate('OpenLP.SlideController',
'Blank to Theme'), self.HideMenu)
self.ThemeScreen.setCheckable(True)
QtCore.QObject.connect(self.ThemeScreen,
QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
if self.screens.display_count > 1:
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_desktop.png'), u'Show Desktop',
self.HideMenu)
u':/slides/slide_desktop.png'),
translate('OpenLP.SlideController',
'Show Desktop'), self.HideMenu)
self.DesktopScreen.setCheckable(True)
QtCore.QObject.connect(self.DesktopScreen,
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema
@ -101,3 +101,18 @@ class AlertsPlugin(Plugin):
'<br />The alert plugin controls the displaying of nursery alerts '
'on the display screen')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('AlertsPlugin', 'Alert'),
u'plural': translate('AlertsPlugin', 'Alerts')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('AlertsPlugin', 'Alerts')
}

View File

@ -35,7 +35,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
Provide UI for the alert system
"""
def __init__(self, plugin):
def __init__(self, title, visible_title):
"""
Initialise the alert form
"""

View File

@ -32,14 +32,13 @@ class AlertsTab(SettingsTab):
"""
AlertsTab is the alerts settings tab in the settings dialog.
"""
def __init__(self, parent):
def __init__(self, parent, visible_title):
self.parent = parent
self.manager = parent.manager
SettingsTab.__init__(self, parent.name)
SettingsTab.__init__(self, parent.name, visible_title)
def setupUi(self):
self.setObjectName(u'AlertsTab')
self.tabTitleVisible = translate('AlertsPlugin.AlertsTab', 'Alerts')
self.AlertsLayout = QtGui.QHBoxLayout(self)
self.AlertsLayout.setSpacing(8)
self.AlertsLayout.setMargin(8)
@ -296,4 +295,3 @@ class AlertsTab(SettingsTab):
self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color))

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__)
@ -58,11 +58,12 @@ class BiblePlugin(Plugin):
self.exportBibleItem.setVisible(False)
def getSettingsTab(self):
return BiblesTab(self.name)
visible_name = self.getString(StringContent.VisibleName)
return BiblesTab(self.name, visible_name[u'title'])
def getMediaManagerItem(self):
# Create the BibleManagerItem object.
return BibleMediaItem(self, self.icon, self.name)
return BibleMediaItem(self, self, self.icon)
def addImportMenuItem(self, import_menu):
self.importBibleItem = QtGui.QAction(import_menu)
@ -79,8 +80,7 @@ class BiblePlugin(Plugin):
self.exportBibleItem = QtGui.QAction(export_menu)
self.exportBibleItem.setObjectName(u'exportBibleItem')
export_menu.addAction(self.exportBibleItem)
self.exportBibleItem.setText(translate(
'BiblesPlugin', '&Bible'))
self.exportBibleItem.setText(translate('BiblesPlugin', '&Bible'))
self.exportBibleItem.setVisible(False)
def onBibleImportClick(self):
@ -96,7 +96,6 @@ class BiblePlugin(Plugin):
def usesTheme(self, theme):
"""
Called to find out if the bible plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
"""
if self.settings_tab.bible_theme == theme:
@ -116,3 +115,60 @@ class BiblePlugin(Plugin):
The new name the plugin should now use.
"""
self.settings_tab.bible_theme = newTheme
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('BiblesPlugin', 'Bible'),
u'plural': translate('BiblesPlugin', 'Bibles')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('BiblesPlugin', 'Bibles')
}
# Middle Header Bar
## Import Button ##
self.textStrings[StringContent.Import] = {
u'title': translate('BiblesPlugin', 'Import'),
u'tooltip': translate('BiblesPlugin',
'Import a Bible')
}
## New Button ##
self.textStrings[StringContent.New] = {
u'title': translate('BiblesPlugin', 'Add'),
u'tooltip': translate('BiblesPlugin',
'Add a new Bible')
}
## Edit Button ##
self.textStrings[StringContent.Edit] = {
u'title': translate('BiblesPlugin', 'Edit'),
u'tooltip': translate('BiblesPlugin',
'Edit the selected Bible')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('BiblesPlugin', 'Delete'),
u'tooltip': translate('BiblesPlugin',
'Delete the selected Bible')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('BiblesPlugin', 'Preview'),
u'tooltip': translate('BiblesPlugin',
'Preview the selected Bible')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('BiblesPlugin', 'Live'),
u'tooltip': translate('BiblesPlugin',
'Send the selected Bible live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('BiblesPlugin', 'Service'),
u'tooltip': translate('BiblesPlugin',
'Add the selected Bible to the service')
}

View File

@ -38,15 +38,14 @@ class BiblesTab(SettingsTab):
"""
log.info(u'Bible Tab loaded')
def __init__(self, title):
def __init__(self, title, visible_title):
self.paragraph_style = True
self.show_new_chapters = False
self.display_style = 0
SettingsTab.__init__(self, title)
SettingsTab.__init__(self, title, visible_title)
def setupUi(self):
self.setObjectName(u'BiblesTab')
self.tabTitleVisible = translate('BiblesPlugin.BiblesTab', 'Bibles')
self.BibleLayout = QtGui.QHBoxLayout(self)
self.BibleLayout.setSpacing(8)
self.BibleLayout.setMargin(8)

View File

@ -407,21 +407,21 @@ class BibleMediaItem(MediaManagerItem):
self.initialiseChapterVerse(bible, book[u'name'],
book[u'chapters'])
def initialiseChapterVerse(self, bible, book, chapters):
def initialiseChapterVerse(self, bible, book, chapter_count):
log.debug(u'initialiseChapterVerse %s, %s', bible, book)
self.chapters_from = chapters
self.verses = self.parent.manager.get_verse_count(bible, book, 1)
if self.verses == 0:
self.chapter_count = chapter_count
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
if verse_count == 0:
self.AdvancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText(
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
else:
self.AdvancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'')
self.adjustComboBox(1, self.chapters_from, self.AdvancedFromChapter)
self.adjustComboBox(1, self.chapters_from, self.AdvancedToChapter)
self.adjustComboBox(1, self.verses, self.AdvancedFromVerse)
self.adjustComboBox(1, self.verses, self.AdvancedToVerse)
self.adjustComboBox(1, self.chapter_count, self.AdvancedFromChapter)
self.adjustComboBox(1, self.chapter_count, self.AdvancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
def onAdvancedVersionComboBox(self):
self.initialiseBible(
@ -435,44 +435,65 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedBookComboBox.itemData(item).toInt()[0])
def onAdvancedFromVerse(self):
frm = int(self.AdvancedFromVerse.currentText())
chapter_frm = int(self.AdvancedFromChapter.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
if chapter_frm == chapter_to:
if chapter_from == chapter_to:
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
verse_from = int(self.AdvancedFromVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to)
self.adjustComboBox(verse_from, verse_count,
self.AdvancedToVerse, True)
def onAdvancedToChapter(self):
chapter_frm = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
if chapter_frm != chapter_to:
self.adjustComboBox(1, verses, self.AdvancedToVerse)
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to)
if chapter_from == chapter_to and verse_from > verse_to:
self.adjustComboBox(verse_from, verse_count, self.AdvancedToVerse)
else:
frm = int(self.AdvancedFromVerse.currentText())
to = int(self.AdvancedToVerse.currentText())
if to < frm:
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
def onAdvancedFromChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
chapter_frm = int(self.AdvancedFromChapter.currentText())
self.adjustComboBox(chapter_frm, self.chapters_from,
self.AdvancedToChapter)
verse = self.parent.manager.get_verse_count(bible, book, chapter_frm)
self.adjustComboBox(1, verse, self.AdvancedToVerse)
self.adjustComboBox(1, verse, self.AdvancedFromVerse)
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_from)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
if chapter_from > chapter_to:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter)
elif chapter_from == chapter_to:
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse, True)
else:
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter, True)
def adjustComboBox(self, range_from, range_to, combo):
def adjustComboBox(self, range_from, range_to, combo, restore=False):
"""
``restore``
If True, then the combo's currentText will be restored after
adjusting (if possible).
"""
log.debug(u'adjustComboBox %s, %s, %s', combo, range_from, range_to)
if restore:
old_text = unicode(combo.currentText())
combo.clear()
for i in range(int(range_from), int(range_to) + 1):
combo.addItem(unicode(i))
if restore and combo.findText(old_text) != -1:
combo.setCurrentIndex(combo.findText(old_text))
def onAdvancedSearchButton(self):
log.debug(u'Advanced Search Button pressed')

View File

@ -28,7 +28,7 @@ import logging
from forms import EditCustomForm
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, 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
@ -55,11 +55,12 @@ class CustomPlugin(Plugin):
self.icon = build_icon(self.icon_path)
def getSettingsTab(self):
return CustomTab(self.name)
visible_name = self.getString(StringContent.VisibleName)
return CustomTab(self.name, visible_name[u'title'])
def getMediaManagerItem(self):
# Create the CustomManagerItem object
return CustomMediaItem(self, self.icon, self.name)
return CustomMediaItem(self, self, self.icon)
def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Plugin</strong>'
@ -96,3 +97,66 @@ class CustomPlugin(Plugin):
for custom in customsUsingTheme:
custom.theme_name = newTheme
self.custommanager.save_object(custom)
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('CustomsPlugin', 'Custom'),
u'plural': translate('CustomsPlugin', 'Customs')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('CustomsPlugin', 'Customs')
}
# Middle Header Bar
## Import Button ##
self.textStrings[StringContent.Import] = {
u'title': translate('CustomsPlugin', 'Import'),
u'tooltip': translate('CustomsPlugin',
'Import a Custom')
}
## Load Button ##
self.textStrings[StringContent.Load] = {
u'title': translate('CustomsPlugin', 'Load'),
u'tooltip': translate('CustomsPlugin',
'Load a new Custom')
}
## New Button ##
self.textStrings[StringContent.New] = {
u'title': translate('CustomsPlugin', 'Add'),
u'tooltip': translate('CustomsPlugin',
'Add a new Custom')
}
## Edit Button ##
self.textStrings[StringContent.Edit] = {
u'title': translate('CustomsPlugin', 'Edit'),
u'tooltip': translate('CustomsPlugin',
'Edit the selected Custom')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('CustomsPlugin', 'Delete'),
u'tooltip': translate('CustomsPlugin',
'Delete the selected Custom')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('CustomsPlugin', 'Preview'),
u'tooltip': translate('CustomsPlugin',
'Preview the selected Custom')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('CustomsPlugin', 'Live'),
u'tooltip': translate('CustomsPlugin',
'Send the selected Custom live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('CustomsPlugin', 'Service'),
u'tooltip': translate('CustomsPlugin',
'Add the selected Custom to the service')
}

View File

@ -32,12 +32,11 @@ class CustomTab(SettingsTab):
"""
CustomTab is the Custom settings tab in the settings dialog.
"""
def __init__(self, title):
SettingsTab.__init__(self, title)
def __init__(self, title, visible_title):
SettingsTab.__init__(self, title, visible_title)
def setupUi(self):
self.setObjectName(u'CustomTab')
self.tabTitleVisible = translate('CustomPlugin.CustomTab', 'Custom')
self.customLayout = QtGui.QFormLayout(self)
self.customLayout.setSpacing(8)
self.customLayout.setMargin(8)

View File

@ -46,14 +46,12 @@ class CustomMediaItem(MediaManagerItem):
"""
log.info(u'Custom Media Item loaded')
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Custom'
self.pluginNameVisible = translate('CustomPlugin.MediaItem', 'Custom')
def __init__(self, parent, plugin, icon):
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
MediaManagerItem.__init__(self, parent, icon, title)
MediaManagerItem.__init__(self, parent, self, icon)
self.singleServiceItem = False
# Holds information about whether the edit is remotly triggered and
# which Custom is required.

View File

@ -26,7 +26,7 @@
import logging
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__)
@ -42,7 +42,7 @@ class ImagePlugin(Plugin):
def getMediaManagerItem(self):
# Create the MediaManagerItem object
return ImageMediaItem(self, self.icon, self.name)
return ImageMediaItem(self, self, self.icon)
def about(self):
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
@ -57,3 +57,60 @@ class ImagePlugin(Plugin):
'selected image as a background instead of the background '
'provided by the theme.')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('ImagePlugin', 'Image'),
u'plural': translate('ImagePlugin', 'Images')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('ImagePlugin', 'Images')
}
# Middle Header Bar
## Load Button ##
self.textStrings[StringContent.Load] = {
u'title': translate('ImagePlugin', 'Load'),
u'tooltip': translate('ImagePlugin',
'Load a new Image')
}
## New Button ##
self.textStrings[StringContent.New] = {
u'title': translate('ImagePlugin', 'Add'),
u'tooltip': translate('ImagePlugin',
'Add a new Image')
}
## Edit Button ##
self.textStrings[StringContent.Edit] = {
u'title': translate('ImagePlugin', 'Edit'),
u'tooltip': translate('ImagePlugin',
'Edit the selected Image')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('ImagePlugin', 'Delete'),
u'tooltip': translate('ImagePlugin',
'Delete the selected Image')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('ImagePlugin', 'Preview'),
u'tooltip': translate('ImagePlugin',
'Preview the selected Image')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('ImagePlugin', 'Live'),
u'tooltip': translate('ImagePlugin',
'Send the selected Image live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('ImagePlugin', 'Service'),
u'tooltip': translate('ImagePlugin',
'Add the selected Image to the service')
}

View File

@ -49,14 +49,12 @@ class ImageMediaItem(MediaManagerItem):
"""
log.info(u'Image Media Item loaded')
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Image'
self.pluginNameVisible = translate('ImagePlugin.MediaItem', 'Image')
def __init__(self, parent, plugin, icon):
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
MediaManagerItem.__init__(self, parent, icon, title)
MediaManagerItem.__init__(self, parent, self, icon)
def retranslateUi(self):
self.OnNewPrompt = translate('ImagePlugin.MediaItem',

View File

@ -46,9 +46,7 @@ class MediaMediaItem(MediaManagerItem):
"""
log.info(u'%s MediaMediaItem loaded', __name__)
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Media'
self.pluginNameVisible = translate('MediaPlugin.MediaItem', 'Media')
def __init__(self, parent, plugin, icon):
self.IconPath = u'images/image'
self.background = False
# this next is a class, not an instance of a class - it will
@ -56,7 +54,7 @@ class MediaMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = MediaListView
self.PreviewFunction = QtGui.QPixmap(
u':/media/media_video.png').toImage()
MediaManagerItem.__init__(self, parent, icon, title)
MediaManagerItem.__init__(self, parent, self, icon)
self.singleServiceItem = False
self.serviceItemIconName = u':/media/media_video.png'

View File

@ -28,7 +28,7 @@ import logging
from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem
log = logging.getLogger(__name__)
@ -70,9 +70,66 @@ class MediaPlugin(Plugin):
def getMediaManagerItem(self):
# Create the MediaManagerItem object
return MediaMediaItem(self, self.icon, self.name)
return MediaMediaItem(self, self, self.icon)
def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
'<br />The media plugin provides playback of audio and video.')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('MediaPlugin', 'Media'),
u'plural': translate('MediaPlugin', 'Media')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('MediaPlugin', 'Media')
}
# Middle Header Bar
## Load Button ##
self.textStrings[StringContent.Load] = {
u'title': translate('MediaPlugin', 'Load'),
u'tooltip': translate('MediaPlugin',
'Load a new Media')
}
## New Button ##
self.textStrings[StringContent.New] = {
u'title': translate('MediaPlugin', 'Add'),
u'tooltip': translate('MediaPlugin',
'Add a new Media')
}
## Edit Button ##
self.textStrings[StringContent.Edit] = {
u'title': translate('MediaPlugin', 'Edit'),
u'tooltip': translate('MediaPlugin',
'Edit the selected Media')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('MediaPlugin', 'Delete'),
u'tooltip': translate('MediaPlugin',
'Delete the selected Media')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('MediaPlugin', 'Preview'),
u'tooltip': translate('MediaPlugin',
'Preview the selected Media')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('MediaPlugin', 'Live'),
u'tooltip': translate('MediaPlugin',
'Send the selected Media live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('MediaPlugin', 'Service'),
u'tooltip': translate('MediaPlugin',
'Add the selected Media to the service')
}

View File

@ -58,15 +58,12 @@ class PresentationMediaItem(MediaManagerItem):
Constructor. Setup defaults
"""
self.controllers = controllers
self.PluginNameShort = u'Presentation'
self.pluginNameVisible = translate('PresentationPlugin.MediaItem',
'Presentation')
self.IconPath = u'presentations/presentation'
self.Automatic = u''
# this next is a class, not an instance of a class - it will
# be instanced by the base MediaManagerItem
self.ListViewWithDnD_class = PresentationListView
MediaManagerItem.__init__(self, parent, icon, title)
MediaManagerItem.__init__(self, parent, self, icon)
self.message_listener = MessageListener(self)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)

View File

@ -32,20 +32,18 @@ class PresentationTab(SettingsTab):
"""
PresentationsTab is the Presentations settings tab in the settings dialog.
"""
def __init__(self, title, controllers):
def __init__(self, title, visible_title, controllers):
"""
Constructor
"""
self.controllers = controllers
SettingsTab.__init__(self, title)
SettingsTab.__init__(self, title, visible_title)
def setupUi(self):
"""
Create the controls for the settings tab
"""
self.setObjectName(u'PresentationTab')
self.tabTitleVisible = translate('PresentationPlugin.PresentationTab',
'Presentations')
self.PresentationLayout = QtGui.QHBoxLayout(self)
self.PresentationLayout.setSpacing(8)
self.PresentationLayout.setMargin(8)

View File

@ -30,7 +30,7 @@ presentations from a variety of document formats.
import os
import logging
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab
@ -60,7 +60,8 @@ class PresentationPlugin(Plugin):
"""
Create the settings Tab
"""
return PresentationTab(self.name, self.controllers)
visible_name = self.getString(StringContent.VisibleName)
return PresentationTab(self.name, visible_name[u'title'], self.controllers)
def initialise(self):
"""
@ -143,3 +144,48 @@ class PresentationPlugin(Plugin):
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('PresentationPlugin', 'Presentation'),
u'plural': translate('PresentationPlugin', 'Presentations')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('PresentationPlugin', 'Presentations')
}
# Middle Header Bar
## Load Button ##
self.textStrings[StringContent.Load] = {
u'title': translate('PresentationPlugin', 'Load'),
u'tooltip': translate('PresentationPlugin',
'Load a new Presentation')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('PresentationPlugin', 'Delete'),
u'tooltip': translate('PresentationPlugin',
'Delete the selected Presentation')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('PresentationPlugin', 'Preview'),
u'tooltip': translate('PresentationPlugin',
'Preview the selected Presentation')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('PresentationPlugin', 'Live'),
u'tooltip': translate('PresentationPlugin',
'Send the selected Presentation live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('PresentationPlugin', 'Service'),
u'tooltip': translate('PresentationPlugin',
'Add the selected Presentation to the service')
}

View File

@ -32,12 +32,11 @@ class RemoteTab(SettingsTab):
"""
RemoteTab is the Remotes settings tab in the settings dialog.
"""
def __init__(self, title):
SettingsTab.__init__(self, title)
def __init__(self, title, visible_title):
SettingsTab.__init__(self, title, visible_title)
def setupUi(self):
self.setObjectName(u'RemoteTab')
self.tabTitleVisible = translate('RemotePlugin.RemoteTab', 'Remotes')
self.remoteLayout = QtGui.QFormLayout(self)
self.remoteLayout.setSpacing(8)
self.remoteLayout.setMargin(8)

View File

@ -26,7 +26,7 @@
import logging
from openlp.core.lib import Plugin, translate, build_icon
from openlp.core.lib import Plugin, StringContent, translate, build_icon
from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__)
@ -65,7 +65,8 @@ class RemotesPlugin(Plugin):
"""
Create the settings Tab
"""
return RemoteTab(self.name)
visible_name = self.getString(StringContent.VisibleName)
return RemoteTab(self.name, visible_name[u'title'])
def about(self):
"""
@ -76,3 +77,17 @@ class RemotesPlugin(Plugin):
'a running version of OpenLP on a different computer via a web '
'browser or through the remote API.')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('RemotePlugin', 'Remote'),
u'plural': translate('RemotePlugin', 'Remotes')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('RemotePlugin', 'Remotes')
}

View File

@ -48,12 +48,10 @@ class SongMediaItem(MediaManagerItem):
"""
log.info(u'Song Media Item loaded')
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Song'
self.pluginNameVisible = translate('SongsPlugin.MediaItem', 'Song')
def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView
MediaManagerItem.__init__(self, parent, icon, title)
MediaManagerItem.__init__(self, parent, self, icon)
self.edit_song_form = EditSongForm(self, self.parent.manager)
self.singleServiceItem = False
#self.edit_song_form = EditSongForm(self.parent.manager, self)

View File

@ -32,12 +32,11 @@ class SongsTab(SettingsTab):
"""
SongsTab is the Songs settings tab in the settings dialog.
"""
def __init__(self, title):
SettingsTab.__init__(self, title)
def __init__(self, title, visible_title):
SettingsTab.__init__(self, title, visible_title)
def setupUi(self):
self.setObjectName(u'SongsTab')
self.tabTitleVisible = translate('SongsPlugin.SongsTab', 'Songs')
self.SongsLayout = QtGui.QFormLayout(self)
self.SongsLayout.setSpacing(8)
self.SongsLayout.setMargin(8)

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.plugins.songs.lib import SongMediaItem, SongsTab
from openlp.plugins.songs.lib.db import init_schema, Song
@ -57,7 +57,8 @@ class SongsPlugin(Plugin):
self.icon = build_icon(self.icon_path)
def getSettingsTab(self):
return SongsTab(self.name)
visible_name = self.getString(StringContent.VisibleName)
return SongsTab(self.name, visible_name[u'title'])
def initialise(self):
log.info(u'Songs Initialising')
@ -70,7 +71,7 @@ class SongsPlugin(Plugin):
Create the MediaManagerItem object, which is displaed in the
Media Manager.
"""
return SongMediaItem(self, self.icon, self.name)
return SongMediaItem(self, self, self.icon)
def addImportMenuItem(self, import_menu):
"""
@ -147,3 +148,54 @@ class SongsPlugin(Plugin):
importer = class_(self.manager, **kwargs)
importer.register(self.mediaItem.import_wizard)
return importer
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('SongsPlugin', 'Song'),
u'plural': translate('SongsPlugin', 'Songs')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('SongsPlugin', 'Songs')
}
# Middle Header Bar
## New Button ##
self.textStrings[StringContent.New] = {
u'title': translate('SongsPlugin', 'Add'),
u'tooltip': translate('SongsPlugin',
'Add a new Song')
}
## Edit Button ##
self.textStrings[StringContent.Edit] = {
u'title': translate('SongsPlugin', 'Edit'),
u'tooltip': translate('SongsPlugin',
'Edit the selected Song')
}
## Delete Button ##
self.textStrings[StringContent.Delete] = {
u'title': translate('SongsPlugin', 'Delete'),
u'tooltip': translate('SongsPlugin',
'Delete the selected Song')
}
## Preview ##
self.textStrings[StringContent.Preview] = {
u'title': translate('SongsPlugin', 'Preview'),
u'tooltip': translate('SongsPlugin',
'Preview the selected Song')
}
## Live Button ##
self.textStrings[StringContent.Live] = {
u'title': translate('SongsPlugin', 'Live'),
u'tooltip': translate('SongsPlugin',
'Send the selected Song live')
}
## Add to service Button ##
self.textStrings[StringContent.Service] = {
u'title': translate('SongsPlugin', 'Service'),
u'tooltip': translate('SongsPlugin',
'Add the selected Song to the service')
}

View File

@ -29,7 +29,7 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, Receiver, build_icon, translate
from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.plugins.songusage.forms import SongUsageDetailForm, \
SongUsageDeleteForm
@ -162,3 +162,17 @@ class SongUsagePlugin(Plugin):
'</strong><br />This plugin tracks the usage of songs in '
'services.')
return about_text
def setPluginTextStrings(self):
"""
Called to define all translatable texts of the plugin
"""
## Name PluginList ##
self.textStrings[StringContent.Name] = {
u'singular': translate('SongUsagePlugin', 'SongUsage'),
u'plural': translate('SongUsagePlugin', 'SongUsage')
}
## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = {
u'title': translate('SongUsagePlugin', 'SongUsage')
}