From 8e853f10b1d2f4b79b7b062e624069b00678eb5b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 29 Oct 2011 10:33:48 +0100 Subject: [PATCH] Fix crash with alerts over video Change default to bottom from middle Remove unused from from previous merge Fixes: https://launchpad.net/bugs/875798, https://launchpad.net/bugs/883414 --- openlp/core/lib/htmlbuilder.py | 21 --------------------- openlp/core/ui/maindisplay.py | 6 +++--- openlp/plugins/alerts/lib/alertsmanager.py | 5 +++-- openlp/plugins/alerts/lib/alertstab.py | 2 +- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 863943e40..5dfe00d36 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -610,24 +610,3 @@ def build_footer_css(item, height): theme.font_footer_size, theme.font_footer_color) return lyrics_html -def build_alert_css(alertTab, width): - """ - Build the display of the footer - - ``alertTab`` - Details from the Alert tab for fonts etc - """ - style = u""" - width: %spx; - vertical-align: %s; - font-family: %s; - font-size: %spt; - color: %s; - background-color: %s; - """ - if not alertTab: - return u'' - align = VerticalType.Names[alertTab.location] - alert = style % (width, align, alertTab.font_face, alertTab.font_size, - alertTab.font_color, alertTab.bg_color) - return alert diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index aa94454b7..4077181ab 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -213,7 +213,7 @@ class MainDisplay(QtGui.QGraphicsView): self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) - def alert(self, text): + def alert(self, text, location): """ Display an alert. @@ -241,10 +241,10 @@ class MainDisplay(QtGui.QGraphicsView): alert_height = int(height.toString()) shrinkItem.resize(self.width(), alert_height) shrinkItem.setVisible(True) - if self.alertTab.location == 1: + if location == 1: shrinkItem.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2) - elif self.alertTab.location == 2: + elif location == 2: shrinkItem.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height) else: diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 8e91aecf5..e73273fe7 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -85,7 +85,7 @@ class AlertsManager(QtCore.QObject): return text = self.alertList.pop(0) alertTab = self.parent().settings_tab - self.parent().liveController.display.alert(text) + self.parent().liveController.display.alert(text, alertTab.location) # Check to see if we have a timer running. if self.timer_id == 0: self.timer_id = self.startTimer(int(alertTab.timeout) * 1000) @@ -100,7 +100,8 @@ class AlertsManager(QtCore.QObject): """ log.debug(u'timer event') if event.timerId() == self.timer_id: - self.parent().liveController.display.alert(u'') + alertTab = self.parent().settings_tab + self.parent().liveController.display.alert(u'', alertTab.location) self.killTimer(self.timer_id) self.timer_id = 0 self.generateAlert() diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 8720c5111..8fd2cb3aa 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -159,7 +159,7 @@ class AlertsTab(SettingsTab): self.font_face = unicode(settings.value( u'font face', QtCore.QVariant(QtGui.QFont().family())).toString()) self.location = settings.value( - u'location', QtCore.QVariant(1)).toInt()[0] + u'location', QtCore.QVariant(2)).toInt()[0] settings.endGroup() self.fontSizeSpinBox.setValue(self.font_size) self.timeoutSpinBox.setValue(self.timeout)