Clean up Plugin Interface to be more Generic

Clean up Mainwindow for adding plugins
Add ThemeManager to Main window and pass to plugins
Add event Manager code to plugins and define some listners
Revert changes to Alert Form.
This commit is contained in:
Tim Bentley 2009-03-23 19:17:07 +00:00
parent 62f48a33f2
commit 66f13e5ede
11 changed files with 48 additions and 123 deletions

View File

@ -17,13 +17,12 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from event import EventType
from event import Event
from eventmanager import EventManager
from pluginconfig import PluginConfig from pluginconfig import PluginConfig
from plugin import Plugin from plugin import Plugin
from settingstab import SettingsTab from settingstab import SettingsTab
from mediamanageritem import MediaManagerItem from mediamanageritem import MediaManagerItem
from event import Event
from eventmanager import EventManager
from xmlrootclass import XmlRootClass from xmlrootclass import XmlRootClass
from serviceitem import ServiceItem from serviceitem import ServiceItem
from eventreceiver import Receiver from eventreceiver import Receiver
@ -32,6 +31,6 @@ from toolbar import OpenLPToolbar
from songxmlhandler import SongXMLBuilder from songxmlhandler import SongXMLBuilder
from songxmlhandler import SongXMLParser from songxmlhandler import SongXMLParser
__all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event','EventType', __all__ = ['PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event',
'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
'SongXMLParser', 'EventManager'] 'SongXMLParser', 'EventManager']

View File

@ -40,17 +40,21 @@ class EventType(object):
PreviewAfterLoad = 12 PreviewAfterLoad = 12
PreviewBeforeShow = 13 PreviewBeforeShow = 13
PreviewAfterShow = 14 PreviewAfterShow = 14
ThemeData = 15
LoadThemeData = 16
class Event(object): class Event(object):
""" """
Provides an Event class to encapsulate events within openlp.org. Provides an Event class to encapsulate events within openlp.org.
""" """
def __init__(self, event_type=EventType.Default, payload=None): def __init__(self, event_type=EventType.Default):
self.event_type = event_type self.type = event_type
self.payload = None
def get_payload(self):
return self.payload
def set_payload(self, payload):
self.payload = payload self.payload = payload
def get_type(self): def get_type(self):
return self.event_type return self.type

View File

@ -33,7 +33,7 @@ class EventManager(object):
def __init__(self): def __init__(self):
self.endpoints=[] self.endpoints=[]
log.info(u'Initialising') log.info(u'Starting')
def register(self, plugin): def register(self, plugin):
log.debug(u'plugin %s registered with EventManager'%plugin) log.debug(u'plugin %s registered with EventManager'%plugin)

View File

@ -88,10 +88,8 @@ class Plugin(object):
self.weight = 0 self.weight = 0
# Set up logging # Set up logging
self.log = logging.getLogger(self.name) self.log = logging.getLogger(self.name)
self.preview_controller = plugin_helpers[u'preview'] self.preview_controller=plugin_helpers[u'preview']
self.live_controller = plugin_helpers[u'live'] self.live_controller=plugin_helpers[u'live']
self.theme_manager = plugin_helpers[u'theme']
self.event_manager = plugin_helpers[u'event']
def check_pre_conditions(self): def check_pre_conditions(self):
""" """

View File

@ -31,7 +31,7 @@ class PluginManager(object):
""" """
global log global log
log=logging.getLogger(u'PluginMgr') log=logging.getLogger(u'PluginMgr')
log.info(u'"Plugin manager loaded') log.info(u'Plugin manager loaded')
def __init__(self, dir): def __init__(self, dir):
""" """

View File

