This commit is contained in:
rimach 2010-09-23 19:12:04 +02:00
commit ef6845dad8
16 changed files with 336 additions and 216 deletions

View File

@ -58,7 +58,10 @@ body {
#image {
z-index:1;
}
#video {
#video1 {
z-index:2;
}
#video2 {
z-index:2;
}
#alert {
@ -80,54 +83,12 @@ body {
<script language="javascript">
var timer = null;
var video_timer = null;
var current_video = '1';
var transition = %s;
function show_video(state, path, volume, loop){
var vid = document.getElementById('video');
if(path != null){
vid.src = path;
vid.load();
}
if(volume != null){
vid.volume = volume;
}
switch(state){
case 'play':
vid.play();
vid.style.display = 'block';
if(loop)
video_timer = setInterval('video_loop()', 200);
break;
case 'pause':
if(video_timer!=null){
clearInterval(video_timer);
video_timer = null;
}
vid.pause();
vid.style.display = 'block';
break;
case 'stop':
if(video_timer!=null){
clearInterval(video_timer);
video_timer = null;
}
vid.pause();
vid.style.display = 'none';
vid.load();
break;
case 'close':
if(video_timer!=null){
clearInterval(video_timer);
video_timer = null;
}
vid.pause();
vid.style.display = 'none';
vid.src = '';
break;
}
}
function video_loop(){
// The preferred method would be to use the video tag loop attribute
// Note, the preferred method for looping would be to use the
// video tag loop attribute.
// But QtWebKit doesn't support this. Neither does it support the
// onended event, hence the setInterval()
// In addition, setting the currentTime attribute to zero to restart
@ -138,12 +99,73 @@ body {
// Note, currently the background may go black between loops. Not
// desirable. Need to investigate using two <video>'s, and hiding/
// preloading one, and toggle between the two when looping.
var vid = document.getElementById('video');
if(vid.ended||vid.currentTime+0.2>=vid.duration){
vid.load();
vid.play();
}
if(current_video=='1'){
var vid = document.getElementById('video1');
var vid2 = document.getElementById('video2');
} else {
var vid = document.getElementById('video2');
var vid2 = document.getElementById('video1');
}
if(volume != null){
vid.volume = volume;
vid2.volume = volume;
}
switch(state){
case 'init':
vid.src = path;
vid2.src = path;
if(loop == null) loop = false;
vid.looping = loop;
vid2.looping = loop;
vid.load();
break;
case 'load':
vid2.style.visibility = 'hidden';
vid2.load();
break;
case 'play':
vid.play();
vid.style.visibility = 'visible';
if(vid.looping){
video_timer = setInterval(
function() {
show_video('poll');
}, 200);
}
break;
case 'pause':
if(video_timer!=null){
clearInterval(video_timer);
video_timer = null;
}
vid.pause();
break;
case 'stop':
show_video('pause');
vid.style.visibility = 'hidden';
break;
case 'poll':
if(vid.ended||vid.currentTime+0.2>vid.duration)
show_video('swap');
break;
case 'swap':
show_video('pause');
if(current_video=='1')
current_video = '2';
else
current_video = '1';
show_video('play');
show_video('load');
break;
case 'close':
show_video('stop');
vid.src = '';
vid2.src = '';
break;
}
}
function show_image(src){
var img = document.getElementById('image');
img.src = src;
@ -273,7 +295,10 @@ body {
</head>
<body>
<img id="image" class="size" %s />
<video id="video" class="size"></video>
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
</video>
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
</video>
%s
<div id="footer" class="footer"></div>
<div id="black" class="size"></div>
@ -424,8 +449,10 @@ def build_lyrics_css(item, webkitvers):
outline = build_lyrics_outline_css(theme)
if theme.display_shadow:
if theme.display_outline and webkitvers < 534.3:
shadow = u'padding-left: %spx; padding-top: %spx ' % \
(theme.display_shadow_size, theme.display_shadow_size)
shadow = u'padding-left: %spx; padding-top: %spx;' % \
(int(theme.display_shadow_size) +
(int(theme.display_outline_size) * 2),
theme.display_shadow_size)
shadow += build_lyrics_outline_css(theme, True)
else:
lyricsmain += u' text-shadow: %s %spx %spx;' % \
@ -485,13 +512,17 @@ def build_lyrics_format_css(theme, width, height):
valign = u'middle'
else:
valign = u'top'
if theme.display_outline:
left_margin = int(theme.display_outline_size) * 2
else:
left_margin = 0
lyrics = u'white-space:pre-wrap; word-wrap: break-word; ' \
'text-align: %s; vertical-align: %s; font-family: %s; ' \
'font-size: %spt; color: %s; line-height: %d%%; ' \
'margin:0; padding:0; width: %spx; height: %spx; ' % \
'font-size: %spt; color: %s; line-height: %d%%; margin:0;' \
'padding:0; padding-left:%spx; width: %spx; height: %spx; ' % \
(align, valign, theme.font_main_name, theme.font_main_proportion,
theme.font_main_color, 100 + int(theme.font_main_line_adjustment),
width, height)
left_margin, width, height)
if theme.display_outline:
if webkit_version() < 534.3:
lyrics += u' letter-spacing: 1px;'

View File

@ -87,7 +87,7 @@ class Renderer(object):
"""
log.debug(u'set_text_rectangle %s , %s' % (rect_main, rect_footer))
self._rect = rect_main
self._rect_footer = rect_footer
self._rect_footer = rect_footer
self.page_width = self._rect.width()
self.page_height = self._rect.height()
if self._theme.display_shadow:
@ -102,7 +102,7 @@ class Renderer(object):
u'*{margin: 0; padding: 0; border: 0;} '\
u'#main {position:absolute; top:0px; %s %s}</style><body>' \
u'<div id="main">' % \
(build_lyrics_format_css(self._theme, self.page_width,
(build_lyrics_format_css(self._theme, self.page_width,
self.page_height), build_lyrics_outline_css(self._theme))
def set_frame_dest(self, frame_width, frame_height):
@ -125,7 +125,7 @@ class Renderer(object):
self.frame.width(), self.frame.height())
if self._theme.background_type == u'image':
self.bg_frame = QtGui.QImage(self.frame.width(),
self.frame.height(),
self.frame.height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
painter = QtGui.QPainter()
painter.begin(self.bg_frame)

View File

@ -28,6 +28,7 @@ import re
import sys
try:
import enchant
from enchant import DictNotFoundError
enchant_available = True
except ImportError:
enchant_available = False
@ -43,7 +44,10 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
QtGui.QPlainTextEdit.__init__(self, *args)
# Default dictionary based on the current locale.
if enchant_available:
self.dict = enchant.Dict()
try:
self.dict = enchant.Dict()
except DictNotFoundError:
self.dict = enchant.Dict(u'en_US')
self.highlighter = Highlighter(self.document())
self.highlighter.setDict(self.dict)

View File

@ -122,12 +122,12 @@ class MainDisplay(DisplayWidget):
self.scene = QtGui.QGraphicsScene(self)
self.setScene(self.scene)
self.scene.addItem(self.webView)
self.webView.setGeometry(QtCore.QRectF(0, 0,
self.webView.setGeometry(QtCore.QRectF(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height()))
except AttributeError:
# QGraphicsWebView a recent addition, so fall back to QWebView
self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0,
self.webView.setGeometry(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height())
self.page = self.webView.page()
self.frame = self.page.mainFrame()
@ -164,7 +164,7 @@ class MainDisplay(DisplayWidget):
- splash_image.height()) / 2,
splash_image)
serviceItem = ServiceItem()
serviceItem.bg_frame = initialFrame
serviceItem.bg_image_bytes = image_to_byte(initialFrame)
self.webView.setHtml(build_html(serviceItem, self.screen,
self.parent.alertTab, self.isLive))
self.initialFrame = True
@ -293,7 +293,7 @@ class MainDisplay(DisplayWidget):
"""
log.debug(u'video')
self.loaded = True
js = u'show_video("play", "%s", %s, true);' % \
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
(videoPath.replace(u'\\', u'\\\\'), str(float(volume)/float(10)))
self.frame.evaluateJavaScript(js)
return self.preview()
@ -326,8 +326,12 @@ class MainDisplay(DisplayWidget):
# Important otherwise first preview will miss the background !
while not self.loaded:
Receiver.send_message(u'openlp_process_events')
# if was hidden keep it hidden
if self.isLive:
self.setVisible(True)
# if was hidden keep it hidden
if self.hide_mode and self.isLive:
self.hideDisplay(self.hide_mode)
preview = QtGui.QImage(self.screen[u'size'].width(),
self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
@ -335,7 +339,6 @@ class MainDisplay(DisplayWidget):
painter.setRenderHint(QtGui.QPainter.Antialiasing)
self.frame.render(painter)
painter.end()
# Make display show up if in single screen mode
return preview
def buildHtml(self, serviceItem):

View File

@ -383,20 +383,20 @@ class ServiceManager(QtGui.QWidget):
serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
tempItem = None
setLastItem = False
while serviceIterator:
if serviceIterator.isSelected() and tempItem is None:
while serviceIterator.value():
if serviceIterator.value().isSelected() and tempItem is None:
setLastItem = True
serviceIterator.setSelected(False)
if serviceIterator.isSelected():
#We are on the first record
serviceIterator.value().setSelected(False)
if serviceIterator.value().isSelected():
# We are on the first record
if tempItem:
tempItem.setSelected(True)
serviceIterator.setSelected(False)
serviceIterator.value().setSelected(False)
else:
tempItem = serviceIterator
lastItem = serviceIterator
++serviceIterator
#Top Item was selected so set the last one
tempItem = serviceIterator.value()
lastItem = serviceIterator.value()
serviceIterator += 1
# Top Item was selected so set the last one
if setLastItem:
lastItem.setSelected(True)
@ -406,16 +406,18 @@ class ServiceManager(QtGui.QWidget):
Called by the down arrow
"""
serviceIterator = QtGui.QTreeWidgetItemIterator(self.serviceManagerList)
firstItem = serviceIterator
firstItem = None
setSelected = False
while serviceIterator:
while serviceIterator.value():
if not firstItem:
firstItem = serviceIterator.value()
if setSelected:
setSelected = False
serviceIterator.setSelected(True)
elif serviceIterator.isSelected():
serviceIterator.setSelected(False)
serviceIterator.value().setSelected(True)
elif serviceIterator.value() and serviceIterator.value().isSelected():
serviceIterator.value().setSelected(False)
setSelected = True
++serviceIterator
serviceIterator += 1
if setSelected:
firstItem.setSelected(True)

View File

@ -40,7 +40,7 @@ class AlertsPlugin(Plugin):
log.info(u'Alerts Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Alerts', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Alerts', u'1.9.3', plugin_helpers)
self.weight = -3
self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self)

View File

@ -37,7 +37,7 @@ class BiblePlugin(Plugin):
log.info(u'Bible Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Bibles', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Bibles', u'1.9.3', plugin_helpers)
self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path)

View File

@ -126,29 +126,29 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'osis_location').toString() == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your '
'Bible from.'))
'You need to specify a file to import your '
'Bible from.'))
self.OSISLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
if self.field(u'csv_booksfile').toString() == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Books File'),
'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'))
'You need to specify a file with books of '
'the Bible to use in the import.'))
self.BooksLocationEdit.setFocus()
return False
elif self.field(u'csv_versefile').toString() == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Verse File'),
'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'))
'You need to specify a file of Bible '
'verses to import.'))
self.CsvVerseLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == \
@ -156,10 +156,10 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'opensong_file').toString() == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid OpenSong Bible'),
'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible '
'file to import.'))
'You need to specify an OpenSong Bible '
'file to import.'))
self.OpenSongFileEdit.setFocus()
return False
return True
@ -171,29 +171,26 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if license_version == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Empty Version Name'),
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your '
'Bible.'))
'You need to specify a version name for your Bible.'))
self.VersionNameEdit.setFocus()
return False
elif license_copyright == u'':
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Empty Copyright'),
'Empty Copyright'),
translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as '
'such.'))
'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as such.'))
self.CopyrightEdit.setFocus()
return False
elif self.manager.exists(license_version):
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists. Please import '
'a different Bible or first delete the existing one.'))
'This Bible already exists. Please import '
'a different Bible or first delete the existing one.'))
self.VersionNameEdit.setFocus()
return False
return True
@ -437,18 +434,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
unicode(self.field(u'proxy_username').toString()),
proxy_password=unicode(self.field(u'proxy_password').toString())
)
success = importer.do_import()
if success:
if importer.do_import():
self.manager.save_meta_data(license_version, license_version,
license_copyright, license_permission)
self.manager.reload_bibles()
self.ImportProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
'Finished import.'))
translate('BiblesPlugin.ImportWizardForm', 'Finished import.'))
else:
self.ImportProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
'Your Bible import failed.'))
'Your Bible import failed.'))
delete_database(self.bibleplugin.settingsSection, importer.file)
def postImport(self):

View File

@ -65,12 +65,6 @@ class BibleMediaItem(MediaManagerItem):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
def _decodeQtObject(self, listobj, key):
obj = listobj[QtCore.QString(key)]
if isinstance(obj, QtCore.QVariant):
obj = obj.toPyObject()
return unicode(obj)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
self.hasImportIcon = True
@ -376,9 +370,6 @@ class BibleMediaItem(MediaManagerItem):
def onSearchProgressShow(self):
self.SearchProgress.setVisible(True)
Receiver.send_message(u'openlp_process_events')
#self.SearchProgress.setMinimum(0)
#self.SearchProgress.setMaximum(2)
#self.SearchProgress.setValue(1)
def onSearchProgressHide(self):
self.SearchProgress.setVisible(False)
@ -408,18 +399,28 @@ class BibleMediaItem(MediaManagerItem):
self.reloadBibles()
def onAdvancedFromVerse(self):
frm = self.AdvancedFromVerse.currentText()
self.adjustComboBox(frm, self.verses, self.AdvancedToVerse)
def onAdvancedToChapter(self):
frm = unicode(self.AdvancedFromChapter.currentText())
to = unicode(self.AdvancedToChapter.currentText())
if frm != to:
frm = int(self.AdvancedFromVerse.currentText())
chapter_frm = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
if chapter_frm == chapter_to:
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
# get the verse count for new chapter
verses = self.parent.manager.get_verse_count(bible, book, int(to))
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
def onAdvancedToChapter(self):
chapter_frm = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
verses = self.parent.manager.get_verse_count(bible, book, chapter_to)
if chapter_frm != chapter_to:
self.adjustComboBox(1, verses, self.AdvancedToVerse)
else:
frm = int(self.AdvancedFromVerse.currentText())
to = int(self.AdvancedToVerse.currentText())
if to < frm:
self.adjustComboBox(frm, verses, self.AdvancedToVerse)
def onAdvancedSearchButton(self):
log.debug(u'Advanced Search Button pressed')
@ -438,32 +439,72 @@ class BibleMediaItem(MediaManagerItem):
dual_bible, versetext)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
self.listView.clear()
self.displayResults(bible, dual_bible)
if self.listView.count() != 0:
bitem = self.listView.item(0)
item_dual_bible = self._decodeQtObject(bitem, 'dual_bible')
if item_dual_bible and dual_bible or not item_dual_bible and \
not dual_bible:
self.displayResults(bible, dual_bible)
elif QtGui.QMessageBox.critical(self,
translate('BiblePlugin.MediaItem', 'Error'),
translate('BiblePlugin.MediaItem', 'You cannot combine single '
'and dual bible verses. Do you want to delete your search '
'results and start a new search?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
self.listView.clear()
self.displayResults(bible, dual_bible)
else:
self.displayResults(bible, dual_bible)
def onAdvancedFromChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
cf = int(self.AdvancedFromChapter.currentText())
self.adjustComboBox(cf, self.chapters_from, self.AdvancedToChapter)
# get the verse count for new chapter
vse = self.parent.manager.get_verse_count(bible, book, cf)
self.adjustComboBox(1, vse, self.AdvancedFromVerse)
self.adjustComboBox(1, vse, self.AdvancedToVerse)
chapter_frm = int(self.AdvancedFromChapter.currentText())
self.adjustComboBox(chapter_frm, self.chapters_from,
self.AdvancedToChapter)
verse = self.parent.manager.get_verse_count(bible, book, chapter_frm)
self.adjustComboBox(1, verse, self.AdvancedToVerse)
self.adjustComboBox(1, verse, self.AdvancedFromVerse)
def onQuickSearchButton(self):
log.debug(u'Quick Search Button pressed')
bible = unicode(self.QuickVersionComboBox.currentText())
dual_bible = unicode(self.QuickSecondBibleComboBox.currentText())
text = unicode(self.QuickSearchEdit.text())
if self.ClearQuickSearchComboBox.currentIndex() == 0:
self.listView.clear()
self.search_results = self.parent.manager.get_verses(bible, text)
if dual_bible:
self.dual_search_results = self.parent.manager.get_verses(
dual_bible, text)
if self.search_results:
if self.ClearQuickSearchComboBox.currentIndex() == 0:
self.listView.clear()
if self.listView.count() != 0 and self.search_results:
bitem = self.listView.item(0)
item_dual_bible = self._decodeQtObject(bitem, 'dual_bible')
if item_dual_bible and dual_bible or not item_dual_bible and \
not dual_bible:
self.displayResults(bible, dual_bible)
elif QtGui.QMessageBox.critical(self,
translate('BiblePlugin.MediaItem', 'Error'),
translate('BiblePlugin.MediaItem', 'You cannot combine single '
'and dual bible verses. Do you want to delete your search '
'results and start a new search?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
self.listView.clear()
self.displayResults(bible, dual_bible)
elif self.search_results:
self.displayResults(bible, dual_bible)
def _decodeQtObject(self, bitem, key):
reference = bitem.data(QtCore.Qt.UserRole)
if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject()
obj = reference[QtCore.QString(key)]
if isinstance(obj, QtCore.QVariant):
obj = obj.toPyObject()
return unicode(obj)
def generateSlideData(self, service_item, item=None):
"""
Generates and formats the slides for the service item as well as the
@ -473,67 +514,40 @@ class BibleMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes()
if len(items) == 0:
return False
has_dual_bible = False
bible_text = u''
old_chapter = u''
raw_footer = []
raw_slides = []
raw_title = []
first_item = True
for item in items:
bitem = self.listView.item(item.row())
reference = bitem.data(QtCore.Qt.UserRole)
if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject()
dual_bible = self._decodeQtObject(reference, 'dual_bible')
if dual_bible:
has_dual_bible = True
break
# Let's loop through the main lot, and assemble our verses.
for item in items:
bitem = self.listView.item(item.row())
reference = bitem.data(QtCore.Qt.UserRole)
if isinstance(reference, QtCore.QVariant):
reference = reference.toPyObject()
book = self._decodeQtObject(reference, 'book')
chapter = self._decodeQtObject(reference, 'chapter')
verse = self._decodeQtObject(reference, 'verse')
bible = self._decodeQtObject(reference, 'bible')
version = self._decodeQtObject(reference, 'version')
copyright = self._decodeQtObject(reference, 'copyright')
permission = self._decodeQtObject(reference, 'permission')
text = self._decodeQtObject(reference, 'text')
dual_bible = self._decodeQtObject(reference, 'dual_bible')
if dual_bible:
dual_version = self._decodeQtObject(reference,
'dual_version')
dual_copyright = self._decodeQtObject(reference,
'dual_copyright')
dual_permission = self._decodeQtObject(reference,
'dual_permission')
dual_text = self._decodeQtObject(reference, 'dual_text')
book = self._decodeQtObject(bitem, 'book')
chapter = int(self._decodeQtObject(bitem, 'chapter'))
verse = int(self._decodeQtObject(bitem, 'verse'))
bible = self._decodeQtObject(bitem, 'bible')
version = self._decodeQtObject(bitem, 'version')
copyright = self._decodeQtObject(bitem, 'copyright')
permission = self._decodeQtObject(bitem, 'permission')
text = self._decodeQtObject(bitem, 'text')
dual_bible = self._decodeQtObject(bitem, 'dual_bible')
dual_version = self._decodeQtObject(bitem, 'dual_version')
dual_copyright = self._decodeQtObject(bitem, 'dual_copyright')
dual_permission = self._decodeQtObject(bitem, 'dual_permission')
dual_text = self._decodeQtObject(bitem, 'dual_text')
verse_text = self.formatVerse(old_chapter, chapter, verse)
footer = u'%s (%s %s %s)' % (book, version, copyright, permission)
if footer not in raw_footer:
raw_footer.append(footer)
if has_dual_bible:
if dual_bible:
footer = u'%s (%s %s %s)' % (book, dual_version,
dual_copyright, dual_permission)
if footer not in raw_footer:
raw_footer.append(footer)
# If there is an old bible_text we have to add it.
if bible_text:
raw_slides.append(bible_text)
bible_text = u''
bible_text = u'%s %s\n\n%s %s' % (verse_text, text,
verse_text, dual_text)
raw_slides.append(bible_text)
bible_text = u''
elif self.parent.settings_tab.layout_style == 0:
bible_text = u'%s %s' % (verse_text, text)
raw_slides.append(bible_text)
bible_text = u''
else:
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
if dual_bible:
footer = u'%s (%s %s %s)' % (book, dual_version, dual_copyright,
dual_permission)
if footer not in raw_footer:
raw_footer.append(footer)
bible_text = u'%s %s\n\n%s %s' % (verse_text, text, verse_text,
dual_text)
raw_slides.append(bible_text)
bible_text = u''
# If we are 'Verse Per Slide' then create a new slide.
elif self.parent.settings_tab.layout_style == 0:
bible_text = u'%s %s' % (verse_text, text)
@ -545,29 +559,31 @@ class BibleMediaItem(MediaManagerItem):
# We have to be 'Continuous'.
else:
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
if first_item:
start_item = item
first_item = False
elif self.checkTitle(item, old_item):
raw_title.append(self.formatTitle(start_item, old_item))
start_item = item
old_item = item
old_chapter = chapter
raw_title.append(self.formatTitle(start_item, item))
# If there are no more items we check whether we have to add bible_text.
if bible_text:
raw_slides.append(bible_text)
bible_text = u''
# Service Item: Capabilities
if self.parent.settings_tab.layout_style == 2 and not has_dual_bible:
# split the line but do not replace line breaks in renderer
if self.parent.settings_tab.layout_style == 2 and not dual_bible:
# Split the line but do not replace line breaks in renderer.
service_item.add_capability(ItemCapabilities.NoLineBreaks)
service_item.add_capability(ItemCapabilities.AllowsPreview)
service_item.add_capability(ItemCapabilities.AllowsLoop)
service_item.add_capability(ItemCapabilities.AllowsAdditions)
# Service Item: Title
if not service_item.title:
if dual_bible:
service_item.title = u'%s (%s, %s) %s' % (book, version,
dual_version, verse_text)
for title in raw_title:
if not service_item.title:
service_item.title = title
else:
service_item.title = u'%s (%s) %s' % (book, version, verse_text)
elif service_item.title.find(
translate('BiblesPlugin.MediaItem', 'etc')) == -1:
service_item.title = u'%s, %s' % (service_item.title,
translate('BiblesPlugin.MediaItem', 'etc'))
service_item.title += u', ' + title
# Service Item: Theme
if len(self.parent.settings_tab.bible_theme) == 0:
service_item.theme = None
@ -582,12 +598,80 @@ class BibleMediaItem(MediaManagerItem):
service_item.raw_footer = raw_footer
return True
def formatTitle(self, start_item, old_item):
"""
This methode is called, when we have to change the title, because
we are at the end of a verse range. E. g. if we want to add
Genesis 1:1-6 as well as Daniel 2:14.
"""
old_bitem = self.listView.item(old_item.row())
old_chapter = int(self._decodeQtObject(old_bitem, 'chapter'))
old_verse = int(self._decodeQtObject(old_bitem, 'verse'))
start_bitem = self.listView.item(start_item.row())
start_book = self._decodeQtObject(start_bitem, 'book')
start_chapter = int(self._decodeQtObject(start_bitem, 'chapter'))
start_verse = int(self._decodeQtObject(start_bitem, 'verse'))
start_bible = self._decodeQtObject(start_bitem, 'bible')
start_dual_bible = self._decodeQtObject(start_bitem, 'dual_bible')
if start_dual_bible:
if start_verse == old_verse and start_chapter == old_chapter:
title = u'%s %s:%s (%s, %s)' % (start_book, start_chapter,
start_verse, start_bible, start_dual_bible)
elif start_chapter == old_chapter:
title = u'%s %s:%s-%s (%s, %s)' % (start_book, start_chapter,
start_verse, old_verse, start_bible, start_dual_bible)
else:
title = u'%s %s:%s-%s:%s (%s, %s)' % (start_book, start_chapter,
start_verse, old_chapter, old_verse, start_bible,
start_dual_bible)
else:
if start_verse == old_verse and start_chapter == old_chapter:
title = u'%s %s:%s (%s)' % (start_book, start_chapter,
start_verse, start_bible)
elif start_chapter == old_chapter:
title = u'%s %s:%s-%s (%s)' % (start_book, start_chapter,
start_verse, old_verse, start_bible)
else:
title = u'%s %s:%s-%s:%s (%s)' % (start_book, start_chapter,
start_verse, old_chapter, old_verse, start_bible)
return title
def checkTitle(self, item, old_item):
"""
This methode checks if we are at the end of an verse range. If that is
the case, we return True, else False. E. g. if we added Genesis 1:1-6,
but the next verse is Daniel 2:14.
"""
bitem = self.listView.item(item.row())
book = self._decodeQtObject(bitem, 'book')
chapter = int(self._decodeQtObject(bitem, 'chapter'))
verse = int(self._decodeQtObject(bitem, 'verse'))
bible = self._decodeQtObject(bitem, 'bible')
dual_bible = self._decodeQtObject(bitem, 'dual_bible')
old_bitem = self.listView.item(old_item.row())
old_book = self._decodeQtObject(old_bitem, 'book')
old_chapter = int(self._decodeQtObject(old_bitem, 'chapter'))
old_verse = int(self._decodeQtObject(old_bitem, 'verse'))
old_bible = self._decodeQtObject(old_bitem, 'bible')
old_dual_bible = self._decodeQtObject(old_bitem, 'dual_bible')
if old_bible != bible or old_dual_bible != dual_bible or \
old_book != book:
return True
elif old_verse + 1 != verse and old_chapter == chapter:
return True
elif old_chapter + 1 == chapter and (verse != 1 or
old_verse != self.parent.manager.get_verse_count(
old_bible, old_book, old_chapter)):
return True
else:
return False
def formatVerse(self, old_chapter, chapter, verse):
if not self.parent.settings_tab.show_new_chapters or \
old_chapter != chapter:
verse_text = chapter + u':' + verse
verse_text = u'%s:%s' % (chapter, verse)
else:
verse_text = verse
verse_text = u'%s' % verse
if self.parent.settings_tab.display_style == 1:
verse_text = u'{su}(' + verse_text + u'){/su}'
elif self.parent.settings_tab.display_style == 2:
@ -690,14 +774,15 @@ class BibleMediaItem(MediaManagerItem):
'copyright': QtCore.QVariant(copyright.value),
'permission': QtCore.QVariant(permission.value),
'text': QtCore.QVariant(verse.text),
'dual_bible': QtCore.QVariant(dual_bible)
'dual_bible': QtCore.QVariant(u''),
'dual_version': QtCore.QVariant(u''),
'dual_copyright': QtCore.QVariant(u''),
'dual_permission': QtCore.QVariant(u''),
'dual_text': QtCore.QVariant(u'')
}
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
verse.chapter, verse.verse, version.value)
# set the row title
bible_verse = QtGui.QListWidgetItem(bible_text)
#bible_verse.setData(QtCore.Qt.UserRole,
# QtCore.QVariant(bible_text))
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
self.listView.addItem(bible_verse)
row = self.listView.setCurrentRow(count + start_count)

View File

@ -47,7 +47,7 @@ class CustomPlugin(Plugin):
log.info(u'Custom Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Custom', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Custom', u'1.9.3', plugin_helpers)
self.weight = -5
self.custommanager = Manager(u'custom', init_schema)
self.edit_custom_form = EditCustomForm(self.custommanager)

View File

@ -35,7 +35,7 @@ class ImagePlugin(Plugin):
log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Images', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Images', u'1.9.3', plugin_helpers)
self.weight = -7
self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path)

View File

@ -37,7 +37,7 @@ class MediaPlugin(Plugin):
log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Media', u'1.9.3', plugin_helpers)
self.weight = -6
self.icon_path = u':/plugins/plugin_media.png'
self.icon = build_icon(self.icon_path)

View File

@ -51,7 +51,7 @@ class PresentationPlugin(Plugin):
"""
log.debug(u'Initialised')
self.controllers = {}
Plugin.__init__(self, u'Presentations', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Presentations', u'1.9.3', plugin_helpers)
self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path)

View File

@ -38,7 +38,7 @@ class RemotesPlugin(Plugin):
"""
remotes constructor
"""
Plugin.__init__(self, u'Remotes', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Remotes', u'1.9.3', plugin_helpers)
self.icon = build_icon(u':/plugins/plugin_remote.png')
self.weight = -1
self.server = None

View File

@ -50,7 +50,7 @@ class SongsPlugin(Plugin):
"""
Create and set up the Songs plugin.
"""
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'Songs', u'1.9.3', plugin_helpers)
self.weight = -10
self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png'

View File

@ -41,7 +41,7 @@ class SongUsagePlugin(Plugin):
log.info(u'SongUsage Plugin loaded')
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'SongUsage', u'1.9.2', plugin_helpers)
Plugin.__init__(self, u'SongUsage', u'1.9.3', plugin_helpers)
self.weight = -4
self.icon = build_icon(u':/plugins/plugin_songusage.png')
self.songusagemanager = None