merged with trunk

This commit is contained in:
Matthias Hub 2011-07-23 19:49:26 +02:00
commit 404a82f820
36 changed files with 102 additions and 181 deletions

View File

@ -31,7 +31,7 @@ import os
import sys import sys
import logging import logging
from openlp.core.lib import Plugin, StringContent, PluginStatus from openlp.core.lib import Plugin, PluginStatus
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -36,7 +36,6 @@ import os
import uuid import uuid
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate from openlp.core.lib import build_icon, clean_tags, expand_tags, translate
from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -57,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
self.dictionary = enchant.Dict() self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document()) self.highlighter = Highlighter(self.document())
self.highlighter.spellingDictionary = self.dictionary self.highlighter.spellingDictionary = self.dictionary
except Error, DictNotFoundError: except (Error, DictNotFoundError):
ENCHANT_AVAILABLE = False ENCHANT_AVAILABLE = False
log.debug(u'Could not load default dictionary') log.debug(u'Could not load default dictionary')

View File

@ -34,8 +34,7 @@ import logging
from xml.dom.minidom import Document from xml.dom.minidom import Document
from lxml import etree, objectify from lxml import etree, objectify
from openlp.core.lib import str_to_bool, translate from openlp.core.lib import str_to_bool
from openlp.core.lib.ui import UiStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate 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): class Ui_DisplayTagDialog(object):

View File

@ -49,7 +49,7 @@ class Ui_FirstTimeWizard(object):
FirstTimeWizard.resize(550, 386) FirstTimeWizard.resize(550, 386)
FirstTimeWizard.setModal(True) FirstTimeWizard.setModal(True)
FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages| FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage) QtGui.QWizard.NoBackButtonOnLastPage)
self.finishButton = self.button(QtGui.QWizard.FinishButton) self.finishButton = self.button(QtGui.QWizard.FinishButton)
@ -81,9 +81,9 @@ class Ui_FirstTimeWizard(object):
self.pluginLayout.addWidget(self.imageCheckBox) self.pluginLayout.addWidget(self.imageCheckBox)
self.presentationCheckBox = QtGui.QCheckBox(self.pluginPage) self.presentationCheckBox = QtGui.QCheckBox(self.pluginPage)
if sys.platform == "darwin": if sys.platform == "darwin":
self.presentationCheckBox.setChecked(False) self.presentationCheckBox.setChecked(False)
else: else:
self.presentationCheckBox.setChecked(True) self.presentationCheckBox.setChecked(True)
self.presentationCheckBox.setObjectName(u'presentationCheckBox') self.presentationCheckBox.setObjectName(u'presentationCheckBox')
self.pluginLayout.addWidget(self.presentationCheckBox) self.pluginLayout.addWidget(self.presentationCheckBox)
self.mediaCheckBox = QtGui.QCheckBox(self.pluginPage) self.mediaCheckBox = QtGui.QCheckBox(self.pluginPage)
@ -209,7 +209,7 @@ class Ui_FirstTimeWizard(object):
'Select the Plugins you wish to use. ')) 'Select the Plugins you wish to use. '))
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs')) self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Custom Text')) 'Custom Slides'))
self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible')) self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible'))
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Images')) 'Images'))

View File

@ -44,7 +44,7 @@ class GeneralTab(SettingsTab):
""" """
self.screens = ScreenList.get_instance() self.screens = ScreenList.get_instance()
self.icon_path = u':/icon/openlp-logo-16x16.png' 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) SettingsTab.__init__(self, parent, u'General', generalTranslated)
def setupUi(self): def setupUi(self):

View File