@ -23,22 +23,15 @@ from PyQt4.QtGui import QDialog
from openlp.core import translate from openlp.core import translate
from openlp.core.resources import * from openlp.core.resources import *
from openlp.core.ui import AlertsTab
from openlp.core.lib import EventManager, Event
class AlertForm(QDialog): class AlertForm(QDialog):
global log global log
log=logging.getLogger(u'AlertForm') log=logging.getLogger(u'AlertForm')
def __init__(self, eventmanager, parent=None): def __init__(self, parent=None):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.alertsTab = AlertsTab()
self.eventmanager = eventmanager
self.setupUi(self) self.setupUi(self)
log.info(u'Defined') log.info(u'Defined')
def get_settings_tab(self):
return self.alertsTab
def setupUi(self, AlertForm): def setupUi(self, AlertForm):
AlertForm.setObjectName("AlertForm") AlertForm.setObjectName("AlertForm")
@ -102,14 +95,6 @@ class AlertForm(QDialog):
self.DisplayButton.setText(translate("AlertForm", u'Display')) self.DisplayButton.setText(translate("AlertForm", u'Display'))
self.CancelButton.setText(translate("AlertForm", u'Cancel')) self.CancelButton.setText(translate("AlertForm", u'Cancel'))
# def show(self):
# self.AlertForm.show()
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())
def load_settings(self): def load_settings(self):
pass pass
@ -118,4 +103,4 @@ class AlertForm(QDialog):
pass pass
def onDisplayClicked(self): def onDisplayClicked(self):
self.eventmanager.post_event(Event()) pass

View File

@ -28,7 +28,7 @@ from openlp.core.resources import *
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \ from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
SlideController, ServiceManager, ThemeManager SlideController, ServiceManager, ThemeManager
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, Event, EventType from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager
from openlp.core import PluginManager from openlp.core import PluginManager
@ -40,7 +40,7 @@ class MainWindow(object):
def __init__(self): def __init__(self):
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
self.EventManager = EventManager() self.EventManager = EventManager()
self.alert_form = AlertForm(self.EventManager) self.alert_form = AlertForm()
self.about_form = AboutForm() self.about_form = AboutForm()
self.settings_form = SettingsForm() self.settings_form = SettingsForm()
@ -51,10 +51,6 @@ class MainWindow(object):
self.setupUi() self.setupUi()
# Add the core components which have settings tabs
self.settings_form.addTab(self.ThemeManagerContents.get_settings_tab())
self.settings_form.addTab(self.alert_form.get_settings_tab())
log.info(u'Load Plugins') log.info(u'Load Plugins')
self.plugin_helpers[u'preview'] = self.PreviewController self.plugin_helpers[u'preview'] = self.PreviewController
self.plugin_helpers[u'live'] = self.LiveController self.plugin_helpers[u'live'] = self.LiveController
@ -83,15 +79,6 @@ class MainWindow(object):
# Call the initialise method to setup plugins. # Call the initialise method to setup plugins.
log.info(u'initialise plugins') log.info(u'initialise plugins')
self.plugin_manager.initialise_plugins() self.plugin_manager.initialise_plugins()
# Register the different UI components with Event Manager
self.EventManager.register(self.ServiceManagerContents)
self.EventManager.register(self.ThemeManagerContents)
self.EventManager.register(self.alert_form)
# Now all windows are defiened and initialised Update the theme data
event = Event(EventType.LoadThemeData)
self.EventManager.post_event(event)
def setupUi(self): def setupUi(self):
self.main_window.setObjectName("main_window") self.main_window.setObjectName("main_window")
@ -120,10 +107,8 @@ class MainWindow(object):
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal) self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setObjectName("ControlSplitter") self.ControlSplitter.setObjectName("ControlSplitter")
self.MainContentLayout.addWidget(self.ControlSplitter) self.MainContentLayout.addWidget(self.ControlSplitter)
self.PreviewController = SlideController(self.ControlSplitter) self.PreviewController = SlideController(self.ControlSplitter)
self.LiveController = SlideController(self.ControlSplitter) self.LiveController = SlideController(self.ControlSplitter)
self.MenuBar = QtGui.QMenuBar(self.main_window) self.MenuBar = QtGui.QMenuBar(self.main_window)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27)) self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
self.MenuBar.setObjectName("MenuBar") self.MenuBar.setObjectName("MenuBar")
@ -180,7 +165,6 @@ class MainWindow(object):
self.MediaManagerLayout.addWidget(self.MediaToolBox) self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents) self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
#Sevice Manager Defined #Sevice Manager Defined
self.ServiceManagerDock = QtGui.QDockWidget(self.main_window) self.ServiceManagerDock = QtGui.QDockWidget(self.main_window)
ServiceManagerIcon = QtGui.QIcon() ServiceManagerIcon = QtGui.QIcon()
@ -189,10 +173,9 @@ class MainWindow(object):
self.ServiceManagerDock.setWindowIcon(ServiceManagerIcon) self.ServiceManagerDock.setWindowIcon(ServiceManagerIcon)
self.ServiceManagerDock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures) self.ServiceManagerDock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.ServiceManagerDock.setObjectName("ServiceManagerDock") self.ServiceManagerDock.setObjectName("ServiceManagerDock")
self.ServiceManagerContents = ServiceManager(self, self.EventManager) self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents) self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
#Theme Manager Defined #Theme Manager Defined
self.ThemeManagerDock = QtGui.QDockWidget(self.main_window) self.ThemeManagerDock = QtGui.QDockWidget(self.main_window)
ThemeManagerIcon = QtGui.QIcon() ThemeManagerIcon = QtGui.QIcon()
@ -202,7 +185,7 @@ class MainWindow(object):
self.ThemeManagerDock.setFloating(False) self.ThemeManagerDock.setFloating(False)
self.ThemeManagerDock.setObjectName("ThemeManagerDock") self.ThemeManagerDock.setObjectName("ThemeManagerDock")
self.ThemeManagerContents = ThemeManager(self, self.EventManager) self.ThemeManagerContents = ThemeManager(self)
# self.ThemeManagerContents = QtGui.QWidget() # self.ThemeManagerContents = QtGui.QWidget()
# self.ThemeManagerContents.setObjectName("ThemeManagerContents") # self.ThemeManagerContents.setObjectName("ThemeManagerContents")

