diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 5269a46d0..46e9fd1fd 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -234,7 +234,8 @@ sup { """ -def build_html(item, screen, alert, islive, background, plugins=None, image=None): +def build_html(item, screen, alert, islive, background, plugins=None, \ + image=None): """ Build the full web paged structure for display diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 08e0c27b8..6c913f5be 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -46,12 +46,17 @@ log = logging.getLogger(__name__) class Display(QtGui.QGraphicsView): """ - This is the display screen for preview Widgets. + This is a general display screen class. """ - def __init__(self, parent, controller, plugins): - QtGui.QGraphicsView.__init__(self, parent) + def __init__(self, parent, live, controller, plugins): + if live: + QtGui.QGraphicsView.__init__(self) + else: + QtGui.QGraphicsView.__init__(self, parent) + self.isLive = live self.controller = controller self.plugins = plugins + self.setViewport(QtOpenGL.QGLWidget()) def setup(self): """ @@ -75,30 +80,20 @@ class Display(QtGui.QGraphicsView): self.webView.setGeometry(0, 0, self.width(), self.height()) -class MainDisplay(QtGui.QGraphicsView): +class MainDisplay(Display): """ This is the display screen. """ def __init__(self, parent, image_manager, live, controller, plugins): - if live: - QtGui.QGraphicsView.__init__(self) - else: - QtGui.QGraphicsView.__init__(self, parent) - self.isLive = live - self.controller = controller - self.plugins = plugins + Display.__init__(self, parent, live, controller, plugins) self.image_manager = image_manager self.screens = ScreenList.get_instance() self.alertTab = None self.hideMode = None - self.videoHide = False self.override = {} self.retranslateUi() self.mediaObject = None self.firstTime = True - - self.setViewport(QtOpenGL.QGLWidget()) - self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint | @@ -381,10 +376,6 @@ class MainDisplay(QtGui.QGraphicsView): Receiver.send_message(u'slidecontroller_live_unblank') else: self.hideDisplay(self.hideMode) - # display hidden for video end we have a new item so must be shown - if self.videoHide and self.isLive: - self.videoHide = False - self.showDisplay() self.__hideMouse() def footer(self, text): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index b5f98b149..4969c9238 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -49,8 +49,29 @@ class SlideList(QtGui.QTableWidget): def __init__(self, parent=None, name=None): QtGui.QTableWidget.__init__(self, parent.controller) +class Controller(QtGui.QWidget): + """ + Controller is a general controller widget. + """ + def __init__(self, parent, isLive=False): + """ + Set up the general Controller. + """ + QtGui.QWidget.__init__(self, parent) + self.isLive = isLive + self.display = None -class SlideController(QtGui.QWidget): + def sendToPlugins(self, *args): + """ + This is the generic function to send signal for control widgets, + created from within other plugins + This function is needed to catch the current controller + """ + sender = self.sender().objectName() or self.sender().text() + controller = self + Receiver.send_message('%s' % sender, [controller, args]) + +class SlideController(Controller): """ SlideController is the slide controller widget. This widget is what the user uses to control the displaying of verses/slides/etc on the screen. @@ -59,9 +80,7 @@ class SlideController(QtGui.QWidget): """ Set up the Slide Controller. """ - QtGui.QWidget.__init__(self, parent) - self.isLive = isLive - self.display = None + Controller.__init__(self, parent, isLive) self.screens = ScreenList.get_instance() self.ratio = float(self.screens.current[u'size'].width()) / \ float(self.screens.current[u'size'].height()) @@ -234,7 +253,6 @@ class SlideController(QtGui.QWidget): self.onEditSong) self.controllerLayout.addWidget(self.toolbar) # Build the Media Toolbar - #self.mediabar = OpenLPToolbar(self) self.mediaManager.addControllerItems(self, self.controllerLayout) if self.isLive: # Build the Song Toolbar @@ -262,9 +280,10 @@ class SlideController(QtGui.QWidget): self.slideLayout.setSpacing(0) self.slideLayout.setMargin(0) self.slideLayout.setObjectName(u'SlideLayout') - self.previewDisplay = Display(self, self, self.parent().pluginManager.plugins) + self.previewDisplay = Display(self, self.isLive, self, self.parent().pluginManager.plugins) self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300)) self.slideLayout.insertWidget(0, self.previewDisplay) + self.previewDisplay.hide() # Actual preview screen self.slidePreview = QtGui.QLabel(self) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, @@ -335,16 +354,6 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix), self.onTextRequest) - def sendToPlugins(self, *args): - """ - This is the generic function to send signal for control widgets, - created from within other plugins - This function is needed to catch the current controller - """ - sender = self.sender().objectName() or self.sender().text() - controller = self - Receiver.send_message('%s' % sender, [controller, args]) - def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') self.nextItem.setObjectName(u'nextItemPreview') @@ -381,7 +390,7 @@ class SlideController(QtGui.QWidget): def liveEscape(self): self.display.setVisible(False) - Receiver.send_message('media_stop', self) + Receiver.send_message('Media Stop', [self]) def servicePrevious(self): time.sleep(0.1) @@ -515,7 +524,6 @@ class SlideController(QtGui.QWidget): elif item.is_media(): self.toolbar.setVisible(False) self.mediabar.setVisible(True) - #self.volumeSlider.setAudioOutput(self.audio) if not item.is_media(): # Work-around for OS X, hide and then show the toolbar # See bug #791050 @@ -1129,7 +1137,9 @@ class SlideController(QtGui.QWidget): log.debug(u'SlideController onMediaStart') file = os.path.join(item.get_frame_path(), item.get_frame_title()) self.mediaManager.video(self, file, False, False) - self.slidePreview.hide() + if not self.isLive or self.mediaManager.withLivePreview: + self.previewDisplay.show() + self.slidePreview.hide() def onMediaClose(self): """ @@ -1137,6 +1147,7 @@ class SlideController(QtGui.QWidget): """ log.debug(u'SlideController onMediaClose') self.mediaManager.video_reset(self) + self.previewDisplay.hide() self.slidePreview.show() def _resetBlank(self): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 7bc45b4e7..3e56aa537 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -138,12 +138,11 @@ class MediaMediaItem(MediaManagerItem): return False self.mediaLength = 0 service_item.media_length = self.mediaLength - service_item.add_capability( - ItemCapabilities.AllowsVariableStartTime) + #TODO + #service_item.add_capability( + # ItemCapabilities.AllowsVariableStartTime) service_item.title = unicode(self.plugin.nameStrings[u'singular']) service_item.add_capability(ItemCapabilities.RequiresMedia) - # TODO - #Receiver.send_message(u'media_video', [self.plugin.liveController, filename, False]) # force a non-existent theme service_item.theme = -1 frame = u':/media/image_clapperboard.png' diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 6093047ba..15474c248 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -169,6 +169,7 @@ class MediaTab(SettingsTab): QtCore.QVariant(u'Webkit')).toString() newApiString = self.usedAPIs.join(u',') if oldApiString != newApiString: + # clean old Media stuff QtCore.QSettings().setValue(self.settingsSection + u'/apis', QtCore.QVariant(newApiString)) Receiver.send_message(u'config_screen_changed') diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 11d62ed7c..d71172802 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -94,9 +94,7 @@ class MediaPlugin(Plugin): Time to tidy up on exit """ log.info(u'Media Finalising') - self.mediaManager.Timer.stop() - self.mediaManager.video_reset(self.previewController) - self.mediaManager.video_reset(self.liveController) + self.mediaManager.finalise() def getDisplayCss(self): """