@ -802,7 +802,6 @@ class ServiceManager(QtGui.QWidget):
# Top Item was selected so set the last one # Top Item was selected so set the last one
if setLastItem: if setLastItem:
lastItem.setSelected(True) lastItem.setSelected(True)
self.setModified()
def onMoveSelectionDown(self): def onMoveSelectionDown(self):
""" """
@ -824,7 +823,6 @@ class ServiceManager(QtGui.QWidget):
serviceIterator += 1 serviceIterator += 1
if setSelected: if setSelected:
firstItem.setSelected(True) firstItem.setSelected(True)
self.setModified()
def onCollapseAll(self): def onCollapseAll(self):
""" """
@ -863,12 +861,12 @@ class ServiceManager(QtGui.QWidget):
Move the current ServiceItem to the top of the list. Move the current ServiceItem to the top of the list.
""" """
item, child = self.findServiceItem() 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] temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(0, temp) self.serviceItems.insert(0, temp)
self.repaintServiceList(0, child) self.repaintServiceList(0, child)
self.setModified() self.setModified()
def onServiceUp(self): def onServiceUp(self):
""" """
@ -880,31 +878,31 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item - 1, temp) self.serviceItems.insert(item - 1, temp)
self.repaintServiceList(item - 1, child) self.repaintServiceList(item - 1, child)
self.setModified() self.setModified()
def onServiceDown(self): def onServiceDown(self):
""" """
Move the current ServiceItem one position down in the list. Move the current ServiceItem one position down in the list.
""" """
item, child = self.findServiceItem() 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] temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(item + 1, temp) self.serviceItems.insert(item + 1, temp)
self.repaintServiceList(item + 1, child) self.repaintServiceList(item + 1, child)
self.setModified() self.setModified()
def onServiceEnd(self): def onServiceEnd(self):
""" """
Move the current ServiceItem to the bottom of the list. Move the current ServiceItem to the bottom of the list.
""" """
item, child = self.findServiceItem() 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] temp = self.serviceItems[item]
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(len(self.serviceItems), temp) self.serviceItems.insert(len(self.serviceItems), temp)
self.repaintServiceList(len(self.serviceItems) - 1, child) self.repaintServiceList(len(self.serviceItems) - 1, child)
self.setModified() self.setModified()
def onDeleteFromService(self): def onDeleteFromService(self):
""" """
@ -914,7 +912,7 @@ class ServiceManager(QtGui.QWidget):
if item != -1: if item != -1:
self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.remove(self.serviceItems[item])
self.repaintServiceList(item - 1, -1) self.repaintServiceList(item - 1, -1)
self.setModified() self.setModified()
def repaintServiceList(self, serviceItem, serviceItemChild): def repaintServiceList(self, serviceItem, serviceItemChild):
""" """

View File

@ -29,7 +29,7 @@ The :mod:`settingsform` provides a user interface for the OpenLP settings
""" """
import logging import logging
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui
from openlp.core.lib import Receiver, build_icon, PluginStatus from openlp.core.lib import Receiver, build_icon, PluginStatus
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab

View File

@ -247,7 +247,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
alternate_label_text = action.defaultShortcuts[1].toString() alternate_label_text = action.defaultShortcuts[1].toString()
shortcuts = self._actionShortcuts(action) shortcuts = self._actionShortcuts(action)
# We do not want to loose pending changes, that is why we have to # 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: if item is None:
primary_text = self.primaryPushButton.text() primary_text = self.primaryPushButton.text()
alternate_text = self.alternatePushButton.text() alternate_text = self.alternatePushButton.text()
@ -280,7 +281,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
""" """
Restores all default shortcuts. Restores all default shortcuts.
""" """
if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole: if self.buttonBox.buttonRole(button) != \
QtGui.QDialogButtonBox.ResetRole:
return return
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'), translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),

View File

@ -33,8 +33,8 @@ import copy
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \ from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
ItemCapabilities, translate, build_icon translate, build_icon
from openlp.core.lib.ui import UiStrings, shortcut_action from openlp.core.lib.ui import UiStrings, shortcut_action
from openlp.core.ui import HideMode, MainDisplay, ScreenList from openlp.core.ui import HideMode, MainDisplay, ScreenList
from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.utils.actions import ActionList, CategoryOrder

View File

@ -37,7 +37,7 @@ class ThemesTab(SettingsTab):
""" """
def __init__(self, parent, mainwindow): def __init__(self, parent, mainwindow):
self.mainwindow = mainwindow self.mainwindow = mainwindow
generalTranslated = translate('ThemeTab', 'Themes') generalTranslated = translate('OpenLP.ThemesTab', 'Themes')
SettingsTab.__init__(self, parent, u'Themes', generalTranslated) SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
self.icon_path = u':/themes/theme_new.png' self.icon_path = u':/themes/theme_new.png'

View File

