Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48869

Cleanups
Dedupe presentation controller code
Fill out the range of Delphi colours to fix theme loading (Support 98)
Naming fixes including starting the attack on mainwindow.py.  This breaks the 
layout saving across the fix as the dock widgets changed names and it doesn't 
know how to match old names to new so you'll have to reset any moved dock 
widgets.
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48869
Your team OpenLP Core is requested to review the proposed merge of 
lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py	2011-01-14 18:58:47 +0000
+++ openlp/core/lib/db.py	2011-02-08 03:36:14 +0000
@@ -86,10 +86,10 @@
         """
         Creates an instance of a class and populates it, returning the instance
         """
-        me = cls()
+        instance = cls()
         for key in kwargs:
-            me.__setattr__(key, kwargs[key])
-        return me
+            instance.__setattr__(key, kwargs[key])
+        return instance
 
 class Manager(object):
     """

=== modified file 'openlp/core/lib/displaytags.py'
--- openlp/core/lib/displaytags.py	2011-01-09 08:17:17 +0000
+++ openlp/core/lib/displaytags.py	2011-02-08 03:36:14 +0000
@@ -60,8 +60,8 @@
         DisplayTags.html_expands.append(tag)
 
     @staticmethod
-    def remove_html_tag(id):
-        """
-        Removes amd individual html_expands list.
-        """
-        DisplayTags.html_expands.pop(id)
+    def remove_html_tag(tag_id):
+        """
+        Removes an individual html_expands tag.
+        """
+        DisplayTags.html_expands.pop(tag_id)

=== modified file 'openlp/core/lib/imagemanager.py'
--- openlp/core/lib/imagemanager.py	2011-01-13 01:14:38 +0000
+++ openlp/core/lib/imagemanager.py	2011-02-08 03:36:14 +0000
@@ -61,10 +61,10 @@
     image = None
     image_bytes = None
 
+
 class ImageManager(QtCore.QObject):
     """
     Image Manager handles the conversion and sizing of images.
-
     """
     log.info(u'Image Manager loaded')
 

=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py	2011-02-03 03:50:04 +0000
+++ openlp/core/lib/plugin.py	2011-02-08 03:36:14 +0000
@@ -44,6 +44,9 @@
 
 
 class StringContent(object):
+    """
+    Provide standard strings for objects to use.
+    """
     Name = u'name'
     Import = u'import'
     Load = u'load'

=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py	2011-02-02 15:52:17 +0000
+++ openlp/core/lib/theme.py	2011-02-08 03:36:14 +0000
@@ -583,8 +583,7 @@
                 self.background_end_color,
                 self.background_direction)
         else:
-            filename = \
-                os.path.split(self.background_filename)[1]
+            filename = os.path.split(self.background_filename)[1]
             self.add_background_image(filename)
         self.add_font(self.font_main_name,
             self.font_main_color,

=== modified file 'openlp/core/theme/theme.py'
--- openlp/core/theme/theme.py	2010-12-28 09:22:29 +0000
+++ openlp/core/theme/theme.py	2011-02-08 03:36:14 +0000
@@ -33,11 +33,14 @@
 from xml.etree.ElementTree import ElementTree, XML
 from PyQt4 import QtGui
 
-DELPHI_COLORS = {u'clRed': 0xFF0000,
-                 u'clBlue': 0x0000FF,
-                 u'clYellow': 0xFFFF00,
-                 u'clBlack': 0x000000,
-                 u'clWhite': 0xFFFFFF}
+DELPHI_COLORS = {
+    u'clAqua': 0x00FFFF,    u'clBlack': 0x000000,   u'clBlue': 0x0000FF,
+    u'clFuchsia': 0xFF00FF, u'clGray': 0x808080,    u'clGreen': 0x008000,
+    u'clLime': 0x00FF00,    u'clMaroon': 0x800000,  u'clNavy': 0x000080,
+    u'clOlive': 0x808000,   u'clPurple': 0x800080,  u'clRed': 0xFF0000,
+    u'clSilver': 0xC0C0C0,  u'clTeal': 0x008080,    u'clWhite': 0xFFFFFF,
+    u'clYellow': 0xFFFF00
+}
 
 BLANK_STYLE_XML = \
 '''<?xml version="1.0" encoding="iso-8859-1"?>
@@ -184,7 +187,6 @@
             if element.tag != u'Theme':
                 element_text = element.text
                 val = 0
-                # easy!
                 if element_text is None:
                     val = element_text
                 # strings need special handling to sort the colours out

=== modified file 'openlp/core/ui/displaytagtab.py'
--- openlp/core/ui/displaytagtab.py	2011-02-02 23:12:31 +0000
+++ openlp/core/ui/displaytagtab.py	2011-02-08 03:36:14 +0000
@@ -23,27 +23,27 @@
 # with this program; if not, write to the Free Software Foundation, Inc., 59  #
 # Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
 ###############################################################################
-'''
+"""
 The :mod:`DisplayTagTab` provides an Tag Edit facility.  The Base set are
 protected and included each time loaded.  Custom tags can be defined and saved.
 The Custom Tag arrays are saved in a pickle so QSettings works on them.  Base
 Tags cannot be changed.
