Merge lp:~trb143/openlp/bug-875798 into lp:openlp

Proposed by Tim Bentley
Status: Merged
Approved by: Andreas Preikschat
Approved revision: 1753
Merged at revision: 1788
Proposed branch: lp:~trb143/openlp/bug-875798
Merge into: lp:openlp
Diff against target: 136 lines (+27/-28)
5 files modified
openlp/core/lib/htmlbuilder.py (+0/-21)
openlp/core/ui/__init__.py (+18/-0)
openlp/core/ui/maindisplay.py (+4/-4)
openlp/plugins/alerts/lib/alertsmanager.py (+3/-2)
openlp/plugins/alerts/lib/alertstab.py (+2/-1)
To merge this branch: bzr merge lp:~trb143/openlp/bug-875798
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Approve
Review via email: mp+80740@code.launchpad.net

This proposal supersedes a proposal from 2011-10-29.

Description of the change

Fix crash with alerts over video
Change default to bottom from middle
Remove unused from from previous merge

To post a comment you must log in.
Revision history for this message
Meinert Jordan (m2j) wrote : Posted in a previous version of this proposal

I'd suggest to use the values of Qt::AlignmentFlag instead of own values.

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Nice idea but we have values of 0,1,2 already used so this fits in better with the existing code.
There would be confusion and more bugs !

Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2011-10-16 08:25:27 +0000
+++ openlp/core/lib/htmlbuilder.py 2011-10-29 19:17:25 +0000
@@ -610,24 +610,3 @@
610 theme.font_footer_size, theme.font_footer_color)610 theme.font_footer_size, theme.font_footer_color)
611 return lyrics_html611 return lyrics_html
612612
613def build_alert_css(alertTab, width):
614 """
615 Build the display of the footer
616
617 ``alertTab``
618 Details from the Alert tab for fonts etc
619 """
620 style = u"""
621 width: %spx;
622 vertical-align: %s;
623 font-family: %s;
624 font-size: %spt;
625 color: %s;
626 background-color: %s;
627 """
628 if not alertTab:
629 return u''
630 align = VerticalType.Names[alertTab.location]
631 alert = style % (width, align, alertTab.font_face, alertTab.font_size,
632 alertTab.font_color, alertTab.bg_color)
633 return alert
634613
=== modified file 'openlp/core/ui/__init__.py'
--- openlp/core/ui/__init__.py 2011-10-02 07:52:28 +0000
+++ openlp/core/ui/__init__.py 2011-10-29 19:17:25 +0000
@@ -52,6 +52,24 @@
52 Theme = 252 Theme = 2
53 Screen = 353 Screen = 3
5454
55class AlertLocation(object):
56 """
57 This is an enumeration class which controls where Alerts are placed on the
58 screen.
59
60 ``Top``
61 Place the text at the top of the screen.
62
63 ``Middle``
64 Place the text in the middle of the screen.
65
66 ``Bottom``
67 Place the text at the bottom of the screen.
68 """
69 Top = 0
70 Middle = 1
71 Bottom = 2
72
55from firsttimeform import FirstTimeForm73from firsttimeform import FirstTimeForm
56from firsttimelanguageform import FirstTimeLanguageForm74from firsttimelanguageform import FirstTimeLanguageForm
57from themelayoutform import ThemeLayoutForm75from themelayoutform import ThemeLayoutForm
5876
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2011-10-22 11:09:01 +0000
+++ openlp/core/ui/maindisplay.py 2011-10-29 19:17:25 +0000
@@ -37,7 +37,7 @@
37from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \37from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
38 translate, PluginManager38 translate, PluginManager
3939
40from openlp.core.ui import HideMode, ScreenList40from openlp.core.ui import HideMode, ScreenList, AlertLocation
4141
42log = logging.getLogger(__name__)42log = logging.getLogger(__name__)
4343
@@ -213,7 +213,7 @@
213 self.frame.evaluateJavaScript(u'show_text("%s")' %213 self.frame.evaluateJavaScript(u'show_text("%s")' %
214 slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))214 slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
215215
216 def alert(self, text):216 def alert(self, text, location):
217 """217 """
218 Display an alert.218 Display an alert.
219219
@@ -241,10 +241,10 @@
241 alert_height = int(height.toString())241 alert_height = int(height.toString())
242 shrinkItem.resize(self.width(), alert_height)242 shrinkItem.resize(self.width(), alert_height)
243 shrinkItem.setVisible(True)243 shrinkItem.setVisible(True)
244 if self.alertTab.location == 1:244 if location == AlertLocation.Middle:
245 shrinkItem.move(self.screen[u'size'].left(),245 shrinkItem.move(self.screen[u'size'].left(),
246 (self.screen[u'size'].height() - alert_height) / 2)246 (self.screen[u'size'].height() - alert_height) / 2)
247 elif self.alertTab.location == 2:247 elif location == AlertLocation.Bottom:
248 shrinkItem.move(self.screen[u'size'].left(),248 shrinkItem.move(self.screen[u'size'].left(),
249 self.screen[u'size'].height() - alert_height)249 self.screen[u'size'].height() - alert_height)
250 else:250 else:
251251
=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py 2011-10-22 11:09:01 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py 2011-10-29 19:17:25 +0000
@@ -85,7 +85,7 @@
85 return85 return
86 text = self.alertList.pop(0)86 text = self.alertList.pop(0)
87 alertTab = self.parent().settings_tab87 alertTab = self.parent().settings_tab
88 self.parent().liveController.display.alert(text)88 self.parent().liveController.display.alert(text, alertTab.location)
89 # Check to see if we have a timer running.89 # Check to see if we have a timer running.
90 if self.timer_id == 0:90 if self.timer_id == 0:
91 self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)91 self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
@@ -100,7 +100,8 @@
100 """100 """
101 log.debug(u'timer event')101 log.debug(u'timer event')
102 if event.timerId() == self.timer_id:102 if event.timerId() == self.timer_id:
103 self.parent().liveController.display.alert(u'')103 alertTab = self.parent().settings_tab
104 self.parent().liveController.display.alert(u'', alertTab.location)
104 self.killTimer(self.timer_id)105 self.killTimer(self.timer_id)
105 self.timer_id = 0106 self.timer_id = 0
106 self.generateAlert()107 self.generateAlert()
107108
=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
--- openlp/plugins/alerts/lib/alertstab.py 2011-10-19 17:53:07 +0000
+++ openlp/plugins/alerts/lib/alertstab.py 2011-10-29 19:17:25 +0000
@@ -28,6 +28,7 @@
28from PyQt4 import QtCore, QtGui28from PyQt4 import QtCore, QtGui
2929
30from openlp.core.lib import SettingsTab, translate, Receiver30from openlp.core.lib import SettingsTab, translate, Receiver
31from openlp.core.ui import AlertLocation
31from openlp.core.lib.ui import UiStrings, create_valign_combo32from openlp.core.lib.ui import UiStrings, create_valign_combo
3233
33class AlertsTab(SettingsTab):34class AlertsTab(SettingsTab):
@@ -159,7 +160,7 @@
159 self.font_face = unicode(settings.value(160 self.font_face = unicode(settings.value(
160 u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())161 u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
161 self.location = settings.value(162 self.location = settings.value(
162 u'location', QtCore.QVariant(1)).toInt()[0]163 u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
163 settings.endGroup()164 settings.endGroup()
164 self.fontSizeSpinBox.setValue(self.font_size)165 self.fontSizeSpinBox.setValue(self.font_size)
165 self.timeoutSpinBox.setValue(self.timeout)166 self.timeoutSpinBox.setValue(self.timeout)