bugfixing

This commit is contained in:
rimach crichter@web.de 2011-07-20 22:48:33 +02:00
commit 6881dd95c3
6 changed files with 47 additions and 46 deletions

View File

@ -234,7 +234,8 @@ sup {
</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

View File

@ -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):
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):

View File

@ -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,6 +1137,8 @@ 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)
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):

View File

@ -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'

View File

@ -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')

View File

@ -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):
"""