bugfixing

This commit is contained in:
rimach 2011-11-30 18:06:57 +01:00
parent 3570e48732
commit 58035f505d
6 changed files with 56 additions and 19 deletions

View File

@ -80,6 +80,8 @@ class Display(QtGui.QGraphicsView):
if self.isLive and log.getEffectiveLevel() == logging.DEBUG: if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
self.webView.settings().setAttribute( self.webView.settings().setAttribute(
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical, self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
@ -91,6 +93,13 @@ class Display(QtGui.QGraphicsView):
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0,
self.width(), self.height()) self.width(), self.height())
def isWebLoaded(self):
"""
Called by webView event to show display is fully loaded
"""
log.debug(u'Webloaded')
self.webLoaded = True
class MainDisplay(Display): class MainDisplay(Display):
""" """

View File

@ -87,9 +87,14 @@ class MediaController(object):
def set_active_players(self): def set_active_players(self):
playerSettings = str(QtCore.QSettings().value(u'media/players', playerSettings = str(QtCore.QSettings().value(u'media/players',
QtCore.QVariant(u'webkit')).toString()) QtCore.QVariant(u'webkit')).toString())
if len(playerSettings) == 0:
playerSettings = u'webkit'
savedPlayers = playerSettings.split(u',') savedPlayers = playerSettings.split(u',')
for player in savedPlayers: for player in self.mediaPlayers.keys():
self.mediaPlayers[player].isActive = True if player in savedPlayers:
self.mediaPlayers[player].isActive = True
else:
self.mediaPlayers[player].isActive = False
def register_controllers(self, controller): def register_controllers(self, controller):
""" """
@ -255,6 +260,8 @@ class MediaController(object):
""" """
# clean up possible running old media files # clean up possible running old media files
self.finalise() self.finalise()
# update player status
self.set_active_players()
display.hasAudio = True display.hasAudio = True
if not self.withLivePreview and \ if not self.withLivePreview and \
display == self.parent.liveController.previewDisplay: display == self.parent.liveController.previewDisplay:
@ -395,11 +402,11 @@ class MediaController(object):
if not self.curDisplayMediaPlayer[display].play(display): if not self.curDisplayMediaPlayer[display].play(display):
return False return False
if status: if status:
display.frame.evaluateJavaScript(u'show_blank("desktop");')
self.curDisplayMediaPlayer[display].set_visible(display, True)
if controller.isLive: if controller.isLive:
if controller.hideMenu.defaultAction().isChecked(): if controller.hideMenu.defaultAction().isChecked():
controller.hideMenu.defaultAction().trigger() controller.hideMenu.defaultAction().trigger()
self.curDisplayMediaPlayer[display].set_visible(display, True)
display.frame.evaluateJavaScript(u'show_blank("desktop");')
# Start Timer for ui updates # Start Timer for ui updates
if not self.timer.isActive(): if not self.timer.isActive():
self.timer.start() self.timer.start()

View File

