From ea1321ef202a174335bbcc01ff207cbcb5a22914 Mon Sep 17 00:00:00 2001 From: rimach Date: Wed, 15 Sep 2010 22:51:01 +0200 Subject: [PATCH 01/11] add pipe using for soffice --- .../plugins/presentations/lib/impresscontroller.py | 14 +++++++++++--- openlp/plugins/songs/lib/oooimport.py | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 9ada43a5a..582368a4e 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -98,7 +98,12 @@ class ImpressController(PresentationController): self.manager._FlagAsMethod(u'Bridge_GetValueObject') else: # -headless - cmd = u'openoffice.org -nologo -norestore -minimized -invisible -nofirststartwizard -accept="socket,host=localhost,port=2002;urp;"' + #connection_type = u'socket' + connection_type = u'pipe,name=openlp_pipe:' + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + + '-accept="' + connection_type \ + + u'socket,host=localhost,port=2002;urp;"' self.process = QtCore.QProcess() self.process.startDetached(cmd) self.process.waitForStarted() @@ -117,11 +122,14 @@ class ImpressController(PresentationController): u'UnoUrlResolver') resolver = context.ServiceManager.createInstanceWithContext( u'com.sun.star.bridge.UnoUrlResolver', context) + #connection_type = u'socket' + connection_type = u'pipe,name=openlp_pipe:' while ctx is None and loop < 3: try: log.debug(u'get UNO Desktop Openoffice - resolve') - ctx = resolver.resolve(u'uno:socket,host=localhost,port=2002;' - u'urp;StarOffice.ComponentContext') + ctx = resolver.resolve(u'uno:' + connection_type \ + + u',host=localhost,' \ + + u'port=2002;urp;StarOffice.ComponentContext') except: log.exception(u'Unable to find running instance ') self.start_process() diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index e8c723c0e..b092d2962 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -94,6 +94,8 @@ class OooImport(SongImport): Start OpenOffice.org process TODO: The presentation/Impress plugin may already have it running """ + #connection_type = u'socket' + connection_type = u'pipe,name=openlp_pipe:' if os.name == u'nt': self.start_ooo_process() self.desktop = self.manager.createInstance( @@ -106,8 +108,9 @@ class OooImport(SongImport): loop = 0 while ctx is None and loop < 5: try: - ctx = resolver.resolve(u'uno:socket,host=localhost,' \ - + 'port=2002;urp;StarOffice.ComponentContext') + ctx = resolver.resolve(u'uno:' + connection_type \ + + u',host=localhost,' \ + + u'port=2002;urp;StarOffice.ComponentContext') except: pass self.start_ooo_process() @@ -117,6 +120,8 @@ class OooImport(SongImport): "com.sun.star.frame.Desktop", ctx) def start_ooo_process(self): + #connection_type = u'socket' + connection_type = u'pipe,name=openlp_pipe:' try: if os.name == u'nt': self.manager = Dispatch(u'com.sun.star.ServiceManager') @@ -125,7 +130,8 @@ class OooImport(SongImport): else: cmd = u'openoffice.org -nologo -norestore -minimized ' \ + u'-invisible -nofirststartwizard ' \ - + '-accept="socket,host=localhost,port=2002;urp;"' + + '-accept="' + connection_type \ + + u'socket,host=localhost,port=2002;urp;"' process = QtCore.QProcess() process.startDetached(cmd) process.waitForStarted() From d2bf1fedae06f58c554252726c0d022b354e57f1 Mon Sep 17 00:00:00 2001 From: rimach Date: Thu, 16 Sep 2010 23:01:44 +0200 Subject: [PATCH 02/11] correct piped soffice start, fix Python2.5 problem with unicode strings in optparse --- openlp.pyw | 22 +++++++------- .../presentations/lib/impresscontroller.py | 28 +++++++++++------- openlp/plugins/songs/lib/oooimport.py | 28 +++++++++++------- resources/images/about-new.bmp | Bin resources/openlp.desktop | 17 +++++++++-- 5 files changed, 60 insertions(+), 35 deletions(-) mode change 100755 => 100644 resources/images/about-new.bmp mode change 100644 => 100755 resources/openlp.desktop diff --git a/openlp.pyw b/openlp.pyw index 9327a1168..80b49321e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -162,18 +162,18 @@ def main(): the PyQt4 Application. """ # Set up command line options. - usage = u'Usage: %prog [options] [qt-options]' + usage = 'Usage: %prog [options] [qt-options]' parser = OptionParser(usage=usage) - parser.add_option(u'-e', u'--no-error-form', dest=u'no_error_form', - action=u'store_true', help=u'Disable the error notification form.') - parser.add_option(u'-l', u'--log-level', dest=u'loglevel', - default=u'warning', metavar=u'LEVEL', help=u'Set logging to LEVEL ' - u'level. Valid values are "debug", "info", "warning".') - parser.add_option(u'-p', u'--portable', dest=u'portable', - action=u'store_true', help=u'Specify if this should be run as a ' - u'portable app, off a USB flash drive (not implemented).') - parser.add_option(u'-s', u'--style', dest=u'style', - help=u'Set the Qt4 style (passed directly to Qt4).') + parser.add_option('-e', '--no-error-form', dest='no_error_form', + action='store_true', help='Disable the error notification form.') + parser.add_option('-l', '--log-level', dest='loglevel', + default='warning', metavar='LEVEL', help='Set logging to LEVEL ' + 'level. Valid values are "debug", "info", "warning".') + parser.add_option('-p', '--portable', dest='portable', + action='store_true', help='Specify if this should be run as a ' + 'portable app, off a USB flash drive (not implemented).') + parser.add_option('-s', '--style', dest='style', + help='Set the Qt4 style (passed directly to Qt4).') # Set up logging log_path = AppLocation.get_directory(AppLocation.CacheDir) if not os.path.exists(log_path): diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 582368a4e..8d2f8e76e 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -74,6 +74,7 @@ class ImpressController(PresentationController): self.process = None self.desktop = None self.manager = None + self.uno_connection_type = u'pipe' #u'socket' def check_available(self): """ @@ -98,12 +99,14 @@ class ImpressController(PresentationController): self.manager._FlagAsMethod(u'Bridge_GetValueObject') else: # -headless - #connection_type = u'socket' - connection_type = u'pipe,name=openlp_pipe:' - cmd = u'openoffice.org -nologo -norestore -minimized ' \ - + u'-invisible -nofirststartwizard ' \ - + '-accept="' + connection_type \ - + u'socket,host=localhost,port=2002;urp;"' + if self.uno_connection_type == u'pipe': + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + + u'-accept=pipe,name=openlp_pipe;urp;' + else: + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + + u'-accept=socket,host=localhost,port=2002;urp;' self.process = QtCore.QProcess() self.process.startDetached(cmd) self.process.waitForStarted() @@ -123,13 +126,18 @@ class ImpressController(PresentationController): resolver = context.ServiceManager.createInstanceWithContext( u'com.sun.star.bridge.UnoUrlResolver', context) #connection_type = u'socket' - connection_type = u'pipe,name=openlp_pipe:' + connection_type = u'pipe,name=openlp_pipe' while ctx is None and loop < 3: try: log.debug(u'get UNO Desktop Openoffice - resolve') - ctx = resolver.resolve(u'uno:' + connection_type \ - + u',host=localhost,' \ - + u'port=2002;urp;StarOffice.ComponentContext') + if self.uno_connection_type == u'pipe': + ctx = resolver.resolve(u'uno:' \ + + u'pipe,name=openlp_pipe;' \ + + u'urp;StarOffice.ComponentContext') + else: + ctx = resolver.resolve(u'uno:' \ + + u'socket,host=localhost,port=2002;' \ + + u'urp;StarOffice.ComponentContext') except: log.exception(u'Unable to find running instance ') self.start_process() diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index b092d2962..26a0abfcc 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -59,6 +59,7 @@ class OooImport(SongImport): self.document = None self.process_started = False self.filenames = kwargs[u'filenames'] + self.uno_connection_type = u'pipe' #u'socket' QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'song_stop_import'), self.stop_import) @@ -94,8 +95,6 @@ class OooImport(SongImport): Start OpenOffice.org process TODO: The presentation/Impress plugin may already have it running """ - #connection_type = u'socket' - connection_type = u'pipe,name=openlp_pipe:' if os.name == u'nt': self.start_ooo_process() self.desktop = self.manager.createInstance( @@ -108,9 +107,14 @@ class OooImport(SongImport): loop = 0 while ctx is None and loop < 5: try: - ctx = resolver.resolve(u'uno:' + connection_type \ - + u',host=localhost,' \ - + u'port=2002;urp;StarOffice.ComponentContext') + if self.uno_connection_type == u'pipe': + ctx = resolver.resolve(u'uno:' \ + + u'pipe,name=openlp_pipe;' \ + + u'urp;StarOffice.ComponentContext') + else: + ctx = resolver.resolve(u'uno:' \ + + u'socket,host=localhost,port=2002;' \ + + u'urp;StarOffice.ComponentContext') except: pass self.start_ooo_process() @@ -120,18 +124,20 @@ class OooImport(SongImport): "com.sun.star.frame.Desktop", ctx) def start_ooo_process(self): - #connection_type = u'socket' - connection_type = u'pipe,name=openlp_pipe:' try: if os.name == u'nt': self.manager = Dispatch(u'com.sun.star.ServiceManager') self.manager._FlagAsMethod(u'Bridge_GetStruct') self.manager._FlagAsMethod(u'Bridge_GetValueObject') else: - cmd = u'openoffice.org -nologo -norestore -minimized ' \ - + u'-invisible -nofirststartwizard ' \ - + '-accept="' + connection_type \ - + u'socket,host=localhost,port=2002;urp;"' + if self.uno_connection_type == u'pipe': + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + + u'-accept=pipe,name=openlp_pipe;urp;' + else: + cmd = u'openoffice.org -nologo -norestore -minimized ' \ + + u'-invisible -nofirststartwizard ' \ + + u'-accept=socket,host=localhost,port=2002;urp;' process = QtCore.QProcess() process.startDetached(cmd) process.waitForStarted() diff --git a/resources/images/about-new.bmp b/resources/images/about-new.bmp old mode 100755 new mode 100644 diff --git a/resources/openlp.desktop b/resources/openlp.desktop old mode 100644 new mode 100755 index 0c843bd69..684119773 --- a/resources/openlp.desktop +++ b/resources/openlp.desktop @@ -1,10 +1,21 @@ [Desktop Entry] +Categories=AudioVideo; +Comment[de]= +Comment= Encoding=UTF-8 -Name=OpenLP -GenericName=Church lyrics projection Exec=openlp +GenericName[de]=Church lyrics projection +GenericName=Church lyrics projection Icon=openlp +MimeType= +Name[de]=OpenLP +Name=OpenLP +Path= StartupNotify=true Terminal=false +TerminalOptions= Type=Application -Categories=AudioVideo; +X-DBUS-ServiceName= +X-DBUS-StartupType= +X-KDE-SubstituteUID=false +X-KDE-Username= From ba346502e44da0470ae86d37c42c9819386beb1c Mon Sep 17 00:00:00 2001 From: rimach Date: Thu, 16 Sep 2010 23:04:02 +0200 Subject: [PATCH 03/11] Head --- resources/openlp.desktop | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/resources/openlp.desktop b/resources/openlp.desktop index 684119773..d84f69297 100755 --- a/resources/openlp.desktop +++ b/resources/openlp.desktop @@ -1,21 +1,11 @@ +#!/usr/bin/env xdg-open [Desktop Entry] -Categories=AudioVideo; -Comment[de]= -Comment= Encoding=UTF-8 -Exec=openlp -GenericName[de]=Church lyrics projection -GenericName=Church lyrics projection -Icon=openlp -MimeType= -Name[de]=OpenLP Name=OpenLP -Path= +GenericName=Church lyrics projection +Exec=openlp +Icon=openlp StartupNotify=true Terminal=false -TerminalOptions= Type=Application -X-DBUS-ServiceName= -X-DBUS-StartupType= -X-KDE-SubstituteUID=false -X-KDE-Username= +Categories=AudioVideo; From 2ad441e88332f6d71bc980cabbfef62d15fd36ad Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 16 Sep 2010 22:19:51 +0100 Subject: [PATCH 04/11] Speedups --- openlp/core/lib/__init__.py | 2 ++ openlp/core/lib/htmlbuilder.py | 6 ++-- openlp/core/lib/renderer.py | 51 ++++++++++++++++++-------------- openlp/core/lib/rendermanager.py | 1 - openlp/core/lib/serviceitem.py | 6 ++-- openlp/core/ui/maindisplay.py | 2 ++ 6 files changed, 37 insertions(+), 31 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index b325f0c6c..ade4bc019 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -220,6 +220,7 @@ def image_to_byte(image): ``image`` The image to converted. """ + log.debug(u'image_to_byte') byte_array = QtCore.QByteArray() # use buffer to store pixmap into byteArray buffie = QtCore.QBuffer(byte_array) @@ -249,6 +250,7 @@ def resize_image(image, width, height, background=QtCore.Qt.black): The background colour defaults to black. """ + log.debug(u'resize_image') preview = QtGui.QImage(image) if not preview.isNull(): # Only resize if different size diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 906ebb987..0e8aca432 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -27,8 +27,6 @@ import logging from PyQt4 import QtWebKit -from openlp.core.lib import image_to_byte - log = logging.getLogger(__name__) HTMLSRC = u""" @@ -301,8 +299,8 @@ def build_html(item, screen, alert, islive): height = screen[u'size'].height() theme = item.themedata webkitvers = webkit_version() - if item.bg_frame: - image = u'data:image/png;base64,%s' % image_to_byte(item.bg_frame) + if item.bg_image_bytes: + image = u'data:image/png;base64,%s' % item.bg_image_bytes else: image = u'' html = HTMLSRC % (build_background_css(item, width, height), diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 0cb92ad39..b10b4636f 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -32,7 +32,8 @@ import logging from PyQt4 import QtGui, QtCore, QtWebKit from openlp.core.lib import resize_image, expand_tags, \ - build_lyrics_format_css, build_lyrics_outline_css + build_lyrics_format_css, build_lyrics_outline_css, image_to_byte + log = logging.getLogger(__name__) @@ -54,6 +55,9 @@ class Renderer(object): self.frame = None self.bg_frame = None self.bg_image = None + self.bg_image_bytes = None + self.web = QtWebKit.QWebView() + self.web.setVisible(False) def set_theme(self, theme): """ @@ -66,15 +70,12 @@ class Renderer(object): self._theme = theme self.bg_frame = None self.bg_image = None + self.bg_image_bytes = None self._bg_image_filename = None self.theme_name = theme.theme_name if theme.background_type == u'image': if theme.background_filename: self._bg_image_filename = unicode(theme.background_filename) - if self.frame: - self.bg_image = resize_image(self._bg_image_filename, - self.frame.width(), - self.frame.height()) def set_text_rectangle(self, rect_main, rect_footer): """ @@ -88,7 +89,21 @@ 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: + self.page_width -= int(self._theme.display_shadow_size) + self.page_height -= int(self._theme.display_shadow_size) + 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 + self.page_shell = u'' \ + u'
' % \ + (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): """ @@ -110,15 +125,18 @@ 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(), QtGui.QImage.Format_ARGB32_Premultiplied) + self.frame.height(), + QtGui.QImage.Format_ARGB32_Premultiplied) painter = QtGui.QPainter() painter.begin(self.bg_frame) painter.fillRect(self.frame.rect(), QtCore.Qt.black) if self.bg_image: painter.drawImage(0, 0, self.bg_image) painter.end() + self.bg_image_bytes = image_to_byte(self.bg_frame) else: self.bg_frame = None + self.bg_image_bytes = None def format_slide(self, words, line_break): """ @@ -139,29 +157,16 @@ class Renderer(object): lines = verse.split(u'\n') for line in lines: text.append(line) - web = QtWebKit.QWebView() - web.resize(self._rect.width(), self._rect.height()) - web.setVisible(False) - frame = web.page().mainFrame() - # Adjust width and height to account for shadow. outline done in css - width = self._rect.width() - int(self._theme.display_shadow_size) - height = self._rect.height() - int(self._theme.display_shadow_size) - shell = u'' \ - u'
' % \ - (build_lyrics_format_css(self._theme, width, height), - build_lyrics_outline_css(self._theme)) formatted = [] html_text = u'' styled_text = u'' - js_height = 'document.getElementById("main").scrollHeight' for line in text: styled_line = expand_tags(line) + line_end styled_text += styled_line - html = shell + styled_text + u'
' - web.setHtml(html) + html = self.page_shell + styled_text + u'
' + self.web.setHtml(html) # Text too long so go to next page - text_height = int(frame.evaluateJavaScript(js_height).toString()) - if text_height > height: + if self.web_frame.contentsSize().height() > self.page_height: formatted.append(html_text) html_text = u'' styled_text = styled_line diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index a6e494b01..e98ab4f01 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -223,7 +223,6 @@ class RenderManager(object): The words to go on the slides. """ log.debug(u'format slide') - self.build_text_rectangle(self.themedata) return self.renderer.format_slide(words, line_break) def calculate_default(self, screen): diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index b0d453af5..e7ec9c2af 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -97,7 +97,7 @@ class ServiceItem(object): self.themedata = None self.main = None self.footer = None - self.bg_frame = None + self.bg_image_bytes = None def _new_item(self): """ @@ -145,7 +145,7 @@ class ServiceItem(object): """ log.debug(u'Render called') self._display_frames = [] - self.bg_frame = None + self.bg_image_bytes = None line_break = True if self.is_capable(ItemCapabilities.NoLineBreaks): line_break = False @@ -156,7 +156,7 @@ class ServiceItem(object): theme = self.theme self.main, self.footer = \ self.render_manager.set_override_theme(theme, useOverride) - self.bg_frame = self.render_manager.renderer.bg_frame + self.bg_image_bytes = self.render_manager.renderer.bg_image_bytes self.themedata = self.render_manager.renderer._theme for slide in self._raw_frames: before = time.time() diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a2b9dd81a..646bdebd5 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -341,7 +341,9 @@ class MainDisplay(DisplayWidget): self.serviceItem = serviceItem html = build_html(self.serviceItem, self.screen, self.parent.alertTab, self.isLive) + log.debug(u'buildHtml - pre setHtml') self.webView.setHtml(html) + log.debug(u'buildHtml - post setHtml') if serviceItem.foot_text and serviceItem.foot_text: self.footer(serviceItem.foot_text) # if was hidden keep it hidden From 2837c36553562787165161526418fe3a30fd7c24 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 17 Sep 2010 21:32:00 +0100 Subject: [PATCH 05/11] tweaks --- openlp/core/lib/renderer.py | 4 ++-- openlp/core/ui/maindisplay.py | 5 +++-- openlp/core/ui/slidecontroller.py | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index b10b4636f..194172a9e 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -56,8 +56,6 @@ class Renderer(object): self.bg_frame = None self.bg_image = None self.bg_image_bytes = None - self.web = QtWebKit.QWebView() - self.web.setVisible(False) def set_theme(self, theme): """ @@ -95,6 +93,8 @@ class Renderer(object): if self._theme.display_shadow: self.page_width -= int(self._theme.display_shadow_size) self.page_height -= int(self._theme.display_shadow_size) + self.web = QtWebKit.QWebView() + self.web.setVisible(False) 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 diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 646bdebd5..fe8438895 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -306,6 +306,7 @@ class MainDisplay(DisplayWidget): # We must have a service item to preview if not hasattr(self, u'serviceItem'): return + Receiver.send_message(u'openlp_process_events') if self.isLive: # Wait for the fade to finish before geting the preview. # Important otherwise preview will have incorrect text if at all ! @@ -318,6 +319,8 @@ class MainDisplay(DisplayWidget): # Important otherwise first preview will miss the background ! while not self.loaded: Receiver.send_message(u'openlp_process_events') + if self.isLive: + self.setVisible(True) preview = QtGui.QImage(self.screen[u'size'].width(), self.screen[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied) @@ -326,8 +329,6 @@ class MainDisplay(DisplayWidget): self.frame.render(painter) painter.end() # Make display show up if in single screen mode - if self.isLive: - self.setVisible(True) return preview def buildHtml(self, serviceItem): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 9f9b4d433..dcaa726df 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -636,9 +636,9 @@ class SlideController(QtGui.QWidget): """ if not self.serviceItem: return - Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive]) if self.serviceItem.is_command(): + Receiver.send_message(u'%s_first' % self.serviceItem.name.lower(), + [self.serviceItem, self.isLive]) self.updatePreview() else: self.PreviewListWidget.selectRow(0) @@ -651,9 +651,9 @@ class SlideController(QtGui.QWidget): index = int(message[0]) if not self.serviceItem: return - Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive, index]) if self.serviceItem.is_command(): + Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), + [self.serviceItem, self.isLive, index]) self.updatePreview() else: self.PreviewListWidget.selectRow(index) @@ -768,9 +768,9 @@ class SlideController(QtGui.QWidget): row = self.PreviewListWidget.currentRow() self.selectedRow = 0 if row > -1 and row < self.PreviewListWidget.rowCount(): - Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), - [self.serviceItem, self.isLive, row]) if self.serviceItem.is_command() and self.isLive: + Receiver.send_message(u'%s_slide' % self.serviceItem.name.lower(), + [self.serviceItem, self.isLive, row]) self.updatePreview() else: frame, raw_html = self.serviceItem.get_rendered_frame(row) From 93b2d54c92c9bb6203ae734f93531f228faa3428 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Sat, 18 Sep 2010 16:24:39 +0100 Subject: [PATCH 06/11] String fixes --- openlp/core/ui/servicemanager.py | 3 ++- openlp/core/ui/slidecontroller.py | 3 ++- openlp/core/ui/thememanager.py | 4 ++-- openlp/plugins/bibles/forms/importwizardform.py | 4 ++-- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/songs/forms/authorsform.py | 3 +-- openlp/plugins/songs/forms/topicsform.py | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b2058a2e1..8db14956d 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -884,7 +884,8 @@ class ServiceManager(QtGui.QWidget): QtGui.QMessageBox.critical(self, translate('OpenLP.ServiceManager', 'Missing Display Handler'), translate('OpenLP.ServiceManager', 'Your item cannot be ' - 'displayed as there is no handler to display it')) + 'displayed as the plugin required to display it is missing ' + 'or inactive')) def remoteEdit(self): """ diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 9f9b4d433..7a2e3ccf0 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -209,7 +209,8 @@ class SlideController(QtGui.QWidget): self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarButton( u'Edit Song', u':/general/general_edit.png', - translate('OpenLP.SlideController', 'Edit and re-preview song'), + translate('OpenLP.SlideController', + 'Edit and reload song preview'), self.onEditSong) if isLive: self.Toolbar.addToolbarSeparator(u'Loop Separator') diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 3ad6b5c8d..d8324f977 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -242,14 +242,14 @@ class ThemeManager(QtGui.QWidget): QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeManager', 'Error'), unicode(translate('OpenLP.ThemeManager', - 'Theme %s is use in %s plugin.')) % \ + 'Theme %s is used in the %s plugin.')) % \ (theme, plugin.name)) return if unicode(self.serviceComboBox.currentText()) == theme: QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeManager', 'Error'), unicode(translate('OpenLP.ThemeManager', - 'Theme %s is use by the service manager.')) % theme) + 'Theme %s is used by the service manager.')) % theme) return row = self.themeListWidget.row(item) self.themeListWidget.takeItem(row) diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py index 67f3756dc..84f0f41ee 100644 --- a/openlp/plugins/bibles/forms/importwizardform.py +++ b/openlp/plugins/bibles/forms/importwizardform.py @@ -182,7 +182,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'Empty Copyright'), translate('BiblesPlugin.ImportWizardForm', - 'You need to set a copyright for your Bible! ' + 'You need to set a copyright for your Bible. ' 'Bibles in the Public Domain need to be marked as ' 'such.')) self.CopyrightEdit.setFocus() @@ -192,7 +192,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'), translate('BiblesPlugin.ImportWizardForm', - 'This Bible already exists! Please import ' + 'This Bible already exists. Please import ' 'a different Bible or first delete the existing one.')) self.VersionNameEdit.setFocus() return False diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 4f35556f1..fd2c2adff 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -246,7 +246,7 @@ class BibleManager(object): translate('BiblesPlugin.BibleManager', 'Scripture Reference Error'), translate('BiblesPlugin.BibleManager', 'Your scripture ' - 'reference is either not supported by OpenLP or invalid. ' + 'reference is either not supported by OpenLP or is invalid. ' 'Please make sure your reference conforms to one of the ' 'following patterns:\n\n' 'Book Chapter\n' diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index c7d1b0396..1dacd82cc 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -97,8 +97,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): self, translate('SongsPlugin.AuthorsForm', 'Error'), translate('SongsPlugin.AuthorsForm', 'You have not set a display name for the ' - 'author, would you like me to combine the first and ' - 'last names for you?'), + 'author, combine the first and last names?'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) ) == QtGui.QMessageBox.Yes: diff --git a/openlp/plugins/songs/forms/topicsform.py b/openlp/plugins/songs/forms/topicsform.py index a618dd9db..c45228527 100644 --- a/openlp/plugins/songs/forms/topicsform.py +++ b/openlp/plugins/songs/forms/topicsform.py @@ -51,7 +51,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog): QtGui.QMessageBox.critical( self, translate('SongsPlugin.TopicsForm', 'Error'), translate('SongsPlugin.TopicsForm', - 'You need to type in a topic name!')) + 'You need to type in a topic name.')) self.NameEdit.setFocus() return False else: From c8d3e3df232dcb44434934d1cf65350b3632f464 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 18 Sep 2010 18:11:37 +0200 Subject: [PATCH 07/11] fixed bug #641734 --- scripts/bible-1to2-converter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/bible-1to2-converter.py b/scripts/bible-1to2-converter.py index 111d22043..ebf246608 100755 --- a/scripts/bible-1to2-converter.py +++ b/scripts/bible-1to2-converter.py @@ -127,6 +127,8 @@ def import_bible(): for row in rows: key = unicode(row[0], u'cp1252') value = unicode(row[1], u'cp1252') + if key == u'Permission': + key = u'Permissions' sql_insert = u'INSERT INTO metadata '\ '("key", "value") '\ 'VALUES (?, ?)' From 7f5a6411d6c694f7a47ace9cebae3d423b50bf7a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 18 Sep 2010 19:14:27 +0200 Subject: [PATCH 08/11] Fix for bug #640697 --- openlp/core/ui/mainwindow.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 60a6ae2b7..193d4ba0c 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -575,7 +575,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage) self.LanguageGroup.triggered.connect(LanguageManager.set_language) QtCore.QObject.connect(self.ModeDefaultItem, - QtCore.SIGNAL(u'triggered()'), self.setViewMode) + QtCore.SIGNAL(u'triggered()'), self.onModeDetaultItemClicked) QtCore.QObject.connect(self.ModeSetupItem, QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked) QtCore.QObject.connect(self.ModeLiveItem, @@ -670,6 +670,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.generalSettingsSection + u'/auto open', QtCore.QVariant(False)).toBool(): self.ServiceManagerContents.onLoadService(True) + view_mode = QtCore.QSettings().value(u'%s/view mode' % \ + self.generalSettingsSection, u'default') + if view_mode == u'default': + self.ModeDefaultItem.setChecked(True) + elif view_mode == u'setup': + self.setViewMode(True, True, False, True, False) + self.ModeSetupItem.setChecked(True) + elif view_mode == u'live': + self.setViewMode(False, True, False, False, True) + self.ModeLiveItem.setChecked(True) def blankCheck(self): """ @@ -677,8 +687,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Triggered by delay thread. """ settings = QtCore.QSettings() - settings.beginGroup(self.generalSettingsSection) - if settings.value(u'screen blank', QtCore.QVariant(False)).toBool(): + if settings.value(u'%s/screen blank' % self.generalSettingsSection, + QtCore.QVariant(False)).toBool(): self.LiveController.mainDisplaySetBackground() if settings.value(u'blank warning', QtCore.QVariant(False)).toBool(): @@ -687,7 +697,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): 'OpenLP Main Display Blanked'), translate('OpenLP.MainWindow', 'The Main Display has been blanked out')) - settings.endGroup() def onHelpWebSiteClicked(self): """ @@ -716,16 +725,31 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ self.settingsForm.exec_() + def onModeDetaultItemClicked(self): + """ + Put OpenLP into "Default" view mode. + """ + settings = QtCore.QSettings() + settings.setValue(u'%s/view mode' % self.generalSettingsSection, + u'default') + self.setViewMode(True, True, True, True, True) + def onModeSetupItemClicked(self): """ Put OpenLP into "Setup" view mode. """ + settings = QtCore.QSettings() + settings.setValue(u'%s/view mode' % self.generalSettingsSection, + u'setup') self.setViewMode(True, True, False, True, False) def onModeLiveItemClicked(self): """ Put OpenLP into "Live" view mode. """ + settings = QtCore.QSettings() + settings.setValue(u'%s/view mode' % self.generalSettingsSection, + u'live') self.setViewMode(False, True, False, False, True) def setViewMode(self, media=True, service=True, theme=True, preview=True, From bf35338c990e6eccc439bb0a393df39d50db9da7 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 18 Sep 2010 20:15:54 +0200 Subject: [PATCH 09/11] Fix some typos. --- openlp/core/ui/mainwindow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 193d4ba0c..0d158d042 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -575,7 +575,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage) self.LanguageGroup.triggered.connect(LanguageManager.set_language) QtCore.QObject.connect(self.ModeDefaultItem, - QtCore.SIGNAL(u'triggered()'), self.onModeDetaultItemClicked) + QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked) QtCore.QObject.connect(self.ModeSetupItem, QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked) QtCore.QObject.connect(self.ModeLiveItem, @@ -725,7 +725,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ self.settingsForm.exec_() - def onModeDetaultItemClicked(self): + def onModeDefaultItemClicked(self): """ Put OpenLP into "Default" view mode. """ From 86bed937f5983171e1e688f119a73c31524f2a3d Mon Sep 17 00:00:00 2001 From: rimach Date: Sat, 18 Sep 2010 20:56:57 +0200 Subject: [PATCH 10/11] Remove unused lines --- openlp/plugins/presentations/lib/impresscontroller.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 8d2f8e76e..d054c3e9c 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -125,8 +125,6 @@ class ImpressController(PresentationController): u'UnoUrlResolver') resolver = context.ServiceManager.createInstanceWithContext( u'com.sun.star.bridge.UnoUrlResolver', context) - #connection_type = u'socket' - connection_type = u'pipe,name=openlp_pipe' while ctx is None and loop < 3: try: log.debug(u'get UNO Desktop Openoffice - resolve') From ad51cb80409605c05014a9f2345ac539974b85b8 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Sun, 19 Sep 2010 21:59:00 +0100 Subject: [PATCH 11/11] Remove top/left border on maindisplay. QGraphicsWebView only appeared in Qt4.6 --- openlp/core/lib/htmlbuilder.py | 6 +++--- openlp/core/ui/maindisplay.py | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 0e8aca432..ef8fb286a 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -272,7 +272,7 @@ body { - + %s @@ -300,9 +300,9 @@ def build_html(item, screen, alert, islive): theme = item.themedata webkitvers = webkit_version() if item.bg_image_bytes: - image = u'data:image/png;base64,%s' % item.bg_image_bytes + image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes else: - image = u'' + image = u'style="display:none;"' html = HTMLSRC % (build_background_css(item, width, height), width, height, build_alert_css(alert, width), diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index fe8438895..7e4a31b83 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -99,6 +99,7 @@ class MainDisplay(DisplayWidget): self.alertTab = None self.hide_mode = None self.setWindowTitle(u'OpenLP Display') + self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) if self.isLive: @@ -116,12 +117,18 @@ class MainDisplay(DisplayWidget): self.screen = self.screens.current self.setVisible(False) self.setGeometry(self.screen[u'size']) - self.scene = QtGui.QGraphicsScene() - self.setScene(self.scene) - self.webView = QtWebKit.QGraphicsWebView() - self.scene.addItem(self.webView) - self.webView.resize(self.screen[u'size'].width(), - self.screen[u'size'].height()) + try: + self.webView = QtWebKit.QGraphicsWebView() + self.scene = QtGui.QGraphicsScene(self) + self.setScene(self.scene) + self.scene.addItem(self.webView) + 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.screen[u'size'].width(), self.screen[u'size'].height()) self.page = self.webView.page() self.frame = self.page.mainFrame() QtCore.QObject.connect(self.webView,