forked from openlp/openlp
More changes and attempts
This commit is contained in:
parent
571e91b20f
commit
3cc600a67b
|
@ -29,6 +29,7 @@ from serviceitemeditform import ServiceItemEditForm
|
|||
from screen import ScreenList
|
||||
from maindisplay import MainDisplay
|
||||
from maindisplay import VideoDisplay
|
||||
from maindisplay import DisplayManager
|
||||
from amendthemeform import AmendThemeForm
|
||||
from slidecontroller import SlideController
|
||||
from splashscreen import SplashScreen
|
||||
|
|
|
@ -34,6 +34,15 @@ from openlp.core.ui import HideMode
|
|||
|
||||
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):
|
||||
"""
|
||||
Customised version of QTableWidget which can respond to keyboard
|
||||
|
@ -42,8 +51,8 @@ class DisplayWidget(QtGui.QWidget):
|
|||
log.info(u'MainDisplay loaded')
|
||||
|
||||
def __init__(self, parent=None, name=None):
|
||||
QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint)# \
|
||||
#| QtCore.Qt.FramelessWindowHint)
|
||||
QtGui.QWidget.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint \
|
||||
| QtCore.Qt.FramelessWindowHint)
|
||||
self.parent = parent
|
||||
self.hotkey_map = {QtCore.Qt.Key_Return: 'servicemanager_next_item',
|
||||
QtCore.Qt.Key_Space: 'live_slidecontroller_next_noloop',
|
||||
|
@ -82,7 +91,7 @@ class MainDisplay(DisplayWidget):
|
|||
"""
|
||||
log.info(u'MainDisplay Loaded')
|
||||
|
||||
def __init__(self, parent, screens, application):
|
||||
def __init__(self, parent, screens):
|
||||
"""
|
||||
The constructor for the display form.
|
||||
|
||||
|
@ -93,9 +102,8 @@ class MainDisplay(DisplayWidget):
|
|||
The list of screens.
|
||||
"""
|
||||
log.debug(u'Initilisation started')
|
||||
DisplayWidget.__init__(self, None)
|
||||
DisplayWidget.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.application = application
|
||||
self.setWindowTitle(u'OpenLP Display')
|
||||
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
|
||||
self.screens = screens
|
||||
|
@ -185,8 +193,6 @@ class MainDisplay(DisplayWidget):
|
|||
self.display_image.setPixmap(self.transparent)
|
||||
self.display_alert.setPixmap(self.transparent)
|
||||
self.display_text.setPixmap(self.transparent)
|
||||
self.raise_()
|
||||
self.setFocus()
|
||||
|
||||
def showDisplay(self):
|
||||
log.debug(u'showDisplay')
|
||||
|
@ -271,7 +277,6 @@ class MainDisplay(DisplayWidget):
|
|||
|
||||
def onMediaQueue(self, message):
|
||||
log.debug(u'Queue new media message %s' % message)
|
||||
self.application.setActiveWindow(self)
|
||||
self.activateWindow()
|
||||
self.hideDisplay()
|
||||
|
||||
|
@ -283,9 +288,9 @@ class VideoWidget(QtGui.QWidget):
|
|||
log.info(u'MainDisplay loaded')
|
||||
|
||||
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
|
||||
# QtCore.Qt.FramelessWindowHint \
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if type(event) == QtGui.QKeyEvent:
|
||||
|
@ -320,7 +325,7 @@ class VideoDisplay(VideoWidget):
|
|||
self.screens = screens
|
||||
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
|
||||
self.mediaObject = Phonon.MediaObject(self)
|
||||
self.video = Phonon.VideoWidget()
|
||||
self.video = Phonon.VideoWidget(parent)
|
||||
self.video.setVisible(False)
|
||||
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
||||
Phonon.createPath(self.mediaObject, self.video)
|
||||
|
@ -366,6 +371,7 @@ class VideoDisplay(VideoWidget):
|
|||
self.video.setFullScreen(True)
|
||||
self.mediaObject.play()
|
||||
self.setVisible(True)
|
||||
self.video.lower()
|
||||
|
||||
def onMediaPause(self):
|
||||
log.debug(u'VideoDisplay Media paused by user')
|
||||
|
|
|
@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui
|
|||
|
||||
from openlp.core.ui import AboutForm, SettingsForm, \
|
||||
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
||||
PluginForm, MediaDockManager, VideoDisplay
|
||||
PluginForm, MediaDockManager, VideoDisplay, DisplayManager
|
||||
from openlp.core.lib import RenderManager, PluginConfig, build_icon, \
|
||||
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, str_to_bool
|
||||
from openlp.core.utils import check_latest_version, AppLocation
|
||||
|
@ -443,8 +443,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.serviceNotSaved = False
|
||||
self.settingsmanager = SettingsManager(screens)
|
||||
self.generalConfig = PluginConfig(u'General')
|
||||
self.videoDisplay = VideoDisplay(self, screens)
|
||||
self.mainDisplay = MainDisplay(self, screens, application)
|
||||
#self.videoDisplay = VideoDisplay(self, screens)
|
||||
#self.mainDisplay = MainDisplay(self, screens)
|
||||
self.displayManager = DisplayManager(screens)
|
||||
self.aboutForm = AboutForm(self, applicationVersion)
|
||||
self.settingsForm = SettingsForm(self.screens, self, self)
|
||||
# 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'settings'] = self.settingsForm
|
||||
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)
|
||||
# hook methods have to happen after find_plugins. Find plugins needs
|
||||
# the controllers hence the hooks have moved from setupUI() to here
|
||||
|
@ -573,15 +574,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
"""
|
||||
self.showMaximized()
|
||||
#screen_number = self.getMonitorNumber()
|
||||
self.mainDisplay.setup()
|
||||
self.videoDisplay.setup()
|
||||
if self.mainDisplay.isVisible():
|
||||
self.mainDisplay.setFocus()
|
||||
self.displayManager.mainDisplay.setup()
|
||||
self.displayManager.videoDisplay.setup()
|
||||
if self.displayManager.mainDisplay.isVisible():
|
||||
self.displayManager.mainDisplay.setFocus()
|
||||
self.activateWindow()
|
||||
if str_to_bool(self.generalConfig.get_config(u'auto open', False)):
|
||||
self.ServiceManagerContents.onLoadService(True)
|
||||
self.videoDisplay.lower()
|
||||
self.mainDisplay.raise_()
|
||||
self.displayManager.videoDisplay.lower()
|
||||
self.displayManager.mainDisplay.raise_()
|
||||
|
||||
def blankCheck(self):
|
||||
"""
|
||||
|
@ -671,8 +672,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
log.info(u'cleanup plugins')
|
||||
self.plugin_manager.finalise_plugins()
|
||||
#Close down the displays
|
||||
self.mainDisplay.close()
|
||||
self.videoDisplay.close()
|
||||
self.displayManager.mainDisplay.close()
|
||||
self.displayManager.videoDisplay.close()
|
||||
|
||||
def serviceChanged(self, reset=False, serviceName=None):
|
||||
"""
|
||||
|
|
|
@ -635,7 +635,7 @@ class SlideController(QtGui.QWidget):
|
|||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
|
||||
log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
|
||||
if self.isLive:
|
||||
self.parent.mainDisplay.frameView(frame, True)
|
||||
self.parent.displayManager.mainDisplay.frameView(frame, True)
|
||||
self.selectedRow = row
|
||||
|
||||
def onSlideChange(self, row):
|
||||
|
|
|
@ -79,11 +79,11 @@ class AlertsManager(QtCore.QObject):
|
|||
log.debug(u'display alert called %s' % text)
|
||||
if not self.screen:
|
||||
self.screenChanged()
|
||||
self.parent.maindisplay.parent.StatusBar.showMessage(u'')
|
||||
#self.parent.maindisplay.parent.StatusBar.showMessage(u'')
|
||||
self.alertList.append(text)
|
||||
if self.timer_id != 0:
|
||||
self.parent.maindisplay.parent.StatusBar.showMessage(\
|
||||
self.trUtf8(u'Alert message created and delayed'))
|
||||
# self.parent.maindisplay.parent.StatusBar.showMessage(\
|
||||
# self.trUtf8(u'Alert message created and delayed'))
|
||||
return
|
||||
self.generateAlert()
|
||||
|
||||
|
|
|
@ -155,6 +155,11 @@ class ImpressController(PresentationController):
|
|||
desktop = self.get_uno_desktop()
|
||||
else:
|
||||
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()
|
||||
if docs.hasElements():
|
||||
log.debug(u'OpenOffice not terminated')
|
||||
|
|
Loading…
Reference in New Issue