bugfixing

This commit is contained in:
rimach crichter@web.de 2011-07-20 22:47:29 +02:00
parent 146e01b9ac
commit 210926867f
6 changed files with 47 additions and 46 deletions

View File

@ -234,7 +234,8 @@ sup {
</html> </html>
""" """
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 Build the full web paged structure for display

View File

@ -46,12 +46,17 @@ log = logging.getLogger(__name__)
class Display(QtGui.QGraphicsView): 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): def __init__(self, parent, live, controller, plugins):
QtGui.QGraphicsView.__init__(self, parent) if live:
QtGui.QGraphicsView.__init__(self)
else:
QtGui.QGraphicsView.__init__(self, parent)
self.isLive = live
self.controller = controller self.controller = controller
self.plugins = plugins self.plugins = plugins
self.setViewport(QtOpenGL.QGLWidget())
def setup(self): def setup(self):
""" """
@ -75,30 +80,20 @@ class Display(QtGui.QGraphicsView):
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0,
self.width(), self.height()) self.width(), self.height())
class MainDisplay(QtGui.QGraphicsView): class MainDisplay(Display):
""" """
This is the display screen. This is the display screen.
""" """
def __init__(self, parent, image_manager, live, controller, plugins): def __init__(self, parent, image_manager, live, controller, plugins):
if live: Display.__init__(self, parent, live, controller, plugins)
QtGui.QGraphicsView.__init__(self)
else:
QtGui.QGraphicsView.__init__(self, parent)
self.isLive = live
self.controller = controller
self.plugins = plugins
self.image_manager = image_manager self.image_manager = image_manager
self.screens = ScreenList.get_instance() self.screens = ScreenList.get_instance()
self.alertTab = None self.alertTab = None
self.hideMode = None self.hideMode = None
self.videoHide = False
self.override = {} self.override = {}
self.retranslateUi() self.retranslateUi()
self.mediaObject = None self.mediaObject = None
self.firstTime = True self.firstTime = True
self.setViewport(QtOpenGL.QGLWidget())
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.WindowStaysOnTopHint |
@ -381,10 +376,6 @@ class MainDisplay(QtGui.QGraphicsView):
Receiver.send_message(u'slidecontroller_live_unblank') Receiver.send_message(u'slidecontroller_live_unblank')
else: else:
self.hideDisplay(self.hideMode) 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() self.__hideMouse()
def footer(self, text): def footer(self, text):

View File