View File

@ -29,7 +29,6 @@ from PyQt4.QtGui import *
# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController # from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController
from openlp.core.lib import OpenLPToolbar from openlp.core.lib import OpenLPToolbar
from openlp.core.lib import ServiceItem from openlp.core.lib import ServiceItem
from openlp.core.lib import Event, EventType
# from openlp.core import PluginManager # from openlp.core import PluginManager
import logging import logging
@ -42,30 +41,24 @@ class ServiceData(QAbstractItemModel):
""" """
global log global log
log=logging.getLogger(u'ServiceData') log=logging.getLogger(u'ServiceData')
def __init__(self): def __init__(self):
QAbstractItemModel.__init__(self) QAbstractItemModel.__init__(self)
self.items=[] self.items=[]
log.info(u'Starting') log.info("Starting")
def columnCount(self, parent): def columnCount(self, parent):
return 1; # always only a single column (for now) return 1; # always only a single column (for now)
def rowCount(self, parent): def rowCount(self, parent):
return len(self.items) return len(self.items)
def insertRow(self, row, service_item): def insertRow(self, row, service_item):
# self.beginInsertRows(QModelIndex(),row,row) # self.beginInsertRows(QModelIndex(),row,row)
log.info("insert row %d:%s"%(row,service_item)) log.info("insert row %d:%s"%(row,service_item))
self.items.insert(row, service_item) self.items.insert(row, service_item)
log.info("Items: %s" % self.items) log.info("Items: %s" % self.items)
# self.endInsertRows() # self.endInsertRows()
def removeRow(self, row): def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row,row) self.beginRemoveRows(QModelIndex(), row,row)
self.items.pop(row) self.items.pop(row)
self.endRemoveRows() self.endRemoveRows()
def addRow(self, item): def addRow(self, item):
self.insertRow(len(self.items), item) self.insertRow(len(self.items), item)
@ -74,7 +67,6 @@ class ServiceData(QAbstractItemModel):
def parent(self, index=QModelIndex()): def parent(self, index=QModelIndex()):
return QModelIndex() # no children as yet return QModelIndex() # no children as yet
def data(self, index, role): def data(self, index, role):
""" """
Called by the service manager to draw us in the service window Called by the service manager to draw us in the service window
@ -119,10 +111,9 @@ class ServiceManager(QWidget):
global log global log
log=logging.getLogger(u'ServiceManager') log=logging.getLogger(u'ServiceManager')
def __init__(self, parent, eventManager): def __init__(self, parent):
QWidget.__init__(self) QWidget.__init__(self)
self.parent=parent self.parent=parent
self.EventManager = eventManager
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
self.Layout.setMargin(0) self.Layout.setMargin(0)
@ -198,12 +189,3 @@ class ServiceManager(QWidget):
oosfile.write(self.oos_as_text) oosfile.write(self.oos_as_text)
oosfile.write("# END OOS\n") oosfile.write("# END OOS\n")
oosfile.close() oosfile.close()
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())
if event.get_type() == EventType.ThemeData:
print event.payload

