openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #08037
[Merge] lp:~j-corwin/openlp/general into lp:openlp
Jonathan Corwin has proposed merging lp:~j-corwin/openlp/general into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #634771 in OpenLP: "OpenLP 1.9.2+bzr1016-0ubuntu1~lucid1 does not start"
https://bugs.launchpad.net/openlp/+bug/634771
Bug #646718 in OpenLP: "Songbook, Number will not loaded, Title will not be saved"
https://bugs.launchpad.net/openlp/+bug/646718
Bug #696013 in OpenLP: "song import from powerpoint crashes every second time"
https://bugs.launchpad.net/openlp/+bug/696013
Bug #696021 in OpenLP: "presentation loader does not work fine in Windows using Powerpoint Viewer 2007"
https://bugs.launchpad.net/openlp/+bug/696021
Bug #696637 in OpenLP: "Alert not positioned correctly in single screen"
https://bugs.launchpad.net/openlp/+bug/696637
Bug #727732 in OpenLP: "Openlp 1.9.?? crashes on start"
https://bugs.launchpad.net/openlp/+bug/727732
Bug #735039 in OpenLP: "Cannot import PowerPoint Presentations with PowerPoint 2010"
https://bugs.launchpad.net/openlp/+bug/735039
For more details, see:
https://code.launchpad.net/~j-corwin/openlp/general/+merge/57788
Fix various blanking/unblanking/hiding problems
--
https://code.launchpad.net/~j-corwin/openlp/general/+merge/57788
Your team OpenLP Core is requested to review the proposed merge of lp:~j-corwin/openlp/general into lp:openlp.
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2011-04-13 09:20:27 +0000
+++ openlp/core/lib/htmlbuilder.py 2011-04-14 21:45:48 +0000
@@ -307,7 +307,7 @@
</head>
<body>
<img id="bgimage" class="size" %s />
-<img id="image" class="size" style="display:none" />
+<img id="image" class="size" %s />
<video id="video1" class="size" style="visibility:hidden" autobuffer preload>
</video>
<video id="video2" class="size" style="visibility:hidden" autobuffer preload>
@@ -320,7 +320,7 @@
</html>
"""
-def build_html(item, screen, alert, islive, background):
+def build_html(item, screen, alert, islive, background, image=None):
"""
Build the full web paged structure for display
@@ -332,6 +332,10 @@
Alert display display information
`islive`
Item is going live, rather than preview/theme building
+ `background`
+ Theme background image - bytes
+ `image`
+ Image media item - bytes
"""
width = screen[u'size'].width()
height = screen[u'size'].height()
@@ -339,11 +343,15 @@
webkitvers = webkit_version()
# Image generated and poked in
if background:
- image = u'src="data:image/png;base64,%s"' % background
+ bgimage_src = u'src="data:image/png;base64,%s"' % background
elif item.bg_image_bytes:
- image = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
- else:
- image = u'style="display:none;"'
+ bgimage_src = u'src="data:image/png;base64,%s"' % item.bg_image_bytes
+ else:
+ bgimage_src = u'style="display:none;"'
+ if image:
+ image_src = u'src="data:image/png;base64,%s"' % image
+ else:
+ image_src = u'style="display:none;"'
html = HTMLSRC % (build_background_css(item, width, height),
width, height,
build_alert_css(alert, width),
@@ -351,7 +359,7 @@
build_lyrics_css(item, webkitvers),
u'true' if theme and theme.display_slide_transition and islive \
else u'false',
- image,
+ bgimage_src, image_src,
build_lyrics_html(item, webkitvers))
return html
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2011-03-25 17:49:53 +0000
+++ openlp/core/ui/maindisplay.py 2011-04-14 21:45:48 +0000
@@ -453,7 +453,7 @@
painter.end()
return preview
- def buildHtml(self, serviceItem):
+ def buildHtml(self, serviceItem, image=None):
"""
Store the serviceItem and build the new HTML from it. Add the
HTML to the display
@@ -480,8 +480,12 @@
if self.serviceItem.themedata.background_filename:
self.serviceItem.bg_image_bytes = self.imageManager. \
get_image_bytes(self.serviceItem.themedata.theme_name)
+ if image:
+ image_bytes = self.imageManager.get_image_bytes(image)
+ else:
+ image_bytes = None
html = build_html(self.serviceItem, self.screen, self.alertTab,
- self.isLive, background)
+ self.isLive, background, image_bytes)
log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml')
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2011-04-14 18:05:00 +0000
+++ openlp/core/ui/slidecontroller.py 2011-04-14 21:45:48 +0000
@@ -365,14 +365,14 @@
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
def setPreviewHotkeys(self, parent=None):
- self.previousItem.setObjectName(u'previousItemPreview')
+ self.previousItem.setObjectName(u'previousItemPreview')
self.nextItem.setObjectName(u'nextItemPreview')
action_list = ActionList.get_instance()
action_list.add_action(self.previousItem)
action_list.add_action(self.nextItem)
def setLiveHotkeys(self, parent=None):
- self.previousItem.setObjectName(u'previousItemLive')
+ self.previousItem.setObjectName(u'previousItemLive')
self.nextItem.setObjectName(u'nextItemLive')
action_list = ActionList.get_instance()
action_list.add_category(
@@ -465,7 +465,7 @@
request = unicode(self.sender().text())
slideno = self.slideList[request]
self.__updatePreviewSelection(slideno)
- self.onSlideSelected()
+ self.slideSelected()
def receiveSpinDelay(self, value):
"""
@@ -561,7 +561,7 @@
# If service item is the same as the current on only change slide
if item.__eq__(self.serviceItem):
self.__checkUpdateSelectedSlide(slideno)
- self.onSlideSelected()
+ self.slideSelected()
return
self._processItem(item, slideno)
@@ -572,24 +572,15 @@
"""
log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop()
- # If old item was a command tell it to stop
- if self.serviceItem:
- if self.serviceItem.is_command():
- Receiver.send_message(u'%s_stop' %
- self.serviceItem.name.lower(), [serviceItem, self.isLive])
- if self.serviceItem.is_media():
- self.onMediaClose()
- if self.isLive:
- if serviceItem.is_capable(ItemCapabilities.ProvidesOwnDisplay):
- self._forceUnblank()
- blanked = self.blankScreen.isChecked()
- else:
- blanked = False
+ old_item = self.serviceItem
+ self.serviceItem = serviceItem
+ if old_item and self.isLive and old_item.is_capable(
+ ItemCapabilities.ProvidesOwnDisplay):
+ self._resetBlank()
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
- [serviceItem, self.isLive, blanked, slideno])
+ [serviceItem, self.isLive, self.hideMode(), slideno])
self.slideList = {}
width = self.parent.controlSplitter.sizes()[self.split]
- self.serviceItem = serviceItem
self.previewListWidget.clear()
self.previewListWidget.setRowCount(0)
self.previewListWidget.setColumnWidth(0, width)
@@ -648,12 +639,25 @@
self.previewListWidget.viewport().size().width())
self.__updatePreviewSelection(slideno)
self.enableToolBar(serviceItem)
- # Pass to display for viewing
- self.display.buildHtml(self.serviceItem)
+ # Pass to display for viewing.
+ # Postpone image build, we need to do this later to avoid the theme
+ # flashing on the screen
+ if not self.serviceItem.is_image():
+ self.display.buildHtml(self.serviceItem)
if serviceItem.is_media():
self.onMediaStart(serviceItem)
- self.onSlideSelected()
+ self.slideSelected(True)
self.previewListWidget.setFocus()
+ if old_item:
+ # Close the old item after the new one is opened
+ # This avoids the service theme/desktop flashing on screen
+ # However opening a new item of the same type will automatically
+ # close the previous, so make sure we don't close the new one.
+ if old_item.is_command() and not serviceItem.is_command():
+ Receiver.send_message(u'%s_stop' %
+ old_item.name.lower(), [old_item, self.isLive])
+ if old_item.is_media() and not serviceItem.is_media():
+ self.onMediaClose()
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
[serviceItem])
@@ -700,7 +704,7 @@
self.updatePreview()
else:
self.previewListWidget.selectRow(0)
- self.onSlideSelected()
+ self.slideSelected()
def onSlideSelectedIndex(self, message):
"""
@@ -715,7 +719,7 @@
self.updatePreview()
else:
self.__checkUpdateSelectedSlide(index)
- self.onSlideSelected()
+ self.slideSelected()
def mainDisplaySetBackground(self):
"""
@@ -758,15 +762,13 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'blanked'))
else:
- Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
- self.blankPlugin(checked)
+ self.blankPlugin()
self.updatePreview()
def onThemeDisplay(self, checked=None):
@@ -781,15 +783,13 @@
self.themeScreen.setChecked(checked)
self.desktopScreen.setChecked(False)
if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'themed'))
else:
- Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
- self.blankPlugin(checked)
+ self.blankPlugin()
self.updatePreview()
def onHideDisplay(self, checked=None):
@@ -804,28 +804,31 @@
self.themeScreen.setChecked(False)
self.desktopScreen.setChecked(checked)
if checked:
- Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank',
QtCore.QVariant(u'hidden'))
else:
- Receiver.send_message(u'maindisplay_show')
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
self.hidePlugin(checked)
self.updatePreview()
- def blankPlugin(self, blank):
- """
- Blank the display screen within a plugin if required.
- """
- log.debug(u'blankPlugin %s ', blank)
+ def blankPlugin(self):
+ """
+ Blank/Hide the display screen within a plugin if required.
+ """
+ hide_mode = self.hideMode()
+ log.debug(u'blankPlugin %s ', hide_mode)
if self.serviceItem is not None:
- if blank:
+ if hide_mode:
+ if not self.serviceItem.is_command():
+ Receiver.send_message(u'maindisplay_hide', hide_mode)
Receiver.send_message(u'%s_blank'
% self.serviceItem.name.lower(),
- [self.serviceItem, self.isLive])
+ [self.serviceItem, self.isLive, hide_mode])
else:
+ if not self.serviceItem.is_command():
+ Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
@@ -837,15 +840,24 @@
log.debug(u'hidePlugin %s ', hide)
if self.serviceItem is not None:
if hide:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
Receiver.send_message(u'%s_hide'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
+ if not self.serviceItem.is_command():
+ Receiver.send_message(u'maindisplay_show')
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
- def onSlideSelected(self):
+ def onSlideSelected(self, start=False):
+ """
+ Slide selected in controller
+ """
+ self.slideSelected()
+
+ def slideSelected(self, start=False):
"""
Generate the preview when you click on a slide.
if this is the Live Controller also display on the screen
@@ -854,7 +866,7 @@
self.selectedRow = 0
if row > -1 and row < self.previewListWidget.rowCount():
if self.serviceItem.is_command():
- if self.isLive:
+ if self.isLive and not start:
Receiver.send_message(
u'%s_slide' % self.serviceItem.name.lower(),
[self.serviceItem, self.isLive, row])
@@ -864,7 +876,11 @@
if self.serviceItem.is_text():
frame = self.display.text(toDisplay)
else:
- frame = self.display.image(toDisplay)
+ if start:
+ self.display.buildHtml(self.serviceItem, toDisplay)
+ frame = self.display.preview()
+ else:
+ frame = self.display.image(toDisplay)
# reset the store used to display first image
self.serviceItem.bg_image_bytes = None
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
@@ -930,7 +946,7 @@
Receiver.send_message('servicemanager_next_item')
return
self.__checkUpdateSelectedSlide(row)
- self.onSlideSelected()
+ self.slideSelected()
def onSlideSelectedPreviousNoloop(self):
self.onSlideSelectedPrevious(False)
@@ -953,7 +969,7 @@
else:
row = 0
self.__checkUpdateSelectedSlide(row)
- self.onSlideSelected()
+ self.slideSelected()
def __checkUpdateSelectedSlide(self, row):
if row + 1 < self.previewListWidget.rowCount():
@@ -974,7 +990,7 @@
else:
self.previewListWidget.selectRow(
self.previewListWidget.rowCount() - 1)
- self.onSlideSelected()
+ self.slideSelected()
def onStartLoop(self):
"""
@@ -1106,20 +1122,32 @@
self.slidePreview.clear()
self.slidePreview.show()
- def _forceUnblank(self):
+ def _resetBlank(self):
"""
Used by command items which provide their own displays to reset the
screen hide attributes
"""
- blank = None
- if self.blankScreen.isChecked:
- blank = self.blankScreen
- if self.themeScreen.isChecked:
- blank = self.themeScreen
- if self.desktopScreen.isChecked:
- blank = self.desktopScreen
- if blank:
- blank.setChecked(False)
- self.hideMenu.setDefaultAction(blank)
- QtCore.QSettings().remove(
- self.parent.generalSettingsSection + u'/screen blank')
+ hide_mode = self.hideMode()
+ if hide_mode == HideMode.Blank:
+ self.onBlankDisplay(True)
+ elif hide_mode == HideMode.Theme:
+ self.onThemeDisplay(True)
+ elif hide_mode == HideMode.Screen:
+ self.onHideDisplay(True)
+ else:
+ self.hidePlugin(False)
+
+ def hideMode(self):
+ """
+ Determine what the hide mode should be according to the blank button
+ """
+ if not self.isLive:
+ return None
+ elif self.blankScreen.isChecked():
+ return HideMode.Blank
+ elif self.themeScreen.isChecked():
+ return HideMode.Theme
+ elif self.desktopScreen.isChecked():
+ return HideMode.Screen
+ else:
+ return None
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2011-04-13 18:18:25 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2011-04-14 21:45:48 +0000
@@ -58,6 +58,7 @@
MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles.
self.settings = self.parent.settings_tab
+ self.quickPreviewAllowed = True
self.search_results = {}
self.second_search_results = {}
QtCore.QObject.connect(Receiver.get_receiver(),
=== modified file 'openlp/plugins/presentations/lib/messagelistener.py'
--- openlp/plugins/presentations/lib/messagelistener.py 2011-04-05 14:24:51 +0000
+++ openlp/plugins/presentations/lib/messagelistener.py 2011-04-14 21:45:48 +0000
@@ -49,7 +49,7 @@
self.doc = None
log.info(u'%s controller loaded' % live)
- def add_handler(self, controller, file, is_blank):
+ def add_handler(self, controller, file, hide_mode, slide_no):
"""
Add a handler, which is an instance of a presentation and
slidecontroller combination. If the slidecontroller has a display
@@ -64,12 +64,21 @@
# Display error message to user
# Inform slidecontroller that the action failed?
return
+ self.doc.slidenumber = slide_no
if self.is_live:
- self.doc.start_presentation()
- if is_blank:
- self.blank()
- Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
- self.doc.slidenumber = 0
+ if hide_mode == HideMode.Screen:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
+ self.stop()
+ elif hide_mode == HideMode.Theme:
+ self.blank(hide_mode)
+ elif hide_mode == HideMode.Blank:
+ self.blank(hide_mode)
+ else:
+ self.doc.start_presentation()
+ Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
+ self.doc.slidenumber = 0
+ if slide_no > 1:
+ self.slide(slide_no)
def activate(self):
"""
@@ -164,14 +173,10 @@
Based on the handler passed at startup triggers slide show to shut down
"""
log.debug(u'Live = %s, shutdown' % self.is_live)
- if self.is_live:
- Receiver.send_message(u'maindisplay_show')
self.doc.close_presentation()
self.doc = None
- #self.doc.slidenumber = 0
- #self.timer.stop()
- def blank(self):
+ def blank(self, hide_mode):
"""
Instruct the controller to blank the presentation
"""
@@ -182,6 +187,8 @@
return
if not self.doc.is_active():
return
+ if hide_mode == HideMode.Theme:
+ Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
self.doc.blank_screen()
def stop(self):
@@ -261,7 +268,7 @@
is_live = message[1]
item = message[0]
log.debug(u'Startup called with message %s' % message)
- is_blank = message[2]
+ hide_mode = message[2]
file = os.path.join(item.get_frame_path(),
item.get_frame_title())
self.handler = item.title
@@ -273,7 +280,8 @@
controller = self.live_handler
else:
controller = self.preview_handler
- controller.add_handler(self.controllers[self.handler], file, is_blank)
+ controller.add_handler(self.controllers[self.handler], file, hide_mode,
+ message[3])
def slide(self, message):
"""
@@ -333,7 +341,6 @@
"""
is_live = message[1]
if is_live:
- Receiver.send_message(u'maindisplay_show')
self.live_handler.shutdown()
else:
self.preview_handler.shutdown()
@@ -351,8 +358,9 @@
React to the message to blank the display
"""
is_live = message[1]
+ hide_mode = message[2]
if is_live:
- self.live_handler.blank()
+ self.live_handler.blank(hide_mode)
def unblank(self, message):
"""
=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py 2011-03-24 19:04:02 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py 2011-04-14 21:45:48 +0000
@@ -251,14 +251,13 @@
win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
except win32ui.error:
dpi = 96
- self.presentation.SlideShowSettings.Run()
- self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.controller.plugin.renderManager
rect = rendermanager.screens.current[u'size']
- self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
- self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi
- self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi
- self.presentation.SlideShowWindow.Width = rect.width() * 72 / dpi
+ ppt_window = self.presentation.SlideShowSettings.Run()
+ ppt_window.Top = rect.y() * 72 / dpi
+ ppt_window.Height = rect.height() * 72 / dpi
+ ppt_window.Left = rect.x() * 72 / dpi
+ ppt_window.Width = rect.width() * 72 / dpi
def get_slide_number(self):
"""
Follow ups