fixed comments, simplification, removed not needed attribute

This commit is contained in:
Andreas Preikschat 2012-04-09 12:22:47 +02:00
parent aa8457dd6e
commit 4ec49627db

View File

@ -221,11 +221,6 @@ class MainDisplay(Display):
self.webView.setHtml(build_html(serviceItem, self.screen, self.webView.setHtml(build_html(serviceItem, self.screen,
self.isLive, None, plugins=self.plugins)) self.isLive, None, plugins=self.plugins))
self.__hideMouse() self.__hideMouse()
# To display or not to display?
if not self.screen[u'primary']:
self.primary = False
else:
self.primary = True
log.debug(u'Finished MainDisplay setup') log.debug(u'Finished MainDisplay setup')
def text(self, slide): def text(self, slide):
@ -253,10 +248,10 @@ class MainDisplay(Display):
log.debug(u'alert to display') log.debug(u'alert to display')
# First we convert <>& marks to html variants, then apply # First we convert <>& marks to html variants, then apply
# formattingtags, finally we double all backslashes for JavaScript. # formattingtags, finally we double all backslashes for JavaScript.
text_prepared = expand_tags(cgi.escape(text)) \ text_prepared = expand_tags(
.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
if self.height() != self.screen[u'size'].height() or \ if self.height() != self.screen[u'size'].height() or not \
not self.isVisible(): self.isVisible():
shrink = True shrink = True
js = u'show_alert("%s", "%s")' % (text_prepared, u'top') js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
else: else:
@ -336,7 +331,7 @@ class MainDisplay(Display):
""" """
log.debug(u'preview for %s', self.isLive) log.debug(u'preview for %s', self.isLive)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# We must have a service item to preview # We must have a service item to preview.
if self.isLive and hasattr(self, u'serviceItem'): if self.isLive and hasattr(self, u'serviceItem'):
# Wait for the fade to finish before geting the preview. # Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all! # Important otherwise preview will have incorrect text if at all!
@ -345,7 +340,7 @@ class MainDisplay(Display):
while self.frame.evaluateJavaScript(u'show_text_complete()') \ while self.frame.evaluateJavaScript(u'show_text_complete()') \
.toString() == u'false': .toString() == u'false':
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# Wait for the webview to update before geting the preview. # Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background ! # Important otherwise first preview will miss the background !
while not self.webLoaded: while not self.webLoaded:
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
@ -356,7 +351,7 @@ class MainDisplay(Display):
else: else:
# Single screen active # Single screen active
if self.screens.display_count == 1: if self.screens.display_count == 1:
# Only make visible if setting enabled # Only make visible if setting enabled.
if QtCore.QSettings().value(u'general/display on monitor', if QtCore.QSettings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
self.setVisible(True) self.setVisible(True)
@ -374,9 +369,9 @@ class MainDisplay(Display):
self.initialFrame = None self.initialFrame = None
self.serviceItem = serviceItem self.serviceItem = serviceItem
background = None background = None
# We have an image override so keep the image till the theme changes # We have an image override so keep the image till the theme changes.
if self.override: if self.override:
# We have an video override so allow it to be stopped # We have an video override so allow it to be stopped.
if u'video' in self.override: if u'video' in self.override:
Receiver.send_message(u'video_background_replaced') Receiver.send_message(u'video_background_replaced')
self.override = {} self.override = {}
@ -429,7 +424,7 @@ class MainDisplay(Display):
""" """
log.debug(u'hideDisplay mode = %d', mode) log.debug(u'hideDisplay mode = %d', mode)
if self.screens.display_count == 1: if self.screens.display_count == 1:
# Only make visible if setting enabled # Only make visible if setting enabled.
if not QtCore.QSettings().value(u'general/display on monitor', if not QtCore.QSettings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
return return
@ -454,7 +449,7 @@ class MainDisplay(Display):
""" """
log.debug(u'showDisplay') log.debug(u'showDisplay')
if self.screens.display_count == 1: if self.screens.display_count == 1:
# Only make visible if setting enabled # Only make visible if setting enabled.
if not QtCore.QSettings().value(u'general/display on monitor', if not QtCore.QSettings().value(u'general/display on monitor',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
return return
@ -462,12 +457,14 @@ class MainDisplay(Display):
if self.isHidden(): if self.isHidden():
self.setVisible(True) self.setVisible(True)
self.hideMode = None self.hideMode = None
# Trigger actions when display is active again # Trigger actions when display is active again.
if self.isLive: if self.isLive:
Receiver.send_message(u'live_display_active') Receiver.send_message(u'live_display_active')
def __hideMouse(self): def __hideMouse(self):
# Hide mouse cursor when moved over display if enabled in settings """
Hide mouse cursor when moved over display.
"""
if QtCore.QSettings().value(u'advanced/hide mouse', if QtCore.QSettings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor) self.setCursor(QtCore.Qt.BlankCursor)
@ -569,13 +566,12 @@ class AudioPlayer(QtCore.QObject):
""" """
Add another file to the playlist. Add another file to the playlist.
``filename`` ``filenames``
The file to add to the playlist. A list with files to be added to the playlist.
""" """
if not isinstance(filenames, list): if not isinstance(filenames, list):
filenames = [filenames] filenames = [filenames]
for filename in filenames: self.playlist.extend(map(Phonon.MediaSource, filenames))
self.playlist.append(Phonon.MediaSource(filename))
def next(self): def next(self):
if not self.repeat and self.currentIndex + 1 == len(self.playlist): if not self.repeat and self.currentIndex + 1 == len(self.playlist):