View File

@ -37,6 +37,12 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
# General tab # General tab
self.GeneralTab = GeneralTab() self.GeneralTab = GeneralTab()
self.addTab(self.GeneralTab) self.addTab(self.GeneralTab)
# Themes tab
self.ThemesTab = ThemesTab()
self.addTab(self.ThemesTab)
# Alert tab
self.AlertsTab = AlertsTab()
self.addTab(self.AlertsTab)
def addTab(self, tab): def addTab(self, tab):
log.info(u'Inserting %s' % tab.title()) log.info(u'Inserting %s' % tab.title())

View File

@ -18,7 +18,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import os import os
import logging
from time import sleep from time import sleep
from copy import deepcopy from copy import deepcopy
@ -28,11 +27,11 @@ from PyQt4.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
# from openlp.core.resources import * # from openlp.core.resources import *
# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController # from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController
from openlp.core.lib import OpenLPToolbar, Event, EventType from openlp.core.lib import OpenLPToolbar
from openlp.core.ui import ThemesTab
#from openlp.core.lib import ThemeItem #from openlp.core.lib import ThemeItem
# from openlp.core import PluginManager # from openlp.core import PluginManager
import logging
class ThemeData(QAbstractItemModel): class ThemeData(QAbstractItemModel):
""" """
@ -42,30 +41,24 @@ class ThemeData(QAbstractItemModel):
""" """
global log global log
log=logging.getLogger(u'ThemeData') log=logging.getLogger(u'ThemeData')
def __init__(self): def __init__(self):
QAbstractItemModel.__init__(self) QAbstractItemModel.__init__(self)
self.items=[] self.items=[]
log.info(u'Starting') log.info("Starting")
def columnCount(self, parent): def columnCount(self, parent):
return 1; # always only a single column (for now) return 1; # always only a single column (for now)
def rowCount(self, parent): def rowCount(self, parent):
return len(self.items) return len(self.items)
def insertRow(self, row, Theme_item): def insertRow(self, row, Theme_item):
# self.beginInsertRows(QModelIndex(),row,row) # self.beginInsertRows(QModelIndex(),row,row)
log.info("insert row %d:%s"%(row,Theme_item)) log.info("insert row %d:%s"%(row,Theme_item))
self.items.insert(row, Theme_item) self.items.insert(row, Theme_item)
log.info("Items: %s" % self.items) log.info("Items: %s" % self.items)
# self.endInsertRows() # self.endInsertRows()
def removeRow(self, row): def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row,row) self.beginRemoveRows(QModelIndex(), row,row)
self.items.pop(row) self.items.pop(row)
self.endRemoveRows() self.endRemoveRows()
def addRow(self, item): def addRow(self, item):
self.insertRow(len(self.items), item) self.insertRow(len(self.items), item)
@ -74,7 +67,6 @@ class ThemeData(QAbstractItemModel):
def parent(self, index=QModelIndex()): def parent(self, index=QModelIndex()):
return QModelIndex() # no children as yet return QModelIndex() # no children as yet
def data(self, index, role): def data(self, index, role):
""" """
Called by the Theme manager to draw us in the Theme window Called by the Theme manager to draw us in the Theme window
@ -106,6 +98,7 @@ class ThemeData(QAbstractItemModel):
def item(self, row): def item(self, row):
log.info("Get Item:%d -> %s" %(row, str(self.items))) log.info("Get Item:%d -> %s" %(row, str(self.items)))
return self.items[row] return self.items[row]
class ThemeManager(QWidget): class ThemeManager(QWidget):
@ -118,10 +111,9 @@ class ThemeManager(QWidget):
global log global log
log=logging.getLogger(u'ThemeManager') log=logging.getLogger(u'ThemeManager')
def __init__(self, parent, eventmanager): def __init__(self, parent):
QWidget.__init__(self) QWidget.__init__(self)
self.parent=parent self.parent=parent
self.EventManager = eventmanager
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
self.Layout.setMargin(0) self.Layout.setMargin(0)
@ -142,8 +134,6 @@ class ThemeManager(QWidget):
self.TreeView.setModel(self.Theme_data) self.TreeView.setModel(self.Theme_data)
self.Layout.addWidget(self.TreeView) self.Layout.addWidget(self.TreeView)
self.themeTab = ThemesTab(self.EventManager)
# def addThemeItem(self, item): # def addThemeItem(self, item):
# """Adds Theme item""" # """Adds Theme item"""
# log.info("addThemeItem") # log.info("addThemeItem")
@ -191,21 +181,7 @@ class ThemeManager(QWidget):
# oosfile.write(self.oos_as_text) # oosfile.write(self.oos_as_text)
# oosfile.write("# END OOS\n") # oosfile.write("# END OOS\n")
# oosfile.close() # oosfile.close()
def addEventManager(self, eventmanager):
self.eventManager = eventmanager
def get_settings_tab(self):
return self.themeTab
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())
if event.get_type() == EventType.LoadThemeData:
event = Event(EventType.ThemeData, self.themeTab.themelist)
self.EventManager.post_event(event)
def getThemes(self): def get_themes(self):
return self.themeTab.themelist return [u'Theme A', u'Theme B']

