This commit is contained in:
Tim Bentley 2011-07-08 08:46:25 +01:00
commit 5efe717137
18 changed files with 178 additions and 95 deletions

View File

@ -288,6 +288,7 @@ class MediaManagerItem(QtGui.QWidget):
self.listView, u':/general/general_add.png',
translate('OpenLP.MediaManagerItem',
'&Add to selected Service Item'), self.onAddEditClick)
self.addCustomContextActions()
# Create the context menu and add all actions from the listView.
self.menu = QtGui.QMenu()
self.menu.addActions(self.listView.actions())
@ -301,6 +302,13 @@ class MediaManagerItem(QtGui.QWidget):
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu)
def addCustomContextActions(self):
"""
Implement this method in your descendent media manager item to
add any context menu items. This method is called automatically.
"""
pass
def initialise(self):
"""
Implement this method in your descendent media manager item to

View File

@ -233,10 +233,12 @@ class MainDisplay(QtGui.QGraphicsView):
API for replacement backgrounds so Images are added directly to cache
"""
self.image_manager.add_image(name, path)
self.image(name)
if hasattr(self, u'serviceItem'):
self.override[u'image'] = name
self.override[u'theme'] = self.serviceItem.themedata.theme_name
self.image(name)
return True
return False
def image(self, name):
"""
@ -349,6 +351,9 @@ class MainDisplay(QtGui.QGraphicsView):
"""
Loads and starts a video to run with the option of sound
"""
# We request a background video but have no service Item
if isBackground and not hasattr(self, u'serviceItem'):
return None
if not self.mediaObject:
self.createMediaObject()
log.debug(u'video')

View File

@ -35,6 +35,8 @@ class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog):
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog)
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
self.dialogLayout.setSpacing(8)
self.dialogLayout.setObjectName(u'dialogLayout')
self.listWidget = QtGui.QListWidget(serviceItemEditDialog)
self.listWidget.setAlternatingRowColors(True)

View File

@ -48,18 +48,18 @@ class ServiceManagerList(QtGui.QTreeWidget):
"""
Set up key bindings and mouse behaviour for the service list
"""
def __init__(self, mainwindow, parent=None, name=None):
def __init__(self, serviceManager, parent=None, name=None):
QtGui.QTreeWidget.__init__(self, parent)
self.mainwindow = mainwindow
self.serviceManager = serviceManager
def keyPressEvent(self, event):
if isinstance(event, QtGui.QKeyEvent):
# here accept the event and do something
if event.key() == QtCore.Qt.Key_Up:
self.mainwindow.onMoveSelectionUp()
self.serviceManager.onMoveSelectionUp()
event.accept()
elif event.key() == QtCore.Qt.Key_Down:
self.mainwindow.onMoveSelectionDown()
self.serviceManager.onMoveSelectionDown()
event.accept()
event.ignore()
else:
@ -688,7 +688,7 @@ class ServiceManager(QtGui.QWidget):
QtGui.QAction, serviceItem[u'service_item'].theme)
if themeAction is not None:
themeAction.setChecked(True)
action = self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
self.menu.exec_(self.serviceManagerList.mapToGlobal(point))
def onServiceItemNoteForm(self):
item = self.findServiceItem()[0]

View File

@ -49,6 +49,8 @@ class ServiceNoteForm(QtGui.QDialog):
def setupUi(self):
self.setObjectName(u'serviceNoteEdit')
self.dialogLayout = QtGui.QVBoxLayout(self)
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
self.dialogLayout.setSpacing(8)
self.dialogLayout.setObjectName(u'verticalLayout')
self.textEdit = QtGui.QTextEdit(self)
self.textEdit.setObjectName(u'textEdit')

View File

@ -27,6 +27,7 @@
import logging
import os
import time
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
@ -412,9 +413,11 @@ class SlideController(QtGui.QWidget):
self.display.videoStop()
def servicePrevious(self):
time.sleep(0.1)
Receiver.send_message('servicemanager_previous_item')
def serviceNext(self):
time.sleep(0.1)
Receiver.send_message('servicemanager_next_item')
def screenSizeChanged(self):

View File

@ -39,7 +39,8 @@ from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, \
check_directory_exists
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \
BackgroundGradientType
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
context_menu_action, context_menu_separator
from openlp.core.theme import Theme
from openlp.core.ui import FileRenameForm, ThemeForm
from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \
@ -104,25 +105,29 @@ class ThemeManager(QtGui.QWidget):
self.contextMenu)
# build the context menu
self.menu = QtGui.QMenu()
self.editAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Edit Theme'))
self.editAction.setIcon(build_icon(u':/themes/theme_edit.png'))
self.copyAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Copy Theme'))
self.copyAction.setIcon(build_icon(u':/themes/theme_edit.png'))
self.renameAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Rename Theme'))
self.renameAction.setIcon(build_icon(u':/themes/theme_edit.png'))
self.deleteAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Delete Theme'))
self.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
self.separator = self.menu.addSeparator()
self.globalAction = self.menu.addAction(
translate('OpenLP.ThemeManager', 'Set As &Global Default'))
self.globalAction.setIcon(build_icon(u':/general/general_export.png'))
self.exportAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Export Theme'))
self.exportAction.setIcon(build_icon(u':/general/general_export.png'))
self.editAction = context_menu_action(
self.menu, u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Edit Theme'), self.onEditTheme)
self.copyAction = context_menu_action(
self.menu, u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Copy Theme'), self.onCopyTheme)
self.renameAction = context_menu_action(
self.menu, u':/themes/theme_edit.png',
translate('OpenLP.ThemeManager', '&Rename Theme'),
self.onRenameTheme)
self.deleteAction = context_menu_action(
self.menu, u':/general/general_delete.png',
translate('OpenLP.ThemeManager', '&Delete Theme'),
self.onDeleteTheme)
context_menu_separator(self.menu)
self.globalAction = context_menu_action(
self.menu, u':/general/general_export.png',
translate('OpenLP.ThemeManager', 'Set As &Global Default'),
self.changeGlobalFromScreen)
self.exportAction = context_menu_action(
self.menu, u':/general/general_export.png',
translate('OpenLP.ThemeManager', '&Export Theme'),
self.onExportTheme)
# Signals
QtCore.QObject.connect(self.themeListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
@ -198,19 +203,7 @@ class ThemeManager(QtGui.QWidget):
self.deleteAction.setVisible(True)
self.renameAction.setVisible(True)
self.globalAction.setVisible(True)
action = self.menu.exec_(self.themeListWidget.mapToGlobal(point))
if action == self.editAction:
self.onEditTheme()
if action == self.copyAction:
self.onCopyTheme()
if action == self.renameAction:
self.onRenameTheme()
if action == self.deleteAction:
self.onDeleteTheme()
if action == self.globalAction:
self.changeGlobalFromScreen()
if action == self.exportAction:
self.onExportTheme()
self.menu.exec_(self.themeListWidget.mapToGlobal(point))
def changeGlobalFromTab(self, themeName):
"""

