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:
self.webView.settings().setAttribute(
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
@ -91,6 +93,13 @@ class Display(QtGui.QGraphicsView):
self.webView.setGeometry(0, 0,
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):
"""

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
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):
"""
@ -145,6 +145,11 @@ class MediaTab(SettingsTab):
self.playerOrderlistWidget.clear()
for player in self.usedPlayers:
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)
def onOrderingUpButtonPressed(self):
@ -199,4 +204,5 @@ class MediaTab(SettingsTab):
if override_changed:
Receiver.send_message(u'mediaitem_media_rebuild')
if player_string_changed:
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'config_screen_changed')

View File

@ -233,6 +233,19 @@ def copy_plugins():
copy(os.path.join(root, 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():
print u'Copying extra files for Windows...'
copy(os.path.join(winres_path, u'OpenLP.ico'),
@ -355,6 +368,7 @@ def main():
run_pyinstaller()
write_version_file()
copy_plugins()
copy_media_player()
if os.path.exists(manual_path):
run_sphinx()
run_htmlhelp()