View File

@ -17,26 +17,19 @@ You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core import translate
from openlp.core.lib import SettingsTab, EventManager, Event, EventType from openlp.core.lib import SettingsTab
from openlp.core.resources import * from openlp.core.resources import *
class ThemesTab(SettingsTab): class ThemesTab(SettingsTab):
""" """
ThemesTab is the theme settings tab in the settings dialog. ThemesTab is the theme settings tab in the settings dialog.
""" """
global log def __init__(self):
log=logging.getLogger(u'ThemesTab') SettingsTab.__init__(self, u'Themes')
def __init__(self, eventmanager):
log.debug(u'Initialise')
self.eventmanager = eventmanager
print eventmanager
SettingsTab.__init__(self, u'Themes')
def setupUi(self): def setupUi(self):
self.setObjectName(u'ThemesTab') self.setObjectName(u'ThemesTab')
@ -52,6 +45,9 @@ class ThemesTab(SettingsTab):
self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout') self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox) self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
self.DefaultComboBox.setObjectName(u'DefaultComboBox') self.DefaultComboBox.setObjectName(u'DefaultComboBox')
self.DefaultComboBox.addItem(QtCore.QString())
self.DefaultComboBox.addItem(QtCore.QString())
self.DefaultComboBox.addItem(QtCore.QString())
self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox) self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
self.DefaultListView = QtGui.QListView(self.GlobalGroupBox) self.DefaultListView = QtGui.QListView(self.GlobalGroupBox)
self.DefaultListView.setObjectName(u'DefaultListView') self.DefaultListView.setObjectName(u'DefaultListView')
@ -99,6 +95,9 @@ class ThemesTab(SettingsTab):
def retranslateUi(self): def retranslateUi(self):
self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme')) self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
self.DefaultComboBox.setItemText(0, translate(u'ThemesTab', u'African Sunset'))
self.DefaultComboBox.setItemText(1, translate(u'ThemesTab', u'Snowy Mountains'))
self.DefaultComboBox.setItemText(2, translate(u'ThemesTab', u'Wilderness'))
self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level')) self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level')) self.SongLevelRadioButton.setText(translate(u'ThemesTab', u'Song level'))
self.SongLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from each song in the database. If a song doesn\'t have a theme associated with it, then use the service\'s theme. If the service doesn\'t have a theme, then use the global theme.')) self.SongLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from each song in the database. If a song doesn\'t have a theme associated with it, then use the service\'s theme. If the service doesn\'t have a theme, then use the global theme.'))
@ -106,10 +105,3 @@ class ThemesTab(SettingsTab):
self.ServiceLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from the service , overriding any of the individual songs\' themes. If the service doesn\'t have a theme, then use the global theme.')) self.ServiceLevelLabel.setText(translate(u'ThemesTab', u'Use the theme from the service , overriding any of the individual songs\' themes. If the service doesn\'t have a theme, then use the global theme.'))
self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level')) self.GlobalLevelRadioButton.setText(translate(u'ThemesTab', u'Global level'))
self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated wither either the service or the songs.')) self.GlobalLevelLabel.setText(translate(u'ThemesTab', u'Use the global theme, overriding any themes associated wither either the service or the songs.'))
def load(self):
log.debug(u'Load')
self.themelist = [u'African Sunset', u'Snowy Mountains', u'Wilderness', u'Wet and Windy London']
for theme in self.themelist:
self.DefaultComboBox.addItem(translate(u'ThemesTab', theme))