forked from openlp/openlp
Stage view changes: show all slides for a verse and tidy verse tags
bzr-revno: 1540
This commit is contained in:
commit
55a5480ea4
@ -186,10 +186,10 @@ class Renderer(object):
|
|||||||
serviceItem.theme = theme_data
|
serviceItem.theme = theme_data
|
||||||
if self.force_page:
|
if self.force_page:
|
||||||
# make big page for theme edit dialog to get line count
|
# make big page for theme edit dialog to get line count
|
||||||
serviceItem.add_from_text(u'', VERSE + VERSE + VERSE, FOOTER)
|
serviceItem.add_from_text(u'', VERSE + VERSE + VERSE)
|
||||||
else:
|
else:
|
||||||
self.image_manager.del_image(theme_data.theme_name)
|
self.image_manager.del_image(theme_data.theme_name)
|
||||||
serviceItem.add_from_text(u'', VERSE, FOOTER)
|
serviceItem.add_from_text(u'', VERSE)
|
||||||
serviceItem.renderer = self
|
serviceItem.renderer = self
|
||||||
serviceItem.raw_footer = FOOTER
|
serviceItem.raw_footer = FOOTER
|
||||||
serviceItem.render(True)
|
serviceItem.render(True)
|
||||||
|
@ -219,6 +219,8 @@ class ServiceItem(object):
|
|||||||
``raw_slide``
|
``raw_slide``
|
||||||
The raw text of the slide.
|
The raw text of the slide.
|
||||||
"""
|
"""
|
||||||
|
if verse_tag:
|
||||||
|
verse_tag = verse_tag.upper()
|
||||||
self.service_item_type = ServiceItemType.Text
|
self.service_item_type = ServiceItemType.Text
|
||||||
title = title.split(u'\n')[0]
|
title = title.split(u'\n')[0]
|
||||||
self._raw_frames.append(
|
self._raw_frames.append(
|
||||||
|
@ -608,7 +608,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
if frame[u'verseTag']:
|
if frame[u'verseTag']:
|
||||||
# These tags are already translated.
|
# These tags are already translated.
|
||||||
verse_def = frame[u'verseTag']
|
verse_def = frame[u'verseTag']
|
||||||
verse_def = u'%s%s' % (verse_def[0].upper(), verse_def[1:])
|
verse_def = u'%s%s' % (verse_def[0], verse_def[1:])
|
||||||
two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
|
two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:])
|
||||||
row = two_line_def
|
row = two_line_def
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
|
@ -30,12 +30,14 @@ body {
|
|||||||
#currentslide {
|
#currentslide {
|
||||||
font-size: 40pt;
|
font-size: 40pt;
|
||||||
color: white;
|
color: white;
|
||||||
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nextslide {
|
#nextslide {
|
||||||
font-size: 30pt;
|
font-size: 40pt;
|
||||||
color: grey;
|
color: grey;
|
||||||
padding-top: 25px;
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#right {
|
#right {
|
||||||
|
@ -46,35 +46,79 @@ window.OpenLP = {
|
|||||||
function (data, status) {
|
function (data, status) {
|
||||||
OpenLP.currentSlides = data.results.slides;
|
OpenLP.currentSlides = data.results.slides;
|
||||||
OpenLP.currentSlide = 0;
|
OpenLP.currentSlide = 0;
|
||||||
|
OpenLP.currentTags = Array();
|
||||||
var div = $("#verseorder");
|
var div = $("#verseorder");
|
||||||
div.html("");
|
div.html("");
|
||||||
for (idx in data.results.slides) {
|
var tag = "";
|
||||||
idx = parseInt(idx, 10);
|
var tags = 0;
|
||||||
div.append(" <span>");
|
var lastChange = 0;
|
||||||
var tag = data.results.slides[idx]["tag"];
|
$.each(data.results.slides, function(idx, slide) {
|
||||||
if (tag == 'None')
|
var prevtag = tag;
|
||||||
tag = idx;
|
tag = slide["tag"];
|
||||||
$("#verseorder span").last().attr("id", "tag" + idx).text(tag);
|
if (tag != prevtag) {
|
||||||
if (data.results.slides[idx]["selected"])
|
// If the tag has changed, add new one to the list
|
||||||
|
lastChange = idx;
|
||||||
|
tags = tags + 1;
|
||||||
|
div.append(" <span>");
|
||||||
|
$("#verseorder span").last().attr("id", "tag" + tags).text(tag);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((slide["text"] == data.results.slides[lastChange]["text"]) &&
|
||||||
|
(data.results.slides.length > idx + (idx - lastChange))) {
|
||||||
|
// If the tag hasn't changed, check to see if the same verse
|
||||||
|
// has been repeated consecutively. Note the verse may have been
|
||||||
|
// split over several slides, so search through. If so, repeat the tag.
|
||||||
|
var match = true;
|
||||||
|
for (var idx2 = 0; idx2 < idx - lastChange; idx2++) {
|
||||||
|
if(data.results.slides[lastChange + idx2]["text"] != data.results.slides[idx + idx2]["text"]) {
|
||||||
|
match = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (match) {
|
||||||
|
lastChange = idx;
|
||||||
|
tags = tags + 1;
|
||||||
|
div.append(" <span>");
|
||||||
|
$("#verseorder span").last().attr("id", "tag" + tags).text(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OpenLP.currentTags[idx] = tags;
|
||||||
|
if (slide["selected"])
|
||||||
OpenLP.currentSlide = idx;
|
OpenLP.currentSlide = idx;
|
||||||
}
|
})
|
||||||
OpenLP.loadService();
|
OpenLP.loadService();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
updateSlide: function() {
|
updateSlide: function() {
|
||||||
|
// Show the current slide on top. Any trailing slides for the same verse
|
||||||
|
// are shown too underneath in grey.
|
||||||
|
// Then leave a blank line between following verses
|
||||||
$("#verseorder span").removeClass("currenttag");
|
$("#verseorder span").removeClass("currenttag");
|
||||||
$("#tag" + OpenLP.currentSlide).addClass("currenttag");
|
$("#tag" + OpenLP.currentTags[OpenLP.currentSlide]).addClass("currenttag");
|
||||||
var text = OpenLP.currentSlides[OpenLP.currentSlide]["text"];
|
var slide = OpenLP.currentSlides[OpenLP.currentSlide];
|
||||||
|
var text = slide["text"];
|
||||||
text = text.replace(/\n/g, '<br />');
|
text = text.replace(/\n/g, '<br />');
|
||||||
$("#currentslide").html(text);
|
$("#currentslide").html(text);
|
||||||
|
text = "";
|
||||||
if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1) {
|
if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1) {
|
||||||
text = OpenLP.currentSlides[OpenLP.currentSlide + 1]["text"];
|
for (var idx = OpenLP.currentSlide + 1; idx < OpenLP.currentSlides.length; idx++) {
|
||||||
|
if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1])
|
||||||
|
text = text + '<p class="nextslide">';
|
||||||
|
text = text + OpenLP.currentSlides[idx]["text"];
|
||||||
|
if (OpenLP.currentTags[idx] != OpenLP.currentTags[idx - 1])
|
||||||
|
text = text + '</p>';
|
||||||
|
else
|
||||||
|
text = text + '<br />';
|
||||||
|
}
|
||||||
text = text.replace(/\n/g, '<br />');
|
text = text.replace(/\n/g, '<br />');
|
||||||
$("#nextslide").html(text);
|
$("#nextslide").html(text);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$("#nextslide").html("Next: " + OpenLP.nextSong);
|
text = '<p class="nextslide">Next: ' + OpenLP.nextSong + '</p>';
|
||||||
|
$("#nextslide").html(text);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateClock: function() {
|
updateClock: function() {
|
||||||
var div = $("#clock");
|
var div = $("#clock");
|
||||||
|
@ -115,7 +115,6 @@ import os
|
|||||||
import urlparse
|
import urlparse
|
||||||
import re
|
import re
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from lxml import html
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
@ -402,12 +401,14 @@ class HttpConnection(object):
|
|||||||
for index, frame in enumerate(current_item.get_frames()):
|
for index, frame in enumerate(current_item.get_frames()):
|
||||||
item = {}
|
item = {}
|
||||||
if current_item.is_text():
|
if current_item.is_text():
|
||||||
item[u'tag'] = unicode(frame[u'verseTag'])
|
if frame[u'verseTag']:
|
||||||
text = unicode(frame[u'html'].replace('<br>', '\n'))
|
item[u'tag'] = unicode(frame[u'verseTag'])
|
||||||
item[u'text'] = html.fromstring(text).text_content()
|
else:
|
||||||
|
item[u'tag'] = unicode(index + 1)
|
||||||
|
item[u'text'] = unicode(frame[u'text'])
|
||||||
item[u'html'] = unicode(frame[u'html'])
|
item[u'html'] = unicode(frame[u'html'])
|
||||||
else:
|
else:
|
||||||
item[u'tag'] = unicode(index)
|
item[u'tag'] = unicode(index + 1)
|
||||||
item[u'text'] = u''
|
item[u'text'] = u''
|
||||||
item[u'html'] = u''
|
item[u'html'] = u''
|
||||||
item[u'selected'] = (self.parent.current_slide == index)
|
item[u'selected'] = (self.parent.current_slide == index)
|
||||||
|
Loading…
Reference in New Issue
Block a user