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 logging
from openlp.core.lib import Plugin, StringContent, PluginStatus
from openlp.core.lib import Plugin, PluginStatus
log = logging.getLogger(__name__)

View File

@ -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__)

View File

@ -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')

View File

@ -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__)

View File

@ -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):

View File

@ -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'))

View File

@ -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):

View File

@ -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):
"""

View File

@ -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

View File

@ -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'),

View File

@ -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, ScreenList
from openlp.core.utils.actions import ActionList, CategoryOrder

View File

@ -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'

View File

@ -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']

View File

@ -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', '<strong>Alerts Plugin</strong>'
'<br />The alert plugin controls the displaying of nursery alerts '
'on the display screen')
'on the display screen.')
return about_text
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.
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:

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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>...')) % 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()

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.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

View File

@ -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('&nbsp;|<br />|\'\+\''), 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 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)
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.'))

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.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

View File

@ -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 '

View File

@ -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':

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):
"""

View File

@ -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__)

View File

@ -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

View File

@ -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')

View File

@ -73,6 +73,8 @@ from openlp.core.utils import get_application_version
log = logging.getLogger(__name__)
CHORD_REGEX = re.compile(u'<chord name=".*?"/>')
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'<chord name=".*?"/>')
def song_to_xml(self, song):
"""
@ -319,7 +320,7 @@ class OpenLyrics(object):
if xml[:5] == u'<?xml':
xml = xml[38:]
# Remove chords from xml.
xml = self.chord_regex.sub(u'', xml)
xml = CHORD_REGEX.sub(u'', xml)
song_xml = objectify.fromstring(xml)
if hasattr(song_xml, u'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, \
translate
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.plugins.songusage.forms import SongUsageDetailForm, \
SongUsageDeleteForm

View File

@ -5,7 +5,12 @@
###############################################################################
# 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 #
# under the terms of the GNU General Public License as published by the Free #
@ -74,44 +79,38 @@ OPTIONAL_MODULES = [
('sqlite', ' (SQLite 2 support)'),
('MySQLdb', ' (MySQL support)'),
('psycopg2', ' (PostgreSQL support)'),
]
]
w = sys.stdout.write
def check_vers(version, required, text):
if type(version) is str:
version = version.split('.')
version = [int(x) for x in version]
version = map(int, version)
if type(required) is str:
required = required.split('.')
required = [int(x) for x in required]
w(' %s >= %s ... ' % (text, '.'.join([str(x) for x in required])))
required = map(int, required)
w(' %s >= %s ... ' % (text, '.'.join(map(str, required))))
if version >= required:
w('.'.join([str(x) for x in version]) + os.linesep)
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')
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')
@ -126,7 +125,6 @@ def verify_versions():
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)
@ -137,7 +135,6 @@ def check_module(mod, text='', indent=' '):
w('FAIL')
w(os.linesep)
def verify_pyenchant():
w('Enchant (spell checker)... ')
try:
@ -150,14 +147,13 @@ def verify_pyenchant():
except ImportError:
w('FAIL' + os.linesep)
def verify_pyqt():
w('Qt4 image formats... ')
try:
from PyQt4 import QtGui
read_f = ', '.join([unicode(format).lower() \
read_f = ', '.join([unicode(format).lower()
for format in QtGui.QImageReader.supportedImageFormats()])
write_f= ', '.join([unicode(format).lower() \
write_f = ', '.join([unicode(format).lower()
for format in QtGui.QImageWriter.supportedImageFormats()])
w(os.linesep)
print(' read: %s' % read_f)
@ -165,9 +161,7 @@ def verify_pyqt():
except ImportError:
w('FAIL' + os.linesep)
def main():
verify_python()
print('Checking for modules...')
@ -187,6 +181,5 @@ def main():
verify_pyqt()
verify_pyenchant()
if __name__ == u'__main__':
main()

View File

@ -46,12 +46,6 @@ PyEnchant
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
This is used to build the documentation. The documentation trunk must be at
the same directory level as Openlp trunk and named "documentation"
@ -179,6 +173,7 @@ def run_pyinstaller():
pyinstaller = Popen((python_exe, pyi_build,
u'--noconfirm',
u'--windowed',
u'--noupx',
u'-o', branch_path,
u'-i', win32_icon,
u'-p', branch_path,