SlideController cleanups

This commit is contained in:
Tim Bentley 2009-11-11 19:10:38 +00:00
parent ab12f73a21
commit 1eb41aab78
5 changed files with 23 additions and 11 deletions

View File

@ -81,6 +81,8 @@ class OpenLP(QtGui.QApplication):
bits = unicode(line).split(u'-')
applicationVersion = {u'Full':unicode(line).rstrip(),
u'version':bits[0], u'build':bits[1]}
log.info(u'Openlp version %s build %s' %
(applicationVersion[u'version'],applicationVersion[u'build'] ))
except:
applicationVersion = {u'Full':u'1.9.0-000',
u'version':u'1.9.0', u'build':u'000'}
@ -139,6 +141,7 @@ def main():
logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
log.addHandler(logfile)
logging.addLevelName(15, u'Timer')
# Parse command line options and deal with them.
(options, args) = parser.parse_args()
if options.debug:

View File

@ -279,3 +279,10 @@ class ServiceItem(object):
"""
return self.uuid != other.uuid
def isSong(self):
return self.name == u'Songs'
def isMedia(self):
return self.name == u'Media'

View File

@ -24,6 +24,7 @@
import logging
import os
import time
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
@ -196,11 +197,16 @@ class MainDisplay(DisplayWidget):
if self.timer_id != 0 :
self.displayAlert()
elif not self.displayBlank:
#self.setWindowOpacity(0.5)
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
#QtCore.QTimer.singleShot(500, self.aa )
if not self.isVisible():
self.setVisible(True)
self.showFullScreen()
# def aa(self):
# self.setWindowOpacity(1)
def blankDisplay(self):
if not self.displayBlank:
self.displayBlank = True

View File

@ -56,7 +56,6 @@ class ServiceManagerList(QtGui.QTreeWidget):
# else:
# event.ignore()
def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent:
#here accept the event and do something
@ -99,7 +98,6 @@ class ServiceManagerList(QtGui.QTreeWidget):
mimeData.setText(u'ServiceManager')
dropAction = drag.start(QtCore.Qt.CopyAction)
class ServiceManager(QtGui.QWidget):
"""
Manages the services. This involves taking text strings from plugins and

View File

@ -347,7 +347,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.service_item_type == ServiceItemType.Text:
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.name == u'Songs' and \
if item.isSong() and \
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
for action in self.Songbar.actions:
self.Songbar.actions[action].setVisible(False)
@ -366,8 +366,7 @@ class SlideController(QtGui.QWidget):
#Not sensible to allow loops with 1 frame
if len(item.frames) > 1:
self.Toolbar.makeWidgetsVisible(self.image_list)
elif item.service_item_type == ServiceItemType.Command and \
item.name == u'Media':
elif item.isMedia():
self.Toolbar.setVisible(False)
self.Mediabar.setVisible(True)
self.volumeSlider.setAudioOutput(self.parent.mainDisplay.audio)
@ -379,10 +378,9 @@ class SlideController(QtGui.QWidget):
self.Toolbar.setVisible(True)
self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
if (item.name == u'Songs' or item.name == u'Custom') and item.fromPlugin:
if item.editEnabled and item.fromPlugin:
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
elif item.service_item_type == ServiceItemType.Command and \
item.name == u'Media':
elif item.isMedia():
self.Toolbar.setVisible(False)
self.Mediabar.setVisible(True)
self.volumeSlider.setAudioOutput(self.audio)
@ -401,7 +399,7 @@ class SlideController(QtGui.QWidget):
self.commandItem = item
before = time.time()
item.render()
log.info(u'Rendering took %4s' % (time.time() - before))
log.log(15, u'Rendering took %4s' % (time.time() - before))
self.enableToolBar(item)
if item.service_item_type == ServiceItemType.Command:
if self.isLive:
@ -490,7 +488,7 @@ class SlideController(QtGui.QWidget):
self.PreviewListWidget.selectRow(slideno)
self.onSlideSelected()
self.PreviewListWidget.setFocus()
log.info(u'Display Rendering took %4s' % (time.time() - before))
log.log(15, u'Display Rendering took %4s' % (time.time() - before))
if self.serviceitem.audit and self.isLive:
Receiver().send_message(u'songusage_live', self.serviceitem.audit)
log.debug(u'displayServiceManagerItems End')
@ -539,7 +537,7 @@ class SlideController(QtGui.QWidget):
if frame is None:
frame = self.serviceitem.render_individual(row)
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
log.info(u'Slide Rendering took %4s' % (time.time() - before))
log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
if self.isLive:
self.parent.mainDisplay.frameView(frame)
self.row = row