diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py
index 7a54b4c64..2248d0ddd 100644
--- a/openlp/core/lib/pluginmanager.py
+++ b/openlp/core/lib/pluginmanager.py
@@ -31,7 +31,7 @@ import os
import sys
import logging
-from openlp.core.lib import Plugin, StringContent, PluginStatus
+from openlp.core.lib import Plugin, PluginStatus
log = logging.getLogger(__name__)
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
index 1245988b4..2aa1efbc2 100644
--- a/openlp/core/lib/serviceitem.py
+++ b/openlp/core/lib/serviceitem.py
@@ -36,7 +36,6 @@ import os
import uuid
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate
-from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__)
diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py
index 57a176a69..0d277b9fe 100644
--- a/openlp/core/lib/spelltextedit.py
+++ b/openlp/core/lib/spelltextedit.py
@@ -57,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document())
self.highlighter.spellingDictionary = self.dictionary
- except Error, DictNotFoundError:
+ except (Error, DictNotFoundError):
ENCHANT_AVAILABLE = False
log.debug(u'Could not load default dictionary')
diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py
index 7ad50490d..c87f9aa2e 100644
--- a/openlp/core/lib/theme.py
+++ b/openlp/core/lib/theme.py
@@ -34,8 +34,7 @@ import logging
from xml.dom.minidom import Document
from lxml import etree, objectify
-from openlp.core.lib import str_to_bool, translate
-from openlp.core.lib.ui import UiStrings
+from openlp.core.lib import str_to_bool
log = logging.getLogger(__name__)
diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py
index 65e900bbb..328fcd137 100644
--- a/openlp/core/ui/displaytagdialog.py
+++ b/openlp/core/ui/displaytagdialog.py
@@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
+from openlp.core.lib.ui import UiStrings
class Ui_DisplayTagDialog(object):
diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py
index 3644ed07b..7e94b4595 100644
--- a/openlp/core/ui/firsttimewizard.py
+++ b/openlp/core/ui/firsttimewizard.py
@@ -49,7 +49,7 @@ class Ui_FirstTimeWizard(object):
FirstTimeWizard.resize(550, 386)
FirstTimeWizard.setModal(True)
FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
- FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages|
+ FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
self.finishButton = self.button(QtGui.QWizard.FinishButton)
@@ -81,9 +81,9 @@ class Ui_FirstTimeWizard(object):
self.pluginLayout.addWidget(self.imageCheckBox)
self.presentationCheckBox = QtGui.QCheckBox(self.pluginPage)
if sys.platform == "darwin":
- self.presentationCheckBox.setChecked(False)
+ self.presentationCheckBox.setChecked(False)
else:
- self.presentationCheckBox.setChecked(True)
+ self.presentationCheckBox.setChecked(True)
self.presentationCheckBox.setObjectName(u'presentationCheckBox')
self.pluginLayout.addWidget(self.presentationCheckBox)
self.mediaCheckBox = QtGui.QCheckBox(self.pluginPage)
@@ -209,7 +209,7 @@ class Ui_FirstTimeWizard(object):
'Select the Plugins you wish to use. '))
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard',
- 'Custom Text'))
+ 'Custom Slides'))
self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible'))
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Images'))
diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py
index 925e3d31f..9a241473a 100644
--- a/openlp/core/ui/generaltab.py
+++ b/openlp/core/ui/generaltab.py
@@ -44,7 +44,7 @@ class GeneralTab(SettingsTab):
"""
self.screens = ScreenList.get_instance()
self.icon_path = u':/icon/openlp-logo-16x16.png'
- generalTranslated = translate('GeneralTab', 'General')
+ generalTranslated = translate('OpenLP.GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', generalTranslated)
def setupUi(self):
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 50636b0d4..f53faf135 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -277,31 +277,22 @@ class Ui_MainWindow(object):
u'settingsConfigureItem', u':/system/system_settings.png',
category=UiStrings().Settings)
action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
- self.helpDocumentationItem = icon_action(mainWindow,
- u'helpDocumentationItem', u':/system/system_help_contents.png',
- category=None)#UiStrings().Help)
- self.helpDocumentationItem.setEnabled(False)
- self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem',
- [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked,
+ self.aboutItem = shortcut_action(mainWindow, u'aboutItem',
+ [QtGui.QKeySequence(u'Ctrl+F1')], self.onAboutItemClicked,
u':/system/system_about.png', category=UiStrings().Help)
if os.name == u'nt':
self.localHelpFile = os.path.join(
AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
- self.helpLocalHelpItem = shortcut_action(
- mainWindow, u'helpLocalHelpItem', [QtGui.QKeySequence(u'F1')],
- self.onHelpLocalHelpClicked, u':/system/system_about.png',
- category=UiStrings().Help)
- self.helpOnlineHelpItem = shortcut_action(
- mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')],
- self.onHelpOnlineHelpClicked, u':/system/system_online_help.png',
- category=UiStrings().Help)
- else:
- self.helpOnlineHelpItem = shortcut_action(
- mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'F1')],
- self.onHelpOnlineHelpClicked, u':/system/system_online_help.png',
- category=UiStrings().Help)
- self.helpWebSiteItem = base_action(
- mainWindow, u'helpWebSiteItem', category=UiStrings().Help)
+ self.offlineHelpItem = shortcut_action(
+ mainWindow, u'offlineHelpItem', [QtGui.QKeySequence(u'F1')],
+ self.onOfflineHelpClicked,
+ u':/system/system_help_contents.png', category=UiStrings().Help)
+ self.onlineHelpItem = shortcut_action(
+ mainWindow, u'onlineHelpItem',
+ [QtGui.QKeySequence(u'Alt+F1')], self.onOnlineHelpClicked,
+ u':/system/system_online_help.png', category=UiStrings().Help)
+ self.webSiteItem = base_action(
+ mainWindow, u'webSiteItem', category=UiStrings().Help)
add_actions(self.fileImportMenu,
(self.importThemeItem, self.importLanguageItem))
add_actions(self.fileExportMenu,
@@ -334,14 +325,13 @@ class Ui_MainWindow(object):
add_actions(self.toolsMenu, (self.toolsAddToolItem, None))
add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None))
add_actions(self.toolsMenu, [self.updateThemeImages])
- add_actions(self.helpMenu, (self.helpDocumentationItem, None))
if os.name == u'nt':
- add_actions(self.helpMenu, (self.helpLocalHelpItem,
- self.helpOnlineHelpItem, None, self.helpWebSiteItem,
- self.helpAboutItem))
+ add_actions(self.helpMenu, (self.offlineHelpItem,
+ self.onlineHelpItem, None, self.webSiteItem,
+ self.aboutItem))
else:
- add_actions(self.helpMenu, (self.helpOnlineHelpItem, None,
- self.helpWebSiteItem, self.helpAboutItem))
+ add_actions(self.helpMenu, (self.onlineHelpItem, None,
+ self.webSiteItem, self.aboutItem))
add_actions(self.menuBar, (self.fileMenu.menuAction(),
self.viewMenu.menuAction(), self.toolsMenu.menuAction(),
self.settingsMenu.menuAction(), self.helpMenu.menuAction()))
@@ -356,7 +346,6 @@ class Ui_MainWindow(object):
self.toolsAddToolItem.setVisible(False)
self.importLanguageItem.setVisible(False)
self.exportLanguageItem.setVisible(False)
- self.helpDocumentationItem.setVisible(False)
self.setLockPanel(panelLocked)
def retranslateUi(self, mainWindow):
@@ -457,17 +446,15 @@ class Ui_MainWindow(object):
'&Plugin List'))
self.settingsPluginListItem.setStatusTip(
translate('OpenLP.MainWindow', 'List the Plugins'))
- self.helpDocumentationItem.setText(
- translate('OpenLP.MainWindow', '&User Guide'))
- self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About'))
- self.helpAboutItem.setStatusTip(
+ self.aboutItem.setText(translate('OpenLP.MainWindow', '&About'))
+ self.aboutItem.setStatusTip(
translate('OpenLP.MainWindow', 'More information about OpenLP'))
if os.name == u'nt':
- self.helpLocalHelpItem.setText(
- translate('OpenLP.MainWindow', '&Help'))
- self.helpOnlineHelpItem.setText(
+ self.offlineHelpItem.setText(
+ translate('OpenLP.MainWindow', '&User Guide'))
+ self.onlineHelpItem.setText(
translate('OpenLP.MainWindow', '&Online Help'))
- self.helpWebSiteItem.setText(
+ self.webSiteItem.setText(
translate('OpenLP.MainWindow', '&Web Site'))
for item in self.languageGroup.actions():
item.setText(item.objectName())
@@ -557,7 +544,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.themeManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.viewThemeManagerItem.setChecked)
- QtCore.QObject.connect(self.helpWebSiteItem,
+ QtCore.QObject.connect(self.webSiteItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
QtCore.QObject.connect(self.toolsOpenDataFolder,
QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked)
@@ -766,20 +753,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
import webbrowser
webbrowser.open_new(u'http://openlp.org/')
- def onHelpLocalHelpClicked(self):
+ def onOfflineHelpClicked(self):
"""
Load the local OpenLP help file
"""
os.startfile(self.localHelpFile)
- def onHelpOnlineHelpClicked(self):
+ def onOnlineHelpClicked(self):
"""
Load the online OpenLP manual
"""
import webbrowser
webbrowser.open_new(u'http://manual.openlp.org/')
- def onHelpAboutItemClicked(self):
+ def onAboutItemClicked(self):
"""
Show the About form
"""
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index f6c069525..c6dfe77aa 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -802,7 +802,6 @@ class ServiceManager(QtGui.QWidget):
# Top Item was selected so set the last one
if setLastItem:
lastItem.setSelected(True)
- self.setModified()
def onMoveSelectionDown(self):
"""
@@ -824,7 +823,6 @@ class ServiceManager(QtGui.QWidget):
serviceIterator += 1
if setSelected:
firstItem.setSelected(True)
- self.setModified()
def onCollapseAll(self):
"""
@@ -863,12 +861,12 @@ class ServiceManager(QtGui.QWidget):
Move the current ServiceItem to the top of the list.
"""
item, child = self.findServiceItem()
- if item < len(self.serviceItems) and item is not -1:
+ if item < len(self.serviceItems) and item != -1:
temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(0, temp)
self.repaintServiceList(0, child)
- self.setModified()
+ self.setModified()
def onServiceUp(self):
"""
@@ -880,31 +878,31 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item - 1, temp)
self.repaintServiceList(item - 1, child)
- self.setModified()
+ self.setModified()
def onServiceDown(self):
"""
Move the current ServiceItem one position down in the list.
"""
item, child = self.findServiceItem()
- if item < len(self.serviceItems) and item is not -1:
+ if item < len(self.serviceItems) and item != -1:
temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item + 1, temp)
self.repaintServiceList(item + 1, child)
- self.setModified()
+ self.setModified()
def onServiceEnd(self):
"""
Move the current ServiceItem to the bottom of the list.
"""
item, child = self.findServiceItem()
- if item < len(self.serviceItems) and item is not -1:
+ if item < len(self.serviceItems) and item != -1:
temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(len(self.serviceItems), temp)
self.repaintServiceList(len(self.serviceItems) - 1, child)
- self.setModified()
+ self.setModified()
def onDeleteFromService(self):
"""
@@ -914,7 +912,7 @@ class ServiceManager(QtGui.QWidget):
if item != -1:
self.serviceItems.remove(self.serviceItems[item])
self.repaintServiceList(item - 1, -1)
- self.setModified()
+ self.setModified()
def repaintServiceList(self, serviceItem, serviceItemChild):
"""
diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py
index 711cac7c2..49d27a466 100644
--- a/openlp/core/ui/settingsform.py
+++ b/openlp/core/ui/settingsform.py
@@ -29,7 +29,7 @@ The :mod:`settingsform` provides a user interface for the OpenLP settings
"""
import logging
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui
from openlp.core.lib import Receiver, build_icon, PluginStatus
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py
index 6bdcc46bc..1eccddc95 100644
--- a/openlp/core/ui/shortcutlistform.py
+++ b/openlp/core/ui/shortcutlistform.py
@@ -247,7 +247,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
alternate_label_text = action.defaultShortcuts[1].toString()
shortcuts = self._actionShortcuts(action)
# We do not want to loose pending changes, that is why we have to
- # keep the text when, this function has not been triggered by a signal.
+ # keep the text when, this function has not been triggered by a
+ # signal.
if item is None:
primary_text = self.primaryPushButton.text()
alternate_text = self.alternatePushButton.text()
@@ -280,7 +281,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
"""
Restores all default shortcuts.
"""
- if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
+ if self.buttonBox.buttonRole(button) != \
+ QtGui.QDialogButtonBox.ResetRole:
return
if QtGui.QMessageBox.question(self,
translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index cf14ee87b..b5f98b149 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -33,8 +33,8 @@ import copy
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
-from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
- ItemCapabilities, translate, build_icon
+from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
+ translate, build_icon
from openlp.core.lib.ui import UiStrings, shortcut_action
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
from openlp.core.utils.actions import ActionList, CategoryOrder
diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py
index 86087e82f..572efdf4b 100644
--- a/openlp/core/ui/themestab.py
+++ b/openlp/core/ui/themestab.py
@@ -37,7 +37,7 @@ class ThemesTab(SettingsTab):
"""
def __init__(self, parent, mainwindow):
self.mainwindow = mainwindow
- generalTranslated = translate('ThemeTab', 'Themes')
+ generalTranslated = translate('OpenLP.ThemesTab', 'Themes')
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
self.icon_path = u':/themes/theme_new.png'
diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py
index 317083799..b0a28962c 100644
--- a/openlp/core/utils/__init__.py
+++ b/openlp/core/utils/__init__.py
@@ -53,6 +53,7 @@ APPLICATION_VERSION = {}
IMAGES_FILTER = None
UNO_CONNECTION_TYPE = u'pipe'
#UNO_CONNECTION_TYPE = u'socket'
+VERSION_SPLITTER = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
class VersionThread(QtCore.QThread):
"""
@@ -61,8 +62,6 @@ class VersionThread(QtCore.QThread):
"""
def __init__(self, parent):
QtCore.QThread.__init__(self, parent)
- self.version_splitter = re.compile(
- r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
def run(self):
"""
@@ -73,7 +72,7 @@ class VersionThread(QtCore.QThread):
version = check_latest_version(app_version)
remote_version = {}
local_version = {}
- match = self.version_splitter.match(version)
+ match = VERSION_SPLITTER.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
@@ -82,7 +81,7 @@ class VersionThread(QtCore.QThread):
remote_version[u'revision'] = int(match.group(4))
else:
return
- match = self.version_splitter.match(app_version[u'full'])
+ match = VERSION_SPLITTER.match(app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
@@ -460,25 +459,6 @@ def file_is_unicode(filename):
return None
return ucsfile
-def string_is_unicode(test_string):
- """
- Makes sure a string is unicode.
-
- ``test_string``
- The string to confirm is unicode.
- """
- return_string = u''
- if not test_string:
- return return_string
- if isinstance(test_string, unicode):
- return_string = test_string
- if not isinstance(test_string, unicode):
- try:
- return_string = unicode(test_string, u'utf-8')
- except UnicodeError:
- log.exception("Error encoding string to unicode")
- return return_string
-
def get_uno_command():
"""
Returns the UNO command to launch an openoffice.org instance.
@@ -511,5 +491,5 @@ from actions import ActionList
__all__ = [u'AppLocation', u'get_application_version', u'check_latest_version',
u'add_actions', u'get_filesystem_encoding', u'LanguageManager',
- u'ActionList', u'get_web_page', u'file_is_unicode', u'string_is_unicode',
- u'get_uno_command', u'get_uno_instance', u'delete_file']
+ u'ActionList', u'get_web_page', u'file_is_unicode', u'get_uno_command',
+ u'get_uno_instance', u'delete_file']
diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py
index 41c2e2211..228031842 100644
--- a/openlp/plugins/alerts/alertsplugin.py
+++ b/openlp/plugins/alerts/alertsplugin.py
@@ -27,7 +27,7 @@
import logging
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtCore
from openlp.core.lib import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager
@@ -104,7 +104,7 @@ class AlertsPlugin(Plugin):
def about(self):
about_text = translate('AlertsPlugin', 'Alerts Plugin'
'
The alert plugin controls the displaying of nursery alerts '
- 'on the display screen')
+ 'on the display screen.')
return about_text
def setPluginTextStrings(self):
diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py
index 8de7744aa..45d283f28 100644
--- a/openlp/plugins/alerts/forms/alertform.py
+++ b/openlp/plugins/alerts/forms/alertform.py
@@ -176,8 +176,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# We found '<>' in the alert text, but the ParameterEdit field is empty.
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
- translate('AlertPlugin.AlertForm', 'No Parameter Found'),
- translate('AlertPlugin.AlertForm', 'You have not entered a '
+ translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
+ translate('AlertsPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
@@ -187,8 +187,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# in the alert text.
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
- translate('AlertPlugin.AlertForm', 'No Placeholder Found'),
- translate('AlertPlugin.AlertForm', 'The alert text does not'
+ translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
+ translate('AlertsPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py
index a5abc32d2..da7658c12 100644
--- a/openlp/plugins/bibles/bibleplugin.py
+++ b/openlp/plugins/bibles/bibleplugin.py
@@ -117,9 +117,9 @@ class BiblePlugin(Plugin):
self.toolsUpgradeItem = QtGui.QAction(tools_menu)
self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem')
self.toolsUpgradeItem.setText(
- translate('BiblePlugin', '&Upgrade older Bibles'))
+ translate('BiblesPlugin', '&Upgrade older Bibles'))
self.toolsUpgradeItem.setStatusTip(
- translate('BiblePlugin', 'Upgrade the Bible databases to the '
+ translate('BiblesPlugin', 'Upgrade the Bible databases to the '
'latest format.'))
tools_menu.addAction(self.toolsUpgradeItem)
QtCore.QObject.connect(self.toolsUpgradeItem,
diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py
index de1574eaa..b5478e514 100644
--- a/openlp/plugins/bibles/forms/bibleimportform.py
+++ b/openlp/plugins/bibles/forms/bibleimportform.py
@@ -27,7 +27,6 @@
"""
The bible import functions for OpenLP
"""
-import csv
import logging
import os
import os.path
@@ -39,7 +38,7 @@ from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
-from openlp.core.utils import AppLocation, string_is_unicode
+from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.manager import BibleFormat
from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename
diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py
index 14936a340..615d4231e 100644
--- a/openlp/plugins/bibles/forms/bibleupgradeform.py
+++ b/openlp/plugins/bibles/forms/bibleupgradeform.py
@@ -27,8 +27,7 @@
The bible import functions for OpenLP
"""
import logging
-import os.path
-import re
+import os
import shutil
from PyQt4 import QtCore, QtGui
@@ -39,7 +38,7 @@ from openlp.core.lib.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, delete_file
-from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB,\
+from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
BiblesResourcesDB, clean_filename
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
@@ -70,8 +69,7 @@ class BibleUpgradeForm(OpenLPWizard):
self.mediaItem = bibleplugin.mediaItem
self.suffix = u'.sqlite'
self.settingsSection = u'bibles'
- self.path = AppLocation.get_section_data_path(
- self.settingsSection)
+ self.path = AppLocation.get_section_data_path(self.settingsSection)
self.files = self.manager.old_bible_databases
self.success = {}
self.newbibles = {}
@@ -413,7 +411,7 @@ class BibleUpgradeForm(OpenLPWizard):
if not backup_path:
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm',
- 'You need to specify a Backup Directory for your '
+ 'You need to specify a backup directory for your '
'Bibles.'))
self.backupDirectoryEdit.setFocus()
return False
@@ -520,7 +518,7 @@ class BibleUpgradeForm(OpenLPWizard):
OpenLPWizard.preWizard(self)
self.progressLabel.setText(translate(
'BiblesPlugin.UpgradeWizardForm',
- 'Starting Bible upgrade...'))
+ 'Starting upgrade...'))
Receiver.send_message(u'openlp_process_events')
def performWizard(self):
@@ -532,7 +530,7 @@ class BibleUpgradeForm(OpenLPWizard):
if self.maxBibles == 0:
self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'There are no '
- 'Bibles available to upgrade.'))
+ 'Bibles that need to be upgraded.'))
self.progressBar.hide()
return
self.maxBibles = 0
diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py
index 83b52971c..6735a7344 100644
--- a/openlp/plugins/bibles/lib/csvbible.py
+++ b/openlp/plugins/bibles/lib/csvbible.py
@@ -115,7 +115,8 @@ class CSVBible(BibleDB):
if self.stop_import_flag:
break
self.wizard.incrementProgressBar(unicode(
- translate('BibleDB.Wizard', 'Importing books... %s')) %
+ translate('BiblesPlugin.CSVBible',
+ 'Importing books... %s')) %
unicode(line[2], details['encoding']))
book_ref_id = self.get_book_ref_id_by_name(
unicode(line[2], details['encoding']), 67, language_id)
@@ -155,7 +156,7 @@ class CSVBible(BibleDB):
book = self.get_book(line_book)
book_ptr = book.name
self.wizard.incrementProgressBar(unicode(translate(
- 'BibleDB.Wizard', 'Importing verses from %s...',
+ 'BiblesPlugin.CSVBible', 'Importing verses from %s...',
'Importing verses from ...')) % book.name)
self.session.commit()
try:
@@ -163,7 +164,7 @@ class CSVBible(BibleDB):
except UnicodeError:
verse_text = unicode(line[3], u'cp1252')
self.create_verse(book.id, line[1], line[2], verse_text)
- self.wizard.incrementProgressBar(translate('BibleDB.Wizard',
+ self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible',
'Importing verses... done.'))
Receiver.send_message(u'openlp_process_events')
self.session.commit()
diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py
index 68f105dff..5273f670c 100644
--- a/openlp/plugins/bibles/lib/db.py
+++ b/openlp/plugins/bibles/lib/db.py
@@ -36,7 +36,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
-from openlp.core.lib import Receiver, translate, check_directory_exists
+from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import BaseModel, init_db, Manager
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation
diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py
index 28ceaad68..290da104c 100644
--- a/openlp/plugins/bibles/lib/http.py
+++ b/openlp/plugins/bibles/lib/http.py
@@ -29,9 +29,7 @@ The :mod:`http` module enables OpenLP to retrieve scripture from bible
websites.
"""
import logging
-import os
import re
-import sqlite3
import socket
import urllib
from HTMLParser import HTMLParseError
@@ -40,7 +38,7 @@ from BeautifulSoup import BeautifulSoup, NavigableString, Tag
from openlp.core.lib import Receiver, translate
from openlp.core.lib.ui import critical_error_message_box
-from openlp.core.utils import AppLocation, get_web_page
+from openlp.core.utils import get_web_page
from openlp.plugins.bibles.lib import SearchResults
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \
Book
@@ -69,10 +67,10 @@ class BGExtract(object):
``chapter``
Chapter number.
"""
- log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version,
+ log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version,
bookname, chapter)
urlbookname = urllib.quote(bookname.encode("utf-8"))
- url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter,
+ url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter,
version)
cleaner = [(re.compile(' |
|\'\+\''), lambda match: '')]
soup = get_soup_for_bible_ref(
@@ -203,7 +201,7 @@ class BSExtract(object):
``chapter``
Chapter number
"""
- log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version,
+ log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version,
bookname, chapter)
urlversion = urllib.quote(version.encode("utf-8"))
urlbookname = urllib.quote(bookname.encode("utf-8"))
@@ -230,7 +228,7 @@ class BSExtract(object):
def get_books_from_http(self, version):
"""
- Load a list of all books a Bible contains from Bibleserver mobile
+ Load a list of all books a Bible contains from Bibleserver mobile
website.
``version``
@@ -276,7 +274,7 @@ class CWExtract(object):
``chapter``
Chapter number
"""
- log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version,
+ log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version,
bookname, chapter)
urlbookname = bookname.replace(u' ', u'-')
urlbookname = urlbookname.lower()
@@ -389,7 +387,7 @@ class HTTPBible(BibleDB):
"""
self.wizard.progressBar.setMaximum(68)
self.wizard.incrementProgressBar(unicode(translate(
- 'BiblesPlugin.HTTPBible',
+ 'BiblesPlugin.HTTPBible',
'Registering Bible and loading books...')))
self.create_meta(u'download source', self.download_source)
self.create_meta(u'download name', self.download_name)
@@ -415,7 +413,7 @@ class HTTPBible(BibleDB):
self.wizard.progressBar.setMaximum(len(books)+2)
self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.HTTPBible', 'Registering Language...')))
- bible = BiblesResourcesDB.get_webbible(self.download_name,
+ bible = BiblesResourcesDB.get_webbible(self.download_name,
self.download_source.lower())
if bible[u'language_id']:
language_id = bible[u'language_id']
@@ -432,14 +430,14 @@ class HTTPBible(BibleDB):
self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.HTTPBible', 'Importing %s...',
'Importing ...')) % book)
- book_ref_id = self.get_book_ref_id_by_name(book, len(books),
+ book_ref_id = self.get_book_ref_id_by_name(book, len(books),
language_id)
if not book_ref_id:
log.exception(u'Importing books from %s - download name: "%s" '\
'failed' % (self.download_source, self.download_name))
return False
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
- log.debug(u'Book details: Name:%s; id:%s; testament_id:%s',
+ log.debug(u'Book details: Name:%s; id:%s; testament_id:%s',
book, book_ref_id, book_details[u'testament_id'])
self.create_book(book, book_ref_id, book_details[u'testament_id'])
if self.stop_import_flag:
@@ -524,7 +522,7 @@ class HTTPBible(BibleDB):
def get_chapter_count(self, book):
"""
Return the number of chapters in a particular book.
-
+
``book``
The book object to get the chapter count for.
"""
@@ -597,14 +595,14 @@ def send_error_message(error_type):
"""
if error_type == u'download':
critical_error_message_box(
- translate('BiblePlugin.HTTPBible', 'Download Error'),
- translate('BiblePlugin.HTTPBible', 'There was a '
+ translate('BiblesPlugin.HTTPBible', 'Download Error'),
+ translate('BiblesPlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'please consider reporting a bug.'))
elif error_type == u'parse':
critical_error_message_box(
- translate('BiblePlugin.HTTPBible', 'Parse Error'),
- translate('BiblePlugin.HTTPBible', 'There was a '
+ translate('BiblesPlugin.HTTPBible', 'Parse Error'),
+ translate('BiblesPlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error continues '
'to occur please consider reporting a bug.'))
diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py
index 9a0b20820..354332083 100644
--- a/openlp/plugins/bibles/lib/manager.py
+++ b/openlp/plugins/bibles/lib/manager.py
@@ -34,7 +34,7 @@ from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation, delete_file
from openlp.plugins.bibles.lib import parse_reference
-from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB
+from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
from csvbible import CSVBible
from http import HTTPBible
from opensong import OpenSongBible
diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py
index 0734df818..82ee4430c 100644
--- a/openlp/plugins/bibles/lib/mediaitem.py
+++ b/openlp/plugins/bibles/lib/mediaitem.py
@@ -87,7 +87,7 @@ class BibleMediaItem(MediaManagerItem):
not second_bible:
self.displayResults(bible, second_bible)
elif critical_error_message_box(
- message=translate('BiblePlugin.MediaItem',
+ message=translate('BiblesPlugin.MediaItem',
'You cannot combine single and dual Bible verse search results. '
'Do you want to delete your search results and start a new '
'search?'),
@@ -437,7 +437,7 @@ class BibleMediaItem(MediaManagerItem):
if verse_count == 0:
self.advancedSearchButton.setEnabled(False)
critical_error_message_box(
- message=translate('BiblePlugin.MediaItem',
+ message=translate('BiblesPlugin.MediaItem',
'Bible not fully loaded.'))
else:
self.advancedSearchButton.setEnabled(True)
@@ -694,8 +694,8 @@ class BibleMediaItem(MediaManagerItem):
verse.verse, verse.verse))
if passage_not_found:
QtGui.QMessageBox.information(self,
- translate('BiblePlugin.MediaItem', 'Information'),
- unicode(translate('BiblePlugin.MediaItem',
+ translate('BiblesPlugin.MediaItem', 'Information'),
+ unicode(translate('BiblesPlugin.MediaItem',
'The second Bible does not contain all the verses '
'that are in the main Bible. Only verses found in both '
'Bibles will be shown. %d verses have not been '
diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py
index 34271019d..836b3d0ae 100644
--- a/openlp/plugins/remotes/lib/httpserver.py
+++ b/openlp/plugins/remotes/lib/httpserver.py
@@ -357,7 +357,8 @@ class HttpConnection(object):
if ext == u'.html':
mimetype = u'text/html'
variables = self.template_vars
- html = Template(filename=path, input_encoding=u'utf-8', output_encoding=u'utf-8').render(**variables)
+ html = Template(filename=path, input_encoding=u'utf-8',
+ output_encoding=u'utf-8').render(**variables)
elif ext == u'.css':
mimetype = u'text/css'
elif ext == u'.js':
diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py
index 79b2b295a..1845bc0e3 100644
--- a/openlp/plugins/songs/forms/editverseform.py
+++ b/openlp/plugins/songs/forms/editverseform.py
@@ -37,6 +37,8 @@ from editversedialog import Ui_EditVerseDialog
log = logging.getLogger(__name__)
+VERSE_REGEX = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
+
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
"""
This is the form that is used to edit the verses of the song.
@@ -60,7 +62,6 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
QtCore.QObject.connect(self.verseTypeComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onVerseTypeComboBoxChanged)
- self.verse_regex = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
def contextMenu(self, point):
item = self.serviceManagerList.itemAt(point)
@@ -105,7 +106,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if position == -1:
return
text = text[:position + 4]
- match = self.verse_regex.match(text)
+ match = VERSE_REGEX.match(text)
if match:
verse_tag = match.group(1)
try:
@@ -136,7 +137,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if position == -1:
return
text = text[:position + 4]
- match = self.verse_regex.match(text)
+ match = VERSE_REGEX.match(text)
if match:
verse_type = match.group(1)
verse_type_index = VerseType.from_loose_input(verse_type)
diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py
index 93d56a05a..c5c019c3c 100644
--- a/openlp/plugins/songs/lib/db.py
+++ b/openlp/plugins/songs/lib/db.py
@@ -29,7 +29,7 @@ The :mod:`db` module provides the database and schema that is the backend for
the Songs plugin
"""
-from sqlalchemy import Column, ForeignKey, Index, Table, types
+from sqlalchemy import Column, ForeignKey, Table, types
from sqlalchemy.orm import mapper, relation
from openlp.core.lib.db import BaseModel, init_db
diff --git a/openlp/plugins/songs/lib/easislidesimport.py b/openlp/plugins/songs/lib/easislidesimport.py
index b1eaceeaf..b24287130 100644
--- a/openlp/plugins/songs/lib/easislidesimport.py
+++ b/openlp/plugins/songs/lib/easislidesimport.py
@@ -26,13 +26,10 @@
###############################################################################
import logging
-import os
import re
from lxml import etree, objectify
-from openlp.core.lib import translate
-from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport import SongImport
diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py
index 448d629d5..820cf595a 100644
--- a/openlp/plugins/songs/lib/ewimport.py
+++ b/openlp/plugins/songs/lib/ewimport.py
@@ -34,7 +34,6 @@ import struct
import re
from openlp.core.lib import translate
-from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py
index 3c8b46d4e..7fca88262 100644
--- a/openlp/plugins/songs/lib/opensongimport.py
+++ b/openlp/plugins/songs/lib/opensongimport.py
@@ -26,9 +26,7 @@
###############################################################################
import logging
-import os
import re
-from zipfile import ZipFile
from lxml import objectify
from lxml.etree import Error, LxmlError
@@ -110,48 +108,13 @@ class OpenSongImport(SongImport):
SongImport.__init__(self, manager, **kwargs)
def do_import(self):
- """
- Import either each of the files in self.import_source - each element of
- which can be either a single opensong file, or a zipfile containing
- multiple opensong files.
- """
- numfiles = 0
- for filename in self.import_source:
- ext = os.path.splitext(filename)[1]
- if ext.lower() == u'.zip':
- z = ZipFile(filename, u'r')
- numfiles += len(z.infolist())
- z.close()
- else:
- numfiles += 1
- log.debug(u'Total number of files: %d', numfiles)
- self.import_wizard.progressBar.setMaximum(numfiles)
+ self.import_wizard.progressBar.setMaximum(len(self.import_source))
for filename in self.import_source:
if self.stop_import_flag:
return
- ext = os.path.splitext(filename)[1]
- if ext.lower() == u'.zip':
- log.debug(u'Zipfile found %s', filename)
- z = ZipFile(filename, u'r')
- for song in z.infolist():
- if self.stop_import_flag:
- z.close()
- return
- parts = os.path.split(song.filename)
- if parts[-1] == u'':
- # No final part => directory
- continue
- log.info(u'Zip importing %s', parts[-1])
- song_file = z.open(song)
- self.do_import_file(song_file)
- song_file.close()
- z.close()
- else:
- # not a zipfile
- log.info(u'Direct import %s', filename)
- song_file = open(filename)
- self.do_import_file(song_file)
- song_file.close()
+ song_file = open(filename)
+ self.do_import_file(song_file)
+ song_file.close()
def do_import_file(self, file):
"""
diff --git a/openlp/plugins/songs/lib/songbeamerimport.py b/openlp/plugins/songs/lib/songbeamerimport.py
index 3a8d63783..400db8f9a 100644
--- a/openlp/plugins/songs/lib/songbeamerimport.py
+++ b/openlp/plugins/songs/lib/songbeamerimport.py
@@ -36,7 +36,6 @@ import re
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport import SongImport
-from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__)
diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py
index 781321fe4..dc45764e4 100644
--- a/openlp/plugins/songs/lib/songimport.py
+++ b/openlp/plugins/songs/lib/songimport.py
@@ -29,9 +29,8 @@ import re
from PyQt4 import QtCore
-from openlp.core.lib import Receiver, translate, check_directory_exists
+from openlp.core.lib import Receiver, translate
from openlp.core.ui.wizard import WizardStrings
-from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib import clean_song, VerseType
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile
from openlp.plugins.songs.lib.ui import SongStrings
diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/wowimport.py
index 0648abe66..e2a5820a5 100644
--- a/openlp/plugins/songs/lib/wowimport.py
+++ b/openlp/plugins/songs/lib/wowimport.py
@@ -31,7 +31,6 @@ Worship songs into the OpenLP database.
import os
import logging
-from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport
BLOCK_TYPES = (u'V', u'C', u'B')
diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py
index c5bf85ad8..3635fd7e7 100644
--- a/openlp/plugins/songs/lib/xml.py
+++ b/openlp/plugins/songs/lib/xml.py
@@ -73,6 +73,8 @@ from openlp.core.utils import get_application_version
log = logging.getLogger(__name__)
+CHORD_REGEX = re.compile(u'')
+
class SongXML(object):
"""
This class builds and parses the XML used to describe songs.
@@ -234,7 +236,6 @@ class OpenLyrics(object):
IMPLEMENTED_VERSION = u'0.7'
def __init__(self, manager):
self.manager = manager
- self.chord_regex = re.compile(u'')
def song_to_xml(self, song):
"""
@@ -319,7 +320,7 @@ class OpenLyrics(object):
if xml[:5] == u'= %s ... ' % (text, '.'.join(map(str, required))))
+ if version >= required:
+ w('.'.join(map(str, version)) + os.linesep)
+ return True
+ else:
+ w('FAIL' + os.linesep)
+ return False
+
+def print_vers_fail(required, text):
+ print(' %s >= %s ... FAIL' % (text, required))
+
+def verify_python():
+ if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
+ exit(1)
+
+def verify_versions():
+ print('Verifying version of modules...')
+ try:
+ from PyQt4 import QtCore
+ check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], 'PyQt4')
+ check_vers(QtCore.qVersion(), VERS['Qt4'], 'Qt4')
+ except ImportError:
+ print_vers_fail(VERS['PyQt4'], 'PyQt4')
+ print_vers_fail(VERS['Qt4'], 'Qt4')
+ try:
+ import sqlalchemy
+ check_vers(sqlalchemy.__version__, VERS['sqlalchemy'], 'sqlalchemy')
+ except ImportError:
+ print_vers_fail(VERS['sqlalchemy'], 'sqlalchemy')
+ try:
+ import enchant
+ check_vers(enchant.__version__, VERS['enchant'], 'enchant')
+ except ImportError:
+ print_vers_fail(VERS['enchant'], 'enchant')
+
+def check_module(mod, text='', indent=' '):
+ space = (30 - len(mod) - len(text)) * ' '
+ w(indent + '%s%s... ' % (mod, text) + space)
+ try:
+ __import__(mod)
+ w('OK')
+ except ImportError:
+ w('FAIL')
+ w(os.linesep)
+
+def verify_pyenchant():
+ w('Enchant (spell checker)... ')
+ try:
+ import enchant
+ w(os.linesep)
+ backends = ', '.join([x.name for x in enchant.Broker().describe()])
+ print(' available backends: %s' % backends)
+ langs = ', '.join(enchant.list_languages())
+ print(' available languages: %s' % langs)
+ except ImportError:
+ w('FAIL' + os.linesep)
+
+def verify_pyqt():
+ w('Qt4 image formats... ')
+ try:
+ from PyQt4 import QtGui
+ read_f = ', '.join([unicode(format).lower()
+ for format in QtGui.QImageReader.supportedImageFormats()])
+ write_f = ', '.join([unicode(format).lower()
+ for format in QtGui.QImageWriter.supportedImageFormats()])
+ w(os.linesep)
+ print(' read: %s' % read_f)
+ print(' write: %s' % write_f)
+ except ImportError:
+ w('FAIL' + os.linesep)
+
+def main():
+ verify_python()
+
+ print('Checking for modules...')
+ for m in MODULES:
+ check_module(m)
+
+ print('Checking for optional modules...')
+ for m in OPTIONAL_MODULES:
+ check_module(m[0], text=m[1])
+
+ if is_win:
+ print('Checking for Windows specific modules...')
+ for m in WIN32_MODULES:
+ check_module(m)
+
+ verify_versions()
+ verify_pyqt()
+ verify_pyenchant()
+
+if __name__ == u'__main__':
+ main()