From 7f1db15ab174f213e42db5a44a6f004e47163d3f Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 29 Apr 2011 01:25:28 +0200 Subject: [PATCH 01/12] Fixed bug #771529, dealing with 1.9.0 databases. --- openlp/plugins/songs/lib/__init__.py | 5 ++++- openlp/plugins/songs/lib/xml.py | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 249a76a38..f9a160e55 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -293,7 +293,10 @@ def clean_song(manager, song): song.lyrics = unicode(sxml.extract_xml(), u'utf-8') # Rebuild the verse order, to convert translated verse tags, which might # have been added prior to 1.9.5. - order = song.verse_order.strip().split() + if song.verse_order: + order = song.verse_order.strip().split() + else: + order = [] new_order = [] for verse_def in order: verse_type = VerseType.Tags[VerseType.from_loose_input(verse_def[0])] diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 87e28591e..f2fd897d9 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -133,14 +133,26 @@ class SongXML(object): [{'lang': 'en', 'type': 'c', 'label': '1'}, u"English chorus"]] """ self.song_xml = None - if xml[:5] == u'') + self.lyrics = etree.SubElement(self.song_xml, u'lyrics') + verses = xml.split(u'\n\n') + for count, verse in enumerate(verses): + verse_list.append([{u'type': u'v', u'label': unicode(count)}, + unicode(verse)]) + self.add_verse_to_lyrics(u'v', unicode(count), verse) + return verse_list + elif xml[:5] == u' Date: Fri, 29 Apr 2011 08:15:09 +0200 Subject: [PATCH 02/12] also split when [---] is within a line --- openlp/core/lib/renderer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7687ebe9a..4dd9928fc 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -222,10 +222,10 @@ class Renderer(object): # Songs and Custom if item.is_capable(ItemCapabilities.AllowsVirtualSplit): # Do not forget the line breaks ! - slides = text.split(u'\n[---]\n') + slides = text.split(u'[---]') pages = [] for slide in slides: - lines = self._lines(slide) + lines = self._lines(slide.strip(u'\n')) new_pages = self._paginate_slide(lines, line_break, self.force_page) pages.extend([page for page in new_pages]) From 19d085bb3cdc133d3bb66db5703ff1ddcc2f0795 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 29 Apr 2011 08:28:09 +0200 Subject: [PATCH 03/12] Changed [:] notation to .startswith(). --- openlp/plugins/songs/lib/xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index f2fd897d9..1c20b23a5 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -146,7 +146,7 @@ class SongXML(object): unicode(verse)]) self.add_verse_to_lyrics(u'v', unicode(count), verse) return verse_list - elif xml[:5] == u' Date: Fri, 29 Apr 2011 09:40:44 +0200 Subject: [PATCH 04/12] removed redundant code --- openlp/core/lib/renderer.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 4dd9928fc..7aeebe75f 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -429,13 +429,8 @@ class Renderer(object): Split the slide up by physical line """ # this parse we do not want to use this so remove it - verses_text = text.split(u'\n') - text = [] - for verse in verses_text: - lines = verse.split(u'\n') - text.extend([line for line in lines]) - - return text + lines = text.split(u'\n') + return [line for line in lines] def _words_split(self, line): """ @@ -443,12 +438,8 @@ class Renderer(object): """ # this parse we are to be wordy line = line.replace(u'\n', u' ') - verses_text = line.split(u' ') - text = [] - for verse in verses_text: - lines = verse.split(u' ') - text.extend([line + u' ' for line in lines]) - return text + words = line.split(u' ') + return [word + u' ' for word in words] def _lines_split(self, text): """ @@ -457,9 +448,4 @@ class Renderer(object): # this parse we do not want to use this so remove it text = text.replace(u'\n[---]', u'') lines = text.split(u'\n') - real_lines = [] - for line in lines: - line = line.replace(u'[---]', u'') - sub_lines = line.split(u'\n') - real_lines.extend([sub_line for sub_line in sub_lines]) - return real_lines + return [line.replace(u'[---]', u'') for line in lines] From 547a7ac14d6bce6a6f9c9c9d411464faf6544222 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 29 Apr 2011 10:28:41 +0200 Subject: [PATCH 05/12] fix and clean up --- openlp/core/lib/renderer.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7aeebe75f..8106b742c 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -25,6 +25,7 @@ ############################################################################### import logging +import re from PyQt4 import QtCore, QtWebKit @@ -228,7 +229,7 @@ class Renderer(object): lines = self._lines(slide.strip(u'\n')) new_pages = self._paginate_slide(lines, line_break, self.force_page) - pages.extend([page for page in new_pages]) + pages.extend(new_pages) # Bibles elif item.is_capable(ItemCapabilities.AllowsWordSplit): pages = self._paginate_slide_words(text, line_break) @@ -341,12 +342,12 @@ class Renderer(object): if force_page and line_count > 0: Receiver.send_message(u'theme_line_count', line_count) line_count = -1 - html_text = html_text.rstrip(u'
') + html_text = re.compile(r'
.*$').sub(u'', html_text) formatted.append(html_text) html_text = u'' styled_text = styled_line html_text += line + line_end - html_text = html_text.rstrip(u'
') + html_text = re.compile(r'
.*$').sub(u'', html_text) formatted.append(html_text) log.debug(u'_paginate_slide - End') return formatted @@ -385,7 +386,8 @@ class Renderer(object): self.web.setHtml(html) if self.web_frame.contentsSize().height() <= \ self.page_height: - previous_raw = previous_raw.rstrip(u'
') + previous_raw = re.compile( + r'
.*$').sub(u'', previous_raw) formatted.append(previous_raw) previous_html = u'' previous_raw = u'' @@ -408,7 +410,8 @@ class Renderer(object): # Text too long so go to next page if self.web_frame.contentsSize().height() > \ self.page_height: - previous_raw = previous_raw.rstrip(u'
') + previous_raw = re.compile( + r'
.*$').sub(u'', previous_raw) formatted.append(previous_raw) previous_html = u'' previous_raw = u'' @@ -419,7 +422,7 @@ class Renderer(object): else: previous_html += styled_line + line_end previous_raw += line + line_end - previous_raw = previous_raw.rstrip(u'
') + previous_raw = re.compile(r'
.*$').sub(u'', previous_raw) formatted.append(previous_raw) log.debug(u'_paginate_slide_words - End') return formatted @@ -429,8 +432,7 @@ class Renderer(object): Split the slide up by physical line """ # this parse we do not want to use this so remove it - lines = text.split(u'\n') - return [line for line in lines] + return text.split(u'\n') def _words_split(self, line): """ From e6f69c01f4a8bb51b1a6b62472743b011308124e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 12:21:14 +0100 Subject: [PATCH 06/12] Remove 2 phonon initialisations --- openlp/core/lib/renderer.py | 2 +- openlp/core/ui/maindisplay.py | 12 +++++++----- openlp/plugins/media/lib/mediaitem.py | 6 ++++-- openlp/plugins/songs/lib/mediaitem.py | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7687ebe9a..6014602b2 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -71,7 +71,7 @@ class Renderer(object): log.debug(u'Initilisation started') self.screens = screens self.image_manager = ImageManager() - self.display = MainDisplay(self, screens, False) + self.display = MainDisplay(self, screens, False, False) self.display.imageManager = self.image_manager self.theme_manager = theme_manager self.service_theme = u'' diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 7843284b3..74cc09135 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -60,11 +60,12 @@ class MainDisplay(DisplayWidget): """ This is the display screen. """ - def __init__(self, parent, screens, live): + def __init__(self, parent, screens, live, needsPhonon=True): DisplayWidget.__init__(self, live, parent=None) self.parent = parent self.screens = screens self.isLive = live + self.needsPhonon = needsPhonon self.alertTab = None self.hideMode = None self.videoHide = False @@ -102,10 +103,11 @@ class MainDisplay(DisplayWidget): self.videoWidget.setGeometry(QtCore.QRect(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())) log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number) - self.mediaObject = Phonon.MediaObject(self) - self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) - Phonon.createPath(self.mediaObject, self.videoWidget) - Phonon.createPath(self.mediaObject, self.audio) + if self.needsPhonon: + self.mediaObject = Phonon.MediaObject(self) + self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) + Phonon.createPath(self.mediaObject, self.videoWidget) + Phonon.createPath(self.mediaObject, self.audio) QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), self.videoState) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 559af11e2..2a0620cf8 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -50,7 +50,7 @@ class MediaMediaItem(MediaManagerItem): u':/media/media_video.png').toImage() MediaManagerItem.__init__(self, parent, self, icon) self.singleServiceItem = False - self.mediaObject = Phonon.MediaObject(self) + self.mediaObject = None QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced) @@ -117,6 +117,8 @@ class MediaMediaItem(MediaManagerItem): 'the media file "%s" no longer exists.')) % filename) def generateSlideData(self, service_item, item=None, xmlVersion=False): + if not self.mediaObject: + self.mediaObject = Phonon.MediaObject(self) if item is None: item = self.listView.currentItem() if item is None: @@ -209,4 +211,4 @@ class MediaMediaItem(MediaManagerItem): img = QtGui.QPixmap(u':/media/media_video.png').toImage() item_name.setIcon(build_icon(img)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) - self.listView.addItem(item_name) \ No newline at end of file + self.listView.addItem(item_name) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d731d8ef8..15fa774ad 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -473,4 +473,4 @@ class SongMediaItem(MediaManagerItem): Locale aware collation of song titles """ return locale.strcoll(unicode(song_1.title.lower()), - unicode(song_2.title.lower())) \ No newline at end of file + unicode(song_2.title.lower())) From 4304d111f185b2daf0d65e7b55e7f167b89c57f2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 12:55:49 +0100 Subject: [PATCH 07/12] Live Initialisation Delayed --- openlp/core/ui/maindisplay.py | 36 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 74cc09135..1ea412fe8 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -71,6 +71,8 @@ class MainDisplay(DisplayWidget): self.videoHide = False self.override = {} self.retranslateUi() + self.mediaObject = None + self.firstTime = True self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint) @@ -104,19 +106,10 @@ class MainDisplay(DisplayWidget): self.screen[u'size'].width(), self.screen[u'size'].height())) log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number) if self.needsPhonon: - self.mediaObject = Phonon.MediaObject(self) - self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) - Phonon.createPath(self.mediaObject, self.videoWidget) - Phonon.createPath(self.mediaObject, self.audio) - QtCore.QObject.connect(self.mediaObject, - QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), - self.videoState) - QtCore.QObject.connect(self.mediaObject, - QtCore.SIGNAL(u'finished()'), - self.videoFinished) - QtCore.QObject.connect(self.mediaObject, - QtCore.SIGNAL(u'tick(qint64)'), - self.videoTick) + if self.firstTime: + self.firstTime = False + else: + self.createMediaObject() log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number) self.webView = QtWebKit.QWebView(self) self.webView.setGeometry(0, 0, @@ -177,6 +170,21 @@ class MainDisplay(DisplayWidget): log.debug( u'Finished setup for monitor %s' % self.screens.monitor_number) + def createMediaObject(self): + self.mediaObject = Phonon.MediaObject(self) + self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) + Phonon.createPath(self.mediaObject, self.videoWidget) + Phonon.createPath(self.mediaObject, self.audio) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), + self.videoState) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'finished()'), + self.videoFinished) + QtCore.QObject.connect(self.mediaObject, + QtCore.SIGNAL(u'tick(qint64)'), + self.videoTick) + def text(self, slide): """ Add the slide text from slideController @@ -350,6 +358,8 @@ class MainDisplay(DisplayWidget): """ Loads and starts a video to run with the option of sound """ + if not self.mediaObject: + self.createMediaObject() log.debug(u'video') self.webLoaded = True self.setGeometry(self.screen[u'size']) From 640815ada3fe7c7f215ab4959477300e9550fc0f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 29 Apr 2011 16:31:17 +0200 Subject: [PATCH 08/12] removed re --- openlp/core/lib/renderer.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 8106b742c..641920852 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -25,7 +25,6 @@ ############################################################################### import logging -import re from PyQt4 import QtCore, QtWebKit @@ -226,7 +225,7 @@ class Renderer(object): slides = text.split(u'[---]') pages = [] for slide in slides: - lines = self._lines(slide.strip(u'\n')) + lines = slide.strip(u'\n').split(u'\n') new_pages = self._paginate_slide(lines, line_break, self.force_page) pages.extend(new_pages) @@ -342,12 +341,14 @@ class Renderer(object): if force_page and line_count > 0: Receiver.send_message(u'theme_line_count', line_count) line_count = -1 - html_text = re.compile(r'
.*$').sub(u'', html_text) + while html_text.endswith(u'
'): + html_text = html_text[:-4] formatted.append(html_text) html_text = u'' styled_text = styled_line html_text += line + line_end - html_text = re.compile(r'
.*$').sub(u'', html_text) + while html_text.endswith(u'
'): + tml_text = html_text[:-4] formatted.append(html_text) log.debug(u'_paginate_slide - End') return formatted @@ -372,7 +373,7 @@ class Renderer(object): formatted = [] previous_html = u'' previous_raw = u'' - lines = self._lines(text) + lines = text.split(u'\n') for line in lines: styled_line = expand_tags(line) html = self.page_shell + previous_html + styled_line + HTML_END @@ -386,8 +387,8 @@ class Renderer(object): self.web.setHtml(html) if self.web_frame.contentsSize().height() <= \ self.page_height: - previous_raw = re.compile( - r'
.*$').sub(u'', previous_raw) + while previous_raw.endswith(u'
'): + previous_raw = previous_raw[:-4] formatted.append(previous_raw) previous_html = u'' previous_raw = u'' @@ -410,8 +411,8 @@ class Renderer(object): # Text too long so go to next page if self.web_frame.contentsSize().height() > \ self.page_height: - previous_raw = re.compile( - r'
.*$').sub(u'', previous_raw) + while previous_raw.endswith(u'
'): + previous_raw = previous_raw[:-4] formatted.append(previous_raw) previous_html = u'' previous_raw = u'' @@ -422,18 +423,12 @@ class Renderer(object): else: previous_html += styled_line + line_end previous_raw += line + line_end - previous_raw = re.compile(r'
.*$').sub(u'', previous_raw) + while previous_raw.endswith(u'
'): + previous_raw = previous_raw[:-4] formatted.append(previous_raw) log.debug(u'_paginate_slide_words - End') return formatted - def _lines(self, text): - """ - Split the slide up by physical line - """ - # this parse we do not want to use this so remove it - return text.split(u'\n') - def _words_split(self, line): """ Split the slide up by word so can wrap better From 0f51c47d9e381a65b488b5133b82e909ef38e947 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 29 Apr 2011 16:36:29 +0200 Subject: [PATCH 09/12] fixed spelling --- openlp/core/lib/renderer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 641920852..bba85d176 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -348,7 +348,7 @@ class Renderer(object): styled_text = styled_line html_text += line + line_end while html_text.endswith(u'
'): - tml_text = html_text[:-4] + html_text = html_text[:-4] formatted.append(html_text) log.debug(u'_paginate_slide - End') return formatted From 08b6d7cee1e063bfd65d6f67ca4e05f8603b42e2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 17:27:27 +0100 Subject: [PATCH 10/12] Fixes for Jon --- openlp/core/ui/maindisplay.py | 12 ++++++++---- openlp/core/utils/__init__.py | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 1ea412fe8..5eec90682 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -81,6 +81,9 @@ class MainDisplay(DisplayWidget): QtCore.SIGNAL(u'maindisplay_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'openlp_phonon_creation'), + self.createMediaObject) def retranslateUi(self): """ @@ -105,10 +108,8 @@ class MainDisplay(DisplayWidget): self.videoWidget.setGeometry(QtCore.QRect(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())) log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number) - if self.needsPhonon: - if self.firstTime: - self.firstTime = False - else: + if self.isLive: + if not self.firstTime: self.createMediaObject() log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number) self.webView = QtWebKit.QWebView(self) @@ -171,6 +172,8 @@ class MainDisplay(DisplayWidget): u'Finished setup for monitor %s' % self.screens.monitor_number) def createMediaObject(self): + self.firstTime = False + log.debug(u'Creating Phonon objects - Start for %s', self.isLive) self.mediaObject = Phonon.MediaObject(self) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) Phonon.createPath(self.mediaObject, self.videoWidget) @@ -184,6 +187,7 @@ class MainDisplay(DisplayWidget): QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'tick(qint64)'), self.videoTick) + log.debug(u'Creating Phonon objects - Finished for %s', self.isLive) def text(self, slide): """ diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 1bc7037ae..d08a63c4b 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -99,6 +99,7 @@ class VersionThread(QtCore.QThread): local_version.get(u'revision') and \ remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) + Receiver.send_message(u'openlp_phonon_creation') class AppLocation(object): From 189daad93ce130a85dcd07960ff108bc32c4dbcb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 17:41:26 +0100 Subject: [PATCH 11/12] More improvements --- openlp/plugins/media/lib/mediaitem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 2a0620cf8..52f689f41 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -54,6 +54,9 @@ class MediaMediaItem(MediaManagerItem): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'video_background_replaced'), self.videobackgroundReplaced) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'openlp_phonon_creation'), + self.createPhonon) def retranslateUi(self): self.onNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media') @@ -117,8 +120,6 @@ class MediaMediaItem(MediaManagerItem): 'the media file "%s" no longer exists.')) % filename) def generateSlideData(self, service_item, item=None, xmlVersion=False): - if not self.mediaObject: - self.mediaObject = Phonon.MediaObject(self) if item is None: item = self.listView.currentItem() if item is None: @@ -212,3 +213,8 @@ class MediaMediaItem(MediaManagerItem): item_name.setIcon(build_icon(img)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) self.listView.addItem(item_name) + + def createPhonon(self): + if not self.mediaObject: + self.mediaObject = Phonon.MediaObject(self) + From 9e721a4824aa8eaee0e61a116c6c16ad1ab26222 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 19:43:29 +0100 Subject: [PATCH 12/12] More improvements --- openlp/core/ui/slidecontroller.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ad2b007a4..fdbf184b5 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -277,15 +277,16 @@ class SlideController(QtGui.QWidget): self.slideLayout.setSpacing(0) self.slideLayout.setMargin(0) self.slideLayout.setObjectName(u'SlideLayout') - self.mediaObject = Phonon.MediaObject(self) - self.video = Phonon.VideoWidget() - self.video.setVisible(False) - self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) - Phonon.createPath(self.mediaObject, self.video) - Phonon.createPath(self.mediaObject, self.audio) if not self.isLive: + self.mediaObject = Phonon.MediaObject(self) + self.video = Phonon.VideoWidget() + self.video.setVisible(False) + self.audio = Phonon.AudioOutput(Phonon.VideoCategory, + self.mediaObject) + Phonon.createPath(self.mediaObject, self.video) + Phonon.createPath(self.mediaObject, self.audio) self.video.setGeometry(QtCore.QRect(0, 0, 300, 225)) - self.slideLayout.insertWidget(0, self.video) + self.slideLayout.insertWidget(0, self.video) # Actual preview screen self.slidePreview = QtGui.QLabel(self) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,