forked from openlp/openlp
Latest changes from head
This commit is contained in:
commit
46967d9ef9
|
@ -20,14 +20,20 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
import types
|
import types
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib.toolbar import *
|
from openlp.core.lib.toolbar import *
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
|
||||||
class BaseListWithDnD(QtGui.QListView):
|
class BaseListWithDnD(QtGui.QListView):
|
||||||
|
"""
|
||||||
|
Please put a short description of what this class does in here.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self,parent = None):
|
def __init__(self,parent = None):
|
||||||
QtGui.QListView.__init__(self,parent)
|
QtGui.QListView.__init__(self,parent)
|
||||||
assert (self.PluginName) # this must be set by the class which is inheriting
|
# this must be set by the class which is inheriting
|
||||||
|
assert(self.PluginName)
|
||||||
|
|
||||||
def mouseMoveEvent(self, event):
|
def mouseMoveEvent(self, event):
|
||||||
"""
|
"""
|
||||||
Drag and drop event does not care what data is selected
|
Drag and drop event does not care what data is selected
|
||||||
|
@ -44,4 +50,3 @@ class BaseListWithDnD(QtGui.QListView):
|
||||||
if dropAction == QtCore.Qt.CopyAction:
|
if dropAction == QtCore.Qt.CopyAction:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
import types
|
import types
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib.toolbar import *
|
from openlp.core.lib.toolbar import *
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from listwithpreviews import ListWithPreviews
|
from listwithpreviews import ListWithPreviews
|
||||||
from serviceitem import ServiceItem
|
from serviceitem import ServiceItem
|
||||||
|
|
||||||
class MediaManagerItem(QtGui.QWidget):
|
class MediaManagerItem(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
MediaManagerItem is a helper widget for plugins.
|
MediaManagerItem is a helper widget for plugins.
|
||||||
|
@ -107,7 +109,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
####################################################################################################
|
###########################################################################
|
||||||
### None of the following *need* to be used, feel free to override
|
### None of the following *need* to be used, feel free to override
|
||||||
### them cmopletely in your plugin's implementation. Alternatively, call them from your
|
### them cmopletely in your plugin's implementation. Alternatively, call them from your
|
||||||
### plugin before or after you've done etra things that you need to.
|
### plugin before or after you've done etra things that you need to.
|
||||||
|
@ -220,8 +222,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
self.parent.config.set_list(self.ConfigSection, self.ListData.getFileList())
|
||||||
|
|
||||||
def generateSlideData(self):
|
def generateSlideData(self):
|
||||||
#assert (0, 'This fn needs to be defined by the plugin');
|
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
||||||
pass
|
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onPreviewClick(self):
|
||||||
log.debug(self.PluginTextShort+u'Preview Requested')
|
log.debug(self.PluginTextShort+u'Preview Requested')
|
||||||
|
|
|
@ -129,14 +129,12 @@ class Renderer:
|
||||||
"""
|
"""
|
||||||
Render a set of lines according to the theme, return bounding box
|
Render a set of lines according to the theme, return bounding box
|
||||||
"""
|
"""
|
||||||
#print "########## Generate frame from lines ##################"
|
|
||||||
log.debug(u'generate_frame_from_lines - Start')
|
log.debug(u'generate_frame_from_lines - Start')
|
||||||
#print "Render Lines ", lines
|
#print "Render Lines ", lines
|
||||||
bbox = self._render_lines_unaligned(lines, False)
|
bbox = self._render_lines_unaligned(lines, False)
|
||||||
if footer_lines is not None:
|
if footer_lines is not None:
|
||||||
bbox1 = self._render_lines_unaligned(footer_lines, True)
|
bbox1 = self._render_lines_unaligned(footer_lines, True)
|
||||||
# reset the frame. first time do not worry about what you paint on.
|
# reset the frame. first time do not worry about what you paint on.
|
||||||
# reset the frame. first time do not worry about what you paint on.
|
|
||||||
self._frame = QtGui.QImage(self._bg_frame)
|
self._frame = QtGui.QImage(self._bg_frame)
|
||||||
x, y = self._correctAlignment(self._rect, bbox)
|
x, y = self._correctAlignment(self._rect, bbox)
|
||||||
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
bbox = self._render_lines_unaligned(lines, False, (x, y), True)
|
||||||
|
@ -158,18 +156,22 @@ class Renderer:
|
||||||
painter.begin(self._bg_frame)
|
painter.begin(self._bg_frame)
|
||||||
if self._theme.background_type == u'solid':
|
if self._theme.background_type == u'solid':
|
||||||
painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
|
painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
|
||||||
elif self._theme.background_type == u'gradient' : # gradient
|
elif self._theme.background_type == u'gradient':
|
||||||
|
# gradient
|
||||||
gradient = None
|
gradient = None
|
||||||
if self._theme.background_direction == u'horizontal':
|
if self._theme.background_direction == u'horizontal':
|
||||||
w = int(self._frame.width()) / 2
|
w = int(self._frame.width()) / 2
|
||||||
gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height()) # vertical
|
# vertical
|
||||||
|
gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height())
|
||||||
elif self._theme.background_direction == u'vertical':
|
elif self._theme.background_direction == u'vertical':
|
||||||
h = int(self._frame.height()) / 2
|
h = int(self._frame.height()) / 2
|
||||||
gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h) # Horizontal
|
# Horizontal
|
||||||
|
gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)
|
||||||
else:
|
else:
|
||||||
w = int(self._frame.width()) / 2
|
w = int(self._frame.width()) / 2
|
||||||
h = int(self._frame.height()) / 2
|
h = int(self._frame.height()) / 2
|
||||||
gradient = QtGui.QRadialGradient(w, h, w) # Circular
|
# Circular
|
||||||
|
gradient = QtGui.QRadialGradient(w, h, w)
|
||||||
gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
|
gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
|
||||||
gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
|
gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
|
||||||
painter.setBrush(QtGui.QBrush(gradient))
|
painter.setBrush(QtGui.QBrush(gradient))
|
||||||
|
@ -182,7 +184,8 @@ class Renderer:
|
||||||
rectPath.lineTo(max_x, 0)
|
rectPath.lineTo(max_x, 0)
|
||||||
rectPath.closeSubpath()
|
rectPath.closeSubpath()
|
||||||
painter.drawPath(rectPath)
|
painter.drawPath(rectPath)
|
||||||
elif self._theme.background_type== u'image': # image
|
elif self._theme.background_type== u'image':
|
||||||
|
# image
|
||||||
painter.fillRect(self._frame.rect(), QtCore.Qt.black)
|
painter.fillRect(self._frame.rect(), QtCore.Qt.black)
|
||||||
if self.bg_image is not None:
|
if self.bg_image is not None:
|
||||||
painter.drawImage(0 ,0 , self.bg_image)
|
painter.drawImage(0 ,0 , self.bg_image)
|
||||||
|
@ -252,11 +255,14 @@ class Renderer:
|
||||||
|
|
||||||
def _correctAlignment(self, rect, bbox):
|
def _correctAlignment(self, rect, bbox):
|
||||||
x = rect.left()
|
x = rect.left()
|
||||||
if int(self._theme.display_verticalAlign) == 0: # top align
|
if int(self._theme.display_verticalAlign) == 0:
|
||||||
|
# top align
|
||||||
y = rect.top()
|
y = rect.top()
|
||||||
elif int(self._theme.display_verticalAlign) == 2: # bottom align
|
elif int(self._theme.display_verticalAlign) == 2:
|
||||||
|
# bottom align
|
||||||
y = rect.bottom() - bbox.height()
|
y = rect.bottom() - bbox.height()
|
||||||
elif int(self._theme.display_verticalAlign) == 1: # centre align
|
elif int(self._theme.display_verticalAlign) == 1:
|
||||||
|
# centre align
|
||||||
y = rect.top() + (rect.height() - bbox.height()) / 2
|
y = rect.top() + (rect.height() - bbox.height()) / 2
|
||||||
else:
|
else:
|
||||||
log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
|
log.error(u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 423 KiB |
Binary file not shown.
After Width: | Height: | Size: 471 KiB |
Binary file not shown.
After Width: | Height: | Size: 425 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
# audio/video sync test
|
||||||
|
# by: Andrew Lok
|
||||||
|
# 2009-06-22
|
||||||
|
|
||||||
|
Import("synctest.avsi")
|
||||||
|
SyncClip(23.976, 44100)
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
# audio/video sync test
|
||||||
|
# by: Andrew Lok
|
||||||
|
# 2009-06-22
|
||||||
|
|
||||||
|
Import("synctest.avsi")
|
||||||
|
SyncClip(25, 48000)
|
Binary file not shown.
|
@ -0,0 +1,6 @@
|
||||||
|
# audio/video sync test
|
||||||
|
# by: Andrew Lok
|
||||||
|
# 2009-06-22
|
||||||
|
|
||||||
|
Import("synctest.avsi")
|
||||||
|
SyncClip(29.97, 32000)
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
# audio/video sync test
|
||||||
|
# by: Andrew Lok
|
||||||
|
# 2009-06-22
|
||||||
|
|
||||||
|
Import("synctest.avsi")
|
||||||
|
SyncClip(29.97, 22050)
|
||||||
|
BicubicResize(640,360)
|
Binary file not shown.
|
@ -0,0 +1,47 @@
|
||||||
|
# audio/video sync test
|
||||||
|
# by: Andrew Lok
|
||||||
|
# 2009-06-22
|
||||||
|
|
||||||
|
#
|
||||||
|
# This code is part of OpenLP's testsuite
|
||||||
|
# OpenLP - Open Source Lyrics Projection
|
||||||
|
# Copyright (c) 2009 Andrew Lok
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
|
||||||
|
function SyncClip(float framerate, int audiorate)
|
||||||
|
{
|
||||||
|
frames=30
|
||||||
|
seconds=frames/framerate
|
||||||
|
|
||||||
|
silence = Tone(seconds, 440, audiorate, 1, "silence", 1.0)
|
||||||
|
tone = Tone(seconds, 440, audiorate, 1, "sine", 1.0)
|
||||||
|
|
||||||
|
silence2 = MonoToStereo(silence, silence)
|
||||||
|
left = MonoToStereo(tone, silence)
|
||||||
|
right = MonoToStereo(silence, tone)
|
||||||
|
|
||||||
|
leftvid=ImageSource("left-720.png",end = frames, fps=framerate, use_DevIL=true)
|
||||||
|
rightvid=ImageSource("right-720.png",end = frames, fps=framerate, use_DevIL=true)
|
||||||
|
normalvid=ImageSource("normal-720.png",end = frames, fps=framerate, use_DevIL=true)
|
||||||
|
|
||||||
|
cycle = AudioDub(leftvid,left) ++ AudioDub(normalvid,silence2) ++ AudioDub(rightvid,right) ++ AudioDub(normalvid,silence2)
|
||||||
|
|
||||||
|
final = loop(cycle,times=5)
|
||||||
|
|
||||||
|
final = final.ConvertToYV12()
|
||||||
|
final = final.info()
|
||||||
|
|
||||||
|
return final
|
||||||
|
}
|
Loading…
Reference in New Issue