forked from openlp/openlp
Head
This commit is contained in:
commit
1970f3138e
@ -35,6 +35,7 @@ logging and a plugin framework are contained within the openlp.core module.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import platform
|
||||||
import logging
|
import logging
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from traceback import format_exception
|
from traceback import format_exception
|
||||||
@ -266,6 +267,9 @@ def main(args=None):
|
|||||||
qt_args.extend(['-style', options.style])
|
qt_args.extend(['-style', options.style])
|
||||||
# Throw the rest of the arguments at Qt, just in case.
|
# Throw the rest of the arguments at Qt, just in case.
|
||||||
qt_args.extend(args)
|
qt_args.extend(args)
|
||||||
|
# Bug #1018855: Set the WM_CLASS property in X11
|
||||||
|
if platform.system() not in ['Windows', 'Darwin']:
|
||||||
|
qt_args.append('OpenLP')
|
||||||
# Initialise the resources
|
# Initialise the resources
|
||||||
qInitResources()
|
qInitResources()
|
||||||
# Now create and actually run the application.
|
# Now create and actually run the application.
|
||||||
|
@ -256,7 +256,7 @@ class Renderer(object):
|
|||||||
if not self.force_page:
|
if not self.force_page:
|
||||||
self.display.buildHtml(serviceItem)
|
self.display.buildHtml(serviceItem)
|
||||||
raw_html = serviceItem.get_rendered_frame(0)
|
raw_html = serviceItem.get_rendered_frame(0)
|
||||||
self.display.text(raw_html)
|
self.display.text(raw_html, False)
|
||||||
preview = self.display.preview()
|
preview = self.display.preview()
|
||||||
return preview
|
return preview
|
||||||
self.force_page = False
|
self.force_page = False
|
||||||
@ -406,7 +406,14 @@ class Renderer(object):
|
|||||||
if theme_data.font_main_shadow:
|
if theme_data.font_main_shadow:
|
||||||
self.page_width -= int(theme_data.font_main_shadow_size)
|
self.page_width -= int(theme_data.font_main_shadow_size)
|
||||||
self.page_height -= int(theme_data.font_main_shadow_size)
|
self.page_height -= int(theme_data.font_main_shadow_size)
|
||||||
|
# For the life of my I don't know why we have to completely kill the
|
||||||
|
# QWebView in order for the display to work properly, but we do. See
|
||||||
|
# bug #1041366 for an example of what happens if we take this out.
|
||||||
|
self.web = None
|
||||||
|
self.web = QtWebKit.QWebView()
|
||||||
|
self.web.setVisible(False)
|
||||||
self.web.resize(self.page_width, self.page_height)
|
self.web.resize(self.page_width, self.page_height)
|
||||||
|
self.web_frame = self.web.page().mainFrame()
|
||||||
# Adjust width and height to account for shadow. outline done in css.
|
# Adjust width and height to account for shadow. outline done in css.
|
||||||
html = u"""<!DOCTYPE html><html><head><script>
|
html = u"""<!DOCTYPE html><html><head><script>
|
||||||
function show_text(newtext) {
|
function show_text(newtext) {
|
||||||
@ -450,8 +457,7 @@ class Renderer(object):
|
|||||||
previous_html, previous_raw, html_lines, lines, separator, u'')
|
previous_html, previous_raw, html_lines, lines, separator, u'')
|
||||||
else:
|
else:
|
||||||
previous_raw = separator.join(lines)
|
previous_raw = separator.join(lines)
|
||||||
if previous_raw:
|
formatted.append(previous_raw)
|
||||||
formatted.append(previous_raw)
|
|
||||||
log.debug(u'_paginate_slide - End')
|
log.debug(u'_paginate_slide - End')
|
||||||
return formatted
|
return formatted
|
||||||
|
|
||||||
|
@ -224,20 +224,33 @@ class MainDisplay(Display):
|
|||||||
self.__hideMouse()
|
self.__hideMouse()
|
||||||
log.debug(u'Finished MainDisplay setup')
|
log.debug(u'Finished MainDisplay setup')
|
||||||
|
|
||||||
def text(self, slide):
|
def text(self, slide, animate=True):
|
||||||
"""
|
"""
|
||||||
Add the slide text from slideController
|
Add the slide text from slideController
|
||||||
|
|
||||||
``slide``
|
``slide``
|
||||||
The slide text to be displayed
|
The slide text to be displayed
|
||||||
|
|
||||||
|
``animate``
|
||||||
|
Perform transitions if applicable when setting the text
|
||||||
"""
|
"""
|
||||||
log.debug(u'text to display')
|
log.debug(u'text to display')
|
||||||
# Wait for the webview to update before displaying text.
|
# Wait for the webview to update before displaying text.
|
||||||
while not self.webLoaded:
|
while not self.webLoaded:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
if animate:
|
||||||
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
||||||
|
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||||
|
else:
|
||||||
|
# This exists for https://bugs.launchpad.net/openlp/+bug/1016843
|
||||||
|
# For unknown reasons if evaluateJavaScript is called
|
||||||
|
# from the themewizard, then it causes a crash on
|
||||||
|
# Windows if there are many items in the service to re-render.
|
||||||
|
# Setting the div elements direct seems to solve the issue
|
||||||
|
self.frame.findFirstElement("#lyricsmain").setInnerXml(slide)
|
||||||
|
self.frame.findFirstElement("#lyricsoutline").setInnerXml(slide)
|
||||||
|
self.frame.findFirstElement("#lyricsshadow").setInnerXml(slide)
|
||||||
|
|
||||||
def alert(self, text, location):
|
def alert(self, text, location):
|
||||||
"""
|
"""
|
||||||
|
@ -286,19 +286,20 @@ class SlideController(Controller):
|
|||||||
text=translate('OpenLP.SlideController', 'Pause Audio'),
|
text=translate('OpenLP.SlideController', 'Pause Audio'),
|
||||||
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
|
tooltip=translate('OpenLP.SlideController', 'Pause audio.'),
|
||||||
checked=False, visible=False, category=self.category,
|
checked=False, visible=False, category=self.category,
|
||||||
triggers=self.onAudioPauseClicked)
|
context=QtCore.Qt.WindowShortcut,
|
||||||
|
shortcuts=[], triggers=self.onAudioPauseClicked)
|
||||||
self.audioMenu = QtGui.QMenu(
|
self.audioMenu = QtGui.QMenu(
|
||||||
translate('OpenLP.SlideController', 'Background Audio'), self)
|
translate('OpenLP.SlideController', 'Background Audio'), self.toolbar)
|
||||||
self.audioPauseItem.setMenu(self.audioMenu)
|
self.audioPauseItem.setMenu(self.audioMenu)
|
||||||
self.audioPauseItem.setParent(self)
|
self.audioPauseItem.setParent(self.toolbar)
|
||||||
self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode(
|
self.toolbar.widgetForAction(self.audioPauseItem).setPopupMode(
|
||||||
QtGui.QToolButton.MenuButtonPopup)
|
QtGui.QToolButton.MenuButtonPopup)
|
||||||
self.nextTrackItem = create_action(self, u'nextTrackItem',
|
self.nextTrackItem = create_action(self, u'nextTrackItem',
|
||||||
text=UiStrings().NextTrack,
|
text=UiStrings().NextTrack,
|
||||||
icon=u':/slides/media_playback_next.png', tooltip=translate(
|
icon=u':/slides/media_playback_next.png', tooltip=translate(
|
||||||
'OpenLP.SlideController', 'Go to next audio track.'),
|
'OpenLP.SlideController', 'Go to next audio track.'),
|
||||||
category=self.category, context=QtCore.Qt.WindowShortcut,
|
category=self.category,
|
||||||
triggers=self.onNextTrackClicked)
|
shortcuts=[], triggers=self.onNextTrackClicked)
|
||||||
self.audioMenu.addAction(self.nextTrackItem)
|
self.audioMenu.addAction(self.nextTrackItem)
|
||||||
self.trackMenu = self.audioMenu.addMenu(
|
self.trackMenu = self.audioMenu.addMenu(
|
||||||
translate('OpenLP.SlideController', 'Tracks'))
|
translate('OpenLP.SlideController', 'Tracks'))
|
||||||
|
@ -528,9 +528,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
for row in self.findVerseSplit.split(verse_list):
|
for row in self.findVerseSplit.split(verse_list):
|
||||||
for match in row.split(u'---['):
|
for match in row.split(u'---['):
|
||||||
for count, parts in enumerate(match.split(u']---\n')):
|
for count, parts in enumerate(match.split(u']---\n')):
|
||||||
if len(parts) <= 1:
|
|
||||||
continue
|
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
if len(parts) == 0:
|
||||||
|
continue
|
||||||
# handling carefully user inputted versetags
|
# handling carefully user inputted versetags
|
||||||
separator = parts.find(u':')
|
separator = parts.find(u':')
|
||||||
if separator >= 0:
|
if separator >= 0:
|
||||||
|
@ -67,7 +67,7 @@ class Ui_EditVerseDialog(object):
|
|||||||
self.verseTypeLayout.addStretch()
|
self.verseTypeLayout.addStretch()
|
||||||
self.dialogLayout.addLayout(self.verseTypeLayout)
|
self.dialogLayout.addLayout(self.verseTypeLayout)
|
||||||
self.buttonBox = create_button_box(editVerseDialog, u'buttonBox',
|
self.buttonBox = create_button_box(editVerseDialog, u'buttonBox',
|
||||||
[u'cancel', u'save'])
|
[u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.buttonBox)
|
||||||
self.retranslateUi(editVerseDialog)
|
self.retranslateUi(editVerseDialog)
|
||||||
|
|
||||||
|
@ -185,22 +185,3 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
text = u'---[%s:1]---\n%s' % \
|
text = u'---[%s:1]---\n%s' % \
|
||||||
(VerseType.TranslatedNames[VerseType.Verse], text)
|
(VerseType.TranslatedNames[VerseType.Verse], text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def accept(self):
|
|
||||||
if self.hasSingleVerse:
|
|
||||||
value = unicode(self.getVerse()[0])
|
|
||||||
else:
|
|
||||||
log.debug(unicode(self.getVerse()[0]).split(u'\n'))
|
|
||||||
value = unicode(self.getVerse()[0]).split(u'\n')[1]
|
|
||||||
if not value:
|
|
||||||
lines = unicode(self.getVerse()[0]).split(u'\n')
|
|
||||||
index = 2
|
|
||||||
while index < len(lines) and not value:
|
|
||||||
value = lines[index]
|
|
||||||
index += 1
|
|
||||||
if not value:
|
|
||||||
critical_error_message_box(
|
|
||||||
message=translate('SongsPlugin.EditSongForm',
|
|
||||||
'You need to type some text in to the verse.'))
|
|
||||||
return False
|
|
||||||
QtGui.QDialog.accept(self)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user