@ -79,8 +79,8 @@ VIDEO_JS = u"""
} }
switch(state){ switch(state){
case 'init': case 'init':
vid.src = path; vid.src = 'file:///' + path;
vid2.src = path; vid2.src = 'file:///' + path;
if(loop == null) loop = false; if(loop == null) loop = false;
vid.looping = loop; vid.looping = loop;
vid2.looping = loop; vid2.looping = loop;
@ -92,7 +92,6 @@ VIDEO_JS = u"""
break; break;
case 'play': case 'play':
vid.play(); vid.play();
//vid.style.visibility = 'visible';
if(vid.looping){ if(vid.looping){
video_timer = setInterval( video_timer = setInterval(
function() { function() {
@ -109,6 +108,7 @@ VIDEO_JS = u"""
break; break;
case 'stop': case 'stop':
show_video('pause'); show_video('pause');
vid.currentTime = 0;
break; break;
case 'poll': case 'poll':
if(vid.ended||vid.currentTime+0.2>vid.duration) if(vid.ended||vid.currentTime+0.2>vid.duration)
@ -313,7 +313,7 @@ class WebkitPlayer(MediaPlayer):
js = u'show_flash("load","%s");' % \ js = u'show_flash("load","%s");' % \
(path.replace(u'\\', u'\\\\')) (path.replace(u'\\', u'\\\\'))
else: else:
js = u'show_video("init", "file:///%s", %s, %s);' % \ js = u'show_video("init", "%s", %s, %s);' % \
(path.replace(u'\\', u'\\\\'), str(vol), loop) (path.replace(u'\\', u'\\\\'), str(vol), loop)
display.frame.evaluateJavaScript(js) display.frame.evaluateJavaScript(js)
return True return True
@ -351,6 +351,7 @@ class WebkitPlayer(MediaPlayer):
display.frame.evaluateJavaScript(u'show_flash("stop");') display.frame.evaluateJavaScript(u'show_flash("stop");')
else: else:
display.frame.evaluateJavaScript(u'show_video("stop");') display.frame.evaluateJavaScript(u'show_video("stop");')
controller.seekSlider.setSliderPosition(0)
self.state = MediaState.Stopped self.state = MediaState.Stopped
def volume(self, display, vol): def volume(self, display, vol):

View File

@ -94,6 +94,10 @@ class SlideController(Controller):
self.songEditList = [ self.songEditList = [
u'Edit Song', u'Edit Song',
] ]
self.nextPreviousList = [
u'Previous Slide',
u'Next Slide'
]
self.timer_id = 0 self.timer_id = 0
self.songEdit = False self.songEdit = False
self.selectedRow = 0 self.selectedRow = 0
@ -157,14 +161,14 @@ class SlideController(Controller):
self.toolbar.sizePolicy().hasHeightForWidth()) self.toolbar.sizePolicy().hasHeightForWidth())
self.toolbar.setSizePolicy(sizeToolbarPolicy) self.toolbar.setSizePolicy(sizeToolbarPolicy)
self.previousItem = self.toolbar.addToolbarButton( self.previousItem = self.toolbar.addToolbarButton(
translate('OpenLP.SlideController', 'Previous Slide'), u'Previous Slide',
u':/slides/slide_previous.png', u':/slides/slide_previous.png',
translate('OpenLP.SlideController', 'Move to previous.'), translate('OpenLP.SlideController', 'Move to previous.'),
self.onSlideSelectedPrevious, self.onSlideSelectedPrevious,
shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp],
context=QtCore.Qt.WidgetWithChildrenShortcut) context=QtCore.Qt.WidgetWithChildrenShortcut)
self.nextItem = self.toolbar.addToolbarButton( self.nextItem = self.toolbar.addToolbarButton(
translate('OpenLP.SlideController', 'Next Slide'), u'Next Slide',
u':/slides/slide_next.png', u':/slides/slide_next.png',
translate('OpenLP.SlideController', 'Move to next.'), translate('OpenLP.SlideController', 'Move to next.'),
self.onSlideSelectedNext, self.onSlideSelectedNext,
@ -685,13 +689,11 @@ class SlideController(Controller):
self.toolbar.makeWidgetsVisible(self.loopList) self.toolbar.makeWidgetsVisible(self.loopList)
if item.is_media(): if item.is_media():
self.mediabar.setVisible(True) self.mediabar.setVisible(True)
self.previousItem.setVisible(False) self.toolbar.makeWidgetsInvisible(self.nextPreviousList)
self.nextItem.setVisible(False)
else: else:
# 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
self.previousItem.setVisible(True) self.toolbar.makeWidgetsVisible(self.nextPreviousList)
self.nextItem.setVisible(True)
self.toolbar.show() self.toolbar.show()
def enablePreviewToolBar(self, item): def enablePreviewToolBar(self, item):
@ -707,13 +709,11 @@ class SlideController(Controller):
self.toolbar.makeWidgetsVisible(self.songEditList) self.toolbar.makeWidgetsVisible(self.songEditList)
elif item.is_media(): elif item.is_media():
self.mediabar.setVisible(True) self.mediabar.setVisible(True)
self.previousItem.setVisible(False) self.toolbar.makeWidgetsInvisible(self.nextPreviousList)
self.nextItem.setVisible(False)
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
self.previousItem.setVisible(True) self.toolbar.makeWidgetsVisible(self.nextPreviousList)
self.nextItem.setVisible(True)
self.toolbar.show() self.toolbar.show()
def refreshServiceItem(self): def refreshServiceItem(self):

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver from openlp.core.lib import SettingsTab, translate, Receiver
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings, critical_error_message_box
class MediaTab(SettingsTab): class MediaTab(SettingsTab):
""" """
@ -145,6 +145,11 @@ class MediaTab(SettingsTab):
self.playerOrderlistWidget.clear() self.playerOrderlistWidget.clear()
for player in self.usedPlayers: for player in self.usedPlayers:
if player in self.PlayerCheckBoxes.keys(): if player in self.PlayerCheckBoxes.keys():
if len(self.usedPlayers) == 1:
# at least one media player have to stay active
self.PlayerCheckBoxes[u'%s' % player].setEnabled(False)
else:
self.PlayerCheckBoxes[u'%s' % player].setEnabled(True)
self.playerOrderlistWidget.addItem(player) self.playerOrderlistWidget.addItem(player)
def onOrderingUpButtonPressed(self): def onOrderingUpButtonPressed(self):
@ -199,4 +204,5 @@ class MediaTab(SettingsTab):
if override_changed: if override_changed:
Receiver.send_message(u'mediaitem_media_rebuild') Receiver.send_message(u'mediaitem_media_rebuild')
if player_string_changed: if player_string_changed:
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')

View File

@ -233,6 +233,19 @@ def copy_plugins():
copy(os.path.join(root, filename), copy(os.path.join(root, filename),
os.path.join(dest_path, filename)) os.path.join(dest_path, filename))
def copy_media_player():
print u'Copying media player...'
source = os.path.join(source_path, u'core', u'ui', u'media')
dest = os.path.join(dist_path, u'core', u'ui', u'media')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith(u'.pyc'):
dest_path = os.path.join(dest, root[len(source)+1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
copy(os.path.join(root, filename),
os.path.join(dest_path, filename))
def copy_windows_files(): def copy_windows_files():
print u'Copying extra files for Windows...' print u'Copying extra files for Windows...'
copy(os.path.join(winres_path, u'OpenLP.ico'), copy(os.path.join(winres_path, u'OpenLP.ico'),
@ -355,6 +368,7 @@ def main():
run_pyinstaller() run_pyinstaller()
write_version_file() write_version_file()
copy_plugins() copy_plugins()
copy_media_player()
if os.path.exists(manual_path): if os.path.exists(manual_path):
run_sphinx() run_sphinx()
run_htmlhelp() run_htmlhelp()