-
-'''
+"""
 import cPickle
+
 from PyQt4 import QtCore, QtGui
 
 from openlp.core.lib import SettingsTab, translate, DisplayTags
 from openlp.core.lib.ui import critical_error_message_box
 
 class DisplayTagTab(SettingsTab):
-    '''
+    """
     The :class:`DisplayTagTab` manages the settings tab .
-    '''
+    """
     def __init__(self):
-        '''
+        """
         Initialise the settings tab
-        '''
+        """
         SettingsTab.__init__(self, u'Display Tags')
 
     def resizeEvent(self, event=None):
@@ -67,9 +67,9 @@
         self.selected = -1
 
     def setupUi(self):
-        '''
+        """
         Configure the UI elements for the tab.
-        '''
+        """
         self.setObjectName(u'DisplayTagTab')
         self.tabTitleVisible = \
             translate(u'OpenLP.DisplayTagTab', 'Display Tags')

=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-02-05 09:45:08 +0000
+++ openlp/core/ui/maindisplay.py	2011-02-08 03:36:14 +0000
@@ -326,8 +326,7 @@
         vol = float(volume)/float(10)
         if isBackground or not self.usePhonon:
             js = u'show_video("init", "%s", %s, true); show_video("play");' % \
-                (videoPath.replace(u'\\', u'\\\\'), \
-                str(vol))
+                (videoPath.replace(u'\\', u'\\\\'), str(vol))
             self.frame.evaluateJavaScript(js)
         else:
             self.phononActive = True
@@ -398,8 +397,7 @@
             if u'video' in self.override:
                 Receiver.send_message(u'video_background_replaced')
                 self.override = {}
-            elif self.override[u'theme'] != \
-                serviceItem.themedata.theme_name:
+            elif self.override[u'theme'] != serviceItem.themedata.theme_name:
                 Receiver.send_message(u'live_theme_changed')
                 self.override = {}
             else:

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-02-04 01:56:19 +0000
+++ openlp/core/ui/mainwindow.py	2011-02-08 03:36:14 +0000
@@ -77,10 +77,10 @@
         self.MainContentLayout.setMargin(0)
         self.MainContentLayout.setObjectName(u'MainContentLayout')
         mainWindow.setCentralWidget(self.MainContent)
-        self.ControlSplitter = QtGui.QSplitter(self.MainContent)
-        self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
-        self.ControlSplitter.setObjectName(u'ControlSplitter')
-        self.MainContentLayout.addWidget(self.ControlSplitter)
+        self.controlSplitter = QtGui.QSplitter(self.MainContent)
+        self.controlSplitter.setOrientation(QtCore.Qt.Horizontal)
+        self.controlSplitter.setObjectName(u'controlSplitter')
+        self.MainContentLayout.addWidget(self.controlSplitter)
         # Create slide controllers
         self.previewController = SlideController(self, self.settingsmanager,
             self.screens)
@@ -102,9 +102,9 @@
         self.FileExportMenu = QtGui.QMenu(self.FileMenu)
         self.FileExportMenu.setObjectName(u'FileExportMenu')
         # View Menu
-        self.ViewMenu = QtGui.QMenu(self.MenuBar)
-        self.ViewMenu.setObjectName(u'ViewMenu')
-        self.ViewModeMenu = QtGui.QMenu(self.ViewMenu)
+        self.viewMenu = QtGui.QMenu(self.MenuBar)
+        self.viewMenu.setObjectName(u'viewMenu')
+        self.ViewModeMenu = QtGui.QMenu(self.viewMenu)
         self.ViewModeMenu.setObjectName(u'ViewModeMenu')
         # Tools Menu
         self.ToolsMenu = QtGui.QMenu(self.MenuBar)
@@ -125,38 +125,38 @@
         self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
         self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
         # Create the MediaManager
-        self.MediaManagerDock = OpenLPDockWidget(mainWindow,
-            u'MediaManagerDock', u':/system/system_mediamanager.png')
-        self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
-        self.MediaManagerDock.setMinimumWidth(
+        self.mediaManagerDock = OpenLPDockWidget(mainWindow,
+            u'mediaManagerDock', u':/system/system_mediamanager.png')
+        self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
+        self.mediaManagerDock.setMinimumWidth(
             self.settingsmanager.mainwindow_left)
         # Create the media toolbox
-        self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock)
+        self.MediaToolBox = QtGui.QToolBox(self.mediaManagerDock)
         self.MediaToolBox.setObjectName(u'MediaToolBox')
-        self.MediaManagerDock.setWidget(self.MediaToolBox)
+        self.mediaManagerDock.setWidget(self.MediaToolBox)
         mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
-            self.MediaManagerDock)
+            self.mediaManagerDock)
         # Create the service manager
-        self.ServiceManagerDock = OpenLPDockWidget(mainWindow,
-            u'ServiceManagerDock', u':/system/system_servicemanager.png')
-        self.ServiceManagerDock.setMinimumWidth(
+        self.serviceManagerDock = OpenLPDockWidget(mainWindow,
+            u'serviceManagerDock', u':/system/system_servicemanager.png')
+        self.serviceManagerDock.setMinimumWidth(
             self.settingsmanager.mainwindow_right)
         self.ServiceManagerContents = ServiceManager(mainWindow,
-            self.ServiceManagerDock)
-        self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
+            self.serviceManagerDock)
+        self.serviceManagerDock.setWidget(self.ServiceManagerContents)
         mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
-            self.ServiceManagerDock)
+            self.serviceManagerDock)
         # Create the theme manager
-        self.ThemeManagerDock = OpenLPDockWidget(mainWindow,
-            u'ThemeManagerDock', u':/system/system_thememanager.png')
-        self.ThemeManagerDock.setMinimumWidth(
+        self.themeManagerDock = OpenLPDockWidget(mainWindow,
+            u'themeManagerDock', u':/system/system_thememanager.png')
+        self.themeManagerDock.setMinimumWidth(
             self.settingsmanager.mainwindow_right)
         self.ThemeManagerContents = ThemeManager(mainWindow,
-            self.ThemeManagerDock)
+            self.themeManagerDock)
         self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
-        self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
+        self.themeManagerDock.setWidget(self.ThemeManagerContents)
         mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
-            self.ThemeManagerDock)
+            self.themeManagerDock)
         # Create the menu items
         self.FileNewItem = icon_action(mainWindow, u'FileNewItem',
             u':/general/general_new.png')
@@ -186,14 +186,14 @@
         mainWindow.actionList.add_action(self.ExportLanguageItem, u'Export')
         self.ViewMediaManagerItem = icon_action(mainWindow,
             u'ViewMediaManagerItem', u':/system/system_mediamanager.png',
-            self.MediaManagerDock.isVisible())
+            self.mediaManagerDock.isVisible())
         self.ViewThemeManagerItem = icon_action(mainWindow,
             u'ViewThemeManagerItem', u':/system/system_thememanager.png',
-            self.ThemeManagerDock.isVisible())
+            self.themeManagerDock.isVisible())
         mainWindow.actionList.add_action(self.ViewMediaManagerItem, u'View')
         self.ViewServiceManagerItem = icon_action(mainWindow,
             u'ViewServiceManagerItem', u':/system/system_servicemanager.png',
-            self.ServiceManagerDock.isVisible())
+            self.serviceManagerDock.isVisible())
         mainWindow.actionList.add_action(self.ViewServiceManagerItem, u'View')
         self.ViewPreviewPanel = checkable_action(mainWindow,
             u'ViewPreviewPanel', previewVisible)
@@ -215,9 +215,9 @@
         self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
             u':/tools/tools_add.png')
         mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
-        self.SettingsPluginListItem = icon_action(mainWindow,
-            u'SettingsPluginListItem', u':/system/settings_plugin_list.png')
-        mainWindow.actionList.add_action(self.SettingsPluginListItem,
+        self.settingsPluginListItem = icon_action(mainWindow,
+            u'settingsPluginListItem', u':/system/settings_plugin_list.png')
+        mainWindow.actionList.add_action(self.settingsPluginListItem,
             u'Settings')
         # i18n Language Items
         self.AutoLanguageItem = checkable_action(mainWindow,
@@ -264,14 +264,14 @@
             self.FileExportMenu.menuAction(), self.FileExitItem)
         add_actions(self.ViewModeMenu, (self.ModeDefaultItem,
             self.ModeSetupItem, self.ModeLiveItem))
-        add_actions(self.ViewMenu, (self.ViewModeMenu.menuAction(),
+        add_actions(self.viewMenu, (self.ViewModeMenu.menuAction(),
             None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
             self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
             self.ViewLivePanel))
         # i18n add Language Actions
         add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
         add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
-        add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
+        add_actions(self.SettingsMenu, (self.settingsPluginListItem,
             self.SettingsLanguageMenu.menuAction(), None,
             self.SettingsShortcutsItem, self.SettingsConfigureItem))
         add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
@@ -279,7 +279,7 @@
             self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
             self.HelpAboutItem))
         add_actions(self.MenuBar, (self.FileMenu.menuAction(),
-            self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(),
+            self.viewMenu.menuAction(), self.ToolsMenu.menuAction(),
             self.SettingsMenu.menuAction(), self.HelpMenu.menuAction()))
         # Initialise the translation
         self.retranslateUi(mainWindow)
@@ -300,18 +300,18 @@
         self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
         self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
         self.FileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export'))
-        self.ViewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
+        self.viewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
         self.ViewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode'))
         self.ToolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools'))
         self.SettingsMenu.setTitle(translate('OpenLP.MainWindow', '&Settings'))
         self.SettingsLanguageMenu.setTitle(translate('OpenLP.MainWindow',
             '&Language'))
         self.HelpMenu.setTitle(translate('OpenLP.MainWindow', '&Help'))
-        self.MediaManagerDock.setWindowTitle(
+        self.mediaManagerDock.setWindowTitle(
             translate('OpenLP.MainWindow', 'Media Manager'))
-        self.ServiceManagerDock.setWindowTitle(
+        self.serviceManagerDock.setWindowTitle(
             translate('OpenLP.MainWindow', 'Service Manager'))
-        self.ThemeManagerDock.setWindowTitle(
+        self.themeManagerDock.setWindowTitle(
             translate('OpenLP.MainWindow', 'Theme Manager'))
         self.FileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
         self.FileNewItem.setToolTip(
@@ -403,11 +403,11 @@
             'Toggle the visibility of the live panel.'))
         self.ViewLivePanel.setShortcut(
             translate('OpenLP.MainWindow', 'F12'))
-        self.SettingsPluginListItem.setText(translate('OpenLP.MainWindow',
+        self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
             '&Plugin List'))
-        self.SettingsPluginListItem.setStatusTip(
+        self.settingsPluginListItem.setStatusTip(
             translate('OpenLP.MainWindow', 'List the Plugins'))
-        self.SettingsPluginListItem.setShortcut(
+        self.settingsPluginListItem.setShortcut(
             translate('OpenLP.MainWindow', 'Alt+F7'))
         self.HelpDocumentationItem.setText(
             translate('OpenLP.MainWindow', '&User Guide'))
@@ -501,20 +501,20 @@
             QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility)
         QtCore.QObject.connect(self.ViewLivePanel,
             QtCore.SIGNAL(u'toggled(bool)'), self.setLivePanelVisibility)
-        QtCore.QObject.connect(self.MediaManagerDock,
+        QtCore.QObject.connect(self.mediaManagerDock,
             QtCore.SIGNAL(u'visibilityChanged(bool)'),
             self.ViewMediaManagerItem.setChecked)
-        QtCore.QObject.connect(self.ServiceManagerDock,
+        QtCore.QObject.connect(self.serviceManagerDock,
             QtCore.SIGNAL(u'visibilityChanged(bool)'),
             self.ViewServiceManagerItem.setChecked)
-        QtCore.QObject.connect(self.ThemeManagerDock,
+        QtCore.QObject.connect(self.themeManagerDock,
             QtCore.SIGNAL(u'visibilityChanged(bool)'),
             self.ViewThemeManagerItem.setChecked)
         QtCore.QObject.connect(self.HelpWebSiteItem,
             QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
         QtCore.QObject.connect(self.HelpAboutItem,
             QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
-        QtCore.QObject.connect(self.SettingsPluginListItem,
+        QtCore.QObject.connect(self.settingsPluginListItem,
             QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
         QtCore.QObject.connect(self.SettingsConfigureItem,
             QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked)
@@ -748,9 +748,9 @@
             settings = QtCore.QSettings()
             settings.setValue(u'%s/view mode' % self.generalSettingsSection,
                 mode)
-        self.MediaManagerDock.setVisible(media)
-        self.ServiceManagerDock.setVisible(service)
-        self.ThemeManagerDock.setVisible(theme)
+        self.mediaManagerDock.setVisible(media)
+        self.serviceManagerDock.setVisible(service)
+        self.themeManagerDock.setVisible(theme)
         self.setPreviewPanelVisibility(preview)
         self.setLivePanelVisibility(live)
 
@@ -867,16 +867,16 @@
                 theme)
 
     def toggleMediaManager(self, visible):
-        if self.MediaManagerDock.isVisible() != visible:
-            self.MediaManagerDock.setVisible(visible)
+        if self.mediaManagerDock.isVisible() != visible:
+            self.mediaManagerDock.setVisible(visible)
 
     def toggleServiceManager(self, visible):
-        if self.ServiceManagerDock.isVisible() != visible:
-            self.ServiceManagerDock.setVisible(visible)
+        if self.serviceManagerDock.isVisible() != visible:
+            self.serviceManagerDock.setVisible(visible)
 
     def toggleThemeManager(self, visible):
-        if self.ThemeManagerDock.isVisible() != visible:
-            self.ThemeManagerDock.setVisible(visible)
+        if self.themeManagerDock.isVisible() != visible:
+            self.themeManagerDock.setVisible(visible)
 
     def setPreviewPanelVisibility(self, visible):
         """

=== modified file 'openlp/core/ui/pluginform.py'
--- openlp/core/ui/pluginform.py	2011-02-06 00:09:22 +0000
+++ openlp/core/ui/pluginform.py	2011-02-08 03:36:14 +0000
@@ -34,7 +34,9 @@
 log = logging.getLogger(__name__)
 
 class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
-
+    """
+    The plugin form provides user control over the plugins OpenLP uses.
+    """
     def __init__(self, parent=None):
         QtGui.QDialog.__init__(self, parent)
         self.parent = parent

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-02-04 03:31:06 +0000
+++ openlp/core/ui/slidecontroller.py	2011-02-08 03:36:14 +0000
@@ -78,7 +78,7 @@
         self.selectedRow = 0
         self.serviceItem = None
         self.alertTab = None
-        self.panel = QtGui.QWidget(parent.ControlSplitter)
+        self.panel = QtGui.QWidget(parent.controlSplitter)
         self.slideList = {}
         # Layout for holding panel
         self.panelLayout = QtGui.QVBoxLayout(self.panel)
@@ -455,7 +455,7 @@
                 self.previewListWidget.resizeRowsToContents()
             else:
                 # Sort out image heights.
-                width = self.parent.ControlSplitter.sizes()[self.split]
+                width = self.parent.controlSplitter.sizes()[self.split]
                 for framenumber in range(len(self.serviceItem.get_frames())):
                     self.previewListWidget.setRowHeight(
                         framenumber, width / self.ratio)
@@ -584,7 +584,7 @@
         Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
             [serviceItem, self.isLive, blanked, slideno])
         self.slideList = {}
-        width = self.parent.ControlSplitter.sizes()[self.split]
+        width = self.parent.controlSplitter.sizes()[self.split]
         self.serviceItem = serviceItem
         self.previewListWidget.clear()
         self.previewListWidget.setRowCount(0)

=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py	2011-02-03 17:22:42 +0000
+++ openlp/plugins/bibles/lib/__init__.py	2011-02-08 03:36:14 +0000
@@ -33,6 +33,13 @@
 log = logging.getLogger(__name__)
 
 def get_reference_match(match_type):
+    """
+    Provides the regexes and matches to use while parsing strings for bible
+    references.
+
+    ``match_type``
+        The type of reference information trying to be extracted in this call.
+    """
     local_separator = unicode(u':;;\s*[:vV]\s*;;-;;\s*-\s*;;,;;\s*,\s*;;end'
         ).split(u';;') # English
     # local_separator = unicode(u',;;\s*,\s*;;-;;\s*-\s*;;.;;\.;;[Ee]nde'

=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py	2011-02-03 23:25:52 +0000
+++ openlp/plugins/images/lib/mediaitem.py	2011-02-08 03:36:14 +0000
@@ -84,8 +84,6 @@
     def initialise(self):
         log.debug(u'initialise')
         self.listView.clear()
-        self.listView.setSelectionMode(
-            QtGui.QAbstractItemView.ExtendedSelection)
         self.listView.setIconSize(QtCore.QSize(88, 50))
         self.servicePath = os.path.join(
             AppLocation.get_section_data_path(self.settingsSection),

=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py	2011-02-02 23:12:31 +0000
+++ openlp/plugins/media/lib/mediaitem.py	2011-02-08 03:36:14 +0000
@@ -151,8 +151,6 @@
             return False
 
     def initialise(self):
-        self.listView.setSelectionMode(
-            QtGui.QAbstractItemView.ExtendedSelection)
         self.listView.setIconSize(QtCore.QSize(88, 50))
         self.loadList(SettingsManager.load_list(self.settingsSection,
             self.settingsSection))

=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py	2011-01-22 17:50:32 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py	2011-02-08 03:36:14 +0000
@@ -69,7 +69,8 @@
         Initialise the class
         """
         log.debug(u'Initialising')
-        PresentationController.__init__(self, plugin, u'Impress')
+        PresentationController.__init__(self, plugin, u'Impress',
+            ImpressDocument)
         self.supports = [u'odp']
         self.alsosupports = [u'ppt', u'pps', u'pptx', u'ppsx']
         self.process = None
@@ -183,14 +184,6 @@
             except:
                 log.exception(u'Failed to terminate OpenOffice')
 
-    def add_doc(self, name):
-        """
-        Called when a new Impress document is opened
-        """
-        log.debug(u'Add Doc OpenOffice')
-        doc = ImpressDocument(self, name)
-        self.docs.append(doc)
-        return doc
 
 class ImpressDocument(PresentationDocument):
     """
@@ -431,35 +424,36 @@
 
     def get_slide_text(self, slide_no):
         """
-        Returns the text on the slide
-
-        ``slide_no``
-        The slide the text is required for, starting at 1
-        """
-        doc = self.document
-        pages = doc.getDrawPages()
+        Returns the text on the slide.
+
+        ``slide_no``
+            The slide the text is required for, starting at 1
+        """
+        return __get_text_from_slide(slide_no)
+
+    def get_slide_notes(self, slide_no):
+        """
+        Returns the text in the slide notes.
+
+        ``slide_no``
+            The slide the notes are required for, starting at 1
+        """
+        return __get_text_from_page(slide_no, True)
+
+    def __get_text_from_page(self, slide_no, notes=False):
+        """
+        Return any text extracted from the presentation page.
+
+        ``notes``
+            A boolean. If set the method searches the notes of the slide.
+        """
         text = ''
+        pages = self.document.getDrawPages()
         page = pages.getByIndex(slide_no - 1)
+        if notes:
+            page = page.getNotesPage()
         for idx in range(page.getCount()):
             shape = page.getByIndex(idx)
             if shape.supportsService("com.sun.star.drawing.Text"):
                 text += shape.getString() + '\n'
         return text
-
-    def get_slide_notes(self, slide_no):
-        """
-        Returns the text on the slide
-
-        ``slide_no``
-        The slide the notes are required for, starting at 1
-        """
-        doc = self.document
-        pages = doc.getDrawPages()
-        text = ''
-        page = pages.getByIndex(slide_no - 1)
-        notes = page.getNotesPage()
-        for idx in range(notes.getCount()):
-            shape = notes.getByIndex(idx)
-            if shape.supportsService("com.sun.star.drawing.Text"):
-                text += shape.getString() + '\n'
-        return text

=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py	2011-02-03 02:46:02 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py	2011-02-08 03:36:14 +0000
@@ -186,7 +186,7 @@
             controller_name = self.findControllerByType(filename)
             if controller_name:
                 controller = self.controllers[controller_name]
-                doc = controller.add_doc(unicode(file))
+                doc = controller.add_document(unicode(file))
                 thumb = os.path.join(doc.get_thumbnail_folder(), u'icon.png')
                 preview = doc.get_thumbnail_path(1, True)
                 if not preview and not initialLoad:
@@ -226,7 +226,7 @@
                 filepath = unicode(item.data(
                     QtCore.Qt.UserRole).toString())
                 for cidx in self.controllers:
-                    doc = self.controllers[cidx].add_doc(filepath)
+                    doc = self.controllers[cidx].add_document(filepath)
                     doc.presentation_deleted()
                     doc.close_presentation()
             for row in row_list:
@@ -260,7 +260,7 @@
                             return False
                     controller = self.controllers[service_item.shortname]
                     (path, name) = os.path.split(filename)
-                    doc = controller.add_doc(filename)
+                    doc = controller.add_document(filename)
                     if doc.get_thumbnail_path(1, True) is None:
                         doc.load_presentation()
                     i = 1

=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py	2011-02-01 00:33:50 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py	2011-02-08 03:36:14 +0000
@@ -59,7 +59,7 @@
         self.controller = controller
         if self.doc is not None:
             self.shutdown()
-        self.doc = self.controller.add_doc(file)
+        self.doc = self.controller.add_document(file)
         if not self.doc.load_presentation():
             # Display error message to user
             # Inform slidecontroller that the action failed?

=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py	2010-12-26 11:04:47 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py	2011-02-08 03:36:14 +0000
@@ -53,7 +53,8 @@
         Initialise the class
         """
         log.debug(u'Initialising')
-        PresentationController.__init__(self, plugin, u'Powerpoint')
+        PresentationController.__init__(self, plugin, u'Powerpoint',
+            PowerpointDocument)
         self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
         self.process = None
 
@@ -97,14 +98,6 @@
                 pass
             self.process = None
 
-        def add_doc(self, name):
-            """
-            Called when a new powerpoint document is opened
-            """
-            log.debug(u'Add Doc PowerPoint')
-            doc = PowerpointDocument(self, name)
-            self.docs.append(doc)
-            return doc
 
 class PowerpointDocument(PresentationDocument):
     """
@@ -291,13 +284,7 @@
         ``slide_no``
             The slide the text is required for, starting at 1.
         """
-        text = ''
-        shapes = self.presentation.Slides(slide_no).Shapes
-        for idx in range(shapes.Count):
-            shape = shapes(idx + 1)
-            if shape.HasTextFrame:
-                text += shape.TextFrame.TextRange.Text + '\n'
-        return text
+        return _get_text_from_shapes(self.presentation.Slides(slide_no).Shapes)
 
     def get_slide_notes(self, slide_no):
         """
@@ -306,10 +293,19 @@
         ``slide_no``
             The slide the notes are required for, starting at 1.
         """
-        text = ''
-        shapes = self.presentation.Slides(slide_no).NotesPage.Shapes
-        for idx in range(shapes.Count):
-            shape = shapes(idx + 1)
-            if shape.HasTextFrame:
-                text += shape.TextFrame.TextRange.Text + '\n'
-        return text
\ No newline at end of file
+        return _get_text_from_shapes(
+            self.presentation.Slides(slide_no).NotesPage.Shapes)
+
+def _get_text_from_shapes(shapes):
+    """
+    Returns any text extracted from the shapes on a presentation slide.
+
+    ``shapes``
+        A set of shapes to search for text.
+    """
+    text = ''
+    for idx in range(shapes.Count):
+        shape = shapes(idx + 1)
+        if shape.HasTextFrame:
+            text += shape.TextFrame.TextRange.Text + '\n'
+    return text

=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py	2010-12-26 11:04:47 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py	2011-02-08 03:36:14 +0000
@@ -49,7 +49,8 @@
         """
         log.debug(u'Initialising')
         self.process = None
-        PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
+        PresentationController.__init__(self, plugin, u'Powerpoint Viewer',
+            PptviewDocument)
         self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
 
     def check_available(self):
@@ -93,14 +94,6 @@
             while self.docs:
                 self.docs[0].close_presentation()
 
-        def add_doc(self, name):
-            """
-            Called when a new powerpoint document is opened
-            """
-            log.debug(u'Add Doc PPTView')
-            doc = PptviewDocument(self, name)
-            self.docs.append(doc)
-            return doc
 
 class PptviewDocument(PresentationDocument):
     """
@@ -247,4 +240,4 @@
         """
         Triggers the previous slide on the running presentation
         """
-        self.controller.process.PrevStep(self.pptid)
\ No newline at end of file
+        self.controller.process.PrevStep(self.pptid)

=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py	2010-12-26 11:04:47 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py	2011-02-08 03:36:14 +0000
@@ -35,151 +35,6 @@
 
 log = logging.getLogger(__name__)
 
-class PresentationController(object):
-    """
-    This class is used to control interactions with presentation applications
-    by creating a runtime environment. This is a base class for presentation
-    controllers to inherit from.
-
-    To create a new controller, take a copy of this file and name it so it ends
-    with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits
-    :class:`~openlp.plugins.presentations.lib.presentationcontroller.PresentationController`,
-    and then fill in the blanks. If possible try to make sure it loads on all
-    platforms, usually by using :mod:``os.name`` checks, although
-    ``__init__``, ``check_available`` and ``presentation_deleted`` should
-    always be implemented.
-
-    See :class:`~openlp.plugins.presentations.lib.impresscontroller.ImpressController`,
-    :class:`~openlp.plugins.presentations.lib.powerpointcontroller.PowerpointController` or
-    :class:`~openlp.plugins.presentations.lib.pptviewcontroller.PptviewController`
-    for examples.
-
-    **Basic Attributes**
-
-    ``name``
-        The name that appears in the options and the media manager
-
-    ``enabled``
-        The controller is enabled
-
-    ``available``
-        The controller is available on this machine. Set by init via
-        call to check_available
-
-    ``plugin``
-        The presentationplugin object
-
-    ``supports``
-        The primary native file types this application supports
-
-    ``alsosupports``
-        Other file types the application can import, although not necessarily
-        the first choice due to potential incompatibilities
-
-    **Hook Functions**
-
-    ``kill()``
-        Called at system exit to clean up any running presentations
-
-    ``check_available()``
-        Returns True if presentation application is installed/can run on this
-        machine
-
-    ``presentation_deleted()``
-        Deletes presentation specific files, e.g. thumbnails
-
-    """
-    log.info(u'PresentationController loaded')
-
-    def __init__(self, plugin=None, name=u'PresentationController'):
-        """
-        This is the constructor for the presentationcontroller object.  This
-        provides an easy way for descendent plugins to populate common data.
-        This method *must* be overridden, like so::
-
-            class MyPresentationController(PresentationController):
-                def __init__(self, plugin):
-                    PresentationController.__init(
-                        self, plugin, u'My Presenter App')
-
-        ``plugin``
-            Defaults to *None*. The presentationplugin object
-
-        ``name``
-            Name of the application, to appear in the application
-        """
-        self.supports = []
-        self.alsosupports = []
-        self.docs = []
-        self.plugin = plugin
-        self.name = name
-        self.settings_section = self.plugin.settingsSection
-        self.available = self.check_available()
-        self.temp_folder = os.path.join(
-            AppLocation.get_section_data_path(self.settings_section), name)
-        self.thumbnail_folder = os.path.join(
-            AppLocation.get_section_data_path(self.settings_section),
-            u'thumbnails')
-        self.thumbnail_prefix = u'slide'
-        if not os.path.isdir(self.thumbnail_folder):
-            os.makedirs(self.thumbnail_folder)
-        if not os.path.isdir(self.temp_folder):
-            os.makedirs(self.temp_folder)
-
-    def enabled(self):
-        """
-        Return whether the controller is currently enabled
-        """
-        if self.available:
-            return QtCore.QSettings().value(
-                self.settings_section + u'/' + self.name,
-                QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
-                    QtCore.Qt.Checked
-        else:
-            return False
-
-    def check_available(self):
-        """
-        Presentation app is able to run on this machine
-        """
-        return False
-
-    def start_process(self):
-        """
-        Loads a running version of the presentation application in the
-        background.
-        """
-        pass
-
-    def kill(self):
-        """
-        Called at system exit to clean up any running presentations and
-        close the application
-        """
-        log.debug(u'Kill')
-        self.close_presentation()
-
-    def add_doc(self, name):
-        """
-        Called when a new presentation document is opened
-        """
-        doc = PresentationDocument(self, name)
-        self.docs.append(doc)
-        return doc
-
-    def remove_doc(self, doc=None):
-        """
-        Called to remove an open document from the collection
-        """
-        log.debug(u'remove_doc Presentation')
-        if doc is None:
-            return
-        if doc in self.docs:
-            self.docs.remove(doc)
-
-    def close_presentation(self):
-        pass
-
 class PresentationDocument(object):
     """
     Base class for presentation documents to inherit from.
@@ -440,4 +295,152 @@
         ``slide_no``
         The slide the notes are required for, starting at 1
         """
-        return ''
\ No newline at end of file
+        return ''
+
+
+class PresentationController(object):
+    """
+    This class is used to control interactions with presentation applications
+    by creating a runtime environment. This is a base class for presentation
+    controllers to inherit from.
+
+    To create a new controller, take a copy of this file and name it so it ends
+    with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits
+    :class:`~openlp.plugins.presentations.lib.presentationcontroller.PresentationController`,
+    and then fill in the blanks. If possible try to make sure it loads on all
+    platforms, usually by using :mod:``os.name`` checks, although
+    ``__init__``, ``check_available`` and ``presentation_deleted`` should
+    always be implemented.
+
+    See :class:`~openlp.plugins.presentations.lib.impresscontroller.ImpressController`,
+    :class:`~openlp.plugins.presentations.lib.powerpointcontroller.PowerpointController` or
+    :class:`~openlp.plugins.presentations.lib.pptviewcontroller.PptviewController`
+    for examples.
+
+    **Basic Attributes**
+
+    ``name``
+        The name that appears in the options and the media manager
+
+    ``enabled``
+        The controller is enabled
+
+    ``available``
+        The controller is available on this machine. Set by init via
+        call to check_available
+
+    ``plugin``
+        The presentationplugin object
+
+    ``supports``
+        The primary native file types this application supports
+
+    ``alsosupports``
+        Other file types the application can import, although not necessarily
+        the first choice due to potential incompatibilities
+
+    **Hook Functions**
+
+    ``kill()``
+        Called at system exit to clean up any running presentations
+
+    ``check_available()``
+        Returns True if presentation application is installed/can run on this
+        machine
+
+    ``presentation_deleted()``
+        Deletes presentation specific files, e.g. thumbnails
+
+    """
+    log.info(u'PresentationController loaded')
+
+    def __init__(self, plugin=None, name=u'PresentationController',
+        document_class=PresentationDocument):
+        """
+        This is the constructor for the presentationcontroller object.  This
+        provides an easy way for descendent plugins to populate common data.
+        This method *must* be overridden, like so::
+
+            class MyPresentationController(PresentationController):
+                def __init__(self, plugin):
+                    PresentationController.__init(
+                        self, plugin, u'My Presenter App')
+
+        ``plugin``
+            Defaults to *None*. The presentationplugin object
+
+        ``name``
+            Name of the application, to appear in the application
+        """
+        self.supports = []
+        self.alsosupports = []
+        self.docs = []
+        self.plugin = plugin
+        self.name = name
+        self.document_class = document_class
+        self.settings_section = self.plugin.settingsSection
+        self.available = self.check_available()
+        self.temp_folder = os.path.join(
+            AppLocation.get_section_data_path(self.settings_section), name)
+        self.thumbnail_folder = os.path.join(
+            AppLocation.get_section_data_path(self.settings_section),
+            u'thumbnails')
+        self.thumbnail_prefix = u'slide'
+        if not os.path.isdir(self.thumbnail_folder):
+            os.makedirs(self.thumbnail_folder)
+        if not os.path.isdir(self.temp_folder):
+            os.makedirs(self.temp_folder)
+
+    def enabled(self):
+        """
+        Return whether the controller is currently enabled
+        """
+        if self.available:
+            return QtCore.QSettings().value(
+                self.settings_section + u'/' + self.name,
+                QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
+                    QtCore.Qt.Checked
+        else:
+            return False
+
+    def check_available(self):
+        """
+        Presentation app is able to run on this machine
+        """
+        return False
+
+    def start_process(self):
+        """
+        Loads a running version of the presentation application in the
+        background.
+        """
+        pass
+
+    def kill(self):
+        """
+        Called at system exit to clean up any running presentations and
+        close the application
+        """
+        log.debug(u'Kill')
+        self.close_presentation()
+
+    def add_document(self, name):
+        """
+        Called when a new presentation document is opened
+        """
+        document = self.document_class(self, name)
+        self.docs.append(document)
+        return document
+
+    def remove_doc(self, doc=None):
+        """
+        Called to remove an open document from the collection
+        """
+        log.debug(u'remove_doc Presentation')
+        if doc is None:
+            return
+        if doc in self.docs:
+            self.docs.remove(doc)
+
+    def close_presentation(self):
+        pass

=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2011-01-18 04:32:24 +0000
+++ openlp/plugins/songs/lib/__init__.py	2011-02-08 03:36:14 +0000
@@ -104,6 +104,15 @@
 
 
 def retrieve_windows_encoding(recommendation=None):
+    """
+    Determines which encoding to use on an information source. The process uses
+    both automated detection, which is passed to this method as a
+    recommendation, and user confirmation to return an encoding.
+
+    ``recommendation``
+        A recommended encoding discovered programmatically for the user to
+        confirm.
+    """
     # map chardet result to compatible windows standard code page
     codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
         'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',

=== modified file 'openlp/plugins/songs/lib/db.py'
--- openlp/plugins/songs/lib/db.py	2011-02-03 17:11:41 +0000
+++ openlp/plugins/songs/lib/db.py	2011-02-08 03:36:14 +0000
@@ -71,7 +71,6 @@
 
 
 def init_schema(url):
-
     """
     Setup the songs database connection and initialise the database schema.
 

=== modified file 'openlp/plugins/songs/lib/opensongimport.py'
--- openlp/plugins/songs/lib/opensongimport.py	2011-01-17 22:27:25 +0000
+++ openlp/plugins/songs/lib/opensongimport.py	2011-02-08 03:36:14 +0000
@@ -36,9 +36,6 @@
 
 log = logging.getLogger(__name__)
 
-class OpenSongImportError(Exception):
-    pass
-
 class OpenSongImport(SongImport):
     """
     Import songs exported from OpenSong

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to