View File

@ -34,7 +34,8 @@ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, add_widget_completer, \
media_item_combo_box, critical_error_message_box, find_and_set_in_combo_box
media_item_combo_box, critical_error_message_box, \
find_and_set_in_combo_box, build_icon
from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
VerseReferenceList, get_reference_match
@ -57,8 +58,8 @@ class BibleMediaItem(MediaManagerItem):
def __init__(self, parent, plugin, icon):
self.IconPath = u'songs/song'
self.lockIcon = QtGui.QIcon(u':/bibles/bibles_search_lock.png')
self.unlockIcon = QtGui.QIcon(u':/bibles/bibles_search_unlock.png')
self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png')
self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
MediaManagerItem.__init__(self, parent, plugin, icon)
# Place to store the search results for both bibles.
self.settings = self.plugin.settings_tab
@ -983,7 +984,8 @@ class BibleMediaItem(MediaManagerItem):
Search for some Bible verses (by reference).
"""
bible = unicode(self.quickVersionComboBox.currentText())
search_results = self.plugin.manager.get_verses(bible, string, False, False)
search_results = self.plugin.manager.get_verses(bible, string, False,
False)
if search_results:
versetext = u' '.join([verse.text for verse in search_results])
return [[string, versetext]]

View File

@ -208,8 +208,13 @@ class ImageMediaItem(MediaManagerItem):
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
(path, name) = os.path.split(filename)
self.plugin.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
if self.plugin.liveController.display.directImage(name,
filename):
self.resetAction.setVisible(True)
else:
critical_error_message_box(UiStrings().LiveBGError,
translate('ImagePlugin.MediaItem',
'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
unicode(translate('ImagePlugin.MediaItem',

View File

@ -114,8 +114,12 @@ class MediaMediaItem(MediaManagerItem):
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
(path, name) = os.path.split(filename)
self.plugin.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
if self.plugin.liveController.display.video(filename, 0, True):
self.resetAction.setVisible(True)
else:
critical_error_message_box(UiStrings().LiveBGError,
translate('MediaPlugin.MediaItem',
'There was no display item to amend.'))
else:
critical_error_message_box(UiStrings().LiveBGError,
unicode(translate('MediaPlugin.MediaItem',

View File

@ -31,6 +31,7 @@ EasyWorship song databases into the current installation database.
import os
import struct
import re
from openlp.core.lib import translate
from openlp.core.ui.wizard import WizardStrings
@ -38,11 +39,26 @@ from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
RTF_STRIPPING_REGEX = re.compile(r'\{\\tx[^}]*\}')
# regex: at least two newlines, can have spaces between them
SLIDE_BREAK_REGEX = re.compile(r'\n *?\n[\n ]*')
NUMBER_REGEX = re.compile(r'[0-9]+')
NOTE_REGEX = re.compile(r'\(.*?\)')
def strip_rtf(blob, encoding):
depth = 0
control = False
clear_text = []
control_word = []
# workaround for \tx bug: remove one pair of curly braces
# if \tx is encountered
match = RTF_STRIPPING_REGEX.search(blob)
if match:
# start and end indices of match are curly braces - filter them out
blob = ''.join([blob[i] for i in xrange(len(blob))
if i != match.start() and i !=match.end()])
for c in blob:
if control:
# for delimiters, set control to False
@ -259,9 +275,45 @@ class EasyWorshipSongImport(SongImport):
if words:
# Format the lyrics
words = strip_rtf(words, self.encoding)
for verse in words.split(u'\n\n'):
verse_type = VerseType.Tags[VerseType.Verse]
for verse in SLIDE_BREAK_REGEX.split(words):
verse = verse.strip()
if not verse:
continue
verse_split = verse.split(u'\n', 1)
first_line_is_tag = False
# EW tags: verse, chorus, pre-chorus, bridge, tag,
# intro, ending, slide
for type in VerseType.Names+[u'tag', u'slide']:
type = type.lower()
ew_tag = verse_split[0].strip().lower()
if ew_tag.startswith(type):
verse_type = type[0]
if type == u'tag' or type == u'slide':
verse_type = VerseType.Tags[VerseType.Other]
first_line_is_tag = True
number_found = False
# check if tag is followed by number and/or note
if len(ew_tag) > len(type):
match = NUMBER_REGEX.search(ew_tag)
if match:
number = match.group()
verse_type += number
number_found = True
match = NOTE_REGEX.search(ew_tag)
if match:
self.comments += ew_tag + u'\n'
if not number_found:
verse_type += u'1'
break
self.add_verse(
verse.strip(), VerseType.Tags[VerseType.Verse])
verse_split[-1].strip() if first_line_is_tag else verse,
verse_type)
if len(self.comments) > 5:
self.comments += unicode(
translate('SongsPlugin.EasyWorshipSongImport',
'\n[above are Song Tags with notes imported from \
EasyWorship]'))
if self.stop_import_flag:
break
if not self.finish():

View File

@ -35,7 +35,8 @@ from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus
from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings
from openlp.core.lib.ui import UiStrings, context_menu_action, \
context_menu_separator
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
@ -128,6 +129,13 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick)
def addCustomContextActions(self):
context_menu_separator(self.listView)
context_menu_action(
self.listView, u':/general/general_clone.png',
translate('OpenLP.MediaManagerItem',
'&Clone'), self.onCloneClick)
def onFocus(self):
self.searchTextEdit.setFocus()
@ -366,6 +374,24 @@ class SongMediaItem(MediaManagerItem):
self.plugin.manager.delete_object(Song, item_id)
self.onSearchTextButtonClick()
def onCloneClick(self):
"""
Clone a Song
"""
log.debug(u'onCloneClick')
if check_item_selected(self.listView, UiStrings().SelectEdit):
self.editItem = self.listView.currentItem()
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
old_song = self.plugin.manager.get_object(Song, item_id)
song_xml = self.openLyrics.song_to_xml(old_song)
new_song_id = self.openLyrics.xml_to_song(song_xml)
new_song = self.plugin.manager.get_object(Song, new_song_id)
new_song.title = u'%s <%s>' % (new_song.title,
translate('SongsPlugin.MediaItem', 'copy',
'For song cloning'))
self.plugin.manager.save_object(new_song)
self.onSongListLoad()
def generateSlideData(self, service_item, item=None, xmlVersion=False):
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -0,0 +1,6 @@
OpenLP.ico
This Windows icon contains several images with different resolution.
It can be recreated by command:
icotool -c -o OpenLP.ico openlp-logo-16x16.png openlp-logo-32x32.png openlp-logo-48x48.png openlp-logo-64x64.png openlp-logo-128x128.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

View File

@ -56,6 +56,7 @@
<file>general_save.png</file>
<file>general_email.png</file>
<file>general_revert.png</file>
<file>general_clone.png</file>
</qresource>
<qresource prefix="slides">
<file>slide_close.png</file>

View File

@ -1,14 +0,0 @@
# -*- mode: python -*-
a = Analysis([
os.path.join(HOMEPATH, 'support\\_mountzlib.py'),
os.path.join(HOMEPATH, 'support\\useUnicode.py'),
os.path.abspath('openlp.pyw')],
pathex=[os.path.abspath('.')])
pyz = PYZ(a.pure)
exe = EXE(pyz, a.scripts, exclude_binaries=1,
name=os.path.abspath(os.path.join('build', 'pyi.win32', 'OpenLP',
'OpenLP.exe')),
debug=False, strip=False, upx=True, console=False,
icon=os.path.abspath(os.path.join('resources', 'images', 'OpenLP.ico')))
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True,
name=os.path.abspath(os.path.join('dist', 'OpenLP')))

View File

@ -32,8 +32,7 @@ Windows Build Script
This script is used to build the Windows binary and the accompanying installer.
For this script to work out of the box, it depends on a number of things:
Python 2.6
This build script only works with Python 2.6.
Python 2.6/2.7
PyQt4
You should already have this installed, OpenLP doesn't work without it. The
@ -49,7 +48,7 @@ Inno Setup 5
UPX
This is used to compress DLLs and EXEs so that they take up less space, but
still function exactly the same. To install UPS, download it from
still function exactly the same. To install UPX, download it from
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable.
@ -61,7 +60,7 @@ HTML Help Workshop
This is used to create the help file
PyInstaller
PyInstaller should be a checkout of revision 844 of trunk, and in a
PyInstaller should be a checkout of revision 1470 of trunk, and in a
directory called, "pyinstaller" on the same level as OpenLP's Bazaar shared
repository directory. The revision is very important as there is currently
a major regression in HEAD.
@ -73,13 +72,8 @@ PyInstaller
http://svn.pyinstaller.org/trunk
Then you need to copy the two hook-*.py files from the "pyinstaller"
subdirectory in OpenLP's "resources" directory into PyInstaller's "hooks"
directory.
Once you've done that, open a command prompt (DOS shell), navigate to the
PyInstaller directory and run::
C:\Projects\pyinstaller>python Configure.py
subdirectory in OpenLP's "resources" directory into PyInstaller's
"PyInstaller/hooks" directory.
Bazaar
You need the command line "bzr" client installed.
@ -137,9 +131,11 @@ site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib',
# Files and executables
pyi_build = os.path.abspath(os.path.join(branch_path, u'..', u'..',
u'pyinstaller', u'Build.py'))
u'pyinstaller', u'pyinstaller.py'))
openlp_main_script = os.path.abspath(os.path.join(branch_path, 'openlp.pyw'))
lrelease_exe = os.path.join(site_packages, u'PyQt4', u'bin', u'lrelease.exe')
i18n_utils = os.path.join(script_path, u'translation_utils.py')
win32_icon = os.path.join(branch_path, u'resources', u'images', 'OpenLP.ico')
# Paths
source_path = os.path.join(branch_path, u'openlp')
@ -148,9 +144,8 @@ manual_build_path = os.path.join(manual_path, u'build')
helpfile_path = os.path.join(manual_build_path, u'htmlhelp')
i18n_path = os.path.join(branch_path, u'resources', u'i18n')
winres_path = os.path.join(branch_path, u'resources', u'windows')
build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP')
dist_path = os.path.join(branch_path, u'dist', u'OpenLP')
enchant_path = os.path.join(site_packages, u'enchant')
build_path = os.path.join(branch_path, u'build')
dist_path = os.path.join(build_path, u'dist', u'OpenLP')
pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations',
u'lib', u'pptviewlib')
@ -174,8 +169,15 @@ def update_code():
def run_pyinstaller():
print u'Running PyInstaller...'
os.chdir(branch_path)
pyinstaller = Popen((python_exe, pyi_build, u'-y', u'-o', build_path,
os.path.join(winres_path, u'OpenLP.spec')), stdout=PIPE)
pyinstaller = Popen((python_exe, pyi_build,
u'--noconfirm',
u'--windowed',
u'-o', build_path,
u'-i', win32_icon,
u'-p', branch_path,
u'-n', 'OpenLP',
openlp_main_script),
stdout=PIPE)
output, error = pyinstaller.communicate()
code = pyinstaller.wait()
if code != 0:
@ -208,19 +210,6 @@ def write_version_file():
f.write(versionstring)
f.close()
def copy_enchant():
print u'Copying enchant/pyenchant...'
source = enchant_path
dest = os.path.join(dist_path, u'enchant')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith(u'.pyc') and not filename.endswith(u'.pyo'):
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_plugins():
print u'Copying plugins...'
source = os.path.join(source_path, u'plugins')
@ -353,7 +342,6 @@ def main():
build_pptviewlib()
run_pyinstaller()
write_version_file()
copy_enchant()
copy_plugins()
if os.path.exists(manual_path):
run_sphinx()