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
1=== modified file 'openlp/core/lib/htmlbuilder.py'
2--- openlp/core/lib/htmlbuilder.py 2011-10-16 08:25:27 +0000
3+++ openlp/core/lib/htmlbuilder.py 2011-10-29 19:17:25 +0000
4@@ -610,24 +610,3 @@
5 theme.font_footer_size, theme.font_footer_color)
6 return lyrics_html
7
8-def build_alert_css(alertTab, width):
9- """
10- Build the display of the footer
11-
12- ``alertTab``
13- Details from the Alert tab for fonts etc
14- """
15- style = u"""
16- width: %spx;
17- vertical-align: %s;
18- font-family: %s;
19- font-size: %spt;
20- color: %s;
21- background-color: %s;
22- """
23- if not alertTab:
24- return u''
25- align = VerticalType.Names[alertTab.location]
26- alert = style % (width, align, alertTab.font_face, alertTab.font_size,
27- alertTab.font_color, alertTab.bg_color)
28- return alert
29
30=== modified file 'openlp/core/ui/__init__.py'
31--- openlp/core/ui/__init__.py 2011-10-02 07:52:28 +0000
32+++ openlp/core/ui/__init__.py 2011-10-29 19:17:25 +0000
33@@ -52,6 +52,24 @@
34 Theme = 2
35 Screen = 3
36
37+class AlertLocation(object):
38+ """
39+ This is an enumeration class which controls where Alerts are placed on the
40+ screen.
41+
42+ ``Top``
43+ Place the text at the top of the screen.
44+
45+ ``Middle``
46+ Place the text in the middle of the screen.
47+
48+ ``Bottom``
49+ Place the text at the bottom of the screen.
50+ """
51+ Top = 0
52+ Middle = 1
53+ Bottom = 2
54+
55 from firsttimeform import FirstTimeForm
56 from firsttimelanguageform import FirstTimeLanguageForm
57 from themelayoutform import ThemeLayoutForm
58
59=== modified file 'openlp/core/ui/maindisplay.py'
60--- openlp/core/ui/maindisplay.py 2011-10-22 11:09:01 +0000
61+++ openlp/core/ui/maindisplay.py 2011-10-29 19:17:25 +0000
62@@ -37,7 +37,7 @@
63 from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
64 translate, PluginManager
65
66-from openlp.core.ui import HideMode, ScreenList
67+from openlp.core.ui import HideMode, ScreenList, AlertLocation
68
69 log = logging.getLogger(__name__)
70
71@@ -213,7 +213,7 @@
72 self.frame.evaluateJavaScript(u'show_text("%s")' %
73 slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
74
75- def alert(self, text):
76+ def alert(self, text, location):
77 """
78 Display an alert.
79
80@@ -241,10 +241,10 @@
81 alert_height = int(height.toString())
82 shrinkItem.resize(self.width(), alert_height)
83 shrinkItem.setVisible(True)
84- if self.alertTab.location == 1:
85+ if location == AlertLocation.Middle:
86 shrinkItem.move(self.screen[u'size'].left(),
87 (self.screen[u'size'].height() - alert_height) / 2)
88- elif self.alertTab.location == 2:
89+ elif location == AlertLocation.Bottom:
90 shrinkItem.move(self.screen[u'size'].left(),
91 self.screen[u'size'].height() - alert_height)
92 else:
93
94=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
95--- openlp/plugins/alerts/lib/alertsmanager.py 2011-10-22 11:09:01 +0000
96+++ openlp/plugins/alerts/lib/alertsmanager.py 2011-10-29 19:17:25 +0000
97@@ -85,7 +85,7 @@
98 return
99 text = self.alertList.pop(0)
100 alertTab = self.parent().settings_tab
101- self.parent().liveController.display.alert(text)
102+ self.parent().liveController.display.alert(text, alertTab.location)
103 # Check to see if we have a timer running.
104 if self.timer_id == 0:
105 self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
106@@ -100,7 +100,8 @@
107 """
108 log.debug(u'timer event')
109 if event.timerId() == self.timer_id:
110- self.parent().liveController.display.alert(u'')
111+ alertTab = self.parent().settings_tab
112+ self.parent().liveController.display.alert(u'', alertTab.location)
113 self.killTimer(self.timer_id)
114 self.timer_id = 0
115 self.generateAlert()
116
117=== modified file 'openlp/plugins/alerts/lib/alertstab.py'
118--- openlp/plugins/alerts/lib/alertstab.py 2011-10-19 17:53:07 +0000
119+++ openlp/plugins/alerts/lib/alertstab.py 2011-10-29 19:17:25 +0000
120@@ -28,6 +28,7 @@
121 from PyQt4 import QtCore, QtGui
122
123 from openlp.core.lib import SettingsTab, translate, Receiver
124+from openlp.core.ui import AlertLocation
125 from openlp.core.lib.ui import UiStrings, create_valign_combo
126
127 class AlertsTab(SettingsTab):
128@@ -159,7 +160,7 @@
129 self.font_face = unicode(settings.value(
130 u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
131 self.location = settings.value(
132- u'location', QtCore.QVariant(1)).toInt()[0]
133+ u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
134 settings.endGroup()
135 self.fontSizeSpinBox.setValue(self.font_size)
136 self.timeoutSpinBox.setValue(self.timeout)