@ -49,8 +49,29 @@ class SlideList(QtGui.QTableWidget):
def __init__(self, parent=None, name=None): def __init__(self, parent=None, name=None):
QtGui.QTableWidget.__init__(self, parent.controller) 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 SlideController is the slide controller widget. This widget is what the
user uses to control the displaying of verses/slides/etc on the screen. 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. Set up the Slide Controller.
""" """
QtGui.QWidget.__init__(self, parent) Controller.__init__(self, parent, isLive)
self.isLive = isLive
self.display = None
self.screens = ScreenList.get_instance() self.screens = ScreenList.get_instance()
self.ratio = float(self.screens.current[u'size'].width()) / \ self.ratio = float(self.screens.current[u'size'].width()) / \
float(self.screens.current[u'size'].height()) float(self.screens.current[u'size'].height())
@ -234,7 +253,6 @@ class SlideController(QtGui.QWidget):
self.onEditSong) self.onEditSong)
self.controllerLayout.addWidget(self.toolbar) self.controllerLayout.addWidget(self.toolbar)
# Build the Media Toolbar # Build the Media Toolbar
#self.mediabar = OpenLPToolbar(self)
self.mediaManager.addControllerItems(self, self.controllerLayout) self.mediaManager.addControllerItems(self, self.controllerLayout)
if self.isLive: if self.isLive:
# Build the Song Toolbar # Build the Song Toolbar
@ -262,9 +280,10 @@ class SlideController(QtGui.QWidget):
self.slideLayout.setSpacing(0) self.slideLayout.setSpacing(0)
self.slideLayout.setMargin(0) self.slideLayout.setMargin(0)
self.slideLayout.setObjectName(u'SlideLayout') 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.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
self.slideLayout.insertWidget(0, self.previewDisplay) self.slideLayout.insertWidget(0, self.previewDisplay)
self.previewDisplay.hide()
# Actual preview screen # Actual preview screen
self.slidePreview = QtGui.QLabel(self) self.slidePreview = QtGui.QLabel(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
@ -335,16 +354,6 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix), QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
self.onTextRequest) 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): def setPreviewHotkeys(self, parent=None):
self.previousItem.setObjectName(u'previousItemPreview') self.previousItem.setObjectName(u'previousItemPreview')
self.nextItem.setObjectName(u'nextItemPreview') self.nextItem.setObjectName(u'nextItemPreview')
@ -381,7 +390,7 @@ class SlideController(QtGui.QWidget):
def liveEscape(self): def liveEscape(self):
self.display.setVisible(False) self.display.setVisible(False)
Receiver.send_message('media_stop', self) Receiver.send_message('Media Stop', [self])
def servicePrevious(self): def servicePrevious(self):
time.sleep(0.1) time.sleep(0.1)
@ -515,7 +524,6 @@ class SlideController(QtGui.QWidget):
elif item.is_media(): elif item.is_media():
self.toolbar.setVisible(False) self.toolbar.setVisible(False)
self.mediabar.setVisible(True) self.mediabar.setVisible(True)
#self.volumeSlider.setAudioOutput(self.audio)
if not item.is_media(): if not item.is_media():
# Work-around for OS X, hide and then show the toolbar # Work-around for OS X, hide and then show the toolbar
# See bug #791050 # See bug #791050
@ -1129,7 +1137,9 @@ class SlideController(QtGui.QWidget):
log.debug(u'SlideController onMediaStart') log.debug(u'SlideController onMediaStart')
file = os.path.join(item.get_frame_path(), item.get_frame_title()) file = os.path.join(item.get_frame_path(), item.get_frame_title())
self.mediaManager.video(self, file, False, False) 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): def onMediaClose(self):
""" """
@ -1137,6 +1147,7 @@ class SlideController(QtGui.QWidget):
""" """
log.debug(u'SlideController onMediaClose') log.debug(u'SlideController onMediaClose')
self.mediaManager.video_reset(self) self.mediaManager.video_reset(self)
self.previewDisplay.hide()
self.slidePreview.show() self.slidePreview.show()
def _resetBlank(self): def _resetBlank(self):

View File

@ -138,12 +138,11 @@ class MediaMediaItem(MediaManagerItem):
return False return False
self.mediaLength = 0 self.mediaLength = 0
service_item.media_length = self.mediaLength service_item.media_length = self.mediaLength
service_item.add_capability( #TODO
ItemCapabilities.AllowsVariableStartTime) #service_item.add_capability(
# ItemCapabilities.AllowsVariableStartTime)
service_item.title = unicode(self.plugin.nameStrings[u'singular']) service_item.title = unicode(self.plugin.nameStrings[u'singular'])
service_item.add_capability(ItemCapabilities.RequiresMedia) service_item.add_capability(ItemCapabilities.RequiresMedia)
# TODO
#Receiver.send_message(u'media_video', [self.plugin.liveController, filename, False])
# force a non-existent theme # force a non-existent theme
service_item.theme = -1 service_item.theme = -1
frame = u':/media/image_clapperboard.png' frame = u':/media/image_clapperboard.png'

View File

@ -169,6 +169,7 @@ class MediaTab(SettingsTab):
QtCore.QVariant(u'Webkit')).toString() QtCore.QVariant(u'Webkit')).toString()
newApiString = self.usedAPIs.join(u',') newApiString = self.usedAPIs.join(u',')
if oldApiString != newApiString: if oldApiString != newApiString:
# clean old Media stuff
QtCore.QSettings().setValue(self.settingsSection + u'/apis', QtCore.QSettings().setValue(self.settingsSection + u'/apis',
QtCore.QVariant(newApiString)) QtCore.QVariant(newApiString))
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')

View File

@ -94,9 +94,7 @@ class MediaPlugin(Plugin):
Time to tidy up on exit Time to tidy up on exit
""" """
log.info(u'Media Finalising') log.info(u'Media Finalising')
self.mediaManager.Timer.stop() self.mediaManager.finalise()
self.mediaManager.video_reset(self.previewController)
self.mediaManager.video_reset(self.liveController)
def getDisplayCss(self): def getDisplayCss(self):
""" """