@ -53,6 +53,7 @@ APPLICATION_VERSION = {}
IMAGES_FILTER = None IMAGES_FILTER = None
UNO_CONNECTION_TYPE = u'pipe' UNO_CONNECTION_TYPE = u'pipe'
#UNO_CONNECTION_TYPE = u'socket' #UNO_CONNECTION_TYPE = u'socket'
VERSION_SPLITTER = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
class VersionThread(QtCore.QThread): class VersionThread(QtCore.QThread):
""" """
@ -61,8 +62,6 @@ class VersionThread(QtCore.QThread):
""" """
def __init__(self, parent): def __init__(self, parent):
QtCore.QThread.__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): def run(self):
""" """
@ -73,7 +72,7 @@ class VersionThread(QtCore.QThread):
version = check_latest_version(app_version) version = check_latest_version(app_version)
remote_version = {} remote_version = {}
local_version = {} local_version = {}
match = self.version_splitter.match(version) match = VERSION_SPLITTER.match(version)
if match: if match:
remote_version[u'major'] = int(match.group(1)) remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2)) remote_version[u'minor'] = int(match.group(2))
@ -82,7 +81,7 @@ class VersionThread(QtCore.QThread):
remote_version[u'revision'] = int(match.group(4)) remote_version[u'revision'] = int(match.group(4))
else: else:
return return
match = self.version_splitter.match(app_version[u'full']) match = VERSION_SPLITTER.match(app_version[u'full'])
if match: if match:
local_version[u'major'] = int(match.group(1)) local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2)) local_version[u'minor'] = int(match.group(2))
@ -460,25 +459,6 @@ def file_is_unicode(filename):
return None return None
return ucsfile 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(): def get_uno_command():
""" """
Returns the UNO command to launch an openoffice.org instance. 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', __all__ = [u'AppLocation', u'get_application_version', u'check_latest_version',
u'add_actions', u'get_filesystem_encoding', u'LanguageManager', u'add_actions', u'get_filesystem_encoding', u'LanguageManager',
u'ActionList', u'get_web_page', u'file_is_unicode', u'string_is_unicode', u'ActionList', u'get_web_page', u'file_is_unicode', u'get_uno_command',
u'get_uno_command', u'get_uno_instance', u'delete_file'] u'get_uno_instance', u'delete_file']

View File

@ -27,7 +27,7 @@
import logging 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 import Plugin, StringContent, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
@ -104,7 +104,7 @@ class AlertsPlugin(Plugin):
def about(self): def about(self):
about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>' about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
'<br />The alert plugin controls the displaying of nursery alerts ' '<br />The alert plugin controls the displaying of nursery alerts '
'on the display screen') 'on the display screen.')
return about_text return about_text
def setPluginTextStrings(self): def setPluginTextStrings(self):

View File

