Displayed video+audio+slider

Tweaked some unicode strings
This commit is contained in:
Martin Thompson 2009-06-22 21:44:35 +01:00
parent eb523ede80
commit d84c99122f
3 changed files with 85 additions and 15 deletions

View File

@ -50,10 +50,10 @@ class TestRender_base:
self.app=None
def write_to_file(self, pixmap, name):
im=pixmap.toImage()
testpathname=os.path.join(u'test_results", name+".bmp')
testpathname=os.path.join(u'test_results', name+'.bmp')
if os.path.exists(testpathname):
os.unlink(testpathname)
im.save(testpathname, "bmp')
im.save(testpathname, 'bmp')
return im
# xxx quitting the app still leaves it hanging aroudn so we die
# when trying to start another one. Not quitting doesn't help
@ -218,4 +218,4 @@ if __name__=="__main__":
t.setup_method(None)
t.test_easy()
t.test_splits()
t.teardown_method(None)
t.teardown_method(None)

View File

@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os
from PyQt4 import QtCore, QtGui
# xxx this needs a try, except once we've decided what to do if it fails
from PyQt4.phonon import Phonon
# from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
# from openlp.plugins.media.lib import MediaTab,MediaMediaItem
"""Renders a video to some surface or other """
class w(QtGui.QMainWindow):
def __init__(self, parent=None):
super(QtGui.QMainWindow, self).__init__(parent)
self.resize(640,480)
self.setWindowTitle(u'simple media player')
self.show()
if __name__==u'__main__':
app = QtGui.QApplication([])
# widget = QtGui.QWidget()
# widget.resize(320, 240)
# widget.setWindowTitle(u'simple')
# widget.show()
# QCore.QCoreApplication.setApplicationName(u'OpenLP')
mainwindow=w()
widget=QtGui.QWidget(mainwindow)
mainwindow.setCentralWidget(widget)
widget.setLayout(QtGui.QVBoxLayout(widget))
# videofile=u'r-128.rm'
videofile=u'/extra_space/Download/coa360download56Kbps240x160.mpg'
source=Phonon.MediaSource(videofile)
media=Phonon.MediaObject(widget)
media.setCurrentSource(source)
video=Phonon.VideoWidget(widget)
audio=Phonon.AudioOutput(Phonon.MusicCategory)
# controller=Phonon.MediaController(media)
Phonon.createPath(media, video);
Phonon.createPath(media, audio);
# player=Phonon.VideoPlayer(Phonon.VideoCategory, widget)
slider=Phonon.SeekSlider(media, mainwindow)
widget.layout().addWidget(slider)
widget.layout().addWidget(video)
slider.show()
video.show()
media.play()
app.exec_()

View File

@ -24,7 +24,7 @@ __ThisDir__ = os.path.dirname(__file__)
if "" == __ThisDir__ :
__ThisDir__ = os.path.abspath(u'.')
sys.path.append(os.path.abspath(u'%s/../../../.."%__ThisDir__))
sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
from openlp.plugins.songs.lib.songxml import *
@ -35,26 +35,26 @@ class Test_Text(object):
"""OpenSong: parse CCLI example"""
global __ThisDir__
s = Song()
s.from_ccli_text_file(u'%s/data_text/CCLI example.txt"%(__ThisDir__))
assert(s.get_title() == "Song Title Here')
assert(s.get_author_list(True) == "Author, artist name')
assert(s.get_copyright() == "1996 Publisher Info')
assert(s.get_song_cclino() == "1234567')
s.from_ccli_text_file(u'%s/data_text/CCLI example.txt'%(__ThisDir__))
assert(s.get_title() == 'Song Title Here')
assert(s.get_author_list(True) == 'Author, artist name')
assert(s.get_copyright() == '1996 Publisher Info')
assert(s.get_song_cclino() == '1234567')
assert(s.get_number_of_slides() == 4)
def test_file2(self):
"""OpenSong: parse PåEnFjern (danish)"""
global __ThisDir__
s = Song()
s.from_ccli_text_file(u'%s/data_text/PåEnFjern.txt"%(__ThisDir__))
assert(s.get_title() == "På en fjern ensom høj')
assert(s.get_author_list(True) == "Georg Bennard')
assert(s.get_copyright() == "')
assert(s.get_song_cclino() == "')
s.from_ccli_text_file(u'%s/data_text/PåEnFjern.txt'%(__ThisDir__))
assert(s.get_title() == 'På en fjern ensom høj')
assert(s.get_author_list(True) == 'Georg Bennard')
assert(s.get_copyright() == '')
assert(s.get_song_cclino() == '')
assert(s.get_number_of_slides() == 8)
if '__main__' == __name__:
# for local debugging
r = Test_Text()
r.test_file1()
r.test_file2()
r.test_file2()