forked from openlp/openlp
Fix crash with alerts over video
Change default to bottom from middle Remove unused from from previous merge bzr-revno: 1788
This commit is contained in:
commit
05886b9d26
@ -610,24 +610,3 @@ def build_footer_css(item, height):
|
|||||||
theme.font_footer_size, theme.font_footer_color)
|
theme.font_footer_size, theme.font_footer_color)
|
||||||
return lyrics_html
|
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
|
|
||||||
|
@ -52,6 +52,24 @@ class HideMode(object):
|
|||||||
Theme = 2
|
Theme = 2
|
||||||
Screen = 3
|
Screen = 3
|
||||||
|
|
||||||
|
class AlertLocation(object):
|
||||||
|
"""
|
||||||
|
This is an enumeration class which controls where Alerts are placed on the
|
||||||
|
screen.
|
||||||
|
|
||||||
|
``Top``
|
||||||
|
Place the text at the top of the screen.
|
||||||
|
|
||||||
|
``Middle``
|
||||||
|
Place the text in the middle of the screen.
|
||||||
|
|
||||||
|
``Bottom``
|
||||||
|
Place the text at the bottom of the screen.
|
||||||
|
"""
|
||||||
|
Top = 0
|
||||||
|
Middle = 1
|
||||||
|
Bottom = 2
|
||||||
|
|
||||||
from firsttimeform import FirstTimeForm
|
from firsttimeform import FirstTimeForm
|
||||||
from firsttimelanguageform import FirstTimeLanguageForm
|
from firsttimelanguageform import FirstTimeLanguageForm
|
||||||
from themelayoutform import ThemeLayoutForm
|
from themelayoutform import ThemeLayoutForm
|
||||||
|
@ -37,7 +37,7 @@ from PyQt4.phonon import Phonon
|
|||||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||||
translate, PluginManager
|
translate, PluginManager
|
||||||
|
|
||||||
from openlp.core.ui import HideMode, ScreenList
|
from openlp.core.ui import HideMode, ScreenList, AlertLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
self.frame.evaluateJavaScript(u'show_text("%s")' %
|
||||||
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||||
|
|
||||||
def alert(self, text):
|
def alert(self, text, location):
|
||||||
"""
|
"""
|
||||||
Display an alert.
|
Display an alert.
|
||||||
|
|
||||||
@ -241,10 +241,10 @@ class MainDisplay(QtGui.QGraphicsView):
|
|||||||
alert_height = int(height.toString())
|
alert_height = int(height.toString())
|
||||||
shrinkItem.resize(self.width(), alert_height)
|
shrinkItem.resize(self.width(), alert_height)
|
||||||
shrinkItem.setVisible(True)
|
shrinkItem.setVisible(True)
|
||||||
if self.alertTab.location == 1:
|
if location == AlertLocation.Middle:
|
||||||
shrinkItem.move(self.screen[u'size'].left(),
|
shrinkItem.move(self.screen[u'size'].left(),
|
||||||
(self.screen[u'size'].height() - alert_height) / 2)
|
(self.screen[u'size'].height() - alert_height) / 2)
|
||||||
elif self.alertTab.location == 2:
|
elif location == AlertLocation.Bottom:
|
||||||
shrinkItem.move(self.screen[u'size'].left(),
|
shrinkItem.move(self.screen[u'size'].left(),
|
||||||
self.screen[u'size'].height() - alert_height)
|
self.screen[u'size'].height() - alert_height)
|
||||||
else:
|
else:
|
||||||
|
@ -85,7 +85,7 @@ class AlertsManager(QtCore.QObject):
|
|||||||
return
|
return
|
||||||
text = self.alertList.pop(0)
|
text = self.alertList.pop(0)
|
||||||
alertTab = self.parent().settings_tab
|
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.
|
# Check to see if we have a timer running.
|
||||||
if self.timer_id == 0:
|
if self.timer_id == 0:
|
||||||
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
|
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
|
||||||
@ -100,7 +100,8 @@ class AlertsManager(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'timer event')
|
log.debug(u'timer event')
|
||||||
if event.timerId() == self.timer_id:
|
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.killTimer(self.timer_id)
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.generateAlert()
|
self.generateAlert()
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||||
|
from openlp.core.ui import AlertLocation
|
||||||
from openlp.core.lib.ui import UiStrings, create_valign_combo
|
from openlp.core.lib.ui import UiStrings, create_valign_combo
|
||||||
|
|
||||||
class AlertsTab(SettingsTab):
|
class AlertsTab(SettingsTab):
|
||||||
@ -159,7 +160,7 @@ class AlertsTab(SettingsTab):
|
|||||||
self.font_face = unicode(settings.value(
|
self.font_face = unicode(settings.value(
|
||||||
u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
|
u'font face', QtCore.QVariant(QtGui.QFont().family())).toString())
|
||||||
self.location = settings.value(
|
self.location = settings.value(
|
||||||
u'location', QtCore.QVariant(1)).toInt()[0]
|
u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0]
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.fontSizeSpinBox.setValue(self.font_size)
|
self.fontSizeSpinBox.setValue(self.font_size)
|
||||||
self.timeoutSpinBox.setValue(self.timeout)
|
self.timeoutSpinBox.setValue(self.timeout)
|
||||||
|
Loading…
Reference in New Issue
Block a user