@ -176,8 +176,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# We found '<>' in the alert text, but the ParameterEdit field is empty. # We found '<>' in the alert text, but the ParameterEdit field is empty.
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \ if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter Found'), translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
translate('AlertPlugin.AlertForm', 'You have not entered a ' translate('AlertsPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'), 'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
@ -187,8 +187,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# in the alert text. # in the alert text.
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \ elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder Found'), translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertPlugin.AlertForm', 'The alert text does not' translate('AlertsPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo you want to continue anyway?'), ' contain \'<>\'.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:

View File

@ -117,9 +117,9 @@ class BiblePlugin(Plugin):
self.toolsUpgradeItem = QtGui.QAction(tools_menu) self.toolsUpgradeItem = QtGui.QAction(tools_menu)
self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem') self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem')
self.toolsUpgradeItem.setText( self.toolsUpgradeItem.setText(
translate('BiblePlugin', '&Upgrade older Bibles')) translate('BiblesPlugin', '&Upgrade older Bibles'))
self.toolsUpgradeItem.setStatusTip( self.toolsUpgradeItem.setStatusTip(
translate('BiblePlugin', 'Upgrade the Bible databases to the ' translate('BiblesPlugin', 'Upgrade the Bible databases to the '
'latest format.')) 'latest format.'))
tools_menu.addAction(self.toolsUpgradeItem) tools_menu.addAction(self.toolsUpgradeItem)
QtCore.QObject.connect(self.toolsUpgradeItem, QtCore.QObject.connect(self.toolsUpgradeItem,

View File

@ -27,7 +27,6 @@
""" """
The bible import functions for OpenLP The bible import functions for OpenLP
""" """
import csv
import logging import logging
import os import os
import os.path 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.db import delete_database
from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings 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.manager import BibleFormat
from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename

View File

@ -27,8 +27,7 @@
The bible import functions for OpenLP The bible import functions for OpenLP
""" """
import logging import logging
import os.path import os
import re
import shutil import shutil
from PyQt4 import QtCore, QtGui 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.lib.ui import UiStrings, critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.core.utils import AppLocation, delete_file 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 BiblesResourcesDB, clean_filename
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
@ -70,8 +69,7 @@ class BibleUpgradeForm(OpenLPWizard):
self.mediaItem = bibleplugin.mediaItem self.mediaItem = bibleplugin.mediaItem
self.suffix = u'.sqlite' self.suffix = u'.sqlite'
self.settingsSection = u'bibles' self.settingsSection = u'bibles'
self.path = AppLocation.get_section_data_path( self.path = AppLocation.get_section_data_path(self.settingsSection)
self.settingsSection)
self.files = self.manager.old_bible_databases self.files = self.manager.old_bible_databases
self.success = {} self.success = {}
self.newbibles = {} self.newbibles = {}
@ -413,7 +411,7 @@ class BibleUpgradeForm(OpenLPWizard):
if not backup_path: if not backup_path:
critical_error_message_box(UiStrings().EmptyField, critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm', translate('BiblesPlugin.UpgradeWizardForm',
'You need to specify a Backup Directory for your ' 'You need to specify a backup directory for your '
'Bibles.')) 'Bibles.'))
self.backupDirectoryEdit.setFocus() self.backupDirectoryEdit.setFocus()
return False return False
@ -520,7 +518,7 @@ class BibleUpgradeForm(OpenLPWizard):
OpenLPWizard.preWizard(self) OpenLPWizard.preWizard(self)
self.progressLabel.setText(translate( self.progressLabel.setText(translate(
'BiblesPlugin.UpgradeWizardForm', 'BiblesPlugin.UpgradeWizardForm',
'Starting Bible upgrade...')) 'Starting upgrade...'))
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
def performWizard(self): def performWizard(self):
@ -532,7 +530,7 @@ class BibleUpgradeForm(OpenLPWizard):
if self.maxBibles == 0: if self.maxBibles == 0:
self.progressLabel.setText( self.progressLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'There are no ' translate('BiblesPlugin.UpgradeWizardForm', 'There are no '
'Bibles available to upgrade.')) 'Bibles that need to be upgraded.'))
self.progressBar.hide() self.progressBar.hide()
return return
self.maxBibles = 0 self.maxBibles = 0

View File

@ -115,7 +115,8 @@ class CSVBible(BibleDB):
if self.stop_import_flag: if self.stop_import_flag:
break break
self.wizard.incrementProgressBar(unicode( self.wizard.incrementProgressBar(unicode(
translate('BibleDB.Wizard', 'Importing books... %s')) % translate('BiblesPlugin.CSVBible',
'Importing books... %s')) %
unicode(line[2], details['encoding'])) unicode(line[2], details['encoding']))
book_ref_id = self.get_book_ref_id_by_name( book_ref_id = self.get_book_ref_id_by_name(
unicode(line[2], details['encoding']), 67, language_id) unicode(line[2], details['encoding']), 67, language_id)
@ -155,7 +156,7 @@ class CSVBible(BibleDB):
book = self.get_book(line_book) book = self.get_book(line_book)
book_ptr = book.name book_ptr = book.name
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(unicode(translate(
'BibleDB.Wizard', 'Importing verses from %s...', 'BiblesPlugin.CSVBible', 'Importing verses from %s...',
'Importing verses from <book name>...')) % book.name) 'Importing verses from <book name>...')) % book.name)
self.session.commit() self.session.commit()
try: try:
@ -163,7 +164,7 @@ class CSVBible(BibleDB):
except UnicodeError: except UnicodeError:
verse_text = unicode(line[3], u'cp1252') verse_text = unicode(line[3], u'cp1252')
self.create_verse(book.id, line[1], line[2], verse_text) 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.')) 'Importing verses... done.'))
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
self.session.commit() self.session.commit()

View File

@ -36,7 +36,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types
from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError 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.db import BaseModel, init_db, Manager
from openlp.core.lib.ui import critical_error_message_box from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation

View File

