forked from openlp/openlp
Head
This commit is contained in:
commit
33f49f7d4a
|
@ -38,63 +38,48 @@ log = logging.getLogger(__name__)
|
|||
# TODO make external and configurable in alpha 4 via a settings dialog
|
||||
html_expands = []
|
||||
|
||||
html_expands.append({u'desc':u'Red', u'start tag':u'{r}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:red">', \
|
||||
u'end tag':u'{/r}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Black', u'start tag':u'{b}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:black">', \
|
||||
u'end tag':u'{/b}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:blue">', \
|
||||
u'end tag':u'{/bl}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:yellow">', \
|
||||
u'end tag':u'{/y}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Green', u'start tag':u'{g}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:green">', \
|
||||
u'end tag':u'{/g}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#CC33CC">', \
|
||||
u'end tag':u'{/pk}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#CC0033">', \
|
||||
u'end tag':u'{/o}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#9900FF">', \
|
||||
u'end tag':u'{/pp}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'White', u'start tag':u'{w}', \
|
||||
u'start html':u'<span style="-webkit-text-fill-color:white">', \
|
||||
u'end tag':u'{/w}', u'end html':u'</span>', \
|
||||
u'protected':False})
|
||||
html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', \
|
||||
u'start html':u'<sup>', \
|
||||
u'end tag':u'{/su}', u'end html':u'</sup>', \
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', \
|
||||
u'start html':u'<sub>', \
|
||||
u'end tag':u'{/sb}', u'end html':u'</sub>', \
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', \
|
||||
u'start html':u'<p>', \
|
||||
u'end tag':u'{/p}', u'end html':u'</p>', \
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', \
|
||||
u'start html':u'<strong>', \
|
||||
u'end tag':u'{/st}', \
|
||||
u'end html':u'</strong>', \
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', \
|
||||
u'start html':u'<em>', \
|
||||
u'end tag':u'{/it}', u'end html':u'</em>', \
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Red', u'start tag':u'{r}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:red">',
|
||||
u'end tag':u'{/r}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Black', u'start tag':u'{b}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:black">',
|
||||
u'end tag':u'{/b}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:blue">',
|
||||
u'end tag':u'{/bl}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:yellow">',
|
||||
u'end tag':u'{/y}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Green', u'start tag':u'{g}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:green">',
|
||||
u'end tag':u'{/g}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#CC33CC">',
|
||||
u'end tag':u'{/pk}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Orange', u'start tag':u'{o}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#CC0033">',
|
||||
u'end tag':u'{/o}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:#9900FF">',
|
||||
u'end tag':u'{/pp}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'White', u'start tag':u'{w}',
|
||||
u'start html':u'<span style="-webkit-text-fill-color:white">',
|
||||
u'end tag':u'{/w}', u'end html':u'</span>', u'protected':False})
|
||||
html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}',
|
||||
u'start html':u'<sup>', u'end tag':u'{/su}', u'end html':u'</sup>',
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}',
|
||||
u'start html':u'<sub>', u'end tag':u'{/sb}', u'end html':u'</sub>',
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}',
|
||||
u'start html':u'<p>', u'end tag':u'{/p}', u'end html':u'</p>',
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Bold', u'start tag':u'{st}',
|
||||
u'start html':u'<strong>', u'end tag':u'{/st}', u'end html':u'</strong>',
|
||||
u'protected':True})
|
||||
html_expands.append({u'desc':u'Italics', u'start tag':u'{it}',
|
||||
u'start html':u'<em>', u'end tag':u'{/it}', u'end html':u'</em>',
|
||||
u'protected':True})
|
||||
|
||||
def translate(context, text, comment=None):
|
||||
"""
|
||||
|
|
|
@ -422,7 +422,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
raise NotImplementedError(u'MediaManagerItem.onDeleteClick needs to '
|
||||
u'be defined by the plugin')
|
||||
|
||||
def generateSlideData(self, service_item, item):
|
||||
def generateSlideData(self, service_item, item=None):
|
||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
|
||||
u'to be defined by the plugin')
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ class MainDisplay(DisplayWidget):
|
|||
self.setScene(self.scene)
|
||||
self.webView = QtWebKit.QGraphicsWebView()
|
||||
self.scene.addItem(self.webView)
|
||||
self.webView.resize(self.screen[u'size'].width(), \
|
||||
self.webView.resize(self.screen[u'size'].width(),
|
||||
self.screen[u'size'].height())
|
||||
self.page = self.webView.page()
|
||||
self.frame = self.page.mainFrame()
|
||||
|
@ -303,6 +303,9 @@ class MainDisplay(DisplayWidget):
|
|||
Generates a preview of the image displayed.
|
||||
"""
|
||||
log.debug(u'preview for %s', self.isLive)
|
||||
# We must have a service item to preview
|
||||
if not hasattr(self, u'serviceItem'):
|
||||
return
|
||||
if self.isLive:
|
||||
# Wait for the fade to finish before geting the preview.
|
||||
# Important otherwise preview will have incorrect text if at all !
|
||||
|
@ -336,7 +339,7 @@ class MainDisplay(DisplayWidget):
|
|||
self.loaded = False
|
||||
self.initialFrame = False
|
||||
self.serviceItem = serviceItem
|
||||
html = build_html(self.serviceItem, self.screen, self.parent.alertTab,\
|
||||
html = build_html(self.serviceItem, self.screen, self.parent.alertTab,
|
||||
self.isLive)
|
||||
self.webView.setHtml(html)
|
||||
if serviceItem.foot_text and serviceItem.foot_text:
|
||||
|
|
|
@ -279,7 +279,8 @@ class ServiceManager(QtGui.QWidget):
|
|||
self.editAction.setVisible(False)
|
||||
self.maintainAction.setVisible(False)
|
||||
self.notesAction.setVisible(False)
|
||||
if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit):
|
||||
if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit) \
|
||||
and hasattr(serviceItem[u'service_item'], u'editId'):
|
||||
self.editAction.setVisible(True)
|
||||
if serviceItem[u'service_item']\
|
||||
.is_capable(ItemCapabilities.AllowsMaintain):
|
||||
|
|
|
@ -113,7 +113,7 @@ class AppLocation(object):
|
|||
"""
|
||||
if dir_type == AppLocation.AppDir:
|
||||
if hasattr(sys, u'frozen') and sys.frozen == 1:
|
||||
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
|
||||
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
|
||||
else:
|
||||
app_path = os.path.split(openlp.__file__)[0]
|
||||
return app_path
|
||||
|
|
|
@ -676,7 +676,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||
self.dual_search_results[count].text)
|
||||
}
|
||||
bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name,
|
||||
verse.chapter, verse.verse, version.value, dual_version.value)
|
||||
verse.chapter, verse.verse, version.value,
|
||||
dual_version.value)
|
||||
else:
|
||||
vdict = {
|
||||
'book': QtCore.QVariant(verse.book.name),
|
||||
|
|
|
@ -89,7 +89,7 @@ class OpenSongBible(BibleDB):
|
|||
Receiver.send_message(u'openlp_process_events')
|
||||
self.wizard.incrementProgressBar(
|
||||
QtCore.QString('%s %s %s' % (
|
||||
translate('BiblesPlugin.Opensong', 'Importing'), \
|
||||
translate('BiblesPlugin.Opensong', 'Importing'),
|
||||
db_book.name, chapter.attrib[u'n'])))
|
||||
self.session.commit()
|
||||
except IOError:
|
||||
|
|
|
@ -57,7 +57,7 @@ class CCLIFileImport(SongImport):
|
|||
self.filenames = kwargs[u'filenames']
|
||||
log.debug(self.filenames)
|
||||
else:
|
||||
raise KeyError(u'Keyword argument "filenames" not supplied.')
|
||||
raise KeyError(u'Keyword argument "filenames" not supplied.')
|
||||
|
||||
def do_import(self):
|
||||
"""
|
||||
|
@ -66,11 +66,11 @@ class CCLIFileImport(SongImport):
|
|||
log.debug(u'Starting CCLI File Import')
|
||||
song_total = len(self.filenames)
|
||||
self.import_wizard.importProgressBar.setMaximum(song_total)
|
||||
song_count = 1
|
||||
song_count = 1
|
||||
for filename in self.filenames:
|
||||
self.import_wizard.incrementProgressBar(
|
||||
u'Importing song %s of %s' % (song_count, song_total))
|
||||
filename = unicode(filename)
|
||||
u'Importing song %s of %s' % (song_count, song_total))
|
||||
filename = unicode(filename)
|
||||
log.debug(u'Importing CCLI File: %s', filename)
|
||||
lines = []
|
||||
if os.path.isfile(filename):
|
||||
|
@ -81,33 +81,34 @@ class CCLIFileImport(SongImport):
|
|||
lines = infile.readlines()
|
||||
ext = os.path.splitext(filename)[1]
|
||||
if ext.lower() == ".usr":
|
||||
log.info(u'SongSelect .usr format file found %s: ' , filename)
|
||||
log.info(u'SongSelect .usr format file found %s: ',
|
||||
filename)
|
||||
self.do_import_usr_file(lines)
|
||||
elif ext.lower() == ".txt":
|
||||
log.info(u'SongSelect .txt format file found %s: ', filename)
|
||||
log.info(u'SongSelect .txt format file found %s: ',
|
||||
filename)
|
||||
self.do_import_txt_file(lines)
|
||||
else:
|
||||
log.info(u'Extension %s is not valid', filename)
|
||||
pass
|
||||
song_count += 1
|
||||
if self.stop_import_flag:
|
||||
return False
|
||||
return False
|
||||
return True
|
||||
|
||||
def do_import_usr_file(self, textList):
|
||||
"""
|
||||
The :method:`do_import_usr_file` method provides OpenLP
|
||||
with the ability to import CCLI SongSelect songs in
|
||||
*USR* file format
|
||||
|
||||
*USR* file format
|
||||
|
||||
``textList``
|
||||
An array of strings containing the usr file content.
|
||||
|
||||
|
||||
**SongSelect .usr file format**
|
||||
``[File]``
|
||||
USR file format first line
|
||||
``Type=``
|
||||
Indicates the file type
|
||||
Indicates the file type
|
||||
e.g. *Type=SongSelect Import File*
|
||||
``Version=3.0``
|
||||
File format version
|
||||
|
@ -116,7 +117,7 @@ class CCLIFileImport(SongImport):
|
|||
``Title=``
|
||||
Contains the song title (e.g. *Title=Above All*)
|
||||
``Author=``
|
||||
Contains a | delimited list of the song authors
|
||||
Contains a | delimited list of the song authors
|
||||
e.g. *Author=LeBlanc, Lenny | Baloche, Paul*
|
||||
``Copyright=``
|
||||
Contains a | delimited list of the song copyrights
|
||||
|
@ -136,7 +137,7 @@ class CCLIFileImport(SongImport):
|
|||
Contains a list of the songs fields in order /t delimited
|
||||
e.g. *Fields=Vers 1/tVers 2/tChorus 1/tAndere 1*
|
||||
``Words=``
|
||||
Contains the songs various lyrics in order as shown by the
|
||||
Contains the songs various lyrics in order as shown by the
|
||||
*Fields* description
|
||||
e.g. *Words=Above all powers....* [/n = CR, /n/t = CRLF]
|
||||
"""
|
||||
|
@ -174,8 +175,8 @@ class CCLIFileImport(SongImport):
|
|||
verse_type = u'O'
|
||||
verse_text = unicode(words_list[counter])
|
||||
verse_text = verse_text.replace("/n", "\n")
|
||||
if len(verse_text) > 0:
|
||||
self.add_verse(verse_text, verse_type);
|
||||
if len(verse_text) > 0:
|
||||
self.add_verse(verse_text, verse_type)
|
||||
#Handle multiple authors
|
||||
author_list = song_author.split(u'/')
|
||||
if len(author_list) < 2:
|
||||
|
@ -192,10 +193,10 @@ class CCLIFileImport(SongImport):
|
|||
"""
|
||||
The :method:`do_import_txt_file` method provides OpenLP
|
||||
with the ability to import CCLI SongSelect songs in
|
||||
*TXT* file format
|
||||
|
||||
*TXT* file format
|
||||
|
||||
``textList``
|
||||
An array of strings containing the txt file content.
|
||||
An array of strings containing the txt file content.
|
||||
|
||||
**SongSelect .txt file format**
|
||||
|
||||
|
@ -225,38 +226,38 @@ class CCLIFileImport(SongImport):
|
|||
e.g. CCLI Number (e.g.CCLI-Liednummer: 2672885)
|
||||
``Song Copyright``
|
||||
e.g. © 1999 Integrity's Hosanna! Music | LenSongs Publishing
|
||||
``Song Authors``
|
||||
``Song Authors``
|
||||
e.g. Lenny LeBlanc | Paul Baloche
|
||||
``Licencing info``
|
||||
e.g. For use solely with the SongSelect Terms of Use.
|
||||
e.g. For use solely with the SongSelect Terms of Use.
|
||||
All rights Reserved. www.ccli.com
|
||||
``CCLI Licence number of user``
|
||||
e.g. CCL-Liedlizenznummer: 14 / CCLI License No. 14
|
||||
``CCLI Licence number of user``
|
||||
e.g. CCL-Liedlizenznummer: 14 / CCLI License No. 14
|
||||
"""
|
||||
log.debug(u'TXT file text: %s', textList)
|
||||
self.set_defaults()
|
||||
line_number = 0
|
||||
verse_text = u''
|
||||
song_comments = u''
|
||||
song_copyright = u'';
|
||||
song_copyright = u''
|
||||
verse_start = False
|
||||
for line in textList:
|
||||
clean_line = line.strip()
|
||||
if not clean_line:
|
||||
if line_number==0:
|
||||
if line_number == 0:
|
||||
continue
|
||||
elif verse_start:
|
||||
if verse_text:
|
||||
if verse_text:
|
||||
self.add_verse(verse_text, verse_type)
|
||||
verse_text = ''
|
||||
verse_start = False
|
||||
else:
|
||||
#line_number=0, song title
|
||||
if line_number==0:
|
||||
if line_number == 0:
|
||||
song_name = clean_line
|
||||
line_number += 1
|
||||
#line_number=1, verses
|
||||
elif line_number==1:
|
||||
#line_number=1, verses
|
||||
elif line_number == 1:
|
||||
#line_number=1, ccli number, first line after verses
|
||||
if clean_line.startswith(u'CCLI'):
|
||||
line_number += 1
|
||||
|
@ -285,15 +286,16 @@ class CCLIFileImport(SongImport):
|
|||
verse_text = verse_text + line
|
||||
else:
|
||||
#line_number=2, copyright
|
||||
if line_number==2:
|
||||
if line_number == 2:
|
||||
line_number += 1
|
||||
song_copyright = clean_line
|
||||
#n=3, authors
|
||||
elif line_number==3:
|
||||
#n=3, authors
|
||||
elif line_number == 3:
|
||||
line_number += 1
|
||||
song_author = clean_line
|
||||
#line_number=4, comments lines before last line
|
||||
elif (line_number==4) and (not clean_line.startswith(u'CCL')):
|
||||
#line_number=4, comments lines before last line
|
||||
elif (line_number == 4) and \
|
||||
(not clean_line.startswith(u'CCL')):
|
||||
song_comments = song_comments + clean_line
|
||||
# split on known separators
|
||||
author_list = song_author.split(u'/')
|
||||
|
@ -307,4 +309,3 @@ class CCLIFileImport(SongImport):
|
|||
self.ccli_number = song_ccli
|
||||
self.comments = song_comments
|
||||
self.finish()
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import logging
|
|||
import chardet
|
||||
try:
|
||||
import sqlite
|
||||
except:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from openlp.core.lib import translate
|
||||
|
@ -93,9 +93,9 @@ class OpenLP1SongImport(SongImport):
|
|||
cursor.execute(u'SELECT authorid, authorname FROM authors')
|
||||
authors = cursor.fetchall()
|
||||
if new_db:
|
||||
# "cache" our list of tracks
|
||||
cursor.execute(u'SELECT trackid, fulltrackname FROM tracks')
|
||||
tracks = cursor.fetchall()
|
||||
# "cache" our list of tracks
|
||||
cursor.execute(u'SELECT trackid, fulltrackname FROM tracks')
|
||||
tracks = cursor.fetchall()
|
||||
# Import the songs
|
||||
cursor.execute(u'SELECT songid, songtitle, lyrics || \'\' AS lyrics, '
|
||||
u'copyrightinfo FROM songs')
|
||||
|
|
|
@ -30,6 +30,7 @@ from zipfile import ZipFile
|
|||
from lxml import objectify
|
||||
from lxml.etree import Error, LxmlError
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.plugins.songs.lib.songimport import SongImport
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -170,7 +171,7 @@ class OpenSongImport(SongImport):
|
|||
self.authors = []
|
||||
try:
|
||||
tree = objectify.parse(file)
|
||||
except Error, LxmlError:
|
||||
except (Error, LxmlError):
|
||||
log.exception(u'Error parsing XML')
|
||||
return
|
||||
root = tree.getroot()
|
||||
|
@ -276,7 +277,8 @@ class OpenSongImport(SongImport):
|
|||
if len(our_verse_order) > 0:
|
||||
order = our_verse_order
|
||||
else:
|
||||
log.warn(u'No verse order available for %s, skipping.', self.title)
|
||||
log.warn(u'No verse order available for %s, skipping.',
|
||||
self.title)
|
||||
for tag in order:
|
||||
if len(tag) == 1:
|
||||
tag = tag + u'1' # Assume it's no.1 if it's not there
|
||||
|
|
|
@ -119,7 +119,7 @@ class WowImport(SongImport):
|
|||
# TODO: check that it is a valid words of worship file (could
|
||||
# check header for WoW File Song Word)
|
||||
self.author = u''
|
||||
self.copyright= u''
|
||||
self.copyright = u''
|
||||
# Get the song title
|
||||
self.file_name = os.path.split(file)[1]
|
||||
self.import_wizard.incrementProgressBar(
|
||||
|
|
Loading…
Reference in New Issue