More changes and attempts

This commit is contained in:
Tim Bentley 2010-04-13 16:53:00 +01:00
parent 571e91b20f
commit 3cc600a67b
6 changed files with 40 additions and 27 deletions

View File

@ -29,6 +29,7 @@ from serviceitemeditform import ServiceItemEditForm
from screen import ScreenList from screen import ScreenList
from maindisplay import MainDisplay from maindisplay import MainDisplay
from maindisplay import VideoDisplay from maindisplay import VideoDisplay
from maindisplay import DisplayManager
from amendthemeform import AmendThemeForm from amendthemeform import AmendThemeForm
from slidecontroller import SlideController from slidecontroller import SlideController
from splashscreen import SplashScreen from splashscreen import SplashScreen

View File

@ -34,6 +34,15 @@ from openlp.core.ui import HideMode
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class DisplayManager(QtGui.QWidget):
def __init__(self, screens):
QtGui.QWidget.__init__(self)
self.screens = screens
self.videoDisplay = VideoDisplay(self, screens)
self.mainDisplay = MainDisplay(self, screens)
class DisplayWidget(QtGui.QWidget): class DisplayWidget(QtGui.QWidget):
""" """
Customised version of QTableWidget which can respond to keyboard Customised version of QTableWidget which can respond to keyboard
@ -42,8 +51,8 @@ class DisplayWidget(QtGui.QWidget):
log.info(u'MainDisplay loaded') log.info(u'MainDisplay loaded')
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None):
QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint)# \ QtGui.QWidget.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint \
#| QtCore.Qt.FramelessWindowHint) | QtCore.Qt.FramelessWindowHint)
self.parent = parent self.parent = parent
self.hotkey_map = {QtCore.Qt.Key_Return: 'servicemanager_next_item', self.hotkey_map = {QtCore.Qt.Key_Return: 'servicemanager_next_item',
QtCore.Qt.Key_Space: 'live_slidecontroller_next_noloop', QtCore.Qt.Key_Space: 'live_slidecontroller_next_noloop',
@ -82,7 +91,7 @@ class MainDisplay(DisplayWidget):
""" """
log.info(u'MainDisplay Loaded') log.info(u'MainDisplay Loaded')
def __init__(self, parent, screens, application): def __init__(self, parent, screens):
""" """
The constructor for the display form. The constructor for the display form.
@ -93,9 +102,8 @@ class MainDisplay(DisplayWidget):
The list of screens. The list of screens.
""" """
log.debug(u'Initilisation started') log.debug(u'Initilisation started')
DisplayWidget.__init__(self, None) DisplayWidget.__init__(self, parent)
self.parent = parent self.parent = parent
self.application = application
self.setWindowTitle(u'OpenLP Display') self.setWindowTitle(u'OpenLP Display')
self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.screens = screens self.screens = screens
@ -185,8 +193,6 @@ class MainDisplay(DisplayWidget):
self.display_image.setPixmap(self.transparent) self.display_image.setPixmap(self.transparent)
self.display_alert.setPixmap(self.transparent) self.display_alert.setPixmap(self.transparent)
self.display_text.setPixmap(self.transparent) self.display_text.setPixmap(self.transparent)
self.raise_()
self.setFocus()
def showDisplay(self): def showDisplay(self):
log.debug(u'showDisplay') log.debug(u'showDisplay')
@ -271,7 +277,6 @@ class MainDisplay(DisplayWidget):
def onMediaQueue(self, message): def onMediaQueue(self, message):
log.debug(u'Queue new media message %s' % message) log.debug(u'Queue new media message %s' % message)
self.application.setActiveWindow(self)
self.activateWindow() self.activateWindow()
self.hideDisplay() self.hideDisplay()
@ -283,9 +288,9 @@ class VideoWidget(QtGui.QWidget):
log.info(u'MainDisplay loaded') log.info(u'MainDisplay loaded')
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None):
QtGui.QWidget.__init__(self, None, QtCore.Qt.WindowStaysOnBottomHint) QtGui.QWidget.__init__(self, None, QtCore.Qt.WindowStaysOnBottomHint \
| QtCore.Qt.FramelessWindowHint)
self.parent = parent self.parent = parent
# QtCore.Qt.FramelessWindowHint \
def keyPressEvent(self, event): def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent: if type(event) == QtGui.QKeyEvent:
@ -320,7 +325,7 @@ class VideoDisplay(VideoWidget):
self.screens = screens self.screens = screens
self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.mediaObject = Phonon.MediaObject(self) self.mediaObject = Phonon.MediaObject(self)
self.video = Phonon.VideoWidget() self.video = Phonon.VideoWidget(parent)
self.video.setVisible(False) self.video.setVisible(False)
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
Phonon.createPath(self.mediaObject, self.video) Phonon.createPath(self.mediaObject, self.video)
@ -366,6 +371,7 @@ class VideoDisplay(VideoWidget):
self.video.setFullScreen(True) self.video.setFullScreen(True)
self.mediaObject.play() self.mediaObject.play()
self.setVisible(True) self.setVisible(True)
self.video.lower()
def onMediaPause(self): def onMediaPause(self):
log.debug(u'VideoDisplay Media paused by user') log.debug(u'VideoDisplay Media paused by user')

View File

@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.ui import AboutForm, SettingsForm, \ from openlp.core.ui import AboutForm, SettingsForm, \
ServiceManager, ThemeManager, MainDisplay, SlideController, \ ServiceManager, ThemeManager, MainDisplay, SlideController, \
PluginForm, MediaDockManager, VideoDisplay PluginForm, MediaDockManager, VideoDisplay, DisplayManager
from openlp.core.lib import RenderManager, PluginConfig, build_icon, \ from openlp.core.lib import RenderManager, PluginConfig, build_icon, \
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool
from openlp.core.utils import check_latest_version, AppLocation from openlp.core.utils import check_latest_version, AppLocation
@ -443,8 +443,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.serviceNotSaved = False self.serviceNotSaved = False
self.settingsmanager = SettingsManager(screens) self.settingsmanager = SettingsManager(screens)
self.generalConfig = PluginConfig(u'General') self.generalConfig = PluginConfig(u'General')
self.videoDisplay = VideoDisplay(self, screens) #self.videoDisplay = VideoDisplay(self, screens)
self.mainDisplay = MainDisplay(self, screens, application) #self.mainDisplay = MainDisplay(self, screens)
self.displayManager = DisplayManager(screens)
self.aboutForm = AboutForm(self, applicationVersion) self.aboutForm = AboutForm(self, applicationVersion)
self.settingsForm = SettingsForm(self.screens, self, self) self.settingsForm = SettingsForm(self.screens, self, self)
# Set up the path with plugins # Set up the path with plugins
@ -526,7 +527,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.plugin_helpers[u'service'] = self.ServiceManagerContents self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_helpers[u'toolbox'] = self.mediaDockManager self.plugin_helpers[u'toolbox'] = self.mediaDockManager
self.plugin_helpers[u'maindisplay'] = self.mainDisplay self.plugin_helpers[u'maindisplay'] = self.displayManager.mainDisplay
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers) self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
# hook methods have to happen after find_plugins. Find plugins needs # hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here # the controllers hence the hooks have moved from setupUI() to here
@ -573,15 +574,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.showMaximized() self.showMaximized()
#screen_number = self.getMonitorNumber() #screen_number = self.getMonitorNumber()
self.mainDisplay.setup() self.displayManager.mainDisplay.setup()
self.videoDisplay.setup() self.displayManager.videoDisplay.setup()
if self.mainDisplay.isVisible(): if self.displayManager.mainDisplay.isVisible():
self.mainDisplay.setFocus() self.displayManager.mainDisplay.setFocus()
self.activateWindow() self.activateWindow()
if str_to_bool(self.generalConfig.get_config(u'auto open', False)): if str_to_bool(self.generalConfig.get_config(u'auto open', False)):
self.ServiceManagerContents.onLoadService(True) self.ServiceManagerContents.onLoadService(True)
self.videoDisplay.lower() self.displayManager.videoDisplay.lower()
self.mainDisplay.raise_() self.displayManager.mainDisplay.raise_()
def blankCheck(self): def blankCheck(self):
""" """
@ -671,8 +672,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'cleanup plugins') log.info(u'cleanup plugins')
self.plugin_manager.finalise_plugins() self.plugin_manager.finalise_plugins()
#Close down the displays #Close down the displays
self.mainDisplay.close() self.displayManager.mainDisplay.close()
self.videoDisplay.close() self.displayManager.videoDisplay.close()
def serviceChanged(self, reset=False, serviceName=None): def serviceChanged(self, reset=False, serviceName=None):
""" """

