Fixed displaying slides in slide controller vs actual rendered slides; Fixed <sup> tag not showing up correctly

This commit is contained in:
Raoul Snyman 2018-04-11 23:20:55 -07:00
parent 1f9d00f47c
commit 3ff3f501fa
6 changed files with 42 additions and 16 deletions

View File

@ -376,7 +376,6 @@ class MainCanvas(OpenLPMixin, Canvas, RegistryProperties):
self.application.process_events() self.application.process_events()
self.setGeometry(self.screen['size']) self.setGeometry(self.screen['size'])
json_verses = json.dumps(slide) json_verses = json.dumps(slide)
print(json_verses)
self.run_javascript('Display.setTextSlides({verses});'.format(verses=json_verses)) self.run_javascript('Display.setTextSlides({verses});'.format(verses=json_verses))
#if animate: #if animate:
# # NOTE: Verify this works with ''.format() # # NOTE: Verify this works with ''.format()

View File

@ -8,6 +8,10 @@
background: #000 !important; background: #000 !important;
color: #fff !important; color: #fff !important;
} }
sup {
vertical-align: super !important;
font-size: smaller !important;
}
.reveal .slides > section, .reveal .slides > section,
.reveal .slides > section > section { .reveal .slides > section > section {
padding: 0; padding: 0;

View File

@ -25,7 +25,6 @@ The :mod:`~openlp.core.display.window` module contains the display window
import logging import logging
import os import os
import json import json
from inspect import currentframe, getouterframes
from PyQt5 import QtCore, QtWidgets, QtWebChannel from PyQt5 import QtCore, QtWidgets, QtWebChannel
@ -123,7 +122,6 @@ class DisplayWindow(QtWidgets.QWidget):
self.webview.page().setWebChannel(self.channel) self.webview.page().setWebChannel(self.channel)
if screen and screen.is_display: if screen and screen.is_display:
self.update_from_screen(screen) self.update_from_screen(screen)
print(getouterframes(currentframe(), 2)[1][3])
def update_from_screen(self, screen): def update_from_screen(self, screen):
""" """

View File

@ -28,6 +28,7 @@ import logging
import ntpath import ntpath
import os import os
import uuid import uuid
from copy import deepcopy
from PyQt5 import QtGui from PyQt5 import QtGui
@ -37,7 +38,7 @@ from openlp.core.common.i18n import translate
from openlp.core.common.mixins import RegistryProperties from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.path import Path from openlp.core.common.path import Path
from openlp.core.common.settings import Settings from openlp.core.common.settings import Settings
# from openlp.core.display.render import remove_tags, render_tags, render_chords from openlp.core.display.render import remove_tags, render_tags
from openlp.core.lib import ImageSource, build_icon from openlp.core.lib import ImageSource, build_icon
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -165,6 +166,8 @@ class ServiceItem(RegistryProperties):
""" """
if plugin: if plugin:
self.name = plugin.name self.name = plugin.name
self._rendered_slides = None
self._display_slides = None
self.title = '' self.title = ''
self.slides = [] self.slides = []
self.processor = None self.processor = None
@ -175,8 +178,6 @@ class ServiceItem(RegistryProperties):
self.foot_text = '' self.foot_text = ''
self.theme = None self.theme = None
self.service_item_type = None self.service_item_type = None
# self._raw_frames = []
# self._display_frames = []
self.unique_identifier = 0 self.unique_identifier = 0
self.notes = '' self.notes = ''
self.from_plugin = False self.from_plugin = False
@ -239,6 +240,32 @@ class ServiceItem(RegistryProperties):
self.icon = icon self.icon = icon
self.iconic_representation = build_icon(icon) self.iconic_representation = build_icon(icon)
@property
def rendered_slides(self):
"""
Render the frames and return them
"""
if not self._rendered_slides:
self._rendered_slides = []
for raw_slide in self.slides:
rendered_slide = deepcopy(raw_slide)
rendered_slide['text'] = render_tags(rendered_slide['text'])
self._rendered_slides.append(rendered_slide)
return self._rendered_slides
@property
def display_slides(self):
"""
Render the frames and return them
"""
if not self._display_slides:
self._display_slides = []
for raw_slide in self.slides:
display_slide = deepcopy(raw_slide)
display_slide['text'] = remove_tags(display_slide['text'])
self._display_slides.append(display_slide)
return self._display_slides
# def render(self, provides_own_theme_data=False): # def render(self, provides_own_theme_data=False):
# """ # """
# The render method is what generates the frames for the screen and obtains the display information from the # The render method is what generates the frames for the screen and obtains the display information from the

View File

@ -39,7 +39,6 @@ from openlp.core.lib import ItemCapabilities, ImageSource, ServiceItemAction, bu
from openlp.core.lib.ui import create_action from openlp.core.lib.ui import create_action
from openlp.core.ui import HideMode, DisplayControllerType from openlp.core.ui import HideMode, DisplayControllerType
from openlp.core.display.window import DisplayWindow from openlp.core.display.window import DisplayWindow
from openlp.core.display.render import render_tags
from openlp.core.widgets.layouts import AspectRatioLayout from openlp.core.widgets.layouts import AspectRatioLayout
from openlp.core.widgets.toolbar import OpenLPToolbar from openlp.core.widgets.toolbar import OpenLPToolbar
from openlp.core.widgets.views import ListPreviewWidget from openlp.core.widgets.views import ListPreviewWidget
@ -745,10 +744,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
theme_name = item.theme if item.theme else Registry().get('theme_manager').global_theme theme_name = item.theme if item.theme else Registry().get('theme_manager').global_theme
self.preview_display.set_theme(Registry().get('theme_manager').get_theme_data(theme_name)) self.preview_display.set_theme(Registry().get('theme_manager').get_theme_data(theme_name))
if item.is_text(): if item.is_text():
slides = item.slides.copy() self.preview_display.load_verses(item.rendered_slides)
for slide in slides:
slide['text'] = render_tags(slide['text'])
self.preview_display.load_verses(slides)
elif item.is_image(): elif item.is_image():
self.preview_display.load_images(item.slides) self.preview_display.load_images(item.slides)
slide_no = 0 slide_no = 0
@ -847,9 +843,9 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
# self.set_audio_items_visibility(True) # self.set_audio_items_visibility(True)
row = 0 row = 0
width = self.main_window.control_splitter.sizes()[self.split] width = self.main_window.control_splitter.sizes()[self.split]
for slide_index, slide in enumerate(self.service_item.slides):
if self.service_item.is_text(): if self.service_item.is_text():
if slide['verse']: for slide_index, slide in enumerate(self.service_item.display_slides):
if not slide['verse'].isdigit():
# These tags are already translated. # These tags are already translated.
verse_def = slide['verse'] verse_def = slide['verse']
verse_def = '{def1}{def2}'.format(def1=verse_def[0], def2=verse_def[1:]) verse_def = '{def1}{def2}'.format(def1=verse_def[0], def2=verse_def[1:])
@ -863,6 +859,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
row += 1 row += 1
self.slide_list[str(row)] = row - 1 self.slide_list[str(row)] = row - 1
else: else:
for slide_index, slide in enumerate(self.service_item.slides):
row += 1 row += 1
self.slide_list[str(row)] = row - 1 self.slide_list[str(row)] = row - 1
# If current slide set background to image # If current slide set background to image

View File

@ -168,7 +168,8 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
self.clear_list() self.clear_list()
row = 0 row = 0
text = [] text = []
for slide_index, slide in enumerate(self.service_item.slides): slides = self.service_item.display_slides if self.service_item.is_text() else self.service_item.slides
for slide_index, slide in enumerate(slides):
self.setRowCount(self.slide_count() + 1) self.setRowCount(self.slide_count() + 1)
item = QtWidgets.QTableWidgetItem() item = QtWidgets.QTableWidgetItem()
slide_height = 0 slide_height = 0