@ -29,9 +29,7 @@ The :mod:`http` module enables OpenLP to retrieve scripture from bible
websites. websites.
""" """
import logging import logging
import os
import re import re
import sqlite3
import socket import socket
import urllib import urllib
from HTMLParser import HTMLParseError 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 import Receiver, translate
from openlp.core.lib.ui import critical_error_message_box 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 import SearchResults
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \ from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \
Book Book
@ -69,10 +67,10 @@ class BGExtract(object):
``chapter`` ``chapter``
Chapter number. 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) bookname, chapter)
urlbookname = urllib.quote(bookname.encode("utf-8")) 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) version)
cleaner = [(re.compile('&nbsp;|<br />|\'\+\''), lambda match: '')] cleaner = [(re.compile('&nbsp;|<br />|\'\+\''), lambda match: '')]
soup = get_soup_for_bible_ref( soup = get_soup_for_bible_ref(
@ -203,7 +201,7 @@ class BSExtract(object):
``chapter`` ``chapter``
Chapter number 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) bookname, chapter)
urlversion = urllib.quote(version.encode("utf-8")) urlversion = urllib.quote(version.encode("utf-8"))
urlbookname = urllib.quote(bookname.encode("utf-8")) urlbookname = urllib.quote(bookname.encode("utf-8"))
@ -230,7 +228,7 @@ class BSExtract(object):
def get_books_from_http(self, version): 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. website.
``version`` ``version``
@ -276,7 +274,7 @@ class CWExtract(object):
``chapter`` ``chapter``
Chapter number 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) bookname, chapter)
urlbookname = bookname.replace(u' ', u'-') urlbookname = bookname.replace(u' ', u'-')
urlbookname = urlbookname.lower() urlbookname = urlbookname.lower()
@ -389,7 +387,7 @@ class HTTPBible(BibleDB):
""" """
self.wizard.progressBar.setMaximum(68) self.wizard.progressBar.setMaximum(68)
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.HTTPBible', 'BiblesPlugin.HTTPBible',
'Registering Bible and loading books...'))) 'Registering Bible and loading books...')))
self.create_meta(u'download source', self.download_source) self.create_meta(u'download source', self.download_source)
self.create_meta(u'download name', self.download_name) 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.progressBar.setMaximum(len(books)+2)
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.HTTPBible', 'Registering Language...'))) 'BiblesPlugin.HTTPBible', 'Registering Language...')))
bible = BiblesResourcesDB.get_webbible(self.download_name, bible = BiblesResourcesDB.get_webbible(self.download_name,
self.download_source.lower()) self.download_source.lower())
if bible[u'language_id']: if bible[u'language_id']:
language_id = bible[u'language_id'] language_id = bible[u'language_id']
@ -432,14 +430,14 @@ class HTTPBible(BibleDB):
self.wizard.incrementProgressBar(unicode(translate( self.wizard.incrementProgressBar(unicode(translate(
'BiblesPlugin.HTTPBible', 'Importing %s...', 'BiblesPlugin.HTTPBible', 'Importing %s...',
'Importing <book name>...')) % book) 'Importing <book name>...')) % 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) language_id)
if not book_ref_id: if not book_ref_id:
log.exception(u'Importing books from %s - download name: "%s" '\ log.exception(u'Importing books from %s - download name: "%s" '\
'failed' % (self.download_source, self.download_name)) 'failed' % (self.download_source, self.download_name))
return False return False
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) 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']) book, book_ref_id, book_details[u'testament_id'])
self.create_book(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: if self.stop_import_flag:
@ -524,7 +522,7 @@ class HTTPBible(BibleDB):
def get_chapter_count(self, book): def get_chapter_count(self, book):
""" """
Return the number of chapters in a particular book. Return the number of chapters in a particular book.
``book`` ``book``
The book object to get the chapter count for. The book object to get the chapter count for.
""" """
@ -597,14 +595,14 @@ def send_error_message(error_type):
""" """
if error_type == u'download': if error_type == u'download':
critical_error_message_box( critical_error_message_box(
translate('BiblePlugin.HTTPBible', 'Download Error'), translate('BiblesPlugin.HTTPBible', 'Download Error'),
translate('BiblePlugin.HTTPBible', 'There was a ' translate('BiblesPlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your ' 'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur ' 'Internet connection, and if this error continues to occur '
'please consider reporting a bug.')) 'please consider reporting a bug.'))
elif error_type == u'parse': elif error_type == u'parse':
critical_error_message_box( critical_error_message_box(
translate('BiblePlugin.HTTPBible', 'Parse Error'), translate('BiblesPlugin.HTTPBible', 'Parse Error'),
translate('BiblePlugin.HTTPBible', 'There was a ' translate('BiblesPlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error continues ' 'problem extracting your verse selection. If this error continues '
'to occur please consider reporting a bug.')) 'to occur please consider reporting a bug.'))

View File

@ -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.lib.ui import critical_error_message_box
from openlp.core.utils import AppLocation, delete_file from openlp.core.utils import AppLocation, delete_file
from openlp.plugins.bibles.lib import parse_reference 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 csvbible import CSVBible
from http import HTTPBible from http import HTTPBible
from opensong import OpenSongBible from opensong import OpenSongBible

View File

@ -87,7 +87,7 @@ class BibleMediaItem(MediaManagerItem):
not second_bible: not second_bible:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
elif critical_error_message_box( elif critical_error_message_box(
message=translate('BiblePlugin.MediaItem', message=translate('BiblesPlugin.MediaItem',
'You cannot combine single and dual Bible verse search results. ' 'You cannot combine single and dual Bible verse search results. '
'Do you want to delete your search results and start a new ' 'Do you want to delete your search results and start a new '
'search?'), 'search?'),
@ -437,7 +437,7 @@ class BibleMediaItem(MediaManagerItem):
if verse_count == 0: if verse_count == 0:
self.advancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
critical_error_message_box( critical_error_message_box(
message=translate('BiblePlugin.MediaItem', message=translate('BiblesPlugin.MediaItem',
'Bible not fully loaded.')) 'Bible not fully loaded.'))
else: else:
self.advancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
@ -694,8 +694,8 @@ class BibleMediaItem(MediaManagerItem):
verse.verse, verse.verse)) verse.verse, verse.verse))
if passage_not_found: if passage_not_found:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('BiblePlugin.MediaItem', 'Information'), translate('BiblesPlugin.MediaItem', 'Information'),
unicode(translate('BiblePlugin.MediaItem', unicode(translate('BiblesPlugin.MediaItem',
'The second Bible does not contain all the verses ' 'The second Bible does not contain all the verses '
'that are in the main Bible. Only verses found in both ' 'that are in the main Bible. Only verses found in both '
'Bibles will be shown. %d verses have not been ' 'Bibles will be shown. %d verses have not been '

View File

@ -357,7 +357,8 @@ class HttpConnection(object):
if ext == u'.html': if ext == u'.html':
mimetype = u'text/html' mimetype = u'text/html'
variables = self.template_vars 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': elif ext == u'.css':
mimetype = u'text/css' mimetype = u'text/css'
elif ext == u'.js': elif ext == u'.js':

View File

@ -37,6 +37,8 @@ from editversedialog import Ui_EditVerseDialog
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
VERSE_REGEX = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
""" """
This is the form that is used to edit the verses of the song. 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.QObject.connect(self.verseTypeComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onVerseTypeComboBoxChanged) self.onVerseTypeComboBoxChanged)
self.verse_regex = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
def contextMenu(self, point): def contextMenu(self, point):
item = self.serviceManagerList.itemAt(point) item = self.serviceManagerList.itemAt(point)
@ -105,7 +106,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if position == -1: if position == -1:
return return
text = text[:position + 4] text = text[:position + 4]
match = self.verse_regex.match(text) match = VERSE_REGEX.match(text)
if match: if match:
verse_tag = match.group(1) verse_tag = match.group(1)
try: try:
@ -136,7 +137,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if position == -1: if position == -1:
return return
text = text[:position + 4] text = text[:position + 4]
match = self.verse_regex.match(text) match = VERSE_REGEX.match(text)
if match: if match:
verse_type = match.group(1) verse_type = match.group(1)
verse_type_index = VerseType.from_loose_input(verse_type) verse_type_index = VerseType.from_loose_input(verse_type)

View File

@ -29,7 +29,7 @@ The :mod:`db` module provides the database and schema that is the backend for
the Songs plugin 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 sqlalchemy.orm import mapper, relation
from openlp.core.lib.db import BaseModel, init_db from openlp.core.lib.db import BaseModel, init_db

View File

@ -26,13 +26,10 @@
############################################################################### ###############################################################################
import logging import logging
import os
import re import re
from lxml import etree, objectify 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 import VerseType
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport

View File

@ -34,7 +34,6 @@ import struct
import re import re
from openlp.core.lib import translate 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 VerseType
from openlp.plugins.songs.lib import retrieve_windows_encoding from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport

View File

@ -26,9 +26,7 @@
############################################################################### ###############################################################################
import logging import logging
import os
import re import re
from zipfile import ZipFile
from lxml import objectify from lxml import objectify
from lxml.etree import Error, LxmlError from lxml.etree import Error, LxmlError
@ -110,48 +108,13 @@ class OpenSongImport(SongImport):
SongImport.__init__(self, manager, **kwargs) SongImport.__init__(self, manager, **kwargs)
def do_import(self): def do_import(self):
""" self.import_wizard.progressBar.setMaximum(len(self.import_source))
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)
for filename in self.import_source: for filename in self.import_source:
if self.stop_import_flag: if self.stop_import_flag:
return return
ext = os.path.splitext(filename)[1] song_file = open(filename)
if ext.lower() == u'.zip': self.do_import_file(song_file)
log.debug(u'Zipfile found %s', filename) song_file.close()
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()
def do_import_file(self, file): def do_import_file(self, file):
""" """

View File

@ -36,7 +36,6 @@ import re
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
from openlp.plugins.songs.lib.ui import SongStrings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -29,9 +29,8 @@ import re
from PyQt4 import QtCore 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.ui.wizard import WizardStrings
from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib import clean_song, VerseType 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.db import Song, Author, Topic, Book, MediaFile
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings

View File

@ -31,7 +31,6 @@ Worship songs into the OpenLP database.
import os import os
import logging import logging
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
BLOCK_TYPES = (u'V', u'C', u'B') BLOCK_TYPES = (u'V', u'C', u'B')

View File

@ -73,6 +73,8 @@ from openlp.core.utils import get_application_version
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
CHORD_REGEX = re.compile(u'<chord name=".*?"/>')
class SongXML(object): class SongXML(object):
""" """
This class builds and parses the XML used to describe songs. This class builds and parses the XML used to describe songs.
@ -234,7 +236,6 @@ class OpenLyrics(object):
IMPLEMENTED_VERSION = u'0.7' IMPLEMENTED_VERSION = u'0.7'
def __init__(self, manager): def __init__(self, manager):
self.manager = manager self.manager = manager
self.chord_regex = re.compile(u'<chord name=".*?"/>')
def song_to_xml(self, song): def song_to_xml(self, song):
""" """
@ -319,7 +320,7 @@ class OpenLyrics(object):
if xml[:5] == u'<?xml': if xml[:5] == u'<?xml':
xml = xml[38:] xml = xml[38:]
# Remove chords from xml. # Remove chords from xml.
xml = self.chord_regex.sub(u'', xml) xml = CHORD_REGEX.sub(u'', xml)
song_xml = objectify.fromstring(xml) song_xml = objectify.fromstring(xml)
if hasattr(song_xml, u'properties'): if hasattr(song_xml, u'properties'):
properties = song_xml.properties properties = song_xml.properties

View File

@ -33,7 +33,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \ from openlp.core.lib import Plugin, StringContent, Receiver, build_icon, \
translate translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.core.lib.ui import base_action, shortcut_action, UiStrings from openlp.core.lib.ui import base_action, shortcut_action
from openlp.core.utils.actions import ActionList from openlp.core.utils.actions import ActionList
from openlp.plugins.songusage.forms import SongUsageDetailForm, \ from openlp.plugins.songusage.forms import SongUsageDetailForm, \
SongUsageDeleteForm SongUsageDeleteForm

View File

@ -5,7 +5,12 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2011 Raoul Snyman # # Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, #
# Armin Köhler, Joshua Millar, Stevan Pettit, Andreas Preikschat, Mattias #
# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -74,44 +79,38 @@ OPTIONAL_MODULES = [
('sqlite', ' (SQLite 2 support)'), ('sqlite', ' (SQLite 2 support)'),
('MySQLdb', ' (MySQL support)'), ('MySQLdb', ' (MySQL support)'),
('psycopg2', ' (PostgreSQL support)'), ('psycopg2', ' (PostgreSQL support)'),
] ]
w = sys.stdout.write w = sys.stdout.write
def check_vers(version, required, text): def check_vers(version, required, text):
if type(version) is str: if type(version) is str:
version = version.split('.') version = version.split('.')
version = [int(x) for x in version] version = map(int, version)
if type(required) is str: if type(required) is str:
required = required.split('.') required = required.split('.')
required = [int(x) for x in required] required = map(int, required)
w(' %s >= %s ... ' % (text, '.'.join([str(x) for x in required]))) w(' %s >= %s ... ' % (text, '.'.join(map(str, required))))
if version >= required: if version >= required:
w('.'.join([str(x) for x in version]) + os.linesep) w('.'.join(map(str, version)) + os.linesep)
return True return True
else: else:
w('FAIL' + os.linesep) w('FAIL' + os.linesep)
return False return False
def print_vers_fail(required, text): def print_vers_fail(required, text):
print(' %s >= %s ... FAIL' % (text, required)) print(' %s >= %s ... FAIL' % (text, required))
def verify_python(): def verify_python():
if not check_vers(list(sys.version_info), VERS['Python'], text='Python'): if not check_vers(list(sys.version_info), VERS['Python'], text='Python'):
exit(1) exit(1)
def verify_versions(): def verify_versions():
print('Verifying version of modules...') print('Verifying version of modules...')
try: try:
from PyQt4 import QtCore from PyQt4 import QtCore
check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], check_vers(QtCore.PYQT_VERSION_STR, VERS['PyQt4'], 'PyQt4')
'PyQt4') check_vers(QtCore.qVersion(), VERS['Qt4'], 'Qt4')
check_vers(QtCore.qVersion(), VERS['Qt4'],
'Qt4')
except ImportError: except ImportError:
print_vers_fail(VERS['PyQt4'], 'PyQt4') print_vers_fail(VERS['PyQt4'], 'PyQt4')
print_vers_fail(VERS['Qt4'], 'Qt4') print_vers_fail(VERS['Qt4'], 'Qt4')
@ -126,7 +125,6 @@ def verify_versions():
except ImportError: except ImportError:
print_vers_fail(VERS['enchant'], 'enchant') print_vers_fail(VERS['enchant'], 'enchant')
def check_module(mod, text='', indent=' '): def check_module(mod, text='', indent=' '):
space = (30 - len(mod) - len(text)) * ' ' space = (30 - len(mod) - len(text)) * ' '
w(indent + '%s%s... ' % (mod, text) + space) w(indent + '%s%s... ' % (mod, text) + space)
@ -137,7 +135,6 @@ def check_module(mod, text='', indent=' '):
w('FAIL') w('FAIL')
w(os.linesep) w(os.linesep)
def verify_pyenchant(): def verify_pyenchant():
w('Enchant (spell checker)... ') w('Enchant (spell checker)... ')
try: try:
@ -150,14 +147,13 @@ def verify_pyenchant():
except ImportError: except ImportError:
w('FAIL' + os.linesep) w('FAIL' + os.linesep)
def verify_pyqt(): def verify_pyqt():
w('Qt4 image formats... ') w('Qt4 image formats... ')
try: try:
from PyQt4 import QtGui from PyQt4 import QtGui
read_f = ', '.join([unicode(format).lower() \ read_f = ', '.join([unicode(format).lower()
for format in QtGui.QImageReader.supportedImageFormats()]) for format in QtGui.QImageReader.supportedImageFormats()])
write_f= ', '.join([unicode(format).lower() \ write_f = ', '.join([unicode(format).lower()
for format in QtGui.QImageWriter.supportedImageFormats()]) for format in QtGui.QImageWriter.supportedImageFormats()])
w(os.linesep) w(os.linesep)
print(' read: %s' % read_f) print(' read: %s' % read_f)
@ -165,9 +161,7 @@ def verify_pyqt():
except ImportError: except ImportError:
w('FAIL' + os.linesep) w('FAIL' + os.linesep)
def main(): def main():
verify_python() verify_python()
print('Checking for modules...') print('Checking for modules...')
@ -187,6 +181,5 @@ def main():
verify_pyqt() verify_pyqt()
verify_pyenchant() verify_pyenchant()
if __name__ == u'__main__': if __name__ == u'__main__':
main() main()

View File

@ -46,12 +46,6 @@ PyEnchant
Inno Setup 5 Inno Setup 5
Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5" Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5"
UPX
This is used to compress DLLs and EXEs so that they take up less space, but
still function exactly the same. To install UPX, download it from
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable.
Sphinx Sphinx
This is used to build the documentation. The documentation trunk must be at This is used to build the documentation. The documentation trunk must be at
the same directory level as Openlp trunk and named "documentation" the same directory level as Openlp trunk and named "documentation"
@ -179,6 +173,7 @@ def run_pyinstaller():
pyinstaller = Popen((python_exe, pyi_build, pyinstaller = Popen((python_exe, pyi_build,
u'--noconfirm', u'--noconfirm',
u'--windowed', u'--windowed',
u'--noupx',
u'-o', branch_path, u'-o', branch_path,
u'-i', win32_icon, u'-i', win32_icon,
u'-p', branch_path, u'-p', branch_path,