View File

@ -635,7 +635,7 @@ class SlideController(QtGui.QWidget):
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
log.log(15, u'Slide Rendering took %4s' % (time.time() - before)) log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
if self.isLive: if self.isLive:
self.parent.mainDisplay.frameView(frame, True) self.parent.displayManager.mainDisplay.frameView(frame, True)
self.selectedRow = row self.selectedRow = row
def onSlideChange(self, row): def onSlideChange(self, row):

View File

@ -79,11 +79,11 @@ class AlertsManager(QtCore.QObject):
log.debug(u'display alert called %s' % text) log.debug(u'display alert called %s' % text)
if not self.screen: if not self.screen:
self.screenChanged() self.screenChanged()
self.parent.maindisplay.parent.StatusBar.showMessage(u'') #self.parent.maindisplay.parent.StatusBar.showMessage(u'')
self.alertList.append(text) self.alertList.append(text)
if self.timer_id != 0: if self.timer_id != 0:
self.parent.maindisplay.parent.StatusBar.showMessage(\ # self.parent.maindisplay.parent.StatusBar.showMessage(\
self.trUtf8(u'Alert message created and delayed')) # self.trUtf8(u'Alert message created and delayed'))
return return
self.generateAlert() self.generateAlert()

View File

@ -155,6 +155,11 @@ class ImpressController(PresentationController):
desktop = self.get_uno_desktop() desktop = self.get_uno_desktop()
else: else:
desktop = self.get_com_desktop() desktop = self.get_com_desktop()
#Sometimes we get a failure and desktop is None
if not desktop:
desktop.terminate()
log.exception(u'Failed to terminate OpenOffice')
return
docs = desktop.getComponents() docs = desktop.getComponents()
if docs.hasElements(): if docs.hasElements():
log.debug(u'OpenOffice not terminated') log.debug(u'OpenOffice not terminated')