forked from openlp/openlp
Added the Song plugin, updated the media manager to include more helper functions.
bzr-revno: 119
This commit is contained in:
parent
aafe80cb9d
commit
59a001be72
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
|
||||
<!-- eric4 user project file for project openlp.org 2.0 -->
|
||||
<!-- Saved: 2008-11-23, 23:21:19 -->
|
||||
<!-- Saved: 2008-11-24, 23:38:56 -->
|
||||
<!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org -->
|
||||
<UserProject version="4.0">
|
||||
</UserProject>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
|
||||
<!-- eric4 tasks file for project openlp.org 2.0 -->
|
||||
<!-- Saved: 2008-11-23, 23:21:19 -->
|
||||
<!-- Saved: 2008-11-24, 23:38:56 -->
|
||||
<Tasks version="4.2">
|
||||
</Tasks>
|
@ -41,6 +41,7 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
if title is not None:
|
||||
self.Title = title
|
||||
self.Toolbar = None
|
||||
#self.ToolbarButtons = []
|
||||
|
||||
def addToolbar(self):
|
||||
"""
|
||||
@ -60,6 +61,46 @@ class MediaManagerItem(QtGui.QWidget):
|
||||
self.ToolbarLayout.setObjectName('ToolbarLayout')
|
||||
|
||||
def addToolbarItem(self, item):
|
||||
"""
|
||||
A method to help developers easily add any control to the toolbar.
|
||||
"""
|
||||
if self.Toolbar is None:
|
||||
self.addToolbar()
|
||||
self.ToolbarLayout.addWidget(item)
|
||||
|
||||
def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
|
||||
"""
|
||||
A method to help developers easily add a button to the toolbar.
|
||||
"""
|
||||
ToolbarButton = QtGui.QToolButton(self.Toolbar)
|
||||
ToolbarButton.setText(QtCore.QObject.trUtf8(title))
|
||||
ToolbarButton.setToolTip(QtCore.QObject.trUtf8(tooltip))
|
||||
if type(icon) is QtGui.QIcon:
|
||||
ButtonIcon = icon
|
||||
elif type(icon) is types.StringType:
|
||||
ButtonIcon = QtGui.QIcon()
|
||||
if icon.startswith(':/'):
|
||||
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||
QtGui.QIcon.Off)
|
||||
else:
|
||||
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
ToolbarButton.setIcon(ButtonIcon)
|
||||
ToolbarButton.setIconSize(QtCore.QSize(20, 20))
|
||||
ToolbarButton.setAutoRaise(True)
|
||||
if objectname is not None:
|
||||
ToolbarButton.setObjectName(objectname)
|
||||
if slot is not None:
|
||||
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("clicked()"), slot)
|
||||
self.addToolbarItem(ToolbarButton)
|
||||
|
||||
def addToolbarLine(self):
|
||||
ToolbarLine = QtGui.QFrame(self.Toolbar)
|
||||
ToolbarLine.setMinimumSize(QtCore.QSize(0, 0))
|
||||
ToolbarLine.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
ToolbarLine.setLineWidth(1)
|
||||
ToolbarLine.setMidLineWidth(0)
|
||||
ToolbarLine.setFrameShape(QtGui.QFrame.VLine)
|
||||
ToolbarLine.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
ToolbarLine.setObjectName('ToolbarLine')
|
||||
self.addToolbarItem(ToolbarLine)
|
||||
|
86
openlp/plugins/song/songplugin.py
Normal file
86
openlp/plugins/song/songplugin.py
Normal file
@ -0,0 +1,86 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from openlp.resources import *
|
||||
from openlp.core import Plugin, MediaManagerItem
|
||||
|
||||
class SongPlugin(Plugin):
|
||||
def __init__(self):
|
||||
# Call the parent constructor
|
||||
Plugin.__init__('Song', '1.9.0')
|
||||
# Create the plugin icon
|
||||
self.Icon = QtGui.QIcon()
|
||||
self.Icon.addPixmap(QtGui.QPixmap(':/media/media_song.png'),
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
# Create the MediaManagerItem object
|
||||
self.MediaManagerItem = MediaManagerItem(self.Icon, 'Songs')
|
||||
# Add a toolbar
|
||||
self.MediaManagerItem.addToolbar()
|
||||
# Create buttons for the toolbar
|
||||
## New Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('New Song', 'Add a new song',
|
||||
':/songs/song_new.png', self.onSongNewClick, 'SongNewItem')
|
||||
## Edit Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('Edit Song', 'Edit the selected song',
|
||||
':/songs/song_edit.png', self.onSongEditClick, 'SongEditItem')
|
||||
## Delete Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('Delete Song', 'Delete the selected song',
|
||||
':/songs/song_delete.png', self.onSongDeleteClick, 'SongDeleteItem')
|
||||
## Separator Line ##
|
||||
self.MediaManagerItem.addToolbarLine()
|
||||
## Preview Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('Preview Song', 'Preview the selected song',
|
||||
':/system/system_preview.png', self.onSongPreviewClick, 'SongPreviewItem')
|
||||
## Live Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('Go Live', 'Send the selected song live',
|
||||
':/system/system_live.png', self.onSongLiveClick, 'SongLiveItem')
|
||||
## Add Song Button ##
|
||||
self.MediaManagerItem.addToolbarButton('Add Song To Service',
|
||||
'Add the selected song(s) to the service', ':/system/system_add.png',
|
||||
self.onSongAddClick, 'SongAddItem')
|
||||
## Spacer ##
|
||||
self.SongSpacerItem = QtGui.QSpacerItem(40, 20,
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.MediaManagerItem.addToolbarItem(self.SongSpacerItem)
|
||||
# Add the songlist widget
|
||||
self.SongList = QtGui.QTableWidget(self.MediaManagerItem)
|
||||
self.SongList.setObjectName("SongList")
|
||||
self.SongList.setColumnCount(0)
|
||||
self.SongList.setRowCount(0)
|
||||
self.MediaManagerItem.PageLayout.addWidget(self.SongList)
|
||||
|
||||
def onSongNewClick(self):
|
||||
pass
|
||||
|
||||
def onSongEditClick(self):
|
||||
pass
|
||||
|
||||
def onSongDeleteClick(self):
|
||||
pass
|
||||
|
||||
def onSongPreviewClick(self):
|
||||
pass
|
||||
|
||||
def onSongLiveClick(self):
|
||||
pass
|
||||
|
||||
def onSongAddClick(self):
|
||||
pass
|
Loading…
Reference in New Issue
Block a user