forked from openlp/openlp
r1690
This commit is contained in:
commit
7483c8dfe8
@ -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__)
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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
|
||||
|
@ -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'),
|
||||
|
@ -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
|
||||
|
@ -459,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.
|
||||
@ -510,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']
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -38,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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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':
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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 #
|
||||
|
Loading…
Reference in New Issue
Block a user