This commit is contained in:
rimach 2011-01-09 22:01:38 +01:00
commit 1ed2151014
74 changed files with 3021 additions and 3029 deletions

View File

@ -34,7 +34,7 @@ from subprocess import Popen, PIPE
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
from openlp.core.lib import Receiver, check_directory_exists
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
from openlp.core.ui.exceptionform import ExceptionForm
@ -150,16 +150,16 @@ class OpenLP(QtGui.QApplication):
log.info(u'Openlp version %s' % app_version[u'version'])
return app_version
def notify(self, obj, evt):
#TODO needed for presentation exceptions
return QtGui.QApplication.notify(self, obj, evt)
# def notify(self, obj, evt):
# #TODO needed for presentation exceptions
# return QtGui.QApplication.notify(self, obj, evt)
def run(self):
"""
Run the OpenLP application.
"""
app_version = self._get_version()
#provide a listener for widgets to reqest a screen update.
# provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -182,7 +182,7 @@ class OpenLP(QtGui.QApplication):
screens = ScreenList()
# Decide how many screens we have and their size
for screen in xrange(0, self.desktop().numScreens()):
size = self.desktop().screenGeometry(screen);
size = self.desktop().screenGeometry(screen)
screens.add_screen({u'number': screen,
u'size': size,
u'primary': (self.desktop().primaryScreen() == screen)})
@ -216,7 +216,7 @@ class OpenLP(QtGui.QApplication):
def setNormalCursor(self):
"""
Sets the Normal Cursor forthe Application
Sets the Normal Cursor for the Application
"""
self.restoreOverrideCursor()
@ -243,8 +243,7 @@ def main():
help='Set the Qt4 style (passed directly to Qt4).')
# Set up logging
log_path = AppLocation.get_directory(AppLocation.CacheDir)
if not os.path.exists(log_path):
os.makedirs(log_path)
check_directory_exists(log_path)
filename = os.path.join(log_path, u'openlp.log')
logfile = logging.FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter(
@ -281,4 +280,4 @@ if __name__ == u'__main__':
"""
Instantiate and run the application.
"""
main()
main()

View File

@ -35,52 +35,51 @@ from PyQt4 import QtCore, QtGui
log = logging.getLogger(__name__)
# TODO make external and configurable in alpha 4 via a settings dialog
html_expands = []
base_html_expands = []
html_expands.append({u'desc': u'Red', u'start tag': u'{r}',
base_html_expands.append({u'desc': u'Red', u'start tag': u'{r}',
u'start html': u'<span style="-webkit-text-fill-color:red">',
u'end tag': u'{/r}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Black', u'start tag': u'{b}',
u'end tag': u'{/r}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Black', u'start tag': u'{b}',
u'start html': u'<span style="-webkit-text-fill-color:black">',
u'end tag': u'{/b}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Blue', u'start tag': u'{bl}',
u'end tag': u'{/b}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Blue', u'start tag': u'{bl}',
u'start html': u'<span style="-webkit-text-fill-color:blue">',
u'end tag': u'{/bl}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Yellow', u'start tag': u'{y}',
u'end tag': u'{/bl}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Yellow', u'start tag': u'{y}',
u'start html': u'<span style="-webkit-text-fill-color:yellow">',
u'end tag': u'{/y}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Green', u'start tag': u'{g}',
u'end tag': u'{/y}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Green', u'start tag': u'{g}',
u'start html': u'<span style="-webkit-text-fill-color:green">',
u'end tag': u'{/g}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Pink', u'start tag': u'{pk}',
u'end tag': u'{/g}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Pink', u'start tag': u'{pk}',
u'start html': u'<span style="-webkit-text-fill-color:#CC33CC">',
u'end tag': u'{/pk}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Orange', u'start tag': u'{o}',
u'end tag': u'{/pk}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Orange', u'start tag': u'{o}',
u'start html': u'<span style="-webkit-text-fill-color:#CC0033">',
u'end tag': u'{/o}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Purple', u'start tag': u'{pp}',
u'end tag': u'{/o}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Purple', u'start tag': u'{pp}',
u'start html': u'<span style="-webkit-text-fill-color:#9900FF">',
u'end tag': u'{/pp}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'White', u'start tag': u'{w}',
u'end tag': u'{/pp}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'White', u'start tag': u'{w}',
u'start html': u'<span style="-webkit-text-fill-color:white">',
u'end tag': u'{/w}', u'end html': u'</span>', u'protected': False})
html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}',
u'end tag': u'{/w}', u'end html': u'</span>', u'protected': True})
base_html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}',
u'start html': u'<sup>', u'end tag': u'{/su}', u'end html': u'</sup>',
u'protected': True})
html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}',
base_html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}',
u'start html': u'<sub>', u'end tag': u'{/sb}', u'end html': u'</sub>',
u'protected': True})
html_expands.append({u'desc': u'Paragraph', u'start tag': u'{p}',
base_html_expands.append({u'desc': u'Paragraph', u'start tag': u'{p}',
u'start html': u'<p>', u'end tag': u'{/p}', u'end html': u'</p>',
u'protected': True})
html_expands.append({u'desc': u'Bold', u'start tag': u'{st}',
base_html_expands.append({u'desc': u'Bold', u'start tag': u'{st}',
u'start html': u'<strong>', u'end tag': u'{/st}', u'end html': u'</strong>',
u'protected': True})
html_expands.append({u'desc': u'Italics', u'start tag': u'{it}',
base_html_expands.append({u'desc': u'Italics', u'start tag': u'{it}',
u'start html': u'<em>', u'end tag': u'{/it}', u'end html': u'</em>',
u'protected': True})
html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
base_html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
u'start html': u'<span style="text-decoration: underline;">',
u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
@ -102,7 +101,8 @@ def translate(context, text, comment=None,
An identifying string for when the same text is used in different roles
within the same context.
"""
return QtCore.QCoreApplication.translate(context, text, comment, encoding, n)
return QtCore.QCoreApplication.translate(
context, text, comment, encoding, n)
def get_text_file_string(text_file):
"""
@ -293,7 +293,7 @@ def clean_tags(text):
Remove Tags from text for display
"""
text = text.replace(u'<br>', u'\n')
for tag in html_expands:
for tag in DisplayTags.get_html_tags():
text = text.replace(tag[u'start tag'], u'')
text = text.replace(tag[u'end tag'], u'')
return text
@ -302,13 +302,25 @@ def expand_tags(text):
"""
Expand tags HTML for display
"""
for tag in html_expands:
for tag in DisplayTags.get_html_tags():
text = text.replace(tag[u'start tag'], tag[u'start html'])
text = text.replace(tag[u'end tag'], tag[u'end html'])
return text
def check_directory_exists(dir):
"""
Check a theme directory exists and if not create it
``dir``
Theme directory to make sure exists
"""
log.debug(u'check_directory_exists')
if not os.path.exists(dir):
os.makedirs(dir)
from theme import ThemeLevel, ThemeXML, BackgroundGradientType, \
BackgroundType, HorizontalType, VerticalType
from displaytags import DisplayTags
from spelltextedit import SpellTextEdit
from eventreceiver import Receiver
from imagemanager import ImageManager

View File

@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
"""
Provide Html Tag management and Display Tag access class
"""
from openlp.core.lib import base_html_expands
class DisplayTags(object):
"""
Static Class to HTML Tags to be access around the code the list is managed
by the Options Tab.
"""
html_expands = []
@staticmethod
def get_html_tags():
"""
Provide access to the html_expands list.
"""
return DisplayTags.html_expands
@staticmethod
def reset_html_tags():
"""
Resets the html_expands list.
"""
DisplayTags.html_expands = []
for html in base_html_expands:
DisplayTags.html_expands.append(html)
@staticmethod
def add_html_tag(tag):
"""
Add a new tag to the list
"""
DisplayTags.html_expands.append(tag)
@staticmethod
def remove_html_tag(id):
"""
Removes amd individual html_expands list.
"""
DisplayTags.html_expands.pop(id)

View File

@ -48,4 +48,3 @@ class OpenLPDockWidget(QtGui.QDockWidget):
self.setObjectName(name)
if icon:
self.setWindowIcon(icon)
self.setFloating(False)

View File

@ -111,7 +111,7 @@ class MediaManagerItem(QtGui.QWidget):
self.singleServiceItem = True
self.pageLayout = QtGui.QVBoxLayout(self)
self.pageLayout.setSpacing(0)
self.pageLayout.setContentsMargins(4, 0, 4, 0)
self.pageLayout.setMargin(0)
self.requiredIcons()
self.setupUi()
self.retranslateUi()
@ -176,7 +176,8 @@ class MediaManagerItem(QtGui.QWidget):
# break compatability), but it makes sense for the icon to
# come before the tooltip (as you have to have an icon, but
# not neccesarily a tooltip)
self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable)
return self.toolbar.addToolbarButton(title, icon, tooltip, slot,
checkable)
def addToolbarSeparator(self):
"""
@ -268,7 +269,6 @@ class MediaManagerItem(QtGui.QWidget):
#Add the List widget
self.listView = self.ListViewWithDnD_class(self)
self.listView.uniformItemSizes = True
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.listView.setSpacing(1)
self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)

View File

@ -175,6 +175,10 @@ class Plugin(QtCore.QObject):
self.status = new_status
QtCore.QSettings().setValue(
self.settingsSection + u'/status', QtCore.QVariant(self.status))
if new_status == PluginStatus.Active:
self.initialise()
elif new_status == PluginStatus.Inactive:
self.finalise()
def isActive(self):
"""
@ -314,4 +318,4 @@ class Plugin(QtCore.QObject):
"""
Called to define all translatable texts of the plugin
"""
pass
pass

View File

@ -69,7 +69,7 @@ class SearchEdit(QtGui.QLineEdit):
"""
frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth)
rightPadding = self.clearButton.sizeHint().width() + frameWidth
rightPadding = self.clearButton.width() + frameWidth
if hasattr(self, u'menuButton'):
leftPadding = self.menuButton.width()
self.setStyleSheet(
@ -78,10 +78,10 @@ class SearchEdit(QtGui.QLineEdit):
else:
self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \
rightPadding)
msz = self.minimumSizeHint();
msz = self.minimumSizeHint()
self.setMinimumSize(
max(msz.width(),
self.clearButton.sizeHint().width() + (frameWidth * 2) + 2),
self.clearButton.width() + (frameWidth * 2) + 2),
max(msz.height(),
self.clearButton.height() + (frameWidth * 2) + 2)
)
@ -93,13 +93,13 @@ class SearchEdit(QtGui.QLineEdit):
``event``
The event that happened.
"""
sz = self.clearButton.sizeHint()
sz = self.clearButton.size()
frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth)
self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
(self.rect().bottom() + 1 - sz.height()) / 2)
if hasattr(self, u'menuButton'):
sz = self.menuButton.sizeHint()
sz = self.menuButton.size()
self.menuButton.move(self.rect().left() + frameWidth + 2,
(self.rect().bottom() + 1 - sz.height()) / 2)

View File

@ -55,7 +55,34 @@ class SettingsTab(QtGui.QWidget):
"""
Setup the tab's interface.
"""
pass
self.tabLayout = QtGui.QHBoxLayout(self)
self.tabLayout.setObjectName(u'tabLayout')
self.leftColumn = QtGui.QWidget(self)
self.leftColumn.setObjectName(u'leftColumn')
self.leftLayout = QtGui.QVBoxLayout(self.leftColumn)
self.leftLayout.setMargin(0)
self.leftLayout.setObjectName(u'leftLayout')
self.tabLayout.addWidget(self.leftColumn)
self.rightColumn = QtGui.QWidget(self)
self.rightColumn.setObjectName(u'rightColumn')
self.rightLayout = QtGui.QVBoxLayout(self.rightColumn)
self.rightLayout.setMargin(0)
self.rightLayout.setObjectName(u'rightLayout')
self.tabLayout.addWidget(self.rightColumn)
def resizeEvent(self, event=None):
"""
Resize the sides in two equal halves if the layout allows this.
"""
if event:
QtGui.QWidget.resizeEvent(self, event)
width = self.width() - self.tabLayout.spacing() - \
self.tabLayout.contentsMargins().left() - \
self.tabLayout.contentsMargins().right()
left_width = min(width - self.rightColumn.minimumSizeHint().width(),
width / 2)
left_width = max(left_width, self.leftColumn.minimumSizeHint().width())
self.leftColumn.setFixedWidth(left_width)
def preLoad(self):
"""
@ -87,6 +114,12 @@ class SettingsTab(QtGui.QWidget):
"""
pass
def cancel(self):
"""
Reset any settings
"""
pass
def postSetUp(self, postUpdate=False):
"""
Changes which need to be made after setup of application

View File

@ -36,7 +36,7 @@ except ImportError:
# http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check
from PyQt4 import QtCore, QtGui
from openlp.core.lib import html_expands, translate
from openlp.core.lib import translate, DisplayTags
class SpellTextEdit(QtGui.QPlainTextEdit):
"""
@ -88,7 +88,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
popupMenu.insertMenu(popupMenu.actions()[0], spell_menu)
tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit',
'Formatting Tags'))
for html in html_expands:
for html in DisplayTags.get_html_tags():
action = SpellAction( html[u'desc'], tagMenu)
action.correct.connect(self.htmlTag)
tagMenu.addAction(action)
@ -110,7 +110,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
"""
Replaces the selected text with word.
"""
for html in html_expands:
for html in DisplayTags.get_html_tags():
if tag == html[u'desc']:
cursor = self.textCursor()
if self.textCursor().hasSelection():
@ -158,4 +158,4 @@ class SpellAction(QtGui.QAction):
def __init__(self, *args):
QtGui.QAction.__init__(self, *args)
self.triggered.connect(lambda x: self.correct.emit(
unicode(self.text())))
unicode(self.text())))

View File

@ -598,4 +598,4 @@ class ThemeXML(object):
self.font_footer_shadow_size)
self.add_display(self.display_horizontal_align,
self.display_vertical_align,
self.display_slide_transition)
self.display_slide_transition)

View File

@ -72,27 +72,27 @@ class OpenLPToolbar(QtGui.QToolBar):
``objectname``
The name of the object, as used in `<button>.setObjectName()`.
"""
toolbarButton = None
newAction = None
if icon:
buttonIcon = build_icon(icon)
actionIcon = build_icon(icon)
if slot and not checkable:
toolbarButton = self.addAction(buttonIcon, title, slot)
newAction = self.addAction(actionIcon, title, slot)
else:
toolbarButton = self.addAction(buttonIcon, title)
self.icons[title] = buttonIcon
newAction = self.addAction(actionIcon, title)
self.icons[title] = actionIcon
else:
toolbarButton = QtGui.QAction(title, toolbarButton)
self.addAction(toolbarButton)
QtCore.QObject.connect(toolbarButton,
newAction = QtGui.QAction(title, newAction)
self.addAction(newAction)
QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'triggered()'), slot)
if tooltip:
toolbarButton.setToolTip(tooltip)
newAction.setToolTip(tooltip)
if checkable:
toolbarButton.setCheckable(True)
QtCore.QObject.connect(toolbarButton,
newAction.setCheckable(True)
QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'toggled(bool)'), slot)
self.actions[title] = toolbarButton
return toolbarButton
self.actions[title] = newAction
return newAction
def addToolbarSeparator(self, handle):
"""
@ -154,4 +154,4 @@ class OpenLPToolbar(QtGui.QToolBar):
push_button.setCheckable(True)
push_button.setFlat(True)
self.addWidget(push_button)
return push_button
return push_button

View File

@ -29,9 +29,20 @@ The :mod:`ui` module provides the core user interface for OpenLP
class HideMode(object):
"""
This is basically an enumeration class which specifies the mode of a Bible.
Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to
be downloaded from the Internet on an as-needed basis.
This is an enumeration class which specifies the different modes of hiding
the display.
``Blank``
This mode is used to hide all output, specifically by covering the
display with a black screen.
``Theme``
This mode is used to hide all output, but covers the display with the
current theme background, as opposed to black.
``Desktop``
This mode hides all output by minimising the display, leaving the user's
desktop showing.
"""
Blank = 1
Theme = 2
@ -48,6 +59,7 @@ from splashscreen import SplashScreen
from generaltab import GeneralTab
from themestab import ThemesTab
from advancedtab import AdvancedTab
from displaytagtab import DisplayTagTab
from aboutform import AboutForm
from pluginform import PluginForm
from settingsform import SettingsForm
@ -58,4 +70,4 @@ from thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
'MediaDockManager', 'ServiceItemEditForm']
'MediaDockManager', 'ServiceItemEditForm']

View File

@ -31,17 +31,12 @@ from openlp.core.lib import build_icon, translate
class Ui_AboutDialog(object):
def setupUi(self, aboutDialog):
aboutDialog.setObjectName(u'aboutDialog')
aboutDialog.resize(516, 481)
aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog)
self.aboutDialogLayout.setSpacing(8)
self.aboutDialogLayout.setMargin(8)
self.aboutDialogLayout.setObjectName(u'aboutDialogLayout')
self.logoLabel = QtGui.QLabel(aboutDialog)
self.logoLabel.setPixmap(
QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
self.logoLabel.setScaledContents(False)
self.logoLabel.setIndent(0)
self.logoLabel.setObjectName(u'logoLabel')
self.aboutDialogLayout.addWidget(self.logoLabel)
self.aboutNotebook = QtGui.QTabWidget(aboutDialog)
@ -49,59 +44,44 @@ class Ui_AboutDialog(object):
self.aboutTab = QtGui.QWidget()
self.aboutTab.setObjectName(u'aboutTab')
self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab)
self.aboutTabLayout.setSpacing(0)
self.aboutTabLayout.setMargin(8)
self.aboutTabLayout.setObjectName(u'aboutTabLayout')
self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab)
self.aboutTextEdit.setReadOnly(True)
self.aboutTextEdit.setObjectName(u'aboutTextEdit')
self.aboutTabLayout.addWidget(self.aboutTextEdit)
self.aboutNotebook.addTab(self.aboutTab, '')
self.aboutNotebook.addTab(self.aboutTab, u'')
self.creditsTab = QtGui.QWidget()
self.creditsTab.setObjectName(u'creditsTab')
self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab)
self.creditsTabLayout.setSpacing(0)
self.creditsTabLayout.setMargin(8)
self.creditsTabLayout.setObjectName(u'creditsTabLayout')
self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab)
self.creditsTextEdit.setReadOnly(True)
self.creditsTextEdit.setObjectName(u'creditsTextEdit')
self.creditsTabLayout.addWidget(self.creditsTextEdit)
self.aboutNotebook.addTab(self.creditsTab, '')
self.aboutNotebook.addTab(self.creditsTab, u'')
self.licenseTab = QtGui.QWidget()
self.licenseTab.setObjectName(u'licenseTab')
self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab)
self.licenseTabLayout.setSpacing(8)
self.licenseTabLayout.setMargin(8)
self.licenseTabLayout.setObjectName(u'licenseTabLayout')
self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab)
self.licenseTextEdit.setReadOnly(True)
self.licenseTextEdit.setObjectName(u'licenseTextEdit')
self.licenseTabLayout.addWidget(self.licenseTextEdit)
self.aboutNotebook.addTab(self.licenseTab, '')
self.aboutNotebook.addTab(self.licenseTab, u'')
self.aboutDialogLayout.addWidget(self.aboutNotebook)
self.buttonWidget = QtGui.QWidget(aboutDialog)
self.buttonWidget.setObjectName(u'buttonWidget')
self.buttonWidgetLayout = QtGui.QHBoxLayout(self.buttonWidget)
self.buttonWidgetLayout.setSpacing(8)
self.buttonWidgetLayout.setMargin(0)
self.buttonWidgetLayout.setObjectName(u'buttonWidgetLayout')
buttonSpacer = QtGui.QSpacerItem(275, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.buttonWidgetLayout.addItem(buttonSpacer)
self.contributeButton = QtGui.QPushButton(self.buttonWidget)
self.buttonBox = QtGui.QDialogButtonBox(aboutDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.buttonBox.setObjectName(u'buttonBox')
self.contributeButton = QtGui.QPushButton()
self.contributeButton.setIcon(
build_icon(u':/system/system_contribute.png'))
self.contributeButton.setObjectName(u'contributeButton')
self.buttonWidgetLayout.addWidget(self.contributeButton)
self.closeButton = QtGui.QPushButton(self.buttonWidget)
self.closeButton.setIcon(build_icon(u':/system/system_close.png'))
self.closeButton.setObjectName(u'closeButton')
self.buttonWidgetLayout.addWidget(self.closeButton)
self.aboutDialogLayout.addWidget(self.buttonWidget)
self.buttonBox.addButton(self.contributeButton,
QtGui.QDialogButtonBox.ActionRole)
self.aboutDialogLayout.addWidget(self.buttonBox)
self.retranslateUi(aboutDialog)
self.aboutNotebook.setCurrentIndex(0)
QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL(u'clicked()'),
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
aboutDialog.close)
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
@ -575,4 +555,3 @@ class Ui_AboutDialog(object):
translate('OpenLP.AboutForm', 'License'))
self.contributeButton.setText(translate('OpenLP.AboutForm',
'Contribute'))
self.closeButton.setText(translate('OpenLP.AboutForm', 'Close'))

View File

@ -46,93 +46,57 @@ class AdvancedTab(SettingsTab):
Configure the UI elements for the tab.
"""
self.setObjectName(u'AdvancedTab')
self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced')
self.advancedTabLayout = QtGui.QHBoxLayout(self)
self.advancedTabLayout.setSpacing(8)
self.advancedTabLayout.setMargin(8)
self.leftWidget = QtGui.QWidget(self)
self.leftLayout = QtGui.QVBoxLayout(self.leftWidget)
self.leftLayout.setSpacing(8)
self.leftLayout.setMargin(0)
self.uiGroupBox = QtGui.QGroupBox(self.leftWidget)
SettingsTab.setupUi(self)
self.uiGroupBox = QtGui.QGroupBox(self.leftColumn)
self.uiGroupBox.setObjectName(u'uiGroupBox')
self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox)
self.uiLayout.setSpacing(8)
self.uiLayout.setMargin(6)
self.uiLayout = QtGui.QFormLayout(self.uiGroupBox)
self.uiLayout.setObjectName(u'uiLayout')
self.recentLayout = QtGui.QHBoxLayout()
self.recentLayout.setSpacing(8)
self.recentLayout.setMargin(0)
self.recentLayout.setObjectName(u'recentLayout')
self.recentLabel = QtGui.QLabel(self.uiGroupBox)
self.recentLabel.setObjectName(u'recentLabel')
self.recentLayout.addWidget(self.recentLabel)
self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox)
self.recentSpinBox.setObjectName(u'recentSpinBox')
self.recentSpinBox.setMinimum(0)
self.recentLayout.addWidget(self.recentSpinBox)
self.recentSpacer = QtGui.QSpacerItem(50, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.recentLayout.addItem(self.recentSpacer)
self.uiLayout.addLayout(self.recentLayout)
self.uiLayout.addRow(self.recentLabel, self.recentSpinBox)
self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox')
self.uiLayout.addWidget(self.mediaPluginCheckBox)
self.uiLayout.addRow(self.mediaPluginCheckBox)
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
self.uiLayout.addWidget(self.doubleClickLiveCheckBox)
# self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
# self.expandServiceItemCheckBox.setObjectName(
# u'expandServiceItemCheckBox')
# self.uiLayout.addWidget(self.expandServiceItemCheckBox)
self.leftLayout.addWidget(self.uiGroupBox)
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.expandServiceItemCheckBox.setObjectName(
u'expandServiceItemCheckBox')
self.uiLayout.addWidget(self.expandServiceItemCheckBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
self.uiLayout.addRow(self.expandServiceItemCheckBox)
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.enableAutoCloseCheckBox.setObjectName(
u'enableAutoCloseCheckBox')
self.uiLayout.addRow(self.enableAutoCloseCheckBox)
self.leftLayout.addWidget(self.uiGroupBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
# self.sharedDirGroupBox.setMaximumSize(QtCore.QSize(500, 85))
# self.sharedDirLayout = QtGui.QVBoxLayout(self.sharedDirGroupBox)
# self.sharedDirLayout.setSpacing(8)
# self.sharedDirLayout.setMargin(8)
# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
# self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox)
# self.sharedCheckBox.setObjectName(u'sharedCheckBox')
# self.sharedDirLayout.addWidget(self.sharedCheckBox)
# self.sharedSubLayout = QtGui.QHBoxLayout()
# self.sharedSubLayout.setSpacing(8)
# self.sharedSubLayout.setMargin(0)
# self.sharedDirLayout.addRow(self.sharedCheckBox)
# self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox)
# self.sharedLabel.setObjectName(u'sharedLabel')
# self.sharedSubLayout.addWidget(self.sharedLabel)
# self.sharedSubLayout = QtGui.QHBoxLayout()
# self.sharedSubLayout.setObjectName(u'sharedSubLayout')
# self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox)
# self.sharedLineEdit.setObjectName(u'sharedLineEdit')
# self.sharedSubLayout.addWidget(self.sharedLineEdit)
# self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox)
# self.sharedPushButton.setObjectName(u'sharedPushButton')
# self.sharedSubLayout.addWidget(self.sharedPushButton)
# self.sharedDirLayout.addLayout(self.sharedSubLayout)
# self.sharedDirLayout.addRow(self.sharedLabel, self.sharedSubLayout)
# self.leftLayout.addWidget(self.sharedDirGroupBox)
self.leftSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.leftLayout.addItem(self.leftSpacer)
self.advancedTabLayout.addWidget(self.leftWidget)
self.rightWidget = QtGui.QWidget(self)
self.rightLayout = QtGui.QVBoxLayout(self.rightWidget)
self.rightLayout.setSpacing(8)
self.rightLayout.setMargin(0)
# self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget)
self.leftLayout.addStretch()
# self.databaseGroupBox = QtGui.QGroupBox(self.rightColumn)
# self.databaseGroupBox.setObjectName(u'databaseGroupBox')
# self.databaseGroupBox.setEnabled(False)
# self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox)
# self.databaseLayout.setSpacing(8)
# self.databaseLayout.setMargin(8)
# self.rightLayout.addWidget(self.databaseGroupBox)
self.rightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.rightLayout.addItem(self.rightSpacer)
self.advancedTabLayout.addWidget(self.rightWidget)
self.rightLayout.addStretch()
# QtCore.QObject.connect(self.sharedCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged)
@ -140,6 +104,7 @@ class AdvancedTab(SettingsTab):
"""
Setup the interface translation strings.
"""
self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced')
self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.recentLabel.setText(
translate('OpenLP.AdvancedTab',
@ -150,6 +115,8 @@ class AdvancedTab(SettingsTab):
'Double-click to send items straight to live'))
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
'Expand new service items on creation'))
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
'Enable application exit confirmation'))
# self.sharedDirGroupBox.setTitle(
# translate('AdvancedTab', 'Central Data Store'))
# self.sharedCheckBox.setText(
@ -180,6 +147,9 @@ class AdvancedTab(SettingsTab):
self.expandServiceItemCheckBox.setChecked(
settings.value(u'expand service item',
QtCore.QVariant(False)).toBool())
self.enableAutoCloseCheckBox.setChecked(
settings.value(u'enable exit confirmation',
QtCore.QVariant(True)).toBool())
settings.endGroup()
def save(self):
@ -196,12 +166,14 @@ class AdvancedTab(SettingsTab):
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
settings.setValue(u'expand service item',
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
settings.setValue(u'enable exit confirmation',
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
settings.endGroup()
def onSharedCheckBoxChanged(self, checked):
"""
Enables the widgets to allow a shared data location
"""
self.sharedLabel.setEnabled(checked)
self.sharedTextEdit.setEnabled(checked)
self.sharedPushButton.setEnabled(checked)
# def onSharedCheckBoxChanged(self, checked):
# """
# Enables the widgets to allow a shared data location
# """
# self.sharedLabel.setEnabled(checked)
# self.sharedTextEdit.setEnabled(checked)
# self.sharedPushButton.setEnabled(checked)

View File

@ -0,0 +1,350 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
'''
The :mod:`DisplayTagTab` provides an Tag Edit facility. The Base set are
protected and included each time loaded. Custom tags can be defined and saved.
The Custom Tag arrays are saved in a pickle so QSettings works on them. Base
Tags cannot be changed.
'''
import cPickle
from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, DisplayTags
class DisplayTagTab(SettingsTab):
'''
The :class:`DisplayTagTab` manages the settings tab .
'''
def __init__(self):
'''
Initialise the settings tab
'''
SettingsTab.__init__(self, u'Display Tags')
def resizeEvent(self, event=None):
pass
def preLoad(self):
"""
Initialise values before the Load takes place
"""
# Create initial copy from master
DisplayTags.reset_html_tags()
user_expands = QtCore.QSettings().value(u'displayTags/html_tags',
QtCore.QVariant(u'')).toString()
# cPickle only accepts str not unicode strings
user_expands_string = str(unicode(user_expands).encode(u'utf8'))
if user_expands_string:
user_tags = cPickle.loads(user_expand_string)
# If we have some user ones added them as well
for t in user_tags:
DisplayTags.add_html_tag(t)
self.selected = -1
def setupUi(self):
'''
Configure the UI elements for the tab.
'''
self.setObjectName(u'DisplayTagTab')
self.tabTitleVisible = \
translate(u'OpenLP.DisplayTagTab', 'Display Tags')
self.displayTagEdit = QtGui.QWidget(self)
self.editGroupBox = QtGui.QGroupBox(self.displayTagEdit)
self.editGroupBox.setGeometry(QtCore.QRect(10, 220, 650, 181))
self.editGroupBox.setObjectName(u'editGroupBox')
self.updatePushButton = QtGui.QPushButton(self.editGroupBox)
self.updatePushButton.setGeometry(QtCore.QRect(550, 140, 71, 26))
self.updatePushButton.setObjectName(u'updatePushButton')
self.layoutWidget = QtGui.QWidget(self.editGroupBox)
self.layoutWidget.setGeometry(QtCore.QRect(5, 20, 571, 114))
self.layoutWidget.setObjectName(u'layoutWidget')
self.formLayout = QtGui.QFormLayout(self.layoutWidget)
self.formLayout.setObjectName(u'formLayout')
self.descriptionLabel = QtGui.QLabel(self.layoutWidget)
self.descriptionLabel.setAlignment(QtCore.Qt.AlignCenter)
self.descriptionLabel.setObjectName(u'descriptionLabel')
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.descriptionLabel)
self.descriptionLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.descriptionLineEdit.setObjectName(u'descriptionLineEdit')
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.descriptionLineEdit)
self.tagLabel = QtGui.QLabel(self.layoutWidget)
self.tagLabel.setAlignment(QtCore.Qt.AlignCenter)
self.tagLabel.setObjectName(u'tagLabel')
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.tagLabel)
self.tagLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.tagLineEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.tagLineEdit.setMaxLength(5)
self.tagLineEdit.setObjectName(u'tagLineEdit')
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.tagLineEdit)
self.startTagLabel = QtGui.QLabel(self.layoutWidget)
self.startTagLabel.setAlignment(QtCore.Qt.AlignCenter)
self.startTagLabel.setObjectName(u'startTagLabel')
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.startTagLabel)
self.startTagLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.startTagLineEdit.setObjectName(u'startTagLineEdit')
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.startTagLineEdit)
self.endTagLabel = QtGui.QLabel(self.layoutWidget)
self.endTagLabel.setAlignment(QtCore.Qt.AlignCenter)
self.endTagLabel.setObjectName(u'endTagLabel')
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole,
self.endTagLabel)
self.endTagLineEdit = QtGui.QLineEdit(self.layoutWidget)
self.endTagLineEdit.setObjectName(u'endTagLineEdit')
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
self.endTagLineEdit)
self.defaultPushButton = QtGui.QPushButton(self.displayTagEdit)
self.defaultPushButton.setGeometry(QtCore.QRect(430, 188, 71, 26))
self.defaultPushButton.setObjectName(u'updatePushButton')
self.deletePushButton = QtGui.QPushButton(self.displayTagEdit)
self.deletePushButton.setGeometry(QtCore.QRect(510, 188, 71, 26))
self.deletePushButton.setObjectName(u'deletePushButton')
self.newPushButton = QtGui.QPushButton(self.displayTagEdit)
self.newPushButton.setGeometry(QtCore.QRect(600, 188, 71, 26))
self.newPushButton.setObjectName(u'newPushButton')
self.tagTableWidget = QtGui.QTableWidget(self.displayTagEdit)
self.tagTableWidget.setGeometry(QtCore.QRect(10, 10, 650, 171))
self.tagTableWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.tagTableWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers)
self.tagTableWidget.setAlternatingRowColors(True)
self.tagTableWidget.setSelectionMode(
QtGui.QAbstractItemView.SingleSelection)
self.tagTableWidget.setSelectionBehavior(
QtGui.QAbstractItemView.SelectRows)
self.tagTableWidget.setCornerButtonEnabled(False)
self.tagTableWidget.setObjectName(u'tagTableWidget')
self.tagTableWidget.setColumnCount(4)
self.tagTableWidget.setRowCount(0)
item = QtGui.QTableWidgetItem()
self.tagTableWidget.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tagTableWidget.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.tagTableWidget.setHorizontalHeaderItem(2, item)
item = QtGui.QTableWidgetItem()
self.tagTableWidget.setHorizontalHeaderItem(3, item)
self.editGroupBox.setTitle(
translate('OpenLP.DisplayTagTab', 'Edit Selection'))
self.updatePushButton.setText(
translate('OpenLP.DisplayTagTab', 'Update'))
self.descriptionLabel.setText(
translate('OpenLP.DisplayTagTab', 'Description'))
self.tagLabel.setText(translate('OpenLP.DisplayTagTab', 'Tag'))
self.startTagLabel.setText(
translate('OpenLP.DisplayTagTab', 'Start tag'))
self.endTagLabel.setText(translate('OpenLP.DisplayTagTab', 'End tag'))
self.deletePushButton.setText(
translate('OpenLP.DisplayTagTab', 'Delete'))
self.defaultPushButton.setText(
translate('OpenLP.DisplayTagTab', 'Default'))
self.newPushButton.setText(translate('OpenLP.DisplayTagTab', 'New'))
self.tagTableWidget.horizontalHeaderItem(0)\
.setText(translate('OpenLP.DisplayTagTab', 'Description'))
self.tagTableWidget.horizontalHeaderItem(1)\
.setText(translate('OpenLP.DisplayTagTab', 'Tag id'))
self.tagTableWidget.horizontalHeaderItem(2)\
.setText(translate('OpenLP.DisplayTagTab', 'Start Html'))
self.tagTableWidget.horizontalHeaderItem(3)\
.setText(translate('OpenLP.DisplayTagTab', 'End Html'))
QtCore.QMetaObject.connectSlotsByName(self.displayTagEdit)
self.tagTableWidget.setColumnWidth(0, 120)
self.tagTableWidget.setColumnWidth(1, 40)
self.tagTableWidget.setColumnWidth(2, 240)
self.tagTableWidget.setColumnWidth(3, 200)
QtCore.QObject.connect(self.tagTableWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected)
QtCore.QObject.connect(self.defaultPushButton,
QtCore.SIGNAL(u'pressed()'), self.onDefaultPushed)
QtCore.QObject.connect(self.newPushButton,
QtCore.SIGNAL(u'pressed()'), self.onNewPushed)
QtCore.QObject.connect(self.updatePushButton,
QtCore.SIGNAL(u'pressed()'), self.onUpdatePushed)
QtCore.QObject.connect(self.deletePushButton,
QtCore.SIGNAL(u'pressed()'), self.onDeletePushed)
def load(self):
"""
Load Display and set field state.
"""
self.newPushButton.setEnabled(True)
self.updatePushButton.setEnabled(False)
self.deletePushButton.setEnabled(False)
for linenumber, html in enumerate(DisplayTags.get_html_tags()):
self.tagTableWidget.setRowCount(
self.tagTableWidget.rowCount() + 1)
self.tagTableWidget.setItem(linenumber, 0,
QtGui.QTableWidgetItem(html[u'desc']))
self.tagTableWidget.setItem(linenumber, 1,
QtGui.QTableWidgetItem(self._strip(html[u'start tag'])))
self.tagTableWidget.setItem(linenumber, 2,
QtGui.QTableWidgetItem(html[u'start html']))
self.tagTableWidget.setItem(linenumber, 3,
QtGui.QTableWidgetItem(html[u'end html']))
self.tagTableWidget.resizeRowsToContents()
self.descriptionLineEdit.setText(u'')
self.tagLineEdit.setText(u'')
self.startTagLineEdit.setText(u'')
self.endTagLineEdit.setText(u'')
self.descriptionLineEdit.setEnabled(False)
self.tagLineEdit.setEnabled(False)
self.startTagLineEdit.setEnabled(False)
self.endTagLineEdit.setEnabled(False)
def save(self):
"""
Save Custom tags in a pickle .
"""
temp = []
for tag in DisplayTags.get_html_tags():
if not tag[u'protected']:
temp.append(tag)
if temp:
ctemp = cPickle.dumps(temp)
QtCore.QSettings().setValue(u'displayTags/html_tags',
QtCore.QVariant(ctemp))
else:
QtCore.QSettings().setValue(u'displayTags/html_tags',
QtCore.QVariant(u''))
def cancel(self):
"""
Reset Custom tags from Settings.
"""
self.preLoad()
self._resetTable()
def onRowSelected(self):
"""
Table Row selected so display items and set field state.
"""
row = self.tagTableWidget.currentRow()
html = DisplayTags.get_html_tags()[row]
self.selected = row
self.descriptionLineEdit.setText(html[u'desc'])
self.tagLineEdit.setText(self._strip(html[u'start tag']))
self.startTagLineEdit.setText(html[u'start html'])
self.endTagLineEdit.setText(html[u'end html'])
if html[u'protected']:
self.descriptionLineEdit.setEnabled(False)
self.tagLineEdit.setEnabled(False)
self.startTagLineEdit.setEnabled(False)
self.endTagLineEdit.setEnabled(False)
self.updatePushButton.setEnabled(False)
self.deletePushButton.setEnabled(False)
else:
self.descriptionLineEdit.setEnabled(True)
self.tagLineEdit.setEnabled(True)
self.startTagLineEdit.setEnabled(True)
self.endTagLineEdit.setEnabled(True)
self.updatePushButton.setEnabled(True)
self.deletePushButton.setEnabled(True)
def onNewPushed(self):
"""
Add a new tag to list only if it is not a duplicate.
"""
for html in DisplayTags.get_html_tags():
if self._strip(html[u'start tag']) == u'n':
QtGui.QMessageBox.critical(self,
translate('OpenLP.DisplayTagTab', 'Update Error'),
translate('OpenLP.DisplayTagTab',
'Tag "n" already defined.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
return
# Add new tag to list
tag = {u'desc': u'New Item', u'start tag': u'{n}',
u'start html': u'<Html_here>', u'end tag': u'{/n}',
u'end html': u'</and here>', u'protected': False}
DisplayTags.add_html_tag(tag)
self._resetTable()
# Highlight new row
self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1)
def onDefaultPushed(self):
"""
Remove all Custom Tags and reset to base set only.
"""
DisplayTags.reset_html_tags()
self._resetTable()
def onDeletePushed(self):
"""
Delete selected custom tag.
"""
if self.selected != -1:
DisplayTags.remove_html_tag(self.selected)
self.selected = -1
self._resetTable()
def onUpdatePushed(self):
"""
Update Custom Tag details if not duplicate.
"""
html_expands = DisplayTags.get_html_tags()
if self.selected != -1:
html = html_expands[self.selected]
tag = unicode(self.tagLineEdit.text())
for linenumber, html1 in enumerate(html_expands):
if self._strip(html1[u'start tag']) == tag and \
linenumber != self.selected:
QtGui.QMessageBox.critical(self,
translate('OpenLP.DisplayTagTab', 'Update Error'),
unicode(translate('OpenLP.DisplayTagTab',
'Tag %s already defined.')) % tag,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
return
html[u'desc'] = unicode(self.descriptionLineEdit.text())
html[u'start html'] = unicode(self.startTagLineEdit.text())
html[u'end html'] = unicode(self.endTagLineEdit.text())
html[u'start tag'] = u'{%s}' % tag
html[u'end tag'] = u'{/%s}' % tag
self.selected = -1
self._resetTable()
def _resetTable(self):
"""
Reset List for loading.
"""
self.tagTableWidget.clearContents()
self.tagTableWidget.setRowCount(0)
self.load()
def _strip(self, tag):
"""
Remove tag wrappers for editing.
"""
tag = tag.replace(u'{', u'')
tag = tag.replace(u'}', u'')
return tag

View File

@ -31,23 +31,16 @@ from openlp.core.lib import translate, build_icon
class Ui_ExceptionDialog(object):
def setupUi(self, exceptionDialog):
exceptionDialog.setObjectName(u'exceptionDialog')
exceptionDialog.resize(580, 407)
self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog)
self.exceptionLayout.setSpacing(8)
self.exceptionLayout.setMargin(8)
self.exceptionLayout.setObjectName(u'exceptionLayout')
self.messageLayout = QtGui.QHBoxLayout()
self.messageLayout.setSpacing(0)
self.messageLayout.setContentsMargins(0, -1, 0, -1)
self.messageLayout.setObjectName(u'messageLayout')
self.messageLayout.addSpacing(12)
self.bugLabel = QtGui.QLabel(exceptionDialog)
self.bugLabel.setMinimumSize(QtCore.QSize(64, 64))
self.bugLabel.setMaximumSize(QtCore.QSize(64, 64))
self.bugLabel.setText(u'')
self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png'))
self.bugLabel.setAlignment(QtCore.Qt.AlignCenter)
self.bugLabel.setObjectName(u'bugLabel')
self.messageLayout.addWidget(self.bugLabel)
self.messageLayout.addSpacing(12)
self.messageLabel = QtGui.QLabel(exceptionDialog)
self.messageLabel.setWordWrap(True)
self.messageLabel.setObjectName(u'messageLabel')
@ -55,11 +48,9 @@ class Ui_ExceptionDialog(object):
self.exceptionLayout.addLayout(self.messageLayout)
self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog)
self.exceptionTextEdit.setReadOnly(True)
self.exceptionTextEdit.setBackgroundVisible(False)
self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
self.exceptionLayout.addWidget(self.exceptionTextEdit)
self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog)
self.exceptionButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.exceptionButtonBox.setObjectName(u'exceptionButtonBox')
self.exceptionLayout.addWidget(self.exceptionButtonBox)
@ -76,8 +67,6 @@ class Ui_ExceptionDialog(object):
QtGui.QDialogButtonBox.ActionRole)
self.retranslateUi(exceptionDialog)
QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'accepted()'), exceptionDialog.accept)
QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject)
QtCore.QObject.connect(self.sendReportButton,
@ -98,4 +87,4 @@ class Ui_ExceptionDialog(object):
self.sendReportButton.setText(translate('OpenLP.ExceptionDialog',
'Send E-Mail'))
self.saveReportButton.setText(translate('OpenLP.ExceptionDialog',
'Save to File'))
'Save to File'))

View File

@ -31,27 +31,26 @@ from openlp.core.lib import translate
class Ui_FileRenameDialog(object):
def setupUi(self, FileRenameDialog):
FileRenameDialog.setObjectName(u'FileRenameDialog')
FileRenameDialog.resize(400, 87)
FileRenameDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(FileRenameDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.fileNameLabel = QtGui.QLabel(FileRenameDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog)
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog)
self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25))
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.widget = QtGui.QWidget(FileRenameDialog)
self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35))
self.widget.setObjectName(u'widget')
self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.fileRenameLabel = QtGui.QLabel(self.widget)
self.fileRenameLabel.setObjectName(u'fileRenameLabel')
self.horizontalLayout.addWidget(self.fileRenameLabel)
self.fileNameEdit = QtGui.QLineEdit(self.widget)
self.fileNameEdit.setObjectName(u'fileNameEdit')
self.horizontalLayout.addWidget(self.fileNameEdit)
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(FileRenameDialog)
self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog)
def retranslateUi(self, FileRenameDialog):
self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:'))
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:'))

View File

@ -52,4 +52,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename'))
return QtGui.QDialog.exec_(self)
return QtGui.QDialog.exec_(self)

View File

@ -85,37 +85,24 @@ class GeneralTab(SettingsTab):
Create the user interface for the general settings tab
"""
self.setObjectName(u'GeneralTab')
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.generalLayout = QtGui.QHBoxLayout(self)
self.generalLayout.setSpacing(8)
self.generalLayout.setMargin(8)
self.generalLayout.setObjectName(u'generalLayout')
self.generalLeftLayout = QtGui.QVBoxLayout()
self.generalLeftLayout.setObjectName(u'generalLeftLayout')
self.generalLeftLayout.setSpacing(8)
self.generalLeftLayout.setMargin(0)
self.generalLayout.addLayout(self.generalLeftLayout)
self.monitorGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.monitorGroupBox = QtGui.QGroupBox(self.leftColumn)
self.monitorGroupBox.setObjectName(u'monitorGroupBox')
self.monitorLayout = QtGui.QVBoxLayout(self.monitorGroupBox)
self.monitorLayout.setSpacing(8)
self.monitorLayout.setMargin(8)
self.monitorLayout = QtGui.QFormLayout(self.monitorGroupBox)
self.monitorLayout.setObjectName(u'monitorLayout')
self.monitorLabel = QtGui.QLabel(self.monitorGroupBox)
self.monitorLabel.setObjectName(u'monitorLabel')
self.monitorLayout.addWidget(self.monitorLabel)
self.monitorLayout.addRow(self.monitorLabel)
self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox)
self.monitorComboBox.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.monitorComboBox)
self.monitorLayout.addRow(self.monitorComboBox)
self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
self.monitorLayout.addWidget(self.displayOnMonitorCheck)
self.generalLeftLayout.addWidget(self.monitorGroupBox)
self.startupGroupBox = QtGui.QGroupBox(self)
self.monitorLayout.addRow(self.displayOnMonitorCheck)
self.leftLayout.addWidget(self.monitorGroupBox)
self.startupGroupBox = QtGui.QGroupBox(self.leftColumn)
self.startupGroupBox.setObjectName(u'startupGroupBox')
self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox)
self.startupLayout.setSpacing(8)
self.startupLayout.setMargin(8)
self.startupLayout.setObjectName(u'startupLayout')
self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.warningCheckBox.setObjectName(u'warningCheckBox')
@ -126,189 +113,107 @@ class GeneralTab(SettingsTab):
self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox)
self.showSplashCheckBox.setObjectName(u'showSplashCheckBox')
self.startupLayout.addWidget(self.showSplashCheckBox)
self.generalLeftLayout.addWidget(self.startupGroupBox)
self.settingsGroupBox = QtGui.QGroupBox(self)
self.leftLayout.addWidget(self.startupGroupBox)
self.settingsGroupBox = QtGui.QGroupBox(self.leftColumn)
self.settingsGroupBox.setObjectName(u'settingsGroupBox')
self.settingsLayout = QtGui.QGridLayout(self.settingsGroupBox)
self.settingsLayout.setSpacing(8)
self.settingsLayout.setMargin(8)
self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox)
self.settingsLayout.setObjectName(u'settingsLayout')
self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox')
self.settingsLayout.addWidget(self.saveCheckServiceCheckBox, 0, 0, 1, 2)
self.settingsLayout.addRow(self.saveCheckServiceCheckBox)
self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox')
self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2)
self.settingsLayout.addRow(self.autoPreviewCheckBox)
# Moved here from image tab
self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
self.timeoutLabel.setObjectName(u'timeoutLabel')
self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1)
self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1)
self.generalLeftLayout.addWidget(self.settingsGroupBox)
self.generalLeftSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.generalLeftLayout.addItem(self.generalLeftSpacer)
self.generalRightLayout = QtGui.QVBoxLayout()
self.generalRightLayout.setSpacing(8)
self.generalRightLayout.setMargin(0)
self.generalRightLayout.setObjectName(u'generalRightLayout')
self.generalLayout.addLayout(self.generalRightLayout)
self.ccliGroupBox = QtGui.QGroupBox(self)
self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
self.leftLayout.addWidget(self.settingsGroupBox)
self.leftLayout.addStretch()
self.ccliGroupBox = QtGui.QGroupBox(self.rightColumn)
self.ccliGroupBox.setObjectName(u'ccliGroupBox')
self.ccliLayout = QtGui.QGridLayout(self.ccliGroupBox)
self.ccliLayout.setMargin(8)
self.ccliLayout.setSpacing(8)
self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox)
self.ccliLayout.setObjectName(u'ccliLayout')
self.numberLabel = QtGui.QLabel(self.ccliGroupBox)
self.numberLabel.setObjectName(u'numberLabel')
self.ccliLayout.addWidget(self.numberLabel, 0, 0, 1, 1)
self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.numberEdit.setValidator(QtGui.QIntValidator())
self.numberEdit.setObjectName(u'numberEdit')
self.ccliLayout.addWidget(self.numberEdit, 0, 1, 1, 1)
self.ccliLayout.addRow(self.numberLabel, self.numberEdit)
self.usernameLabel = QtGui.QLabel(self.ccliGroupBox)
self.usernameLabel.setObjectName(u'usernameLabel')
self.ccliLayout.addWidget(self.usernameLabel, 1, 0, 1, 1)
self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.usernameEdit.setObjectName(u'usernameEdit')
self.ccliLayout.addWidget(self.usernameEdit, 1, 1, 1, 1)
self.ccliLayout.addRow(self.usernameLabel, self.usernameEdit)
self.passwordLabel = QtGui.QLabel(self.ccliGroupBox)
self.passwordLabel.setObjectName(u'passwordLabel')
self.ccliLayout.addWidget(self.passwordLabel, 2, 0, 1, 1)
self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox)
self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password)
self.passwordEdit.setObjectName(u'passwordEdit')
self.ccliLayout.addWidget(self.passwordEdit, 2, 1, 1, 1)
self.generalRightLayout.addWidget(self.ccliGroupBox)
self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit)
self.rightLayout.addWidget(self.ccliGroupBox)
# Moved here from display tab
self.displayGroupBox = QtGui.QGroupBox(self)
self.displayGroupBox = QtGui.QGroupBox(self.rightColumn)
self.displayGroupBox.setObjectName(u'displayGroupBox')
self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox)
self.displayLayout.setSpacing(8)
self.displayLayout.setMargin(8)
self.displayLayout = QtGui.QGridLayout(self.displayGroupBox)
self.displayLayout.setObjectName(u'displayLayout')
self.currentLayout = QtGui.QHBoxLayout()
self.currentLayout.setSpacing(8)
self.currentLayout.setMargin(0)
self.currentLayout.setObjectName(u'currentLayout')
self.currentXLayout = QtGui.QVBoxLayout()
self.currentXLayout.setSpacing(0)
self.currentXLayout.setMargin(0)
self.currentXLayout.setObjectName(u'currentXLayout')
self.currentXLabel = QtGui.QLabel(self.displayGroupBox)
self.currentXLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentXLabel.setObjectName(u'currentXLabel')
self.currentXLayout.addWidget(self.currentXLabel)
self.displayLayout.addWidget(self.currentXLabel, 0, 0)
self.currentXValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentXValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentXValueLabel.setObjectName(u'currentXValueLabel')
self.currentXLayout.addWidget(self.currentXValueLabel)
self.currentLayout.addLayout(self.currentXLayout)
self.currentYLayout = QtGui.QVBoxLayout()
self.currentYLayout.setSpacing(0)
self.currentYLayout.setMargin(0)
self.currentYLayout.setObjectName(u'currentYLayout')
self.displayLayout.addWidget(self.currentXValueLabel, 1, 0)
self.currentYLabel = QtGui.QLabel(self.displayGroupBox)
self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentYLabel.setObjectName(u'currentYLabel')
self.currentYLayout.addWidget(self.currentYLabel)
self.displayLayout.addWidget(self.currentYLabel, 0, 1)
self.currentYValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentYValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentYValueLabel.setObjectName(u'currentYValueLabel')
self.currentYLayout.addWidget(self.currentYValueLabel)
self.currentLayout.addLayout(self.currentYLayout)
self.currentWidthLayout = QtGui.QVBoxLayout()
self.currentWidthLayout.setSpacing(0)
self.currentWidthLayout.setMargin(0)
self.currentWidthLayout.setObjectName(u'currentWidthLayout')
self.displayLayout.addWidget(self.currentYValueLabel, 1, 1)
self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentWidthLabel.setObjectName(u'currentWidthLabel')
self.currentWidthLayout.addWidget(self.currentWidthLabel)
self.displayLayout.addWidget(self.currentWidthLabel, 0, 2)
self.currentWidthValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentWidthValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentWidthValueLabel.setObjectName(u'currentWidthValueLabel')
self.currentWidthLayout.addWidget(self.currentWidthValueLabel)
self.currentLayout.addLayout(self.currentWidthLayout)
self.currentHeightLayout = QtGui.QVBoxLayout()
self.currentHeightLayout.setSpacing(0)
self.currentHeightLayout.setMargin(0)
self.currentHeightLayout.setObjectName(u'currentHeightLayout')
self.displayLayout.addWidget(self.currentWidthValueLabel, 1, 2)
self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.currentHeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.currentHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentHeightLabel.setObjectName(u'currentHeightLabel')
self.currentHeightLayout.addWidget(self.currentHeightLabel)
self.displayLayout.addWidget(self.currentHeightLabel, 0, 3)
self.currentHeightValueLabel = QtGui.QLabel(self.displayGroupBox)
self.currentHeightValueLabel.setAlignment(QtCore.Qt.AlignCenter)
self.currentHeightValueLabel.setObjectName(u'Height')
self.currentHeightLayout.addWidget(self.currentHeightValueLabel)
self.currentLayout.addLayout(self.currentHeightLayout)
self.displayLayout.addLayout(self.currentLayout)
self.displayLayout.addWidget(self.currentHeightValueLabel, 1, 3)
self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox)
self.overrideCheckBox.setObjectName(u'overrideCheckBox')
self.displayLayout.addWidget(self.overrideCheckBox)
self.generalRightLayout.addWidget(self.displayGroupBox)
self.displayLayout.addWidget(self.overrideCheckBox, 2, 0, 1, 4)
self.rightLayout.addWidget(self.displayGroupBox)
# Custom position
self.customLayout = QtGui.QHBoxLayout()
self.customLayout.setSpacing(8)
self.customLayout.setMargin(0)
self.customLayout.setObjectName(u'customLayout')
self.customXLayout = QtGui.QVBoxLayout()
self.customXLayout.setSpacing(0)
self.customXLayout.setMargin(0)
self.customXLayout.setObjectName(u'customXLayout')
self.customXLabel = QtGui.QLabel(self.displayGroupBox)
self.customXLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customXLabel.setObjectName(u'customXLabel')
self.customXLayout.addWidget(self.customXLabel)
self.displayLayout.addWidget(self.customXLabel, 3, 0)
self.customXValueEdit = ValidEdit(self.displayGroupBox)
self.customXValueEdit.setObjectName(u'customXValueEdit')
self.customXLayout.addWidget(self.customXValueEdit)
self.customLayout.addLayout(self.customXLayout)
self.customYLayout = QtGui.QVBoxLayout()
self.customYLayout.setSpacing(0)
self.customYLayout.setMargin(0)
self.customYLayout.setObjectName(u'customYLayout')
self.displayLayout.addWidget(self.customXValueEdit, 4, 0)
self.customYLabel = QtGui.QLabel(self.displayGroupBox)
self.customYLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customYLabel.setObjectName(u'customYLabel')
self.customYLayout.addWidget(self.customYLabel)
self.displayLayout.addWidget(self.customYLabel, 3, 1)
self.customYValueEdit = ValidEdit(self.displayGroupBox)
self.customYValueEdit.setObjectName(u'customYValueEdit')
self.customYLayout.addWidget(self.customYValueEdit)
self.customLayout.addLayout(self.customYLayout)
self.customWidthLayout = QtGui.QVBoxLayout()
self.customWidthLayout.setSpacing(0)
self.customWidthLayout.setMargin(0)
self.customWidthLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.customWidthLayout.setObjectName(u'customWidthLayout')
self.displayLayout.addWidget(self.customYValueEdit, 4, 1)
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.customWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customWidthLabel.setObjectName(u'customWidthLabel')
self.customWidthLayout.addWidget(self.customWidthLabel)
self.displayLayout.addWidget(self.customWidthLabel, 3, 2)
self.customWidthValueEdit = ValidEdit(self.displayGroupBox)
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
self.customWidthLayout.addWidget(self.customWidthValueEdit)
self.customLayout.addLayout(self.customWidthLayout)
self.customHeightLayout = QtGui.QVBoxLayout()
self.customHeightLayout.setSpacing(0)
self.customHeightLayout.setMargin(0)
self.customHeightLayout.setObjectName(u'customHeightLayout')
self.displayLayout.addWidget(self.customWidthValueEdit, 4, 2)
self.customHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.customHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customHeightLabel.setObjectName(u'customHeightLabel')
self.customHeightLayout.addWidget(self.customHeightLabel)
self.displayLayout.addWidget(self.customHeightLabel, 3, 3)
self.customHeightValueEdit = ValidEdit(self.displayGroupBox)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
self.customHeightLayout.addWidget(self.customHeightValueEdit)
self.customLayout.addLayout(self.customHeightLayout)
self.displayLayout.addLayout(self.customLayout)
# Bottom spacer
self.generalRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.generalRightLayout.addItem(self.generalRightSpacer)
self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3)
self.rightLayout.addWidget(self.displayGroupBox)
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(self.overrideCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
@ -329,6 +234,7 @@ class GeneralTab(SettingsTab):
"""
Translate the general settings tab to the currently selected language
"""
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab',
'Monitors'))
self.monitorLabel.setText(translate('OpenLP.GeneralTab',
@ -389,11 +295,11 @@ class GeneralTab(SettingsTab):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list:
screen_name = unicode(translate('OpenLP.GeneralTab', 'Screen %d')) \
% (screen[u'number'] + 1)
screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'),
screen[u'number'] + 1)
if screen[u'primary']:
screen_name = unicode(translate('OpenLP.GeneralTab',
'%s (primary)')) % screen_name
screen_name = u'%s (%s)' % (screen_name,
translate('OpenLP.GeneralTab', 'primary'))
self.monitorComboBox.addItem(screen_name)
self.numberEdit.setText(unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString()))

View File

@ -31,7 +31,9 @@ import os
from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
build_icon, translate
from openlp.core.ui import HideMode
log = logging.getLogger(__name__)
@ -94,7 +96,6 @@ class MainDisplay(DisplayWidget):
"""
This is the display screen.
"""
def __init__(self, parent, screens, live):
DisplayWidget.__init__(self, live, parent=None)
self.parent = parent
@ -102,7 +103,9 @@ class MainDisplay(DisplayWidget):
self.isLive = live
self.alertTab = None
self.hideMode = None
self.setWindowTitle(u'OpenLP Display')
mainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
self.setWindowIcon(mainIcon)
self.retranslateUi()
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
QtCore.Qt.WindowStaysOnTopHint)
@ -112,11 +115,17 @@ class MainDisplay(DisplayWidget):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
def retranslateUi(self):
"""
Setup the interface translation strings.
"""
self.setWindowTitle(translate('OpenLP.MainDisplay', 'OpenLP Display'))
def setup(self):
"""
Set up and build the output screen
"""
log.debug(u'Setup live = %s for %s ' % (self.isLive,
log.debug(u'Setup live = %s for monitor %s ' % (self.isLive,
self.screens.monitor_number))
self.usePhonon = QtCore.QSettings().value(
u'media/use phonon', QtCore.QVariant(True)).toBool()

View File

@ -66,25 +66,10 @@ class Ui_MainWindow(object):
MainWindow.setObjectName(u'MainWindow')
MainWindow.resize(self.settingsmanager.width,
self.settingsmanager.height)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
MainWindow.setWindowIcon(MainIcon)
self.setDockNestingEnabled(True)
MainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
MainWindow.setDockNestingEnabled(True)
# Set up the main container, which contains all the other form widgets.
self.MainContent = QtGui.QWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.MainContent.sizePolicy().hasHeightForWidth())
self.MainContent.setSizePolicy(sizePolicy)
self.MainContent.setObjectName(u'MainContent')
self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent)
self.MainContentLayout.setSpacing(0)
@ -93,7 +78,6 @@ class Ui_MainWindow(object):
MainWindow.setCentralWidget(self.MainContent)
self.ControlSplitter = QtGui.QSplitter(self.MainContent)
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setOpaqueResize(False)
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
# Create slide controllers
@ -109,7 +93,6 @@ class Ui_MainWindow(object):
self.liveController.Panel.setVisible(liveVisible)
# Create menu
self.MenuBar = QtGui.QMenuBar(MainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
self.MenuBar.setObjectName(u'MenuBar')
self.FileMenu = QtGui.QMenu(self.MenuBar)
self.FileMenu.setObjectName(u'FileMenu')
@ -147,38 +130,33 @@ class Ui_MainWindow(object):
self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
self.MediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_left)
self.MediaManagerContents = QtGui.QWidget(MainWindow)
self.MediaManagerContents.setObjectName(u'MediaManagerContents')
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
self.MediaManagerLayout.setObjectName(u'MediaManagerLayout')
# Create the media toolbox
self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)
self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock)
self.MediaToolBox.setObjectName(u'MediaToolBox')
self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents)
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
self.MediaManagerDock.setWidget(self.MediaToolBox)
MainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
self.MediaManagerDock)
# Create the service manager
self.ServiceManagerDock = OpenLPDockWidget(
MainWindow, u'ServiceManagerDock',
build_icon(u':/system/system_servicemanager.png'))
self.ServiceManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right)
self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerContents = ServiceManager(MainWindow)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.ServiceManagerDock)
# Create the theme manager
self.ThemeManagerDock = OpenLPDockWidget(
MainWindow, u'ThemeManagerDock',
build_icon(u':/system/system_thememanager.png'))
self.ThemeManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_right)
self.ThemeManagerContents = ThemeManager(self)
self.ThemeManagerContents = ThemeManager(MainWindow)
self.ThemeManagerContents.setObjectName(u'ThemeManagerContents')
self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea,
self.ThemeManagerDock)
# Create the menu items
self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon(build_icon(u':/general/general_new.png'))
@ -275,9 +253,12 @@ class Ui_MainWindow(object):
self.AutoLanguageItem.setCheckable(True)
MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings')
self.LanguageGroup = QtGui.QActionGroup(MainWindow)
self.LanguageGroup.setExclusive(True)
self.LanguageGroup.setObjectName(u'LanguageGroup')
self.AutoLanguageItem.setChecked(LanguageManager.auto_language)
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
qmList = LanguageManager.get_qm_list()
savedLanguage = LanguageManager.get_language()
self.AutoLanguageItem.setChecked(LanguageManager.auto_language)
for key in sorted(qmList.keys()):
languageItem = QtGui.QAction(MainWindow)
languageItem.setObjectName(key)
@ -285,7 +266,6 @@ class Ui_MainWindow(object):
if qmList[key] == savedLanguage:
languageItem.setChecked(True)
add_actions(self.LanguageGroup, [languageItem])
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
self.SettingsShortcutsItem = QtGui.QAction(MainWindow)
self.SettingsShortcutsItem.setIcon(
build_icon(u':/system/system_configure_shortcuts.png'))
@ -334,15 +314,13 @@ class Ui_MainWindow(object):
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
self.SettingsLanguageMenu.menuAction(), None,
self.SettingsShortcutsItem, self.SettingsConfigureItem))
add_actions(self.ToolsMenu,
(self.ToolsAddToolItem, None))
add_actions(self.HelpMenu,
(self.HelpDocumentationItem, self.HelpOnlineHelpItem, None,
self.HelpWebSiteItem, self.HelpAboutItem))
add_actions(self.MenuBar,
(self.FileMenu.menuAction(), self.ViewMenu.menuAction(),
self.ToolsMenu.menuAction(), self.SettingsMenu.menuAction(),
self.HelpMenu.menuAction()))
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
add_actions(self.HelpMenu, (self.HelpDocumentationItem,
self.HelpOnlineHelpItem, None, self.HelpWebSiteItem,
self.HelpAboutItem))
add_actions(self.MenuBar, (self.FileMenu.menuAction(),
self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(),
self.SettingsMenu.menuAction(), self.HelpMenu.menuAction()))
# Initialise the translation
self.retranslateUi(MainWindow)
self.MediaToolBox.setCurrentIndex(0)
@ -842,7 +820,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
#self.ServiceManagerContents.onSaveService(True)
if self.ServiceManagerContents.saveFile():
self.cleanUp()
event.accept()
@ -854,18 +831,25 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
else:
event.ignore()
else:
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
if QtCore.QSettings().value(u'advanced/enable exit confirmation',
QtCore.QVariant(True)).toBool():
ret = QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow',
'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
self.cleanUp()
event.accept()
else:
event.ignore()
else:
self.cleanUp()
event.accept()
else:
event.ignore()
def cleanUp(self):
"""

View File

@ -31,69 +31,41 @@ class Ui_PluginViewDialog(object):
def setupUi(self, pluginViewDialog):
pluginViewDialog.setObjectName(u'pluginViewDialog')
pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal)
pluginViewDialog.resize(554, 344)
self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog)
self.pluginLayout.setSpacing(8)
self.pluginLayout.setMargin(8)
self.pluginLayout.setObjectName(u'pluginLayout')
self.listLayout = QtGui.QHBoxLayout()
self.listLayout.setSpacing(8)
self.listLayout.setObjectName(u'listLayout')
self.pluginListWidget = QtGui.QListWidget(pluginViewDialog)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.pluginListWidget.sizePolicy().hasHeightForWidth())
self.pluginListWidget.setSizePolicy(sizePolicy)
self.pluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215))
self.pluginListWidget.setObjectName(u'pluginListWidget')
self.listLayout.addWidget(self.pluginListWidget)
self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog)
self.pluginInfoGroupBox.setAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.pluginInfoGroupBox.setFlat(False)
self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox')
self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox)
self.pluginInfoLayout.setMargin(8)
self.pluginInfoLayout.setSpacing(8)
self.pluginInfoLayout.setObjectName(u'pluginInfoLayout')
self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionLabel.setObjectName(u'versionLabel')
self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.LabelRole, self.versionLabel)
self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionNumberLabel.setObjectName(u'versionNumberLabel')
self.pluginInfoLayout.setWidget(
1, QtGui.QFormLayout.FieldRole, self.versionNumberLabel)
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.aboutLabel.setObjectName(u'aboutLabel')
self.pluginInfoLayout.setWidget(
2, QtGui.QFormLayout.LabelRole, self.aboutLabel)
self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.statusLabel.setObjectName(u'statusLabel')
self.pluginInfoLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.statusLabel)
self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox)
self.statusComboBox.addItems((u'', u''))
self.statusComboBox.setObjectName(u'statusComboBox')
self.statusComboBox.addItem(QtCore.QString())
self.statusComboBox.addItem(QtCore.QString())
self.pluginInfoLayout.setWidget(
0, QtGui.QFormLayout.FieldRole, self.statusComboBox)
self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox)
self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionLabel.setObjectName(u'versionLabel')
self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.versionNumberLabel.setObjectName(u'versionNumberLabel')
self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel)
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
self.aboutLabel.setObjectName(u'aboutLabel')
self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
self.aboutTextBrowser.setTextInteractionFlags(
QtCore.Qt.LinksAccessibleByMouse)
self.aboutTextBrowser.setObjectName(u'aboutTextBrowser')
self.pluginInfoLayout.setWidget(
2, QtGui.QFormLayout.FieldRole, self.aboutTextBrowser)
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
self.listLayout.addWidget(self.pluginInfoGroupBox)
self.pluginLayout.addLayout(self.listLayout)
self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog)
self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
self.pluginListButtonBox.setObjectName(u'pluginListButtonBox')
self.pluginLayout.addWidget(self.pluginListButtonBox)
self.versionNumberLabel.setText(u'')
self.retranslateUi(pluginViewDialog)
QtCore.QObject.connect(self.pluginListButtonBox,
QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close)

View File

@ -67,23 +67,24 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
# sometimes when it's loaded from the config, it isn't cast to int.
plugin.status = int(plugin.status)
# Set the little status text in brackets next to the plugin name.
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
if plugin.status == PluginStatus.Active:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
elif plugin.status == PluginStatus.Inactive:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
elif plugin.status == PluginStatus.Disabled:
if plugin.status == PluginStatus.Disabled:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)'))
elif plugin.status == PluginStatus.Active:
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Active)'))
else:
# PluginStatus.Inactive
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
name_string = plugin.getString(StringContent.Name)
item.setText(status_text % name_string[u'singular'])
# If the plugin has an icon, set it!
if plugin.icon:
item.setIcon(plugin.icon)
self.pluginListWidget.addItem(item)
self.pluginListWidget.setFixedWidth(
self.pluginListWidget.sizeHint().width())
def _clearDetails(self):
self.statusComboBox.setCurrentIndex(-1)
@ -125,10 +126,8 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
return
if status == 0:
self.activePlugin.toggleStatus(PluginStatus.Active)
self.activePlugin.initialise()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
self.activePlugin.finalise()
status_text = unicode(
translate('OpenLP.PluginForm', '%s (Inactive)'))
if self.activePlugin.status == PluginStatus.Active:

View File

@ -26,54 +26,37 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib import translate, build_icon
class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog):
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
serviceItemEditDialog.resize(386, 272)
self.layoutWidget = QtGui.QWidget(serviceItemEditDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241))
self.layoutWidget.setObjectName(u'layoutWidget')
self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.outerLayout.setObjectName(u'outerLayout')
self.topLayout = QtGui.QHBoxLayout()
self.topLayout.setObjectName(u'topLayout')
self.listWidget = QtGui.QListWidget(self.layoutWidget)
self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.listWidget = QtGui.QListWidget(serviceItemEditDialog)
self.listWidget.setAlternatingRowColors(True)
self.listWidget.setObjectName(u'listWidget')
self.topLayout.addWidget(self.listWidget)
self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.deleteButton = QtGui.QPushButton(self.layoutWidget)
self.deleteButton = QtGui.QPushButton(serviceItemEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.buttonLayout.addItem(spacerItem)
self.upButton = QtGui.QPushButton(self.layoutWidget)
self.upButton.setText(u'')
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upButton.setIcon(icon)
self.buttonLayout.addStretch()
self.upButton = QtGui.QPushButton(serviceItemEditDialog)
self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(self.layoutWidget)
self.downButton.setText(u'')
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.downButton.setIcon(icon)
self.downButton = QtGui.QPushButton(serviceItemEditDialog)
self.downButton.setIcon(build_icon(u':/services/service_down.png'))
self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton)
self.topLayout.addLayout(self.buttonLayout)
self.outerLayout.addLayout(self.topLayout)
self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(serviceItemEditDialog)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.outerLayout.addWidget(self.buttonBox)
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
@ -82,4 +65,4 @@ class Ui_ServiceItemEditDialog(object):
serviceItemEditDialog.setWindowTitle(
translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item'))
self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm',
'Delete'))
'Delete'))

View File

@ -118,7 +118,6 @@ class ServiceManager(QtGui.QWidget):
self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.expandTabs = False
# Create the top toolbar
self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton(
@ -140,13 +139,18 @@ class ServiceManager(QtGui.QWidget):
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
'Theme:'), self)
self.themeLabel.setMargin(3)
self.themeLabel.setObjectName(u'themeLabel')
self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel)
self.themeComboBox = QtGui.QComboBox(self.toolbar)
self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager',
'Select a theme for the service'))
self.themeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents)
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.themeComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.themeComboBox.setObjectName(u'themeComboBox')
self.toolbar.addToolbarWidget(u'ThemeWidget', self.themeComboBox)
self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar)
# Create the service manager list
self.serviceManagerList = ServiceManagerList(self)
@ -216,6 +220,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager',
'Collapse all the service items.'),
self.onCollapseAll)
self.orderToolbar.setObjectName(u'orderToolbar')
self.layout.addWidget(self.orderToolbar)
# Connect up our signals and slots
QtCore.QObject.connect(self.themeComboBox,
@ -247,7 +252,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.serviceSettingsSection + u'/service theme',
QtCore.QVariant(u'')).toString())
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
#build the drag and drop context menu
# build the drag and drop context menu
self.dndMenu = QtGui.QMenu()
self.newAction = self.dndMenu.addAction(
translate('OpenLP.ServiceManager', '&Add New Item'))
@ -304,7 +309,7 @@ class ServiceManager(QtGui.QWidget):
Setter for service file.
"""
self._fileName = unicode(fileName)
self.parent.setServiceModified(self.isModified, self.shortFileName())
self.parent.setServiceModified(self.isModified(), self.shortFileName())
QtCore.QSettings(). \
setValue(u'service/last file',QtCore.QVariant(fileName))
@ -367,7 +372,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)')))
'OpenLP Service Files (*.osz)')))
if not fileName:
return False
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
@ -457,7 +462,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)')))
'OpenLP Service Files (*.osz)')))
if not fileName:
return False
if os.path.splitext(fileName)[1] == u'':
@ -682,7 +687,7 @@ class ServiceManager(QtGui.QWidget):
# Top Item was selected so set the last one
if setLastItem:
lastItem.setSelected(True)
self.isModified = True
self.setModified(True)
def onMoveSelectionDown(self):
"""
@ -705,7 +710,7 @@ class ServiceManager(QtGui.QWidget):
serviceIterator += 1
if setSelected:
firstItem.setSelected(True)
self.isModified = True
self.setModified(True)
def onCollapseAll(self):
"""
@ -749,7 +754,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(self.serviceItems[item])
self.serviceItems.insert(0, temp)
self.repaintServiceList(0, count)
self.isModified = True
self.setModified(True)
def onServiceUp(self):
"""
@ -982,8 +987,8 @@ class ServiceManager(QtGui.QWidget):
u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0)
else:
self.serviceItems.insert(self.dropPosition, {u'service_item': item,
u'order': self.dropPosition,
self.serviceItems.insert(self.dropPosition,
{u'service_item': item, u'order': self.dropPosition,
u'expanded':expand})
self.repaintServiceList(self.dropPosition, 0)
# if rebuilding list make sure live is fixed.

View File

@ -30,24 +30,19 @@ from openlp.core.lib import translate
class Ui_ServiceNoteEdit(object):
def setupUi(self, serviceNoteEdit):
serviceNoteEdit.setObjectName(u'serviceNoteEdit')
serviceNoteEdit.resize(400, 243)
self.widget = QtGui.QWidget(serviceNoteEdit)
self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223))
self.widget.setObjectName(u'widget')
self.verticalLayout = QtGui.QVBoxLayout(self.widget)
self.verticalLayout.setObjectName(u'verticalLayout')
self.textEdit = QtGui.QTextEdit(self.widget)
self.dialogLayout = QtGui.QVBoxLayout(serviceNoteEdit)
self.dialogLayout.setObjectName(u'verticalLayout')
self.textEdit = QtGui.QTextEdit(serviceNoteEdit)
self.textEdit.setObjectName(u'textEdit')
self.verticalLayout.addWidget(self.textEdit)
self.buttonBox = QtGui.QDialogButtonBox(self.widget)
self.dialogLayout.addWidget(self.textEdit)
self.buttonBox = QtGui.QDialogButtonBox(serviceNoteEdit)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(serviceNoteEdit)
QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit)
def retranslateUi(self, serviceNoteEdit):
serviceNoteEdit.setWindowTitle(
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -31,32 +31,21 @@ from openlp.core.lib import translate, build_icon
class Ui_SettingsDialog(object):
def setupUi(self, settingsDialog):
settingsDialog.setObjectName(u'settingsDialog')
settingsDialog.resize(724, 502)
settingsDialog.resize(700, 500)
settingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
self.settingsLayout.setSpacing(8)
self.settingsLayout.setMargin(8)
margins = self.settingsLayout.contentsMargins()
self.settingsLayout.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget)
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.buttonBox.sizePolicy().hasHeightForWidth())
self.buttonBox.setSizePolicy(sizePolicy)
self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.settingsLayout.addWidget(self.buttonBox)
self.retranslateUi(settingsDialog)
self.settingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), settingsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
@ -65,4 +54,4 @@ class Ui_SettingsDialog(object):
def retranslateUi(self, settingsDialog):
settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm',
'Configure OpenLP'))
'Configure OpenLP'))

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtGui
from openlp.core.lib import Receiver
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab, DisplayTagTab
from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(__name__)
@ -55,6 +55,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
# Advanced tab
self.advancedTab = AdvancedTab()
self.addTab(u'Advanced', self.advancedTab)
# Edit Display Tags tab
self.displayTagTab = DisplayTagTab()
self.addTab(u'Display Tags', self.displayTagTab)
def addTab(self, name, tab):
"""
@ -68,9 +71,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Add a tab to the form at a specific location
"""
log.debug(u'Inserting %s tab' % tab.tabTitle)
# 14 : There are 3 tables currently and locations starts at -10
# 15 : There are 4 tables currently and locations starts at -10
self.settingsTabWidget.insertTab(
location + 14, tab, tab.tabTitleVisible)
location + 15, tab, tab.tabTitleVisible)
def removeTab(self, tab):
"""
@ -93,9 +96,17 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Receiver.send_message(u'config_updated')
return QtGui.QDialog.accept(self)
def reject(self):
"""
Process the form saving the settings
"""
for tabIndex in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tabIndex).cancel()
return QtGui.QDialog.reject(self)
def postSetUp(self):
"""
Run any post-setup code for the tabs on the form
"""
for tabIndex in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tabIndex).postSetUp()
self.settingsTabWidget.widget(tabIndex).postSetUp()

View File

@ -31,83 +31,57 @@ from openlp.core.lib import translate, build_icon
class Ui_ShortcutListDialog(object):
def setupUi(self, shortcutListDialog):
shortcutListDialog.setObjectName(u'shortcutListDialog')
shortcutListDialog.resize(500, 438)
self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog)
self.shortcutListLayout.setSpacing(8)
self.shortcutListLayout.setMargin(8)
self.shortcutListLayout.setObjectName(u'shortcutListLayout')
self.shortcutListTreeWidget = QtGui.QTreeWidget(shortcutListDialog)
self.shortcutListTreeWidget.setAlternatingRowColors(True)
self.shortcutListTreeWidget.setObjectName(u'shortcutListTreeWidget')
self.shortcutListTreeWidget.setColumnCount(2)
self.shortcutListTreeWidget.setSelectionBehavior(
QtGui.QAbstractItemView.SelectRows)
self.shortcutListLayout.addWidget(self.shortcutListTreeWidget)
self.shortcutLayout = QtGui.QVBoxLayout()
self.shortcutLayout.setSpacing(8)
self.shortcutLayout.setContentsMargins(0, -1, -1, -1)
self.shortcutLayout.setObjectName(u'shortcutLayout')
self.defaultRadioButton = QtGui.QRadioButton(shortcutListDialog)
self.defaultRadioButton.setChecked(True)
self.defaultRadioButton.setObjectName(u'defaultRadioButton')
self.shortcutLayout.addWidget(self.defaultRadioButton)
self.customShortcutLayout = QtGui.QHBoxLayout()
self.customShortcutLayout.setSpacing(8)
self.customShortcutLayout.setObjectName(u'customShortcutLayout')
self.customRadioButton = QtGui.QRadioButton(shortcutListDialog)
self.customRadioButton.setObjectName(u'customRadioButton')
self.customShortcutLayout.addWidget(self.customRadioButton)
self.shortcutPushButton = QtGui.QPushButton(shortcutListDialog)
self.shortcutPushButton.setMinimumSize(QtCore.QSize(84, 0))
self.shortcutPushButton.setIcon(
self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.treeWidget = QtGui.QTreeWidget(shortcutListDialog)
self.treeWidget.setAlternatingRowColors(True)
self.treeWidget.setObjectName(u'treeWidget')
self.treeWidget.setColumnCount(2)
self.dialogLayout.addWidget(self.treeWidget)
self.defaultButton = QtGui.QRadioButton(shortcutListDialog)
self.defaultButton.setChecked(True)
self.defaultButton.setObjectName(u'defaultButton')
self.dialogLayout.addWidget(self.defaultButton)
self.customLayout = QtGui.QHBoxLayout()
self.customLayout.setObjectName(u'customLayout')
self.customButton = QtGui.QRadioButton(shortcutListDialog)
self.customButton.setObjectName(u'customButton')
self.customLayout.addWidget(self.customButton)
self.shortcutButton = QtGui.QPushButton(shortcutListDialog)
self.shortcutButton.setIcon(
build_icon(u':/system/system_configure_shortcuts.png'))
self.shortcutPushButton.setCheckable(True)
self.shortcutPushButton.setChecked(False)
self.shortcutPushButton.setObjectName(u'shortcutPushButton')
self.customShortcutLayout.addWidget(self.shortcutPushButton)
self.clearShortcutToolButton = QtGui.QToolButton(shortcutListDialog)
self.clearShortcutToolButton.setMinimumSize(QtCore.QSize(0, 16))
self.clearShortcutToolButton.setText(u'')
self.clearShortcutToolButton.setIcon(
self.shortcutButton.setCheckable(True)
self.shortcutButton.setObjectName(u'shortcutButton')
self.customLayout.addWidget(self.shortcutButton)
self.clearShortcutButton = QtGui.QToolButton(shortcutListDialog)
self.clearShortcutButton.setIcon(
build_icon(u':/system/clear_shortcut.png'))
self.clearShortcutToolButton.setObjectName(u'clearShortcutToolButton')
self.customShortcutLayout.addWidget(self.clearShortcutToolButton)
self.customShortcutSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.customShortcutLayout.addItem(self.customShortcutSpacer)
self.shortcutLayout.addLayout(self.customShortcutLayout)
self.shortcutListLayout.addLayout(self.shortcutLayout)
self.shortcutListButtonBox = QtGui.QDialogButtonBox(shortcutListDialog)
self.shortcutListButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.shortcutListButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok |
QtGui.QDialogButtonBox.Reset)
self.shortcutListButtonBox.setObjectName(u'shortcutListButtonBox')
self.shortcutListLayout.addWidget(self.shortcutListButtonBox)
self.clearShortcutButton.setAutoRaise(True)
self.clearShortcutButton.setObjectName(u'clearShortcutButton')
self.customLayout.addWidget(self.clearShortcutButton)
self.customLayout.addStretch()
self.dialogLayout.addLayout(self.customLayout)
self.buttonBox = QtGui.QDialogButtonBox(shortcutListDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Reset)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(shortcutListDialog)
QtCore.QObject.connect(
self.shortcutListButtonBox,
QtCore.SIGNAL(u'accepted()'),
shortcutListDialog.accept
)
QtCore.QObject.connect(
self.shortcutListButtonBox,
QtCore.SIGNAL(u'rejected()'),
shortcutListDialog.reject
)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
shortcutListDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
shortcutListDialog.reject)
QtCore.QMetaObject.connectSlotsByName(shortcutListDialog)
def retranslateUi(self, shortcutListDialog):
shortcutListDialog.setWindowTitle(
translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts'))
self.shortcutListTreeWidget.setHeaderLabels([
self.treeWidget.setHeaderLabels([
translate('OpenLP.ShortcutListDialog', 'Action'),
translate('OpenLP.ShortcutListDialog', 'Shortcut')
])
self.defaultRadioButton.setText(
translate('OpenLP.ShortcutListDialog', 'Shortcut')])
self.defaultButton.setText(
translate('OpenLP.ShortcutListDialog', 'Default: %s'))
self.customRadioButton.setText(
self.customButton.setText(
translate('OpenLP.ShortcutListDialog', 'Custom:'))
self.shortcutPushButton.setText(
self.shortcutButton.setText(
translate('OpenLP.ShortcutListDialog', 'None'))

View File

@ -49,11 +49,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
self.setupUi(self)
self.actionList = None
self.captureShortcut = False
QtCore.QObject.connect(
self.shortcutPushButton,
QtCore.SIGNAL(u'toggled(bool)'),
self.onShortcutPushButtonClicked
)
QtCore.QObject.connect(self.shortcutButton,
QtCore.SIGNAL(u'toggled(bool)'), self.onShortcutButtonClicked)
def keyReleaseEvent(self, event):
Qt = QtCore.Qt
@ -83,8 +80,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
QtGui.QMessageBox.Ok
)
else:
self.shortcutPushButton.setText(key_sequence.toString())
self.shortcutPushButton.setChecked(False)
self.shortcutButton.setText(key_sequence.toString())
self.shortcutButton.setChecked(False)
self.captureShortcut = False
def exec_(self, actionList):
@ -93,7 +90,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
return QtGui.QDialog.exec_(self)
def refreshActions(self):
self.shortcutListTreeWidget.clear()
self.treeWidget.clear()
for category in self.actionList.categories:
item = QtGui.QTreeWidgetItem([category.name])
for action in category.actions:
@ -103,7 +100,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
actionItem.setIcon(0, action.icon())
item.addChild(actionItem)
item.setExpanded(True)
self.shortcutListTreeWidget.addTopLevelItem(item)
self.treeWidget.addTopLevelItem(item)
def onShortcutPushButtonClicked(self, toggled):
def onShortcutButtonClicked(self, toggled):
self.captureShortcut = toggled

View File

@ -128,7 +128,6 @@ class SlideController(QtGui.QWidget):
# Splitter
self.Splitter = QtGui.QSplitter(self.Panel)
self.Splitter.setOrientation(QtCore.Qt.Vertical)
self.Splitter.setOpaqueResize(False)
self.PanelLayout.addWidget(self.Splitter)
# Actual controller section
self.Controller = QtGui.QWidget(self.Splitter)

View File

@ -26,33 +26,17 @@
from PyQt4 import QtCore, QtGui
class SplashScreen(object):
class SplashScreen(QtGui.QSplashScreen):
def __init__(self):
self.splash_screen = QtGui.QSplashScreen()
QtGui.QSplashScreen.__init__(self)
self.setupUi()
def setupUi(self):
self.splash_screen.setObjectName(u'splash_screen')
self.splash_screen.setWindowModality(QtCore.Qt.NonModal)
self.splash_screen.setEnabled(True)
self.splash_screen.resize(370, 370)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.splash_screen.sizePolicy().hasHeightForWidth())
self.splash_screen.setSizePolicy(sizePolicy)
self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
self.setObjectName(u'splash_screen')
self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png')
self.splash_screen.setPixmap(splash_image)
self.splash_screen.setMask(splash_image.mask())
self.splash_screen.setWindowFlags(
QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
QtCore.QMetaObject.connectSlotsByName(self.splash_screen)
def show(self):
self.splash_screen.show()
def finish(self, widget):
self.splash_screen.finish(widget)
self.setPixmap(splash_image)
self.setMask(splash_image.mask())
self.resize(370, 370)
QtCore.QMetaObject.connectSlotsByName(self)

View File

@ -38,8 +38,8 @@ log = logging.getLogger(__name__)
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
This is the Bible Import Wizard, which allows easy importing of Bibles
into OpenLP from other formats like OSIS, CSV and OpenSong.
This is the Theme Import Wizard, which allows easy creation and editing of
OpenLP themes.
"""
log.info(u'ThemeWizardForm loaded')
@ -291,9 +291,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
self.updateThemeAllowed = True
self.themeNameLabel.setVisible(not edit)
self.themeNameEdit.setVisible(not edit)
self.edit_mode = edit
if edit:
self.setWindowTitle(unicode(translate('OpenLP.ThemeWizard',
'Edit Theme %s')) % self.theme.theme_name)
'Edit Theme - %s')) % self.theme.theme_name)
self.next()
else:
self.setWindowTitle(translate('OpenLP.ThemeWizard', 'New Theme'))
@ -435,8 +436,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
"""
Background style Combo box has changed.
"""
self.theme.background_type = BackgroundType.to_string(index)
self.setBackgroundPageValues()
# do not allow updates when screen is building for the first time.
if self.updateThemeAllowed:
self.theme.background_type = BackgroundType.to_string(index)
self.setBackgroundPageValues()
def onGradientComboBoxCurrentIndexChanged(self, index):
"""
@ -579,7 +582,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
return
self.accepted = True
saveFrom = None
saveTo = None
if self.theme.background_type == \
@ -588,8 +590,12 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
os.path.split(unicode(self.theme.background_filename))[1]
saveTo = os.path.join(self.path, self.theme.theme_name, filename)
saveFrom = self.theme.background_filename
if self.thememanager.saveTheme(self.theme, saveFrom, saveTo):
return QtGui.QDialog.accept(self)
if not self.edit_mode and \
not self.thememanager.checkIfThemeExists(self.theme.theme_name):
return
self.accepted = True
self.thememanager.saveTheme(self.theme, saveFrom, saveTo)
return QtGui.QDialog.accept(self)
def _colorButton(self, field):
"""

View File

@ -36,7 +36,7 @@ from openlp.core.ui import FileRenameForm, ThemeForm
from openlp.core.theme import Theme
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
BackgroundType, BackgroundGradientType
BackgroundType, BackgroundGradientType, check_directory_exists
from openlp.core.utils import AppLocation, get_filesystem_encoding
log = logging.getLogger(__name__)
@ -49,12 +49,14 @@ class ThemeManager(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent)
self.parent = parent
self.settingsSection = u'themes'
self.themeForm = ThemeForm(self)
self.fileRenameForm = FileRenameForm(self)
self.serviceComboBox = self.parent.ServiceManagerContents.themeComboBox
# start with the layout
self.layout = QtGui.QVBoxLayout(self)
self.layout.setSpacing(0)
self.layout.setMargin(0)
self.themeForm = ThemeForm(self)
self.fileRenameForm = FileRenameForm(self)
self.layout.setObjectName(u'layout')
self.toolbar = OpenLPToolbar(self)
self.toolbar.addToolbarButton(
translate('OpenLP.ThemeManager', 'New Theme'),
@ -82,13 +84,17 @@ class ThemeManager(QtGui.QWidget):
u':/general/general_export.png',
translate('OpenLP.ThemeManager', 'Export a theme.'),
self.onExportTheme)
self.themeWidget = QtGui.QWidgetAction(self.toolbar)
self.toolbar.setObjectName(u'toolbar')
self.layout.addWidget(self.toolbar)
self.themeWidget = QtGui.QWidgetAction(self.toolbar)
self.themeWidget.setObjectName(u'themeWidget')
# create theme manager list
self.themeListWidget = QtGui.QListWidget(self)
self.themeListWidget.setAlternatingRowColors(True)
self.themeListWidget.setIconSize(QtCore.QSize(88, 50))
self.layout.addWidget(self.themeListWidget)
self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.themeListWidget.setObjectName(u'themeListWidget')
self.layout.addWidget(self.themeListWidget)
QtCore.QObject.connect(self.themeListWidget,
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
self.contextMenu)
@ -106,35 +112,45 @@ class ThemeManager(QtGui.QWidget):
self.deleteAction = self.menu.addAction(
translate('OpenLP.ThemeManager', '&Delete Theme'))
self.deleteAction.setIcon(build_icon(u':/general/general_delete.png'))
self.sep1 = self.menu.addAction(u'')
self.sep1.setSeparator(True)
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'))
#Signals
# Signals
QtCore.QObject.connect(self.themeListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.changeGlobalFromScreen)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_global'), self.changeGlobalFromTab)
#Variables
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Variables
self.themelist = []
self.path = AppLocation.get_section_data_path(self.settingsSection)
self.checkThemesExists(self.path)
check_directory_exists(self.path)
self.thumbPath = os.path.join(self.path, u'thumbnails')
self.checkThemesExists(self.thumbPath)
check_directory_exists(self.thumbPath)
self.themeForm.path = self.path
self.oldBackgroundImage = None
self.editingDefault = False
# Last little bits of setting up
self.configUpdated()
def configUpdated(self, firstTime=False):
"""
Triggered when Config dialog is updated.
"""
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
def contextMenu(self, point):
"""
Build the Right Click Context menu and set state depending on
the type of theme.
"""
item = self.themeListWidget.itemAt(point)
if item is None:
return
@ -215,7 +231,6 @@ class ThemeManager(QtGui.QWidget):
editing form for the user to make their customisations.
"""
theme = ThemeXML()
self.saveThemeName = u''
self.themeForm.theme = theme
self.themeForm.exec_()
@ -231,12 +246,15 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = oldThemeName
if self.fileRenameForm.exec_():
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
oldThemeData = self.getThemeData(oldThemeName)
self.deleteTheme(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName)
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
if self.checkIfThemeExists(newThemeName):
oldThemeData = self.getThemeData(oldThemeName)
self.deleteTheme(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName)
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(oldThemeName):
plugin.renameTheme(oldThemeName, newThemeName)
def onCopyTheme(self):
"""
@ -245,12 +263,12 @@ class ThemeManager(QtGui.QWidget):
item = self.themeListWidget.currentItem()
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = u''
if self.fileRenameForm.exec_(True):
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName)
self.loadThemes()
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
if self.checkIfThemeExists(newThemeName):
themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName)
self.loadThemes()
def cloneThemeData(self, themeData, newThemeName):
"""
@ -276,14 +294,10 @@ class ThemeManager(QtGui.QWidget):
'You must select a theme to edit.')):
item = self.themeListWidget.currentItem()
themeName = unicode(item.text())
if themeName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.editingDefault = True
theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString()))
if theme.background_type == u'image':
self.oldBackgroundImage = theme.background_filename
self.saveThemeName = unicode(
item.data(QtCore.Qt.UserRole).toString())
self.themeForm.theme = theme
self.themeForm.exec_(True)
@ -444,20 +458,9 @@ class ThemeManager(QtGui.QWidget):
unicode(themeName) + u'.xml')
xml = get_text_file_string(xmlFile)
if not xml:
return self.baseTheme()
return self._baseTheme()
else:
return self.createThemeFromXml(xml, self.path)
def checkThemesExists(self, dir):
"""
Check a theme directory exists and if not create it
``dir``
Theme directory to make sure exists
"""
log.debug(u'check themes')
if not os.path.exists(dir):
os.mkdir(dir)
return self._createThemeFromXml(xml, self.path)
def unzipTheme(self, filename, dir):
"""
@ -489,8 +492,7 @@ class ThemeManager(QtGui.QWidget):
theme_dir = None
if osfile.endswith(os.path.sep):
theme_dir = os.path.join(dir, osfile)
if not os.path.exists(theme_dir):
os.mkdir(os.path.join(dir, osfile))
check_directory_exists(theme_dir)
else:
fullpath = os.path.join(dir, osfile)
names = osfile.split(os.path.sep)
@ -500,8 +502,7 @@ class ThemeManager(QtGui.QWidget):
themename = names[0]
if theme_dir is None:
theme_dir = os.path.join(dir, names[0])
if not os.path.exists(theme_dir):
os.mkdir(os.path.join(dir, names[0]))
check_directory_exists(theme_dir)
if os.path.splitext(ucsfile)[1].lower() in [u'.xml']:
xml_data = zip.read(file)
try:
@ -517,19 +518,22 @@ class ThemeManager(QtGui.QWidget):
outfile = open(fullpath, u'wb')
outfile.write(zip.read(file))
if filexml:
theme = self.createThemeFromXml(filexml, self.path)
theme = self._createThemeFromXml(filexml, self.path)
self.generateAndSaveImage(dir, themename, theme)
else:
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'File is not a valid theme.'))
Receiver.send_message(u'openlp_error_message', {
u'title': translate('OpenLP.ThemeManager',
'Validation Error'),
u'message':translate('OpenLP.ThemeManager',
'File is not a valid theme.')})
log.exception(u'Theme file does not contain XML data %s' %
filename)
except (IOError, NameError):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
Receiver.send_message(u'openlp_error_message', {
u'title': translate('OpenLP.ThemeManager',
'Validation Error'),
u'message':translate('OpenLP.ThemeManager',
'File is not a valid theme.')})
log.exception(u'Importing theme from zip failed %s' % filename)
finally:
if zip:
@ -551,9 +555,161 @@ class ThemeManager(QtGui.QWidget):
if tree.find(u'BackgroundType') is None:
return xml_data
else:
return self.migrateVersion122(xml_data)
return self._migrateVersion122(xml_data)
def migrateVersion122(self, xml_data):
def checkIfThemeExists(self, themeName):
"""
Check if theme already exists and displays error message
``themeName``
Name of the Theme to test
"""
theme_dir = os.path.join(self.path, themeName)
if os.path.exists(theme_dir):
Receiver.send_message(u'openlp_error_message', {
u'title': translate('OpenLP.ThemeManager',
'Validation Error'),
u'message':translate('OpenLP.ThemeManager',
'A theme with this name already exists.')})
return False
return True
def saveTheme(self, theme, imageFrom, imageTo):
"""
Called by thememaintenance Dialog to save the theme
and to trigger the reload of the theme list
"""
name = theme.theme_name
theme_pretty_xml = theme.extract_formatted_xml()
log.debug(u'saveTheme %s %s', name, theme_pretty_xml)
theme_dir = os.path.join(self.path, name)
check_directory_exists(theme_dir)
theme_file = os.path.join(theme_dir, name + u'.xml')
if imageTo and self.oldBackgroundImage and \
imageTo != self.oldBackgroundImage:
try:
os.remove(self.oldBackgroundImage)
except OSError:
log.exception(u'Unable to remove old theme background')
outfile = None
try:
outfile = open(theme_file, u'w')
outfile.write(theme_pretty_xml)
except IOError:
log.exception(u'Saving theme to file failed')
finally:
if outfile:
outfile.close()
if imageFrom and imageFrom != imageTo:
try:
encoding = get_filesystem_encoding()
shutil.copyfile(
unicode(imageFrom).encode(encoding),
unicode(imageTo).encode(encoding))
except IOError:
log.exception(u'Failed to save theme image')
self.generateAndSaveImage(self.path, name, theme)
self.loadThemes()
self.pushThemes()
def generateAndSaveImage(self, dir, name, theme):
log.debug(u'generateAndSaveImage %s %s', dir, name)
theme_xml = theme.extract_xml()
frame = self.generateImage(theme)
samplepathname = os.path.join(self.path, name + u'.png')
if os.path.exists(samplepathname):
os.unlink(samplepathname)
frame.save(samplepathname, u'png')
thumb = os.path.join(self.thumbPath, u'%s.png' % name)
icon = build_icon(frame)
pixmap = icon.pixmap(QtCore.QSize(88, 50))
pixmap.save(thumb, u'png')
log.debug(u'Theme image written to %s', samplepathname)
def generateImage(self, themeData, forcePage=False):
"""
Call the RenderManager to build a Sample Image
``themeData``
The theme to generated a preview for.
``forcePage``
Flag to tell message lines per page need to be generated.
"""
log.debug(u'generateImage \n%s ', themeData)
return self.parent.renderManager.generate_preview(themeData, forcePage)
def getPreviewImage(self, theme):
"""
Return an image representing the look of the theme
``theme``
The theme to return the image for
"""
log.debug(u'getPreviewImage %s ', theme)
image = os.path.join(self.path, theme + u'.png')
return image
def _baseTheme(self):
"""
Provide a base theme with sensible defaults
"""
log.debug(u'base theme created')
newtheme = ThemeXML()
return newtheme
def _createThemeFromXml(self, themeXml, path):
"""
Return a theme object using information parsed from XML
``themeXml``
The XML data to load into the theme
"""
theme = ThemeXML()
theme.parse(themeXml)
theme.extend_image_filename(path)
return theme
def _validate_theme_action(self, select_text, confirm_title, confirm_text,
testPlugin=True):
"""
Check to see if theme has been selected and the destructive action
is allowed.
"""
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget, select_text):
item = self.themeListWidget.currentItem()
theme = unicode(item.text())
# confirm deletion
answer = QtGui.QMessageBox.question(self, confirm_title,
confirm_text % theme, QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return False
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
return False
# check for use in the system else where.
if testPlugin:
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(theme):
Receiver.send_message(u'openlp_error_message', {
u'title': translate('OpenLP.ThemeManager',
'Validation Error'),
u'message': unicode(translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \
(theme, plugin.name)})
return False
return True
def _migrateVersion122(self, xml_data):
"""
Convert the xml data from version 1 format to the current format.
@ -609,192 +765,4 @@ class ThemeManager(QtGui.QWidget):
vAlignCorrection = 2
newtheme.display_horizontal_align = theme.HorizontalAlign
newtheme.display_vertical_align = vAlignCorrection
return newtheme.extract_xml()
def saveTheme(self, theme, imageFrom, imageTo):
"""
Called by thememaintenance Dialog to save the theme
and to trigger the reload of the theme list
"""
name = theme.theme_name
theme_pretty_xml = theme.extract_formatted_xml()
log.debug(u'saveTheme %s %s', name, theme_pretty_xml)
theme_dir = os.path.join(self.path, name)
if not os.path.exists(theme_dir):
os.mkdir(os.path.join(self.path, name))
theme_file = os.path.join(theme_dir, name + u'.xml')
log.debug(theme_file)
editedServiceTheme = False
result = QtGui.QMessageBox.Yes
if self.saveThemeName != name:
if os.path.exists(theme_file):
result = QtGui.QMessageBox.question(self,
translate('OpenLP.ThemeManager', 'Theme Exists'),
translate('OpenLP.ThemeManager',
'A theme with this name already '
'exists. Would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if self.saveThemeName != u'':
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(self.saveThemeName):
plugin.renameTheme(self.saveThemeName, name)
if unicode(self.serviceComboBox.currentText()) == name:
editedServiceTheme = True
if result == QtGui.QMessageBox.Yes:
# Save the theme, overwriting the existing theme if necessary.
if imageTo and self.oldBackgroundImage and \
imageTo != self.oldBackgroundImage:
try:
os.remove(self.oldBackgroundImage)
except OSError:
log.exception(u'Unable to remove old theme background')
outfile = None
try:
outfile = open(theme_file, u'w')
outfile.write(theme_pretty_xml)
except IOError:
log.exception(u'Saving theme to file failed')
finally:
if outfile:
outfile.close()
if imageFrom and imageFrom != imageTo:
try:
encoding = get_filesystem_encoding()
shutil.copyfile(
unicode(imageFrom).encode(encoding),
unicode(imageTo).encode(encoding))
except IOError:
log.exception(u'Failed to save theme image')
self.generateAndSaveImage(self.path, name, theme)
self.loadThemes()
# Check if we need to set a new service theme
if editedServiceTheme:
newThemeIndex = self.serviceComboBox.findText(name)
if newThemeIndex != -1:
self.serviceComboBox.setCurrentIndex(newThemeIndex)
if self.editingDefault:
if self.saveThemeName != name:
newThemeItem = self.themeListWidget.findItems(name,
QtCore.Qt.MatchExactly)[0]
newThemeIndex = self.themeListWidget.indexFromItem(
newThemeItem).row()
self.global_theme = unicode(
self.themeListWidget.item(newThemeIndex).text())
newName = unicode(translate('OpenLP.ThemeManager',
'%s (default)')) % self.global_theme
self.themeListWidget.item(newThemeIndex).setText(newName)
QtCore.QSettings().setValue(
self.settingsSection + u'/global theme',
QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global',
self.global_theme)
self.editingDefault = False
self.pushThemes()
return True
else:
# Don't close the dialog - allow the user to change the name of
# the theme or to cancel the theme dialog completely.
return False
def generateAndSaveImage(self, dir, name, theme):
log.debug(u'generateAndSaveImage %s %s', dir, name)
theme_xml = theme.extract_xml()
frame = self.generateImage(theme)
samplepathname = os.path.join(self.path, name + u'.png')
if os.path.exists(samplepathname):
os.unlink(samplepathname)
frame.save(samplepathname, u'png')
thumb = os.path.join(self.thumbPath, u'%s.png' % name)
icon = build_icon(frame)
pixmap = icon.pixmap(QtCore.QSize(88, 50))
pixmap.save(thumb, u'png')
log.debug(u'Theme image written to %s', samplepathname)
def generateImage(self, themeData, forcePage=False):
"""
Call the RenderManager to build a Sample Image
``themeData``
The theme to generated a preview for.
``forcePage``
Flag to tell message lines per page need to be generated.
"""
log.debug(u'generateImage \n%s ', themeData)
return self.parent.renderManager.generate_preview(themeData, forcePage)
def getPreviewImage(self, theme):
"""
Return an image representing the look of the theme
``theme``
The theme to return the image for
"""
log.debug(u'getPreviewImage %s ', theme)
image = os.path.join(self.path, theme + u'.png')
return image
def baseTheme(self):
"""
Provide a base theme with sensible defaults
"""
log.debug(u'base theme created')
newtheme = ThemeXML()
return newtheme
def createThemeFromXml(self, themeXml, path):
"""
Return a theme object using information parsed from XML
``themeXml``
The XML data to load into the theme
"""
theme = ThemeXML()
theme.parse(themeXml)
theme.extend_image_filename(path)
return theme
def _validate_theme_action(self, select_text, confirm_title, confirm_text,
testPlugin=True):
"""
Check to see if theme has been selected and the destructive action
is allowed.
"""
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget, select_text):
item = self.themeListWidget.currentItem()
theme = unicode(item.text())
# confirm deletion
answer = QtGui.QMessageBox.question(self, confirm_title,
confirm_text % theme, QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return False
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
return False
else:
if testPlugin:
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(theme):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \
(theme, plugin.name))
return False
if unicode(self.serviceComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used by the service manager.')) % theme)
return False
return True
return newtheme.extract_xml()

View File

@ -38,63 +38,54 @@ class ThemesTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'ThemesTab')
self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes')
self.ThemesTabLayout = QtGui.QHBoxLayout(self)
self.ThemesTabLayout.setSpacing(8)
self.ThemesTabLayout.setMargin(8)
self.ThemesTabLayout.setObjectName(u'ThemesTabLayout')
self.GlobalGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.GlobalGroupBox = QtGui.QGroupBox(self.leftColumn)
self.GlobalGroupBox.setObjectName(u'GlobalGroupBox')
self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox)
self.GlobalGroupBoxLayout.setSpacing(8)
self.GlobalGroupBoxLayout.setMargin(8)
self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout')
self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox)
self.DefaultComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.DefaultComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.DefaultComboBox.setObjectName(u'DefaultComboBox')
self.GlobalGroupBoxLayout.addWidget(self.DefaultComboBox)
self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox)
self.DefaultListView.setObjectName(u'DefaultListView')
self.GlobalGroupBoxLayout.addWidget(self.DefaultListView)
self.ThemesTabLayout.addWidget(self.GlobalGroupBox)
self.LevelGroupBox = QtGui.QGroupBox(self)
self.leftLayout.addWidget(self.GlobalGroupBox)
self.leftLayout.addStretch()
self.LevelGroupBox = QtGui.QGroupBox(self.rightColumn)
self.LevelGroupBox.setObjectName(u'LevelGroupBox')
self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox)
self.LevelLayout.setLabelAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setFormAlignment(
QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.LevelLayout.setMargin(8)
self.LevelLayout.setSpacing(8)
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LevelLayout.setObjectName(u'LevelLayout')
self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton')
self.LevelLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.SongLevelRadioButton)
self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.SongLevelLabel.setWordWrap(True)
self.SongLevelLabel.setObjectName(u'SongLevelLabel')
self.LevelLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.SongLevelLabel)
self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel)
self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton')
self.LevelLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.ServiceLevelRadioButton)
self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.ServiceLevelLabel.setWordWrap(True)
self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel')
self.LevelLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.LevelLayout.addRow(self.ServiceLevelRadioButton,
self.ServiceLevelLabel)
self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox)
self.GlobalLevelRadioButton.setChecked(True)
self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton')
self.LevelLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.GlobalLevelRadioButton)
self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox)
self.GlobalLevelLabel.setWordWrap(True)
self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel')
self.LevelLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.LevelLayout.addRow(self.GlobalLevelRadioButton,
self.GlobalLevelLabel)
self.ThemesTabLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addStretch()
QtCore.QObject.connect(self.SongLevelRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed)
QtCore.QObject.connect(self.ServiceLevelRadioButton,
@ -107,6 +98,7 @@ class ThemesTab(SettingsTab):
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
def retranslateUi(self):
self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes')
self.GlobalGroupBox.setTitle(
translate('OpenLP.ThemesTab', 'Global Theme'))
self.LevelGroupBox.setTitle(
@ -212,4 +204,4 @@ class ThemesTab(SettingsTab):
if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview)
self.DefaultListView.setPixmap(preview)

View File

@ -249,7 +249,8 @@ class Ui_ThemeWizard(object):
self.footerSizeSpinBox.setMaximum(999)
self.footerSizeSpinBox.setValue(10)
self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox')
self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox)
self.footerAreaLayout.addRow(self.footerSizeLabel,
self.footerSizeSpinBox)
ThemeWizard.addPage(self.footerAreaPage)
# Alignment Page
self.alignmentPage = QtGui.QWizardPage()
@ -317,9 +318,11 @@ class Ui_ThemeWizard(object):
self.areaPositionLayout.addWidget(self.mainPositionGroupBox)
self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage)
self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox')
self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox)
self.footerPositionLayout = QtGui.QFormLayout(
self.footerPositionGroupBox)
self.footerPositionLayout.setObjectName(u'FooterPositionLayout')
self.footerPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox)
self.footerPositionCheckBox = QtGui.QCheckBox(
self.footerPositionGroupBox)
self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox')
self.footerPositionLayout.addRow(self.footerPositionCheckBox)
self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox)
@ -360,6 +363,8 @@ class Ui_ThemeWizard(object):
self.themeNameLabel = QtGui.QLabel(self.previewPage)
self.themeNameLabel.setObjectName(u'ThemeNameLabel')
self.themeNameEdit = QtGui.QLineEdit(self.previewPage)
self.themeNameEdit.setValidator(QtGui.QRegExpValidator(
QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self))
self.themeNameEdit.setObjectName(u'ThemeNameEdit')
self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit)
self.previewLayout.addLayout(self.themeNameLayout)

View File

@ -29,115 +29,81 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
class Ui_AlertDialog(object):
def setupUi(self, AlertDialog):
AlertDialog.setObjectName(u'AlertDialog')
AlertDialog.resize(567, 440)
AlertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.AlertDialogLayout = QtGui.QVBoxLayout(AlertDialog)
self.AlertDialogLayout.setSpacing(8)
self.AlertDialogLayout.setMargin(8)
self.AlertDialogLayout.setObjectName(u'AlertDialogLayout')
self.AlertTextLayout = QtGui.QFormLayout()
self.AlertTextLayout.setContentsMargins(0, 0, -1, -1)
self.AlertTextLayout.setSpacing(8)
self.AlertTextLayout.setObjectName(u'AlertTextLayout')
self.AlertEntryLabel = QtGui.QLabel(AlertDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.AlertEntryLabel.sizePolicy().hasHeightForWidth())
self.AlertEntryLabel.setSizePolicy(sizePolicy)
self.AlertEntryLabel.setObjectName(u'AlertEntryLabel')
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.AlertEntryLabel)
self.AlertParameter = QtGui.QLabel(AlertDialog)
self.AlertParameter.setObjectName(u'AlertParameter')
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.AlertParameter)
self.ParameterEdit = QtGui.QLineEdit(AlertDialog)
self.ParameterEdit.setObjectName(u'ParameterEdit')
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.ParameterEdit)
self.AlertTextEdit = QtGui.QLineEdit(AlertDialog)
self.AlertTextEdit.setObjectName(u'AlertTextEdit')
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.AlertTextEdit)
self.AlertDialogLayout.addLayout(self.AlertTextLayout)
self.ManagementLayout = QtGui.QHBoxLayout()
self.ManagementLayout.setSpacing(8)
self.ManagementLayout.setContentsMargins(-1, -1, -1, 0)
self.ManagementLayout.setObjectName(u'ManagementLayout')
self.AlertListWidget = QtGui.QListWidget(AlertDialog)
self.AlertListWidget.setAlternatingRowColors(True)
self.AlertListWidget.setObjectName(u'AlertListWidget')
self.ManagementLayout.addWidget(self.AlertListWidget)
self.ManageButtonLayout = QtGui.QVBoxLayout()
self.ManageButtonLayout.setSpacing(8)
self.ManageButtonLayout.setObjectName(u'ManageButtonLayout')
self.NewButton = QtGui.QPushButton(AlertDialog)
self.NewButton.setIcon(build_icon(u':/general/general_new.png'))
self.NewButton.setObjectName(u'NewButton')
self.ManageButtonLayout.addWidget(self.NewButton)
self.SaveButton = QtGui.QPushButton(AlertDialog)
self.SaveButton.setEnabled(False)
self.SaveButton.setIcon(build_icon(u':/general/general_save.png'))
self.SaveButton.setObjectName(u'SaveButton')
self.ManageButtonLayout.addWidget(self.SaveButton)
self.DeleteButton = QtGui.QPushButton(AlertDialog)
self.DeleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.DeleteButton.setObjectName(u'DeleteButton')
self.ManageButtonLayout.addWidget(self.DeleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.ManageButtonLayout.addItem(spacerItem)
self.ManagementLayout.addLayout(self.ManageButtonLayout)
self.AlertDialogLayout.addLayout(self.ManagementLayout)
self.AlertButtonLayout = QtGui.QHBoxLayout()
self.AlertButtonLayout.setSpacing(8)
self.AlertButtonLayout.setObjectName(u'AlertButtonLayout')
spacerItem1 = QtGui.QSpacerItem(181, 0, QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Minimum)
self.AlertButtonLayout.addItem(spacerItem1)
def setupUi(self, alertDialog):
alertDialog.setObjectName(u'alertDialog')
alertDialog.resize(400, 300)
alertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.alertDialogLayout = QtGui.QGridLayout(alertDialog)
self.alertDialogLayout.setObjectName(u'alertDialogLayout')
self.alertTextLayout = QtGui.QFormLayout()
self.alertTextLayout.setObjectName(u'alertTextLayout')
self.alertEntryLabel = QtGui.QLabel(alertDialog)
self.alertEntryLabel.setObjectName(u'alertEntryLabel')
self.alertTextEdit = QtGui.QLineEdit(alertDialog)
self.alertTextEdit.setObjectName(u'alertTextEdit')
self.alertEntryLabel.setBuddy(self.alertTextEdit)
self.alertTextLayout.addRow(self.alertEntryLabel, self.alertTextEdit)
self.alertParameter = QtGui.QLabel(alertDialog)
self.alertParameter.setObjectName(u'alertParameter')
self.parameterEdit = QtGui.QLineEdit(alertDialog)
self.parameterEdit.setObjectName(u'parameterEdit')
self.alertParameter.setBuddy(self.parameterEdit)
self.alertTextLayout.addRow(self.alertParameter, self.parameterEdit)
self.alertDialogLayout.addLayout(self.alertTextLayout, 0, 0, 1, 2)
self.alertListWidget = QtGui.QListWidget(alertDialog)
self.alertListWidget.setAlternatingRowColors(True)
self.alertListWidget.setObjectName(u'alertListWidget')
self.alertDialogLayout.addWidget(self.alertListWidget, 1, 0)
self.manageButtonLayout = QtGui.QVBoxLayout()
self.manageButtonLayout.setObjectName(u'manageButtonLayout')
self.newButton = QtGui.QPushButton(alertDialog)
self.newButton.setIcon(build_icon(u':/general/general_new.png'))
self.newButton.setObjectName(u'newButton')
self.manageButtonLayout.addWidget(self.newButton)
self.saveButton = QtGui.QPushButton(alertDialog)
self.saveButton.setEnabled(False)
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.saveButton.setObjectName(u'saveButton')
self.manageButtonLayout.addWidget(self.saveButton)
self.deleteButton = QtGui.QPushButton(alertDialog)
self.deleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.deleteButton.setObjectName(u'deleteButton')
self.manageButtonLayout.addWidget(self.deleteButton)
self.manageButtonLayout.addStretch()
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(alertDialog)
self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
displayIcon = build_icon(u':/general/general_live.png')
self.DisplayButton = QtGui.QPushButton(AlertDialog)
self.DisplayButton.setIcon(displayIcon)
self.DisplayButton.setObjectName(u'DisplayButton')
self.AlertButtonLayout.addWidget(self.DisplayButton)
self.DisplayCloseButton = QtGui.QPushButton(AlertDialog)
self.DisplayCloseButton.setIcon(displayIcon)
self.DisplayCloseButton.setObjectName(u'DisplayCloseButton')
self.AlertButtonLayout.addWidget(self.DisplayCloseButton)
self.CloseButton = QtGui.QPushButton(AlertDialog)
self.CloseButton.setIcon(build_icon(u':/system/system_close.png'))
self.CloseButton.setObjectName(u'CloseButton')
self.AlertButtonLayout.addWidget(self.CloseButton)
self.AlertDialogLayout.addLayout(self.AlertButtonLayout)
self.AlertEntryLabel.setBuddy(self.AlertTextEdit)
self.AlertParameter.setBuddy(self.ParameterEdit)
self.displayButton = QtGui.QPushButton(alertDialog)
self.displayButton.setIcon(displayIcon)
self.displayButton.setObjectName(u'displayButton')
self.buttonBox.addButton(self.displayButton,
QtGui.QDialogButtonBox.ActionRole)
self.displayCloseButton = QtGui.QPushButton(alertDialog)
self.displayCloseButton.setIcon(displayIcon)
self.displayCloseButton.setObjectName(u'displayCloseButton')
self.buttonBox.addButton(self.displayCloseButton,
QtGui.QDialogButtonBox.ActionRole)
self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.retranslateUi(alertDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
alertDialog.close)
QtCore.QMetaObject.connectSlotsByName(alertDialog)
self.retranslateUi(AlertDialog)
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'),
AlertDialog.close)
QtCore.QMetaObject.connectSlotsByName(AlertDialog)
def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle(
def retranslateUi(self, alertDialog):
alertDialog.setWindowTitle(
translate('AlertsPlugin.AlertForm', 'Alert Message'))
self.AlertEntryLabel.setText(
self.alertEntryLabel.setText(
translate('AlertsPlugin.AlertForm', 'Alert &text:'))
self.AlertParameter.setText(
self.alertParameter.setText(
translate('AlertsPlugin.AlertForm', '&Parameter:'))
self.NewButton.setText(
self.newButton.setText(
translate('AlertsPlugin.AlertForm', '&New'))
self.SaveButton.setText(
self.saveButton.setText(
translate('AlertsPlugin.AlertForm', '&Save'))
self.DeleteButton.setText(
self.deleteButton.setText(
translate('AlertsPlugin.AlertForm', '&Delete'))
self.DisplayButton.setText(
self.displayButton.setText(
translate('AlertsPlugin.AlertForm', 'Displ&ay'))
self.DisplayCloseButton.setText(
self.displayCloseButton.setText(
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText(
translate('AlertsPlugin.AlertForm', '&Close'))

View File

@ -44,62 +44,62 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.item_id = None
QtGui.QDialog.__init__(self, plugin.formparent)
self.setupUi(self)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'),
QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'),
self.onDisplayClicked)
QtCore.QObject.connect(self.DisplayCloseButton,
QtCore.QObject.connect(self.displayCloseButton,
QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
QtCore.QObject.connect(self.AlertTextEdit,
QtCore.QObject.connect(self.alertTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
QtCore.QObject.connect(self.NewButton, QtCore.SIGNAL(u'clicked()'),
QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'),
self.onNewClick)
QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL(u'clicked()'),
QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'clicked()'),
self.onDeleteClick)
QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL(u'clicked()'),
QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'),
self.onSaveClick)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
QtCore.QObject.connect(self.AlertListWidget,
QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
def loadList(self):
"""
Loads the list with alerts.
"""
self.AlertListWidget.clear()
self.alertListWidget.clear()
alerts = self.manager.get_all_objects(AlertItem,
order_by_ref=AlertItem.text)
for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.AlertListWidget.addItem(item_name)
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.alertListWidget.addItem(item_name)
self.saveButton.setEnabled(False)
self.deleteButton.setEnabled(False)
def onDisplayClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())):
if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.loadList()
def onDisplayCloseClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())):
if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.close()
def onDeleteClick(self):
"""
Deletes the selected item.
"""
item = self.AlertListWidget.currentItem()
item = self.alertListWidget.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.manager.delete_object(AlertItem, item_id)
row = self.AlertListWidget.row(item)
self.AlertListWidget.takeItem(row)
row = self.alertListWidget.row(item)
self.alertListWidget.takeItem(row)
self.item_id = None
self.AlertTextEdit.setText(u'')
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(False)
self.alertTextEdit.setText(u'')
self.saveButton.setEnabled(False)
self.deleteButton.setEnabled(False)
def onNewClick(self):
if len(self.AlertTextEdit.text()) == 0:
if len(self.alertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self,
translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
@ -107,9 +107,9 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
'clicking New.'))
else:
alert = AlertItem()
alert.text = unicode(self.AlertTextEdit.text())
alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert)
self.AlertTextEdit.setText(u'')
self.alertTextEdit.setText(u'')
self.loadList()
def onSaveClick(self):
@ -118,7 +118,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
if self.item_id:
alert = self.manager.get_object(AlertItem, self.item_id)
alert.text = unicode(self.AlertTextEdit.text())
alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert)
self.item_id = None
self.loadList()
@ -129,36 +129,36 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
# Only enable the button, if we are editing an item.
if self.item_id:
self.SaveButton.setEnabled(True)
self.saveButton.setEnabled(True)
def onDoubleClick(self):
"""
List item has been double clicked to display it
"""
items = self.AlertListWidget.selectedIndexes()
items = self.alertListWidget.selectedIndexes()
for item in items:
bitem = self.AlertListWidget.item(item.row())
bitem = self.alertListWidget.item(item.row())
self.triggerAlert(unicode(bitem.text()))
self.AlertTextEdit.setText(unicode(bitem.text()))
self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(True)
self.saveButton.setEnabled(False)
self.deleteButton.setEnabled(True)
def onSingleClick(self):
"""
List item has been single clicked to add it to
the edit field so it can be changed.
"""
items = self.AlertListWidget.selectedIndexes()
items = self.alertListWidget.selectedIndexes()
for item in items:
bitem = self.AlertListWidget.item(item.row())
self.AlertTextEdit.setText(unicode(bitem.text()))
bitem = self.alertListWidget.item(item.row())
self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
# If the alert does not contain '<>' we clear the ParameterEdit field.
if unicode(self.AlertTextEdit.text()).find(u'<>') == -1:
self.ParameterEdit.setText(u'')
self.SaveButton.setEnabled(False)
self.DeleteButton.setEnabled(True)
if unicode(self.alertTextEdit.text()).find(u'<>') == -1:
self.parameterEdit.setText(u'')
self.saveButton.setEnabled(False)
self.deleteButton.setEnabled(True)
def triggerAlert(self, text):
"""
@ -170,27 +170,27 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
if text:
# We found '<>' in the alert text, but the ParameterEdit field is
# empty.
if text.find(u'<>') != -1 and not self.ParameterEdit.text() and \
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus()
return False
self.parameterEdit.setFocus()
return False
# The ParameterEdit field is not empty, but we have not found '<>'
# in the alert text.
elif text.find(u'<>') == -1 and self.ParameterEdit.text() and \
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus()
return False
text = text.replace(u'<>', unicode(self.ParameterEdit.text()))
self.parameterEdit.setFocus()
return False
text = text.replace(u'<>', unicode(self.parameterEdit.text()))
self.parent.alertsmanager.displayAlert(text)
return True
return False
return False

View File

@ -39,139 +39,59 @@ class AlertsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'AlertsTab')
self.AlertsLayout = QtGui.QHBoxLayout(self)
self.AlertsLayout.setSpacing(8)
self.AlertsLayout.setMargin(8)
self.AlertsLayout.setObjectName(u'AlertsLayout')
self.AlertLeftColumn = QtGui.QWidget(self)
self.AlertLeftColumn.setObjectName(u'AlertLeftColumn')
self.SlideLeftLayout = QtGui.QVBoxLayout(self.AlertLeftColumn)
self.SlideLeftLayout.setSpacing(8)
self.SlideLeftLayout.setMargin(0)
self.SlideLeftLayout.setObjectName(u'SlideLeftLayout')
self.FontGroupBox = QtGui.QGroupBox(self.AlertLeftColumn)
SettingsTab.setupUi(self)
self.FontGroupBox = QtGui.QGroupBox(self.leftColumn)
self.FontGroupBox.setObjectName(u'FontGroupBox')
self.FontLayout = QtGui.QVBoxLayout(self.FontGroupBox)
self.FontLayout.setSpacing(8)
self.FontLayout.setMargin(8)
self.FontLayout = QtGui.QFormLayout(self.FontGroupBox)
self.FontLayout.setObjectName(u'FontLayout')
self.FontLabel = QtGui.QLabel(self.FontGroupBox)
self.FontLabel.setObjectName(u'FontLabel')
self.FontLayout.addWidget(self.FontLabel)
self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox)
self.FontComboBox.setObjectName(u'FontComboBox')
self.FontLayout.addWidget(self.FontComboBox)
self.ColorWidget = QtGui.QWidget(self.FontGroupBox)
self.ColorWidget.setObjectName(u'ColorWidget')
self.ColorLayout = QtGui.QHBoxLayout(self.ColorWidget)
self.ColorLayout.setSpacing(8)
self.ColorLayout.setMargin(0)
self.ColorLayout.setObjectName(u'ColorLayout')
self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
self.FontLayout.addRow(self.FontLabel, self.FontComboBox)
self.FontColorLabel = QtGui.QLabel(self.FontGroupBox)
self.FontColorLabel.setObjectName(u'FontColorLabel')
self.ColorLayout.addWidget(self.FontColorLabel)
self.FontColorButton = QtGui.QPushButton(self.ColorWidget)
self.ColorLayout = QtGui.QHBoxLayout()
self.ColorLayout.setObjectName(u'ColorLayout')
self.FontColorButton = QtGui.QPushButton(self.FontGroupBox)
self.FontColorButton.setObjectName(u'FontColorButton')
self.ColorLayout.addWidget(self.FontColorButton)
self.ColorSpacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.ColorLayout.addItem(self.ColorSpacerItem)
self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
self.ColorLayout.addSpacing(20)
self.BackgroundColorLabel = QtGui.QLabel(self.FontGroupBox)
self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.ColorLayout.addWidget(self.BackgroundColorLabel)
self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget)
self.BackgroundColorButton = QtGui.QPushButton(self.FontGroupBox)
self.BackgroundColorButton.setObjectName(u'BackgroundColorButton')
self.ColorLayout.addWidget(self.BackgroundColorButton)
self.FontLayout.addWidget(self.ColorWidget)
self.FontSizeWidget = QtGui.QWidget(self.FontGroupBox)
self.FontSizeWidget.setObjectName(u'FontSizeWidget')
self.FontSizeLayout = QtGui.QHBoxLayout(self.FontSizeWidget)
self.FontSizeLayout.setSpacing(8)
self.FontSizeLayout.setMargin(0)
self.FontSizeLayout.setObjectName(u'FontSizeLayout')
self.FontSizeLabel = QtGui.QLabel(self.FontSizeWidget)
self.FontLayout.addRow(self.FontColorLabel, self.ColorLayout)
self.FontSizeLabel = QtGui.QLabel(self.FontGroupBox)
self.FontSizeLabel.setObjectName(u'FontSizeLabel')
self.FontSizeLayout.addWidget(self.FontSizeLabel)
self.FontSizeSpinBox = QtGui.QSpinBox(self.FontSizeWidget)
self.FontSizeSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox')
self.FontSizeLayout.addWidget(self.FontSizeSpinBox)
self.FontSizeSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.FontSizeLayout.addItem(self.FontSizeSpacer)
self.FontLayout.addWidget(self.FontSizeWidget)
self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox)
self.TimeoutWidget.setObjectName(u'TimeoutWidget')
self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget)
self.TimeoutLayout.setSpacing(8)
self.TimeoutLayout.setMargin(0)
self.TimeoutLayout.setObjectName(u'TimeoutLayout')
self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget)
self.FontLayout.addRow(self.FontSizeLabel, self.FontSizeSpinBox)
self.TimeoutLabel = QtGui.QLabel(self.FontGroupBox)
self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.TimeoutLayout.addWidget(self.TimeoutLabel)
self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget)
self.TimeoutSpinBox = QtGui.QSpinBox(self.FontGroupBox)
self.TimeoutSpinBox.setMaximum(180)
self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.TimeoutLayout.addWidget(self.TimeoutSpinBox)
self.TimeoutSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TimeoutLayout.addItem(self.TimeoutSpacer)
self.FontLayout.addWidget(self.TimeoutWidget)
self.LocationWidget = QtGui.QWidget(self.FontGroupBox)
self.LocationWidget.setObjectName(u'LocationWidget')
self.LocationLayout = QtGui.QHBoxLayout(self.LocationWidget)
self.LocationLayout.setSpacing(8)
self.LocationLayout.setMargin(0)
self.LocationLayout.setObjectName(u'LocationLayout')
self.LocationLabel = QtGui.QLabel(self.LocationWidget)
self.FontLayout.addRow(self.TimeoutLabel, self.TimeoutSpinBox)
self.LocationLabel = QtGui.QLabel(self.FontGroupBox)
self.LocationLabel.setObjectName(u'LocationLabel')
self.LocationLayout.addWidget(self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.LocationWidget)
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox = QtGui.QComboBox(self.FontGroupBox)
self.LocationComboBox.addItems([u'', u'', u''])
self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationLayout.addWidget(self.LocationComboBox)
self.LocationSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.LocationLayout.addItem(self.LocationSpacer)
self.FontLayout.addWidget(self.LocationWidget)
self.SlideLeftLayout.addWidget(self.FontGroupBox)
self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideLeftLayout.addItem(self.SlideLeftSpacer)
self.AlertsLayout.addWidget(self.AlertLeftColumn)
self.AlertRightColumn = QtGui.QWidget(self)
self.AlertRightColumn.setObjectName(u'AlertRightColumn')
self.SlideRightLayout = QtGui.QVBoxLayout(self.AlertRightColumn)
self.SlideRightLayout.setSpacing(8)
self.SlideRightLayout.setMargin(0)
self.SlideRightLayout.setObjectName(u'SlideRightLayout')
self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.PreviewGroupBox.sizePolicy().hasHeightForWidth())
self.PreviewGroupBox.setSizePolicy(sizePolicy)
self.FontLayout.addRow(self.LocationLabel, self.LocationComboBox)
self.leftLayout.addWidget(self.FontGroupBox)
self.leftLayout.addStretch()
self.PreviewGroupBox = QtGui.QGroupBox(self.rightColumn)
self.PreviewGroupBox.setObjectName(u'PreviewGroupBox')
self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox)
self.PreviewLayout.setSpacing(8)
self.PreviewLayout.setMargin(8)
self.PreviewLayout.setObjectName(u'PreviewLayout')
self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
self.FontPreview.setFixedSize(QtCore.QSize(350, 100))
self.FontPreview.setReadOnly(True)
self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
self.FontPreview.setAlignment(
QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.FontPreview.setObjectName(u'FontPreview')
self.PreviewLayout.addWidget(self.FontPreview)
self.SlideRightLayout.addWidget(self.PreviewGroupBox)
self.SlideRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideRightLayout.addItem(self.SlideRightSpacer)
self.AlertsLayout.addWidget(self.AlertRightColumn)
self.rightLayout.addWidget(self.PreviewGroupBox)
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(self.BackgroundColorButton,
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked)
@ -294,4 +214,4 @@ class AlertsTab(SettingsTab):
font.setPointSize(self.font_size)
self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
(self.bg_color, self.font_color))
(self.bg_color, self.font_color))

View File

@ -46,89 +46,51 @@ class BiblesTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'BiblesTab')
self.BibleLayout = QtGui.QHBoxLayout(self)
self.BibleLayout.setSpacing(8)
self.BibleLayout.setMargin(8)
self.BibleLayout.setObjectName(u'BibleLayout')
self.BibleLeftWidget = QtGui.QWidget(self)
self.BibleLeftWidget.setObjectName(u'BibleLeftWidget')
self.BibleLeftLayout = QtGui.QVBoxLayout(self.BibleLeftWidget)
self.BibleLeftLayout.setObjectName(u'BibleLeftLayout')
self.BibleLeftLayout.setSpacing(8)
self.BibleLeftLayout.setMargin(0)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn)
self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox')
self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setMargin(8)
self.VerseDisplayLayout = QtGui.QFormLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout')
self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox')
self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 0, 0, 1, 1)
self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget')
self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget)
self.DisplayStyleLayout.setSpacing(8)
self.DisplayStyleLayout.setMargin(0)
self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout')
self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget)
self.VerseDisplayLayout.addRow(self.NewChaptersCheckBox)
self.DisplayStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel')
self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel)
self.DisplayStyleComboBox = QtGui.QComboBox(self.DisplayStyleWidget)
self.DisplayStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.DisplayStyleComboBox.addItems([u'', u'', u'', u''])
self.DisplayStyleComboBox.setObjectName(u'DisplayStyleComboBox')
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleComboBox.addItem(QtCore.QString())
self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox)
self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 1, 0, 1, 1)
self.LayoutStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.LayoutStyleWidget.setObjectName(u'LayoutStyleWidget')
self.LayoutStyleLayout = QtGui.QHBoxLayout(self.LayoutStyleWidget)
self.LayoutStyleLayout.setSpacing(8)
self.LayoutStyleLayout.setMargin(0)
self.LayoutStyleLayout.setObjectName(u'LayoutStyleLayout')
self.LayoutStyleLabel = QtGui.QLabel(self.LayoutStyleWidget)
self.VerseDisplayLayout.addRow(self.DisplayStyleLabel,
self.DisplayStyleComboBox)
self.LayoutStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel')
self.LayoutStyleLayout.addWidget(self.LayoutStyleLabel)
self.LayoutStyleComboBox = QtGui.QComboBox(self.LayoutStyleWidget)
self.LayoutStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox')
self.LayoutStyleComboBox.addItem(QtCore.QString())
self.LayoutStyleComboBox.addItem(QtCore.QString())
self.LayoutStyleComboBox.addItem(QtCore.QString())
self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox)
self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1)
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
self.BibleThemeLayout.setSpacing(8)
self.BibleThemeLayout.setMargin(0)
self.BibleThemeLayout.setObjectName(u'BibleThemeLayout')
self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget)
self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
self.BibleThemeLayout.addWidget(self.BibleThemeLabel)
self.BibleThemeComboBox = QtGui.QComboBox(self.BibleThemeWidget)
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
self.BibleThemeComboBox.addItem(QtCore.QString())
self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
self.LayoutStyleComboBox.addItems([u'', u'', u''])
self.VerseDisplayLayout.addRow(self.LayoutStyleLabel,
self.LayoutStyleComboBox)
self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox')
self.VerseDisplayLayout.addWidget(self.BibleSecondCheckBox, 3, 0, 1, 1)
self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1)
self.VerseDisplayLayout.addRow(self.BibleSecondCheckBox)
self.BibleThemeLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.BibleThemeLabel.setObjectName(u'BibleThemeLabel')
self.BibleThemeComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox)
self.BibleThemeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.BibleThemeComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.BibleThemeComboBox.addItem(u'')
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
self.VerseDisplayLayout.addRow(self.BibleThemeLabel,
self.BibleThemeComboBox)
self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.ChangeNoteLabel.setWordWrap(True)
self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 5, 0, 1, 1)
self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox)
self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.BibleLeftLayout.addItem(self.BibleLeftSpacer)
self.BibleLayout.addWidget(self.BibleLeftWidget)
self.BibleRightWidget = QtGui.QWidget(self)
self.BibleRightWidget.setObjectName(u'BibleRightWidget')
self.BibleRightLayout = QtGui.QVBoxLayout(self.BibleRightWidget)
self.BibleRightLayout.setObjectName(u'BibleRightLayout')
self.BibleRightLayout.setSpacing(8)
self.BibleRightLayout.setMargin(0)
self.BibleLayout.addWidget(self.BibleRightWidget)
self.VerseDisplayLayout.addRow(self.ChangeNoteLabel)
self.leftLayout.addWidget(self.VerseDisplayGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.rightLayout.addStretch()
# Signals and slots
QtCore.QObject.connect(
self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
@ -251,4 +213,4 @@ class BiblesTab(SettingsTab):
# Not Found.
index = 0
self.bible_theme = u''
self.BibleThemeComboBox.setCurrentIndex(index)
self.BibleThemeComboBox.setCurrentIndex(index)

View File

@ -28,7 +28,7 @@ import logging
import chardet
import re
from PyQt4 import QtCore, QtGui
from PyQt4 import QtCore
from sqlalchemy import Column, ForeignKey, or_, Table, types
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError

View File

@ -212,13 +212,7 @@ class BGExtract(object):
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
send_error_message(u'download')
finally:
if not page:
return None
@ -229,15 +223,26 @@ class BGExtract(object):
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'bibles_download_error')
send_error_message(u'parse')
finally:
if not soup:
return None
Receiver.send_message(u'openlp_process_events')
footnotes = soup.findAll(u'sup', u'footnote')
[footnote.extract() for footnote in footnotes]
if footnotes:
[footnote.extract() for footnote in footnotes]
crossrefs = soup.findAll(u'sup', u'xref')
if crossrefs:
[crossref.extract() for crossref in crossrefs]
cleanup = [(re.compile('\s+'), lambda match: ' ')]
verses = BeautifulSoup(str(soup), markupMassage=cleanup)
content = verses.find(u'div', u'result-text-style-normal')
if not content:
content = verses.find(u'div', u'result-text-style-rtl-serif')
if not content:
log.debug(u'No content found in the BibleGateway response.')
send_error_message(u'parse')
return None
verse_count = len(verses.findAll(u'sup', u'versenum'))
found_count = 0
verse_list = {}
@ -283,13 +288,7 @@ class BSExtract(object):
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
send_error_message(u'download')
finally:
if not page:
return None
@ -298,19 +297,15 @@ class BSExtract(object):
soup = BeautifulSoup(page)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
send_error_message(u'parse')
return None
Receiver.send_message(u'openlp_process_events')
content = None
try:
content = soup.find(u'div', u'content').find(u'div').findAll(u'div')
except:
log.exception(u'No verses found.')
log.exception(u'No verses found in the Bibleserver response.')
send_error_message(u'parse')
finally:
if not content:
return None
@ -356,28 +351,21 @@ class CWExtract(object):
Receiver.send_message(u'openlp_process_events')
except urllib2.URLError:
log.exception(u'The web bible page could not be downloaded.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
send_error_message(u'download')
return None
soup = None
try:
soup = BeautifulSoup(page)
except HTMLParseError:
log.exception(u'BeautifulSoup could not parse the bible page.')
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error '
'continues to occur consider reporting a bug.')
})
send_error_message(u'parse')
return None
Receiver.send_message(u'openlp_process_events')
htmlverses = soup.findAll(u'span', u'versetext')
if not htmlverses:
log.debug(u'No verses found in the CrossWalk response.')
send_error_message(u'parse')
return None
verses = {}
reduce_spaces = re.compile(r'[ ]{2,}')
fix_punctuation = re.compile(r'[ ]+([.,;])')
@ -488,7 +476,7 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblesPlugin', 'No Book Found'),
u'message': translate('BiblesPlugin', 'No matching '
'book could be found in this Bible. Check that you'
'book could be found in this Bible. Check that you '
'have spelled the name of the book correctly.')
})
return []
@ -560,3 +548,20 @@ class HTTPBible(BibleDB):
The chapter whose verses are being counted.
"""
return HTTPBooks.get_verse_count(book, chapter)
def send_error_message(reason):
if reason == u'downoad':
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem downloading your verse selection. Please check your '
'Internet connection, and if this error continues to occur '
'consider reporting a bug.')
})
elif reason == u'parse':
Receiver.send_message(u'openlp_error_message', {
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
'problem extracting your verse selection. If this error continues '
'continues to occur consider reporting a bug.')
})

View File

@ -26,9 +26,9 @@
import logging
from PyQt4 import QtCore, QtGui
from PyQt4 import QtCore
from openlp.core.lib import SettingsManager, translate
from openlp.core.lib import Receiver, SettingsManager, translate
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
@ -257,23 +257,33 @@ class BibleManager(object):
- Genesis 1:1-10,2:1-10
"""
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
if not bible:
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'No Bibles available'),
u'message': translate('BiblesPlugin.BibleManager',
'There are no Bibles currently installed. Please use the '
'Import Wizard to install one or more Bibles.')
})
return None
reflist = parse_reference(versetext)
if reflist:
return self.db_cache[bible].get_verses(reflist)
else:
QtGui.QMessageBox.information(self.parent.mediaItem,
translate('BiblesPlugin.BibleManager',
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'Your scripture '
'reference is either not supported by OpenLP or is invalid. '
'Please make sure your reference conforms to one of the '
'following patterns:\n\n'
u'message': translate('BiblesPlugin.BibleManager',
'Your scripture reference is either not supported by OpenLP '
'or is invalid. Please make sure your reference conforms to '
'one of the following patterns:\n\n'
'Book Chapter\n'
'Book Chapter-Chapter\n'
'Book Chapter:Verse-Verse\n'
'Book Chapter:Verse-Verse,Verse-Verse\n'
'Book Chapter:Verse-Verse,Chapter:Verse-Verse\n'
'Book Chapter:Verse-Chapter:Verse'))
'Book Chapter:Verse-Chapter:Verse')
})
return None
def verse_search(self, bible, second_bible, text):
@ -298,22 +308,25 @@ class BibleManager(object):
second_webbible = self.db_cache[second_bible].get_object(BibleMeta,
u'download source')
if webbible or second_webbible:
QtGui.QMessageBox.information(self.parent.mediaItem,
translate('BiblesPlugin.BibleManager',
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'Web Bible cannot be used'),
translate('BiblesPlugin.BibleManager', 'Text Search is not '
'available with Web Bibles.'))
u'message': translate('BiblesPlugin.BibleManager',
'Text Search is not available with Web Bibles.')
})
return None
if text:
return self.db_cache[bible].verse_search(text)
else:
QtGui.QMessageBox.information(self.parent.mediaItem,
translate('BiblesPlugin.BibleManager',
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'Scripture Reference Error'),
translate('BiblesPlugin.BibleManager', 'You did not enter a '
'search keyword.\nYou can separate different keywords by a '
'space to search for all of your keywords and you can separate '
'them by a comma to search for one of them.'))
u'message': translate('BiblesPlugin.BibleManager',
'You did not enter a search keyword.\n'
'You can separate different keywords by a space to search for '
'all of your keywords and you can separate them by a comma to '
'search for one of them.')
})
return None
def save_meta_data(self, bible, version, copyright, permissions):

View File

@ -56,8 +56,6 @@ class BibleMediaItem(MediaManagerItem):
log.info(u'Bible Media Item loaded')
def __init__(self, parent, plugin, icon):
self.PluginNameShort = u'Bible'
self.pluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView
MediaManagerItem.__init__(self, parent, plugin, icon)
@ -76,184 +74,194 @@ class BibleMediaItem(MediaManagerItem):
self.addToServiceItem = False
def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SearchTabWidget.sizePolicy().hasHeightForWidth())
self.SearchTabWidget.setSizePolicy(sizePolicy)
self.SearchTabWidget.setObjectName(u'SearchTabWidget')
self.searchTabWidget = QtGui.QTabWidget(self)
self.searchTabWidget.setSizePolicy(
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
self.searchTabWidget.setObjectName(u'SearchTabWidget')
# Add the Quick Search tab.
self.QuickTab = QtGui.QWidget()
self.QuickTab.setObjectName(u'QuickTab')
self.QuickLayout = QtGui.QGridLayout(self.QuickTab)
self.QuickLayout.setMargin(2)
self.QuickLayout.setSpacing(4)
self.QuickLayout.setVerticalSpacing(4)
self.QuickLayout.setObjectName(u'QuickLayout')
self.QuickVersionLabel = QtGui.QLabel(self.QuickTab)
self.QuickVersionLabel.setObjectName(u'QuickVersionLabel')
self.QuickLayout.addWidget(self.QuickVersionLabel, 0, 0, 1, 1)
self.QuickVersionComboBox = QtGui.QComboBox(self.QuickTab)
self.QuickVersionComboBox.setSizeAdjustPolicy(
self.quickTab = QtGui.QWidget()
self.quickTab.setObjectName(u'quickTab')
self.quickLayout = QtGui.QFormLayout(self.quickTab)
self.quickLayout.setObjectName(u'quickLayout')
self.quickVersionLabel = QtGui.QLabel(self.quickTab)
self.quickVersionLabel.setObjectName(u'quickVersionLabel')
self.quickVersionComboBox = QtGui.QComboBox(self.quickTab)
self.quickVersionComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.QuickVersionComboBox.setObjectName(u'VersionComboBox')
self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2)
self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab)
self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel')
self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1)
self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab)
self.QuickSecondBibleComboBox.setSizeAdjustPolicy(
self.quickVersionComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.quickVersionComboBox.setObjectName(u'quickVersionComboBox')
self.quickVersionLabel.setBuddy(self.quickVersionComboBox)
self.quickLayout.addRow(self.quickVersionLabel,
self.quickVersionComboBox)
self.quickSecondLabel = QtGui.QLabel(self.quickTab)
self.quickSecondLabel.setObjectName(u'quickSecondLabel')
self.quickSecondComboBox = QtGui.QComboBox(self.quickTab)
self.quickSecondComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.QuickSecondBibleComboBox.setObjectName(u'SecondBible')
self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2)
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel')
self.QuickLayout.addWidget(self.QuickSearchLabel, 2, 0, 1, 1)
self.QuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.QuickSearchComboBox.setObjectName(u'SearchComboBox')
self.QuickLayout.addWidget(self.QuickSearchComboBox, 2, 1, 1, 2)
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel')
self.QuickLayout.addWidget(self.QuickSearchLabel, 3, 0, 1, 1)
self.QuickSearchEdit = QtGui.QLineEdit(self.QuickTab)
self.QuickSearchEdit.setObjectName(u'QuickSearchEdit')
self.QuickLayout.addWidget(self.QuickSearchEdit, 3, 1, 1, 2)
self.QuickClearLabel = QtGui.QLabel(self.QuickTab)
self.QuickClearLabel.setObjectName(u'QuickSearchLabel')
self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1)
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox')
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2)
self.QuickSearchButtonLayout = QtGui.QHBoxLayout()
self.QuickSearchButtonLayout.setMargin(0)
self.QuickSearchButtonLayout.setSpacing(0)
self.QuickSearchButtonLayout.setObjectName(u'QuickSearchButtonLayout')
self.QuickSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.QuickSearchButtonLayout.addItem(self.QuickSearchButtonSpacer)
self.QuickSearchButton = QtGui.QPushButton(self.QuickTab)
self.QuickSearchButton.setObjectName(u'QuickSearchButton')
self.QuickSearchButtonLayout.addWidget(self.QuickSearchButton)
self.QuickLayout.addLayout(self.QuickSearchButtonLayout, 5, 0, 1, 3)
self.QuickMessage = QtGui.QLabel(self.QuickTab)
self.QuickMessage.setObjectName(u'QuickMessage')
self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3)
self.SearchTabWidget.addTab(self.QuickTab,
self.quickSecondComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.quickSecondComboBox.setObjectName(u'quickSecondComboBox')
self.quickSecondLabel.setBuddy(self.quickSecondComboBox)
self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox)
self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab)
self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel')
self.quickSearchComboBox = QtGui.QComboBox(self.quickTab)
self.quickSearchComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.quickSearchComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.quickSearchComboBox.setObjectName(u'quickSearchComboBox')
self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox)
self.quickLayout.addRow(self.quickSearchTypeLabel,
self.quickSearchComboBox)
self.quickSearchLabel = QtGui.QLabel(self.quickTab)
self.quickSearchLabel.setObjectName(u'quickSearchLabel')
self.quickSearchEdit = QtGui.QLineEdit(self.quickTab)
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
self.quickClearLabel = QtGui.QLabel(self.quickTab)
self.quickClearLabel.setObjectName(u'quickClearLabel')
self.quickClearComboBox = QtGui.QComboBox(self.quickTab)
self.quickClearComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.quickClearComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.quickClearComboBox.setObjectName(u'quickClearComboBox')
self.quickLayout.addRow(self.quickClearLabel, self.quickClearComboBox)
self.quickSearchButtonLayout = QtGui.QHBoxLayout()
self.quickSearchButtonLayout.setObjectName(u'quickSearchButtonLayout')
self.quickSearchButtonLayout.addStretch()
self.quickSearchButton = QtGui.QPushButton(self.quickTab)
self.quickSearchButton.setObjectName(u'quickSearchButton')
self.quickSearchButtonLayout.addWidget(self.quickSearchButton)
self.quickLayout.addRow(self.quickSearchButtonLayout)
self.quickMessage = QtGui.QLabel(self.quickTab)
self.quickMessage.setObjectName(u'quickMessage')
self.quickLayout.addRow(self.quickMessage)
self.searchTabWidget.addTab(self.quickTab,
translate('BiblesPlugin.MediaItem', 'Quick'))
QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
# Add the Advanced Search tab.
self.AdvancedTab = QtGui.QWidget()
self.AdvancedTab.setObjectName(u'AdvancedTab')
self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab)
self.AdvancedLayout.setMargin(2)
self.AdvancedLayout.setSpacing(4)
self.AdvancedLayout.setVerticalSpacing(4)
self.AdvancedLayout.setObjectName(u'AdvancedLayout')
self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel')
self.AdvancedLayout.addWidget(self.AdvancedVersionLabel, 0, 0, 1, 1)
self.AdvancedVersionComboBox = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedVersionComboBox.setSizeAdjustPolicy(
self.advancedTab = QtGui.QWidget()
self.advancedTab.setObjectName(u'advancedTab')
self.advancedLayout = QtGui.QGridLayout(self.advancedTab)
self.advancedLayout.setObjectName(u'advancedLayout')
self.advancedVersionLabel = QtGui.QLabel(self.advancedTab)
self.advancedVersionLabel.setObjectName(u'advancedVersionLabel')
self.advancedLayout.addWidget(self.advancedVersionLabel, 0, 0,
QtCore.Qt.AlignRight)
self.advancedVersionComboBox = QtGui.QComboBox(self.advancedTab)
self.advancedVersionComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox')
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2)
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel')
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1)
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy(
self.advancedVersionComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.advancedVersionComboBox.setObjectName(u'advancedVersionComboBox')
self.advancedVersionLabel.setBuddy(self.advancedVersionComboBox)
self.advancedLayout.addWidget(self.advancedVersionComboBox, 0, 1, 1, 2)
self.advancedSecondLabel = QtGui.QLabel(self.advancedTab)
self.advancedSecondLabel.setObjectName(u'advancedSecondLabel')
self.advancedLayout.addWidget(self.advancedSecondLabel, 1, 0,
QtCore.Qt.AlignRight)
self.advancedSecondComboBox = QtGui.QComboBox(self.advancedTab)
self.advancedSecondComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AdvancedSecondBibleComboBox.setObjectName(
u'AdvancedSecondBibleComboBox')
self.AdvancedLayout.addWidget(
self.AdvancedSecondBibleComboBox, 1, 1, 1, 2)
self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel')
self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1)
self.AdvancedBookComboBox = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedBookComboBox.setObjectName(u'AdvancedBookComboBox')
self.AdvancedLayout.addWidget(self.AdvancedBookComboBox, 2, 1, 1, 2)
self.AdvancedChapterLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedChapterLabel.setObjectName(u'AdvancedChapterLabel')
self.AdvancedLayout.addWidget(self.AdvancedChapterLabel, 3, 1, 1, 1)
self.AdvancedVerseLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedVerseLabel.setObjectName(u'AdvancedVerseLabel')
self.AdvancedLayout.addWidget(self.AdvancedVerseLabel, 3, 2, 1, 1)
self.AdvancedFromLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedFromLabel.setObjectName(u'AdvancedFromLabel')
self.AdvancedLayout.addWidget(self.AdvancedFromLabel, 4, 0, 1, 1)
self.AdvancedFromChapter = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedFromChapter.setObjectName(u'AdvancedFromChapter')
self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 4, 1, 1, 1)
self.AdvancedFromVerse = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedFromVerse.setObjectName(u'AdvancedFromVerse')
self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 4, 2, 1, 1)
self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedToLabel.setObjectName(u'AdvancedToLabel')
self.AdvancedLayout.addWidget(self.AdvancedToLabel, 5, 0, 1, 1)
self.AdvancedToChapter = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedToChapter.setObjectName(u'AdvancedToChapter')
self.AdvancedLayout.addWidget(self.AdvancedToChapter, 5, 1, 1, 1)
self.AdvancedToVerse = QtGui.QComboBox(self.AdvancedTab)
self.AdvancedToVerse.setObjectName(u'AdvancedToVerse')
self.AdvancedLayout.addWidget(self.AdvancedToVerse, 5, 2, 1, 1)
self.AdvancedClearLabel = QtGui.QLabel(self.QuickTab)
self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel')
self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 6, 0, 1, 1)
self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearAdvancedSearchComboBox.setObjectName(
u'ClearAdvancedSearchComboBox')
self.AdvancedLayout.addWidget(
self.ClearAdvancedSearchComboBox, 6, 1, 1, 2)
self.AdvancedSearchButtonLayout = QtGui.QHBoxLayout()
self.AdvancedSearchButtonLayout.setMargin(0)
self.AdvancedSearchButtonLayout.setSpacing(0)
self.AdvancedSearchButtonLayout.setObjectName(
u'AdvancedSearchButtonLayout')
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton)
self.AdvancedLayout.addLayout(
self.AdvancedSearchButtonLayout, 7, 0, 1, 3)
self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab)
self.AdvancedMessage.setObjectName(u'AdvancedMessage')
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3)
self.SearchTabWidget.addTab(self.AdvancedTab,
self.advancedSecondComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.advancedSecondComboBox.setObjectName(u'advancedSecondComboBox')
self.advancedSecondLabel.setBuddy(self.advancedSecondComboBox)
self.advancedLayout.addWidget(self.advancedSecondComboBox, 1, 1, 1, 2)
self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
self.advancedBookLabel.setObjectName(u'advancedBookLabel')
self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0,
QtCore.Qt.AlignRight)
self.advancedBookComboBox = QtGui.QComboBox(self.advancedTab)
self.advancedBookComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.advancedBookComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.advancedBookComboBox.setObjectName(u'advancedBookComboBox')
self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
self.advancedLayout.addWidget(self.advancedBookComboBox, 2, 1, 1, 2)
self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
self.advancedChapterLabel.setObjectName(u'advancedChapterLabel')
self.advancedLayout.addWidget(self.advancedChapterLabel, 3, 1)
self.advancedVerseLabel = QtGui.QLabel(self.advancedTab)
self.advancedVerseLabel.setObjectName(u'advancedVerseLabel')
self.advancedLayout.addWidget(self.advancedVerseLabel, 3, 2)
self.advancedFromLabel = QtGui.QLabel(self.advancedTab)
self.advancedFromLabel.setObjectName(u'advancedFromLabel')
self.advancedLayout.addWidget(self.advancedFromLabel, 4, 0,
QtCore.Qt.AlignRight)
self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
self.advancedFromChapter.setObjectName(u'advancedFromChapter')
self.advancedLayout.addWidget(self.advancedFromChapter, 4, 1)
self.advancedFromVerse = QtGui.QComboBox(self.advancedTab)
self.advancedFromVerse.setObjectName(u'advancedFromVerse')
self.advancedLayout.addWidget(self.advancedFromVerse, 4, 2)
self.advancedToLabel = QtGui.QLabel(self.advancedTab)
self.advancedToLabel.setObjectName(u'advancedToLabel')
self.advancedLayout.addWidget(self.advancedToLabel, 5, 0,
QtCore.Qt.AlignRight)
self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
self.advancedToChapter.setObjectName(u'advancedToChapter')
self.advancedLayout.addWidget(self.advancedToChapter, 5, 1)
self.advancedToVerse = QtGui.QComboBox(self.advancedTab)
self.advancedToVerse.setObjectName(u'advancedToVerse')
self.advancedLayout.addWidget(self.advancedToVerse, 5, 2)
self.advancedClearLabel = QtGui.QLabel(self.quickTab)
self.advancedClearLabel.setObjectName(u'advancedClearLabel')
self.advancedLayout.addWidget(self.advancedClearLabel, 6, 0,
QtCore.Qt.AlignRight)
self.advancedClearComboBox = QtGui.QComboBox(self.quickTab)
self.advancedClearComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.advancedClearComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.advancedClearComboBox.setObjectName(u'advancedClearComboBox')
self.advancedClearLabel.setBuddy(self.advancedClearComboBox)
self.advancedLayout.addWidget(self.advancedClearComboBox, 6, 1, 1, 2)
self.advancedSearchButtonLayout = QtGui.QHBoxLayout()
self.advancedSearchButtonLayout.setObjectName(
u'advancedSearchButtonLayout')
self.advancedSearchButtonLayout.addStretch()
self.advancedSearchButton = QtGui.QPushButton(self.advancedTab)
self.advancedSearchButton.setObjectName(u'advancedSearchButton')
self.advancedSearchButtonLayout.addWidget(self.advancedSearchButton)
self.advancedLayout.addLayout(
self.advancedSearchButtonLayout, 7, 0, 1, 3)
self.advancedMessage = QtGui.QLabel(self.advancedTab)
self.advancedMessage.setObjectName(u'advancedMessage')
self.advancedLayout.addWidget(self.advancedMessage, 8, 0, 1, 3)
self.searchTabWidget.addTab(self.advancedTab,
translate('BiblesPlugin.MediaItem', 'Advanced'))
# Add the search tab widget to the page layout.
self.pageLayout.addWidget(self.SearchTabWidget)
self.pageLayout.addWidget(self.searchTabWidget)
# Combo Boxes
QtCore.QObject.connect(self.AdvancedVersionComboBox,
QtCore.QObject.connect(self.advancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
QtCore.QObject.connect(self.AdvancedBookComboBox,
QtCore.QObject.connect(self.advancedBookComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
QtCore.QObject.connect(self.AdvancedFromChapter,
QtCore.QObject.connect(self.advancedFromChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
QtCore.QObject.connect(self.AdvancedFromVerse,
QtCore.QObject.connect(self.advancedFromVerse,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
QtCore.QObject.connect(self.AdvancedToChapter,
QtCore.QObject.connect(self.advancedToChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
QtCore.QObject.connect(self.QuickSearchComboBox,
QtCore.QObject.connect(self.quickSearchComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
QtCore.QObject.connect(self.QuickVersionComboBox,
QtCore.QObject.connect(self.quickVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
# Buttons
QtCore.QObject.connect(self.AdvancedSearchButton,
QtCore.QObject.connect(self.advancedSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton,
QtCore.QObject.connect(self.quickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Other stuff
QtCore.QObject.connect(self.QuickSearchEdit,
QtCore.QObject.connect(self.quickSearchEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
@ -276,59 +284,59 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'configUpdated')
if QtCore.QSettings().value(self.settingsSection + u'/second bibles',
QtCore.QVariant(True)).toBool():
self.AdvancedSecondBibleLabel.setVisible(True)
self.AdvancedSecondBibleComboBox.setVisible(True)
self.QuickSecondVersionLabel.setVisible(True)
self.QuickSecondBibleComboBox.setVisible(True)
self.advancedSecondLabel.setVisible(True)
self.advancedSecondComboBox.setVisible(True)
self.quickSecondLabel.setVisible(True)
self.quickSecondComboBox.setVisible(True)
else:
self.AdvancedSecondBibleLabel.setVisible(False)
self.AdvancedSecondBibleComboBox.setVisible(False)
self.QuickSecondVersionLabel.setVisible(False)
self.QuickSecondBibleComboBox.setVisible(False)
self.advancedSecondLabel.setVisible(False)
self.advancedSecondComboBox.setVisible(False)
self.quickSecondLabel.setVisible(False)
self.quickSecondComboBox.setVisible(False)
def retranslateUi(self):
log.debug(u'retranslateUi')
self.QuickVersionLabel.setText(
self.quickVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:'))
self.QuickSecondVersionLabel.setText(
self.quickSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:'))
self.QuickSearchLabel.setText(
self.quickSearchTypeLabel.setText(
translate('BiblesPlugin.MediaItem', 'Search type:'))
self.QuickSearchLabel.setText(
self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:'))
self.QuickSearchButton.setText(
self.quickSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickClearLabel.setText(
self.quickClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedVersionLabel.setText(
self.advancedVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:'))
self.AdvancedSecondBibleLabel.setText(
self.advancedSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:'))
self.AdvancedBookLabel.setText(
self.advancedBookLabel.setText(
translate('BiblesPlugin.MediaItem', 'Book:'))
self.AdvancedChapterLabel.setText(
self.advancedChapterLabel.setText(
translate('BiblesPlugin.MediaItem', 'Chapter:'))
self.AdvancedVerseLabel.setText(
self.advancedVerseLabel.setText(
translate('BiblesPlugin.MediaItem', 'Verse:'))
self.AdvancedFromLabel.setText(
self.advancedFromLabel.setText(
translate('BiblesPlugin.MediaItem', 'From:'))
self.AdvancedToLabel.setText(
self.advancedToLabel.setText(
translate('BiblesPlugin.MediaItem', 'To:'))
self.AdvancedClearLabel.setText(
self.advancedClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedSearchButton.setText(
self.advancedSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickSearchComboBox.addItem(
self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Verse Search'))
self.QuickSearchComboBox.addItem(
self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Text Search'))
self.ClearQuickSearchComboBox.addItem(
self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearQuickSearchComboBox.addItem(
self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep'))
self.ClearAdvancedSearchComboBox.addItem(
self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearAdvancedSearchComboBox.addItem(
self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep'))
def initialise(self):
@ -340,8 +348,8 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'bible manager initialise complete')
def setQuickMessage(self, text):
self.QuickMessage.setText(text)
self.AdvancedMessage.setText(text)
self.quickMessage.setText(text)
self.advancedMessage.setText(text)
Receiver.send_message(u'openlp_process_events')
# Minor delay to get the events processed.
time.sleep(0.1)
@ -368,12 +376,12 @@ class BibleMediaItem(MediaManagerItem):
def loadBibles(self):
log.debug(u'Loading Bibles')
self.QuickVersionComboBox.clear()
self.QuickSecondBibleComboBox.clear()
self.AdvancedVersionComboBox.clear()
self.AdvancedSecondBibleComboBox.clear()
self.QuickSecondBibleComboBox.addItem(u'')
self.AdvancedSecondBibleComboBox.addItem(u'')
self.quickVersionComboBox.clear()
self.quickSecondComboBox.clear()
self.advancedVersionComboBox.clear()
self.advancedSecondComboBox.clear()
self.quickSecondComboBox.addItem(u'')
self.advancedSecondComboBox.addItem(u'')
# Get all bibles and sort the list.
bibles = self.parent.manager.get_bibles().keys()
bibles.sort()
@ -381,10 +389,10 @@ class BibleMediaItem(MediaManagerItem):
first = True
for bible in bibles:
if bible:
self.QuickVersionComboBox.addItem(bible)
self.QuickSecondBibleComboBox.addItem(bible)
self.AdvancedVersionComboBox.addItem(bible)
self.AdvancedSecondBibleComboBox.addItem(bible)
self.quickVersionComboBox.addItem(bible)
self.quickSecondComboBox.addItem(bible)
self.advancedVersionComboBox.addItem(bible)
self.advancedSecondComboBox.addItem(bible)
if first:
first = False
self.initialiseBible(bible)
@ -406,12 +414,12 @@ class BibleMediaItem(MediaManagerItem):
"""
log.debug(u'initialiseBible %s', bible)
book_data = self.parent.manager.get_books(bible)
self.AdvancedBookComboBox.clear()
self.advancedBookComboBox.clear()
first = True
for book in book_data:
row = self.AdvancedBookComboBox.count()
self.AdvancedBookComboBox.addItem(book[u'name'])
self.AdvancedBookComboBox.setItemData(
row = self.advancedBookComboBox.count()
self.advancedBookComboBox.addItem(book[u'name'])
self.advancedBookComboBox.setItemData(
row, QtCore.QVariant(book[u'chapters']))
if first:
first = False
@ -423,16 +431,16 @@ class BibleMediaItem(MediaManagerItem):
self.chapter_count = chapter_count
verse_count = self.parent.manager.get_verse_count(bible, book, 1)
if verse_count == 0:
self.AdvancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText(
self.advancedSearchButton.setEnabled(False)
self.advancedMessage.setText(
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
else:
self.AdvancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'')
self.adjustComboBox(1, self.chapter_count, self.AdvancedFromChapter)
self.adjustComboBox(1, self.chapter_count, self.AdvancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
self.advancedSearchButton.setEnabled(True)
self.advancedMessage.setText(u'')
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
self.adjustComboBox(1, self.chapter_count, self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.advancedFromVerse)
self.adjustComboBox(1, verse_count, self.advancedToVerse)
def updateAutoCompleter(self):
"""
@ -442,73 +450,73 @@ class BibleMediaItem(MediaManagerItem):
"""
books = []
# We have to do a 'Verse Search'.
if self.QuickSearchComboBox.currentIndex() == 0:
if self.quickSearchComboBox.currentIndex() == 0:
bibles = self.parent.manager.get_bibles()
bible = unicode(self.QuickVersionComboBox.currentText())
bible = unicode(self.quickVersionComboBox.currentText())
if bible:
book_data = bibles[bible].get_books()
books = [book.name for book in book_data]
books.sort()
completer = QtGui.QCompleter(books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.QuickSearchEdit.setCompleter(completer)
self.quickSearchEdit.setCompleter(completer)
def onAdvancedVersionComboBox(self):
self.initialiseBible(
unicode(self.AdvancedVersionComboBox.currentText()))
unicode(self.advancedVersionComboBox.currentText()))
def onAdvancedBookComboBox(self):
item = int(self.AdvancedBookComboBox.currentIndex())
item = int(self.advancedBookComboBox.currentIndex())
self.initialiseChapterVerse(
unicode(self.AdvancedVersionComboBox.currentText()),
unicode(self.AdvancedBookComboBox.currentText()),
self.AdvancedBookComboBox.itemData(item).toInt()[0])
unicode(self.advancedVersionComboBox.currentText()),
unicode(self.advancedBookComboBox.currentText()),
self.advancedBookComboBox.itemData(item).toInt()[0])
def onAdvancedFromVerse(self):
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
if chapter_from == chapter_to:
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
verse_from = int(self.AdvancedFromVerse.currentText())
bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.advancedBookComboBox.currentText())
verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to)
self.adjustComboBox(verse_from, verse_count,
self.AdvancedToVerse, True)
self.advancedToVerse, True)
def onAdvancedToChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText())
bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.advancedFromVerse.currentText())
verse_to = int(self.advancedToVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to)
if chapter_from == chapter_to and verse_from > verse_to:
self.adjustComboBox(verse_from, verse_count, self.AdvancedToVerse)
self.adjustComboBox(verse_from, verse_count, self.advancedToVerse)
else:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
self.adjustComboBox(1, verse_count, self.advancedToVerse)
def onAdvancedFromChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText())
bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.advancedToChapter.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_from)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse)
self.adjustComboBox(1, verse_count, self.advancedFromVerse)
if chapter_from > chapter_to:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse)
self.adjustComboBox(1, verse_count, self.advancedToVerse)
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter)
self.advancedToChapter)
elif chapter_from == chapter_to:
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse, True)
self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.advancedToVerse, True)
else:
self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter, True)
self.advancedToChapter, True)
def adjustComboBox(self, range_from, range_to, combo, restore=False):
"""
@ -541,14 +549,14 @@ class BibleMediaItem(MediaManagerItem):
Does an advanced search and saves the search results.
"""
log.debug(u'Advanced Search Button pressed')
self.AdvancedSearchButton.setEnabled(False)
bible = unicode(self.AdvancedVersionComboBox.currentText())
second_bible = unicode(self.AdvancedSecondBibleComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText())
chapter_from = self.AdvancedFromChapter.currentText()
chapter_to = self.AdvancedToChapter.currentText()
verse_from = self.AdvancedFromVerse.currentText()
verse_to = self.AdvancedToVerse.currentText()
self.advancedSearchButton.setEnabled(False)
bible = unicode(self.advancedVersionComboBox.currentText())
second_bible = unicode(self.advancedSecondComboBox.currentText())
book = unicode(self.advancedBookComboBox.currentText())
chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.advancedToChapter.currentText()
verse_from = self.advancedFromVerse.currentText()
verse_to = self.advancedToVerse.currentText()
verse_separator = get_reference_match(u'sep_v_display')
range_separator = get_reference_match(u'sep_r_display')
verse_range = chapter_from + verse_separator + verse_from + \
@ -558,7 +566,7 @@ class BibleMediaItem(MediaManagerItem):
if second_bible:
self.second_search_results = self.parent.manager.get_verses(
second_bible, versetext)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
if self.advancedClearComboBox.currentIndex() == 0:
self.listView.clear()
if self.listView.count() != 0:
# Check if the first item is a second bible item or not.
@ -578,7 +586,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible)
else:
self.displayResults(bible, second_bible)
self.AdvancedSearchButton.setEnabled(True)
self.advancedSearchButton.setEnabled(True)
def onQuickSearchButton(self):
"""
@ -586,11 +594,11 @@ class BibleMediaItem(MediaManagerItem):
either be "Verse Search" or "Text Search".
"""
log.debug(u'Quick Search Button pressed')
self.QuickSearchButton.setEnabled(False)
bible = unicode(self.QuickVersionComboBox.currentText())
second_bible = unicode(self.QuickSecondBibleComboBox.currentText())
text = unicode(self.QuickSearchEdit.text())
if self.QuickSearchComboBox.currentIndex() == 0:
self.quickSearchButton.setEnabled(False)
bible = unicode(self.quickVersionComboBox.currentText())
second_bible = unicode(self.quickSecondComboBox.currentText())
text = unicode(self.quickSearchEdit.text())
if self.quickSearchComboBox.currentIndex() == 0:
# We are doing a 'Verse Search'.
self.search_results = self.parent.manager.get_verses(bible, text)
if second_bible and self.search_results:
@ -608,7 +616,7 @@ class BibleMediaItem(MediaManagerItem):
verse.verse))
self.second_search_results = \
bibles[second_bible].get_verses(text)
if self.ClearQuickSearchComboBox.currentIndex() == 0:
if self.quickClearComboBox.currentIndex() == 0:
self.listView.clear()
if self.listView.count() != 0 and self.search_results:
bitem = self.listView.item(0)
@ -627,13 +635,14 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible)
elif self.search_results:
self.displayResults(bible, second_bible)
self.QuickSearchButton.setEnabled(True)
self.quickSearchButton.setEnabled(True)
def displayResults(self, bible, second_bible=u''):
"""
Displays the search results in the media manager. All data needed for
further action is saved for/in each row.
"""
verse_separator = get_reference_match(u'sep_v_display')
version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
permissions = self.parent.manager.get_meta_data(bible, u'Permissions')
@ -669,8 +678,8 @@ class BibleMediaItem(MediaManagerItem):
}
except IndexError:
break
bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name,
verse.chapter, verse.verse, version.value,
bible_text = u' %s %d%s%d (%s, %s)' % (verse.book.name,
verse.chapter, verse_separator, verse.verse, version.value,
second_version.value)
else:
vdict = {
@ -688,8 +697,8 @@ class BibleMediaItem(MediaManagerItem):
'second_permissions': QtCore.QVariant(u''),
'second_text': QtCore.QVariant(u'')
}
bible_text = u'%s %d:%d (%s)' % (verse.book.name,
verse.chapter, verse.verse, version.value)
bible_text = u'%s %d%s%d (%s)' % (verse.book.name,
verse.chapter, verse_separator, verse.verse, version.value)
bible_verse = QtGui.QListWidgetItem(bible_text)
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
self.listView.addItem(bible_verse)
@ -716,11 +725,11 @@ class BibleMediaItem(MediaManagerItem):
if len(items) == 0:
return False
bible_text = u''
old_item = None
old_chapter = -1
raw_footer = []
raw_slides = []
raw_title = []
first_item = True
for item in items:
bitem = self.listView.item(item.row())
book = self._decodeQtObject(bitem, 'book')
@ -761,9 +770,8 @@ class BibleMediaItem(MediaManagerItem):
# We have to be 'Continuous'.
else:
bible_text = u'%s %s\u00a0%s\n' % (bible_text, verse_text, text)
if first_item:
if not old_item:
start_item = item
first_item = False
elif self.checkTitle(item, old_item):
raw_title.append(self.formatTitle(start_item, old_item))
start_item = item

View File

@ -43,8 +43,8 @@ Luke,Luke,Luke
John,John,John
Acts,Acts,Acts
Rom,Romans,Rom
1Cor,1 Corinthans,1Cor
2Cor,2 Corinthans,2Cor
1Cor,1 Corinthians,1Cor
2Cor,2 Corinthians,2Cor
Gal,Galatians,Gal
Eph,Ephesians,Eph
Phil,Philippians,Phil

1 Gen Genesis Gen
43 John John John
44 Acts Acts Acts
45 Rom Romans Rom
46 1Cor 1 Corinthans 1 Corinthians 1Cor
47 2Cor 2 Corinthans 2 Corinthians 2Cor
48 Gal Galatians Gal
49 Eph Ephesians Eph
50 Phil Philippians Phil

View File

@ -31,86 +31,73 @@ from openlp.core.lib import build_icon, translate
class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog):
customEditDialog.setObjectName(u'customEditDialog')
customEditDialog.resize(590, 541)
customEditDialog.resize(450, 350)
customEditDialog.setWindowIcon(
build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.gridLayout = QtGui.QGridLayout(customEditDialog)
self.gridLayout.setObjectName(u'gridLayout')
self.horizontalLayout3 = QtGui.QHBoxLayout()
self.horizontalLayout3.setObjectName(u'horizontalLayout3')
self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.titleLayout = QtGui.QHBoxLayout()
self.titleLayout.setObjectName(u'titleLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
self.titleLabel.setObjectName(u'titleLabel')
self.titleLayout.addWidget(self.titleLabel)
self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.titleLabel.setBuddy(self.titleEdit)
self.titleEdit.setObjectName(u'titleEdit')
self.titleLayout.addWidget(self.titleEdit)
self.dialogLayout.addLayout(self.titleLayout)
self.centralLayout = QtGui.QHBoxLayout()
self.centralLayout.setObjectName(u'centralLayout')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.centralLayout.addWidget(self.slideListView)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.buttonLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.buttonLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
self.upButton = QtGui.QPushButton(customEditDialog)
self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
self.downButton.setIcon(build_icon(u':/services/service_down.png'))
self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton)
self.centralLayout.addLayout(self.buttonLayout)
self.dialogLayout.addLayout(self.centralLayout)
self.bottomFormLayout = QtGui.QFormLayout()
self.bottomFormLayout.setObjectName(u'bottomFormLayout')
self.themeLabel = QtGui.QLabel(customEditDialog)
self.themeLabel.setObjectName(u'themeLabel')
self.horizontalLayout3.addWidget(self.themeLabel)
self.themeComboBox = QtGui.QComboBox(customEditDialog)
self.themeLabel.setBuddy(self.themeComboBox)
self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.themeComboBox.setObjectName(u'themeComboBox')
self.horizontalLayout3.addWidget(self.themeComboBox)
self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1)
self.horizontalLayout2 = QtGui.QHBoxLayout()
self.horizontalLayout2.setObjectName(u'horizontalLayout2')
self.themeLabel.setBuddy(self.themeComboBox)
self.bottomFormLayout.addRow(self.themeLabel, self.themeComboBox)
self.creditLabel = QtGui.QLabel(customEditDialog)
self.creditLabel.setObjectName(u'creditLabel')
self.horizontalLayout2.addWidget(self.creditLabel)
self.creditEdit = QtGui.QLineEdit(customEditDialog)
self.creditLabel.setBuddy(self.creditEdit)
self.creditEdit.setObjectName(u'creditEdit')
self.horizontalLayout2.addWidget(self.creditEdit)
self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1)
self.creditLabel.setBuddy(self.creditEdit)
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1)
self.horizontalLayout4 = QtGui.QHBoxLayout()
self.horizontalLayout4.setObjectName(u'horizontalLayout4')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.horizontalLayout4.addWidget(self.slideListView)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.verticalLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.verticalLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.verticalLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.verticalLayout.addWidget(self.deleteButton)
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.upButton = QtGui.QPushButton(customEditDialog)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upButton.setIcon(icon1)
self.upButton.setObjectName(u'upButton')
self.verticalLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.downButton.setIcon(icon2)
self.downButton.setObjectName(u'downButton')
self.verticalLayout.addWidget(self.downButton)
self.horizontalLayout4.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
self.titleLabel.setObjectName(u'titleLabel')
self.horizontalLayout.addWidget(self.titleLabel)
self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.titleLabel.setBuddy(self.titleEdit)
self.titleEdit.setObjectName(u'titleEdit')
self.horizontalLayout.addWidget(self.titleEdit)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customEditDialog.accept)
@ -152,4 +139,4 @@ class Ui_CustomEditDialog(object):
self.themeLabel.setText(
translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.creditLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Credits:'))
translate('CustomPlugin.EditCustomForm', '&Credits:'))

View File

@ -31,19 +31,20 @@ from openlp.core.lib import translate, SpellTextEdit
class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog):
customSlideEditDialog.setObjectName(u'customSlideEditDialog')
customSlideEditDialog.resize(474, 442)
customSlideEditDialog.resize(350, 300)
self.dialogLayout = QtGui.QVBoxLayout(customSlideEditDialog)
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit)
self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog)
self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox')
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349))
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27))
self.splitButton.setObjectName(u'splitButton')
self.buttonBox.addButton(self.splitButton,
QtGui.QDialogButtonBox.ActionRole)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customSlideEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customSlideEditDialog.accept)
@ -56,4 +57,4 @@ class Ui_CustomSlideEditDialog(object):
translate('CustomPlugin.EditCustomForm', 'Split Slide'))
self.splitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
'by inserting a slide splitter.'))
'by inserting a slide splitter.'))

View File

@ -37,21 +37,17 @@ class CustomTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'CustomTab')
self.customLayout = QtGui.QFormLayout(self)
self.customLayout.setSpacing(8)
self.customLayout.setMargin(8)
self.customLayout.setObjectName(u'customLayout')
self.customModeGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.customModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.customModeGroupBox.setObjectName(u'customModeGroupBox')
self.customModeLayout = QtGui.QVBoxLayout(self.customModeGroupBox)
self.customModeLayout.setSpacing(8)
self.customModeLayout.setMargin(8)
self.customModeLayout = QtGui.QFormLayout(self.customModeGroupBox)
self.customModeLayout.setObjectName(u'customModeLayout')
self.displayFooterCheckBox = QtGui.QCheckBox(self.customModeGroupBox)
self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox')
self.customModeLayout.addWidget(self.displayFooterCheckBox)
self.customLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.customModeGroupBox)
self.customModeLayout.addRow(self.displayFooterCheckBox)
self.leftLayout.addWidget(self.customModeGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.displayFooterCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onDisplayFooterCheckBoxChanged)
@ -76,4 +72,4 @@ class CustomTab(SettingsTab):
def save(self):
QtCore.QSettings().setValue(self.settingsSection + u'/display footer',
QtCore.QVariant(self.displayFooter))
QtCore.QVariant(self.displayFooter))

View File

@ -30,8 +30,8 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected
ItemCapabilities, SettingsManager, translate, check_item_selected, \
Receiver, check_directory_exists
from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__)
@ -63,6 +63,14 @@ class ImageMediaItem(MediaManagerItem):
file_formats = get_images_filter()
self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
unicode(translate('ImagePlugin.MediaItem', 'All Files')))
self.replaceAction.setText(
translate('ImagePlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Replace Live Background'))
self.resetAction.setText(
translate('ImagePlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -80,43 +88,21 @@ class ImageMediaItem(MediaManagerItem):
self.servicePath = os.path.join(
AppLocation.get_section_data_path(self.settingsSection),
u'thumbnails')
if not os.path.exists(self.servicePath):
os.mkdir(self.servicePath)
check_directory_exists(self.servicePath)
self.loadList(SettingsManager.load_list(
self.settingsSection, self.settingsSection))
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction(
context_menu_action(
self.listView, u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
self.listView.addAction(self.replaceAction)
def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False)
self.resetButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Reset Background'),
u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout.
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
self.replaceAction = self.addToolbarButton(u'', u'',
u':/slides/slide_blank.png', self.onReplaceClick, False)
self.resetAction = self.addToolbarButton(u'', u'',
u':/system/system_close.png', self.onResetClick, False)
self.resetAction.setVisible(False)
def onDeleteClick(self):
"""
@ -204,10 +190,13 @@ class ImageMediaItem(MediaManagerItem):
return False
def onResetClick(self):
self.resetButton.setVisible(False)
self.resetAction.setVisible(False)
self.parent.liveController.display.resetImage()
def onReplaceClick(self):
"""
Called to replace Live backgound with the video selected
"""
if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')):
@ -217,13 +206,14 @@ class ImageMediaItem(MediaManagerItem):
if os.path.exists(filename):
(path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
else:
QtGui.QMessageBox.critical(self,
translate('ImagePlugin.MediaItem', 'Live Background Could '
'Not Be Replaced'),
unicode(translate('ImagePlugin.MediaItem',
'The image %s no longer exists.')) % filename)
self.resetButton.setVisible(True)
Receiver.send_message(u'openlp_error_message', {
u'title': translate('ImagePlugin.MediaItem',
'Live Background Error'),
u'message': unicode(translate('ImagePlugin.MediaItem',
'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename})
def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self)
MediaManagerItem.onPreviewClick(self)

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
ItemCapabilities, SettingsManager, translate, check_item_selected, \
context_menu_action
Receiver
log = logging.getLogger(__name__)
@ -63,6 +63,14 @@ class MediaMediaItem(MediaManagerItem):
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;All files (*)')) % \
(self.parent.video_list, self.parent.audio_list)
self.replaceAction.setText(
translate('MediaPlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('MediaPlugin.MediaItem', 'Replace Live Background'))
self.resetAction.setText(
translate('MediaPlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -73,47 +81,37 @@ class MediaMediaItem(MediaManagerItem):
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction(
context_menu_action(self.listView, u':/slides/slide_blank.png',
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
self.listView.addAction(self.replaceAction)
def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
# Replace backgrounds do not work at present so remove functionality.
self.blankButton = self.toolbar.addToolbarButton(
translate('MediaPlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False)
self.resetButton = self.toolbar.addToolbarButton(
u'Reset Background', u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
self.replaceAction = self.addToolbarButton(u'', u'',
u':/slides/slide_blank.png', self.onReplaceClick, False)
self.resetAction = self.addToolbarButton(u'', u'',
u':/system/system_close.png', self.onResetClick, False)
self.resetAction.setVisible(False)
def onResetClick(self):
self.resetButton.setVisible(False)
self.resetAction.setVisible(False)
self.parent.liveController.display.resetVideo()
def onReplaceClick(self):
if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem',
translate('MediaPlugin.MediaItem',
'You must select a media file to replace the background with.')):
item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
self.parent.liveController.display.video(filename, 0, True)
self.resetButton.setVisible(True)
if os.path.exists(filename):
(path, name) = os.path.split(filename)
self.parent.liveController.display.video(filename, 0, True)
self.resetAction.setVisible(True)
else:
Receiver.send_message(u'openlp_error_message', {
u'title': translate('MediaPlugin.MediaItem',
'Live Background Error'),
u'message': unicode(translate('MediaPlugin.MediaItem',
'There was a problem replacing your background, '
'the media file "%s" no longer exists.')) % filename})
def generateSlideData(self, service_item, item=None, xmlVersion=False):
if item is None:

View File

@ -37,27 +37,23 @@ class MediaTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'MediaTab')
self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media')
self.mediaLayout = QtGui.QFormLayout(self)
self.mediaLayout.setSpacing(8)
self.mediaLayout.setMargin(8)
self.mediaLayout.setObjectName(u'mediaLayout')
self.mediaModeGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.mediaModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.mediaModeGroupBox.setObjectName(u'mediaModeGroupBox')
self.mediaModeLayout = QtGui.QVBoxLayout(self.mediaModeGroupBox)
self.mediaModeLayout.setSpacing(8)
self.mediaModeLayout.setMargin(8)
self.mediaModeLayout = QtGui.QFormLayout(self.mediaModeGroupBox)
self.mediaModeLayout.setObjectName(u'mediaModeLayout')
self.usePhononCheckBox = QtGui.QCheckBox(self.mediaModeGroupBox)
self.usePhononCheckBox.setObjectName(u'usePhononCheckBox')
self.mediaModeLayout.addWidget(self.usePhononCheckBox)
self.mediaLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.mediaModeGroupBox)
self.mediaModeLayout.addRow(self.usePhononCheckBox)
self.leftLayout.addWidget(self.mediaModeGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.usePhononCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onUsePhononCheckBoxChanged)
def retranslateUi(self):
self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media')
self.mediaModeGroupBox.setTitle(translate('MediaPlugin.MediaTab',
'Media Display'))
self.usePhononCheckBox.setText(
@ -79,4 +75,4 @@ class MediaTab(SettingsTab):
if oldUsePhonon != self.usePhonon:
QtCore.QSettings().setValue(self.settingsSection + u'/use phonon',
QtCore.QVariant(self.usePhonon))
Receiver.send_message(u'config_screen_changed')
Receiver.send_message(u'config_screen_changed')

View File

@ -79,7 +79,7 @@ class MediaPlugin(Plugin):
return MediaTab(self.name)
def getMediaManagerItem(self):
# Create the MediaManagerItem object
# Create the MediaManagerItem object.
return MediaMediaItem(self, self, self.icon)
def about(self):

View File

@ -76,6 +76,8 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic')
self.displayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
def buildFileMaskString(self):
"""
@ -106,27 +108,24 @@ class PresentationMediaItem(MediaManagerItem):
"""
Display custom media manager items for presentations
"""
self.PresentationWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.PresentationWidget.sizePolicy().hasHeightForWidth())
self.PresentationWidget.setSizePolicy(sizePolicy)
self.PresentationWidget.setObjectName(u'PresentationWidget')
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget)
self.DisplayLayout.setObjectName(u'DisplayLayout')
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget)
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox')
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2)
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
self.presentationWidget = QtGui.QWidget(self)
self.presentationWidget.setObjectName(u'presentationWidget')
self.displayLayout = QtGui.QFormLayout(self.presentationWidget)
self.displayLayout.setMargin(self.displayLayout.spacing())
self.displayLayout.setObjectName(u'displayLayout')
self.displayTypeLabel = QtGui.QLabel(self.presentationWidget)
self.displayTypeLabel.setObjectName(u'displayTypeLabel')
self.displayTypeComboBox = QtGui.QComboBox(self.presentationWidget)
self.displayTypeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.displayTypeComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.displayTypeComboBox.setObjectName(u'displayTypeComboBox')
self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
self.displayLayout.addRow(self.displayTypeLabel,
self.displayTypeComboBox)
# Add the Presentation widget to the page layout
self.pageLayout.addWidget(self.PresentationWidget)
self.pageLayout.addWidget(self.presentationWidget)
def initialise(self):
"""
@ -151,19 +150,19 @@ class PresentationMediaItem(MediaManagerItem):
Load the combobox with the enabled presentation controllers,
allowing user to select a specific app if settings allow
"""
self.DisplayTypeComboBox.clear()
self.displayTypeComboBox.clear()
for item in self.controllers:
# load the drop down selection
if self.controllers[item].enabled():
self.DisplayTypeComboBox.addItem(item)
if self.DisplayTypeComboBox.count() > 1:
self.DisplayTypeComboBox.insertItem(0, self.Automatic)
self.DisplayTypeComboBox.setCurrentIndex(0)
self.displayTypeComboBox.addItem(item)
if self.displayTypeComboBox.count() > 1:
self.displayTypeComboBox.insertItem(0, self.Automatic)
self.displayTypeComboBox.setCurrentIndex(0)
if QtCore.QSettings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
self.PresentationWidget.show()
self.presentationWidget.show()
else:
self.PresentationWidget.hide()
self.presentationWidget.hide()
def loadList(self, list, initialLoad=False):
"""
@ -247,8 +246,8 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes()
if len(items) > 1:
return False
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
service_item.title = unicode(self.displayTypeComboBox.currentText())
service_item.shortname = unicode(self.displayTypeComboBox.currentText())
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
shortname = service_item.shortname
if shortname:

View File

@ -44,76 +44,47 @@ class PresentationTab(SettingsTab):
Create the controls for the settings tab
"""
self.setObjectName(u'PresentationTab')
self.PresentationLayout = QtGui.QHBoxLayout(self)
self.PresentationLayout.setSpacing(8)
self.PresentationLayout.setMargin(8)
self.PresentationLayout.setObjectName(u'PresentationLayout')
self.PresentationLeftWidget = QtGui.QWidget(self)
self.PresentationLeftWidget.setObjectName(u'PresentationLeftWidget')
self.PresentationLeftLayout = QtGui.QVBoxLayout(
self.PresentationLeftWidget)
self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout')
self.PresentationLeftLayout.setSpacing(8)
self.PresentationLeftLayout.setMargin(0)
self.VerseDisplayGroupBox = QtGui.QGroupBox(self)
self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox')
self.VerseDisplayLayout = QtGui.QVBoxLayout(self.VerseDisplayGroupBox)
self.VerseDisplayLayout.setMargin(8)
self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout')
SettingsTab.setupUi(self)
self.ControllersGroupBox = QtGui.QGroupBox(self.leftColumn)
self.ControllersGroupBox.setObjectName(u'ControllersGroupBox')
self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox)
self.ControllersLayout.setObjectName(u'ControllersLayout')
self.PresenterCheckboxes = {}
for key in self.controllers:
controller = self.controllers[key]
checkbox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
checkbox.setTristate(False)
checkbox = QtGui.QCheckBox(self.ControllersGroupBox)
checkbox.setEnabled(controller.available)
checkbox.setObjectName(controller.name + u'CheckBox')
self.PresenterCheckboxes[controller.name] = checkbox
self.VerseDisplayLayout.addWidget(checkbox)
self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget')
self.PresentationThemeLayout = QtGui.QHBoxLayout(
self.PresentationThemeWidget)
self.PresentationThemeLayout.setSpacing(8)
self.PresentationThemeLayout.setMargin(0)
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
self.AdvancedGroupBox = QtGui.QGroupBox(self)
self.ControllersLayout.addWidget(checkbox)
self.leftLayout.addWidget(self.ControllersGroupBox)
self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn)
self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox')
self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox)
self.AdvancedLayout.setSpacing(8)
self.AdvancedLayout.setMargin(8)
self.AdvancedLayout.setObjectName(u'AdvancedLayout')
self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox)
self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox')
self.AdvancedLayout.addWidget(self.OverrideAppCheckBox)
self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox)
self.PresentationLeftLayout.addWidget(self.AdvancedGroupBox)
self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
self.PresentationLayout.addWidget(self.PresentationLeftWidget)
self.PresentationRightWidget = QtGui.QWidget(self)
self.PresentationRightWidget.setObjectName(u'PresentationRightWidget')
self.PresentationRightLayout = QtGui.QVBoxLayout(
self.PresentationRightWidget)
self.PresentationRightLayout.setObjectName(u'PresentationRightLayout')
self.PresentationRightLayout.setSpacing(8)
self.PresentationRightLayout.setMargin(0)
self.PresentationRightSpacer = QtGui.QSpacerItem(50, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.PresentationRightLayout.addItem(self.PresentationRightSpacer)
self.PresentationLayout.addWidget(self.PresentationRightWidget)
self.leftLayout.addWidget(self.AdvancedGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
def retranslateUi(self):
"""
Make any translation changes
"""
self.VerseDisplayGroupBox.setTitle(
self.ControllersGroupBox.setTitle(
translate('PresentationPlugin.PresentationTab',
'Available Controllers'))
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setText(controller.name)
if controller.available:
checkbox.setText(controller.name)
else:
checkbox.setText(
unicode(translate('PresentationPlugin.PresentationTab',
'%s (unvailable)')) % controller.name)
self.AdvancedGroupBox.setTitle(
translate('PresentationPlugin.PresentationTab',
'Advanced'))
@ -127,11 +98,10 @@ class PresentationTab(SettingsTab):
"""
for key in self.controllers:
controller = self.controllers[key]
if controller.available:
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(QtCore.QSettings().value(
self.settingsSection + u'/' + controller.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
checkbox = self.PresenterCheckboxes[controller.name]
checkbox.setChecked(QtCore.QSettings().value(
self.settingsSection + u'/' + controller.name,
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value(
self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
@ -143,16 +113,18 @@ class PresentationTab(SettingsTab):
changed = False
for key in self.controllers:
controller = self.controllers[key]
checkbox = self.PresenterCheckboxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name
if QtCore.QSettings().value(setting_key) != checkbox.checkState():
changed = True
QtCore.QSettings().setValue(setting_key,
QtCore.QVariant(checkbox.checkState()))
if checkbox.checkState() == QtCore.Qt.Checked:
controller.start_process()
else:
controller.kill()
if controller.available:
checkbox = self.PresenterCheckboxes[controller.name]
setting_key = self.settingsSection + u'/' + controller.name
if QtCore.QSettings().value(setting_key) != \
checkbox.checkState():
changed = True
QtCore.QSettings().setValue(setting_key,
QtCore.QVariant(checkbox.checkState()))
if checkbox.isChecked():
controller.start_process()
else:
controller.kill()
setting_key = self.settingsSection + u'/override app'
if QtCore.QSettings().value(setting_key) != \
self.OverrideAppCheckBox.checkState():
@ -160,4 +132,4 @@ class PresentationTab(SettingsTab):
QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
changed = True
if changed:
Receiver.send_message(u'mediaitem_presentation_rebuild')
Receiver.send_message(u'mediaitem_presentation_rebuild')

View File

@ -37,34 +37,38 @@ class RemoteTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'RemoteTab')
self.remoteLayout = QtGui.QFormLayout(self)
self.remoteLayout.setSpacing(8)
self.remoteLayout.setMargin(8)
self.remoteLayout.setObjectName(u'remoteLayout')
self.serverSettingsGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.serverSettingsGroupBox = QtGui.QGroupBox(self.leftColumn)
self.serverSettingsGroupBox.setObjectName(u'serverSettingsGroupBox')
self.serverSettingsLayout = QtGui.QFormLayout(
self.serverSettingsGroupBox)
self.serverSettingsLayout.setSpacing(8)
self.serverSettingsLayout.setMargin(8)
self.serverSettingsLayout.setObjectName(u'serverSettingsLayout')
self.addressLabel = QtGui.QLabel(self.serverSettingsGroupBox)
self.addressLabel.setObjectName(u'addressLabel')
self.addressEdit = QtGui.QLineEdit(self.serverSettingsGroupBox)
self.addressEdit.setSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
self.addressEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(
u'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self))
self.addressEdit.setObjectName(u'addressEdit')
self.serverSettingsLayout.addRow(
translate('RemotePlugin.RemoteTab', 'Serve on IP address:'),
self.addressEdit)
self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit)
self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox)
self.portLabel.setObjectName(u'portLabel')
self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox)
self.portSpinBox.setObjectName(u'portSpinBox')
self.portSpinBox.setMaximum(32767)
self.serverSettingsLayout.addRow(
translate('RemotePlugin.RemoteTab', 'Port number:'),
self.portSpinBox)
self.remoteLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.serverSettingsGroupBox)
self.portSpinBox.setObjectName(u'portSpinBox')
self.serverSettingsLayout.addRow(self.portLabel, self.portSpinBox)
self.leftLayout.addWidget(self.serverSettingsGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
def retranslateUi(self):
self.serverSettingsGroupBox.setTitle(
translate('RemotePlugin.RemoteTab', 'Server Settings'))
self.addressLabel.setText(translate('RemotePlugin.RemoteTab',
'Serve on IP address:'))
self.portLabel.setText(translate('RemotePlugin.RemoteTab',
'Port number:'))
def load(self):
self.portSpinBox.setValue(
@ -78,4 +82,4 @@ class RemoteTab(SettingsTab):
QtCore.QSettings().setValue(self.settingsSection + u'/port',
QtCore.QVariant(self.portSpinBox.value()))
QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
QtCore.QVariant(self.addressEdit.text()))
QtCore.QVariant(self.addressEdit.text()))

View File

@ -29,58 +29,51 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_AuthorsDialog(object):
def setupUi(self, AuthorsDialog):
AuthorsDialog.setObjectName(u'AuthorsDialog')
AuthorsDialog.resize(393, 147)
self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog)
self.AuthorsLayout.setMargin(8)
self.AuthorsLayout.setSpacing(8)
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.FirstNameLabel = QtGui.QLabel(AuthorsDialog)
self.FirstNameLabel.setObjectName(u'FirstNameLabel')
self.AuthorsLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.FirstNameLabel)
self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog)
self.FirstNameEdit.setObjectName(u'FirstNameEdit')
self.AuthorsLayout.setWidget(0,
QtGui.QFormLayout.FieldRole, self.FirstNameEdit)
self.LastNameLabel = QtGui.QLabel(AuthorsDialog)
self.LastNameLabel.setObjectName(u'LastNameLabel')
self.AuthorsLayout.setWidget(1,
QtGui.QFormLayout.LabelRole, self.LastNameLabel)
self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog)
self.LastNameEdit.setObjectName(u'LastNameEdit')
self.AuthorsLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.LastNameEdit)
self.DisplayLabel = QtGui.QLabel(AuthorsDialog)
self.DisplayLabel.setObjectName(u'DisplayLabel')
self.AuthorsLayout.setWidget(2,
QtGui.QFormLayout.LabelRole, self.DisplayLabel)
self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog)
self.DisplayEdit.setObjectName(u'DisplayEdit')
self.AuthorsLayout.setWidget(2,
QtGui.QFormLayout.FieldRole, self.DisplayEdit)
self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog)
self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.AuthorButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.AuthorButtonBox.setObjectName(u'AuthorButtonBox')
self.AuthorsLayout.setWidget(3,
QtGui.QFormLayout.FieldRole, self.AuthorButtonBox)
def setupUi(self, authorsDialog):
authorsDialog.setObjectName(u'AuthorsDialog')
authorsDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.authorLayout = QtGui.QFormLayout()
self.authorLayout.setObjectName(u'authorLayout')
self.firstNameLabel = QtGui.QLabel(authorsDialog)
self.firstNameLabel.setObjectName(u'firstNameLabel')
self.firstNameEdit = QtGui.QLineEdit(authorsDialog)
self.firstNameEdit.setObjectName(u'firstNameEdit')
self.firstNameLabel.setBuddy(self.firstNameEdit)
self.authorLayout.addRow(self.firstNameLabel, self.firstNameEdit)
self.lastNameLabel = QtGui.QLabel(authorsDialog)
self.lastNameLabel.setObjectName(u'lastNameLabel')
self.lastNameEdit = QtGui.QLineEdit(authorsDialog)
self.lastNameEdit.setObjectName(u'lastNameEdit')
self.lastNameLabel.setBuddy(self.lastNameEdit)
self.authorLayout.addRow(self.lastNameLabel, self.lastNameEdit)
self.displayLabel = QtGui.QLabel(authorsDialog)
self.displayLabel.setObjectName(u'displayLabel')
self.displayEdit = QtGui.QLineEdit(authorsDialog)
self.displayEdit.setObjectName(u'displayEdit')
self.displayLabel.setBuddy(self.displayEdit)
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.dialogLayout.addLayout(self.authorLayout)
self.buttonBox = QtGui.QDialogButtonBox(authorsDialog)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(authorsDialog)
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), authorsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), authorsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(authorsDialog)
self.retranslateUi(AuthorsDialog)
QtCore.QObject.connect(self.AuthorButtonBox,
QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept)
QtCore.QObject.connect(self.AuthorButtonBox,
QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AuthorsDialog)
def retranslateUi(self, AuthorsDialog):
AuthorsDialog.setWindowTitle(
def retranslateUi(self, authorsDialog):
authorsDialog.setWindowTitle(
translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
self.DisplayLabel.setText(
self.displayLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.FirstNameLabel.setText(
self.firstNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'First name:'))
self.LastNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Last name:'))
self.lastNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Last name:'))

View File

@ -40,36 +40,36 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self._autoDisplayName = False
QtCore.QObject.connect(self.FirstNameEdit,
QtCore.QObject.connect(self.firstNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'),
self.onFirstNameEditTextEdited)
QtCore.QObject.connect(self.LastNameEdit,
QtCore.QObject.connect(self.lastNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'),
self.onLastNameEditTextEdited)
def exec_(self, clear=True):
if clear:
self.FirstNameEdit.clear()
self.LastNameEdit.clear()
self.DisplayEdit.clear()
self.FirstNameEdit.setFocus()
self.firstNameEdit.clear()
self.lastNameEdit.clear()
self.displayEdit.clear()
self.firstNameEdit.setFocus()
return QtGui.QDialog.exec_(self)
def onFirstNameEditTextEdited(self, text):
if not self._autoDisplayName:
return
display_name = text
if self.LastNameEdit.text() != u'':
display_name = display_name + u' ' + self.LastNameEdit.text()
self.DisplayEdit.setText(display_name)
if self.lastNameEdit.text() != u'':
display_name = display_name + u' ' + self.lastNameEdit.text()
self.displayEdit.setText(display_name)
def onLastNameEditTextEdited(self, text):
if not self._autoDisplayName:
return
display_name = text
if self.FirstNameEdit.text() != u'':
display_name = self.FirstNameEdit.text() + u' ' + display_name
self.DisplayEdit.setText(display_name)
if self.firstNameEdit.text() != u'':
display_name = self.firstNameEdit.text() + u' ' + display_name
self.displayEdit.setText(display_name)
def autoDisplayName(self):
return self._autoDisplayName
@ -78,21 +78,21 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
self._autoDisplayName = on
def accept(self):
if not self.FirstNameEdit.text():
if not self.firstNameEdit.text():
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the first name of the author.'))
self.FirstNameEdit.setFocus()
self.firstNameEdit.setFocus()
return False
elif not self.LastNameEdit.text():
elif not self.lastNameEdit.text():
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the last name of the author.'))
self.LastNameEdit.setFocus()
self.lastNameEdit.setFocus()
return False
elif not self.DisplayEdit.text():
elif not self.displayEdit.text():
if QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
@ -101,11 +101,11 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
) == QtGui.QMessageBox.Yes:
self.DisplayEdit.setText(self.FirstNameEdit.text() + \
u' ' + self.LastNameEdit.text())
self.displayEdit.setText(self.firstNameEdit.text() + \
u' ' + self.lastNameEdit.text())
return QtGui.QDialog.accept(self)
else:
self.DisplayEdit.setFocus()
self.displayEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)
return QtGui.QDialog.accept(self)

View File

@ -29,445 +29,312 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
class Ui_EditSongDialog(object):
def setupUi(self, EditSongDialog):
EditSongDialog.setObjectName(u'EditSongDialog')
EditSongDialog.resize(645, 417)
icon = build_icon(u':/icon/openlp.org-icon-32.bmp')
EditSongDialog.setWindowIcon(icon)
EditSongDialog.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(EditSongDialog)
self.verticalLayout.setMargin(8)
self.verticalLayout.setObjectName(u'verticalLayout')
self.SongTabWidget = QtGui.QTabWidget(EditSongDialog)
self.SongTabWidget.setObjectName(u'SongTabWidget')
self.LyricsTab = QtGui.QWidget()
self.LyricsTab.setObjectName(u'LyricsTab')
self.LyricsTabLayout = QtGui.QGridLayout(self.LyricsTab)
self.LyricsTabLayout.setMargin(8)
self.LyricsTabLayout.setSpacing(8)
self.LyricsTabLayout.setObjectName(u'LyricsTabLayout')
self.TitleLabel = QtGui.QLabel(self.LyricsTab)
self.TitleLabel.setObjectName(u'TitleLabel')
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1)
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab)
self.TitleLabel.setBuddy(self.TitleEditItem)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TitleEditItem.sizePolicy().hasHeightForWidth())
self.TitleEditItem.setSizePolicy(sizePolicy)
self.TitleEditItem.setObjectName(u'TitleEditItem')
self.LyricsTabLayout.addWidget(self.TitleEditItem, 0, 1, 1, 2)
self.AlternativeTitleLabel = QtGui.QLabel(self.LyricsTab)
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel')
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1)
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab)
self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit)
self.AlternativeEdit.setObjectName(u'AlternativeEdit')
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2)
self.LyricsLabel = QtGui.QLabel(self.LyricsTab)
self.LyricsLabel.setAlignment(
QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
self.LyricsLabel.setBuddy(self.VerseListWidget)
self.VerseListWidget.setColumnCount(1)
self.VerseListWidget.horizontalHeader().setVisible(False)
self.VerseListWidget.setSelectionBehavior(1)
self.VerseListWidget.setEditTriggers(
def setupUi(self, editSongDialog):
editSongDialog.setObjectName(u'editSongDialog')
editSongDialog.resize(650, 400)
editSongDialog.setWindowIcon(
build_icon(u':/icon/openlp.org-icon-32.bmp'))
editSongDialog.setModal(True)
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.songTabWidget = QtGui.QTabWidget(editSongDialog)
self.songTabWidget.setObjectName(u'songTabWidget')
# lyrics tab
self.lyricsTab = QtGui.QWidget()
self.lyricsTab.setObjectName(u'lyricsTab')
self.lyricsTabLayout = QtGui.QGridLayout(self.lyricsTab)
self.lyricsTabLayout.setObjectName(u'lyricsTabLayout')
self.titleLabel = QtGui.QLabel(self.lyricsTab)
self.titleLabel.setObjectName(u'titleLabel')
self.lyricsTabLayout.addWidget(self.titleLabel, 0, 0)
self.titleEdit = QtGui.QLineEdit(self.lyricsTab)
self.titleEdit.setObjectName(u'titleEdit')
self.titleLabel.setBuddy(self.titleEdit)
self.lyricsTabLayout.addWidget(self.titleEdit, 0, 1, 1, 2)
self.alternativeTitleLabel = QtGui.QLabel(self.lyricsTab)
self.alternativeTitleLabel.setObjectName(u'alternativeTitleLabel')
self.lyricsTabLayout.addWidget(self.alternativeTitleLabel, 1, 0)
self.alternativeEdit = QtGui.QLineEdit(self.lyricsTab)
self.alternativeEdit.setObjectName(u'alternativeEdit')
self.alternativeTitleLabel.setBuddy(self.alternativeEdit)
self.lyricsTabLayout.addWidget(self.alternativeEdit, 1, 1, 1, 2)
self.lyricsLabel = QtGui.QLabel(self.lyricsTab)
self.lyricsLabel.setFixedHeight(self.titleEdit.sizeHint().height())
self.lyricsLabel.setObjectName(u'lyricsLabel')
self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
QtCore.Qt.AlignTop)
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
self.verseListWidget.horizontalHeader().setVisible(False)
self.verseListWidget.setAlternatingRowColors(True)
self.verseListWidget.setColumnCount(1)
self.verseListWidget.setSelectionBehavior(
QtGui.QAbstractItemView.SelectRows)
self.verseListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers)
self.VerseListWidget.setAlternatingRowColors(True)
self.VerseListWidget.setObjectName(u'VerseListWidget')
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1)
self.VerseOrderLabel = QtGui.QLabel(self.LyricsTab)
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel')
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1)
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab)
self.VerseOrderLabel.setBuddy(self.VerseOrderEdit)
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit')
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2)
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab)
self.VerseButtonWidget.setObjectName(u'VerseButtonWidget')
self.VerseButtonsLayout = QtGui.QVBoxLayout(self.VerseButtonWidget)
self.VerseButtonsLayout.setSpacing(8)
self.VerseButtonsLayout.setMargin(0)
self.VerseButtonsLayout.setObjectName(u'VerseButtonsLayout')
self.VerseAddButton = QtGui.QPushButton(self.VerseButtonWidget)
self.VerseAddButton.setObjectName(u'VerseAddButton')
self.VerseButtonsLayout.addWidget(self.VerseAddButton)
self.VerseEditButton = QtGui.QPushButton(self.VerseButtonWidget)
self.VerseEditButton.setObjectName(u'VerseEditButton')
self.VerseButtonsLayout.addWidget(self.VerseEditButton)
self.VerseEditAllButton = QtGui.QPushButton(self.VerseButtonWidget)
self.VerseEditAllButton.setObjectName(u'VerseEditAllButton')
self.VerseButtonsLayout.addWidget(self.VerseEditAllButton)
self.VerseDeleteButton = QtGui.QPushButton(self.VerseButtonWidget)
self.VerseDeleteButton.setObjectName(u'VerseDeleteButton')
self.VerseButtonsLayout.addWidget(self.VerseDeleteButton)
spacerItem = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.VerseButtonsLayout.addItem(spacerItem)
self.LyricsTabLayout.addWidget(self.VerseButtonWidget, 2, 2, 1, 1)
self.SongTabWidget.addTab(self.LyricsTab, u'')
self.AuthorsTab = QtGui.QWidget()
self.AuthorsTab.setObjectName(u'AuthorsTab')
self.AuthorsTabLayout = QtGui.QHBoxLayout(self.AuthorsTab)
self.AuthorsTabLayout.setSpacing(8)
self.AuthorsTabLayout.setMargin(8)
self.AuthorsTabLayout.setObjectName(u'AuthorsTabLayout')
self.AuthorsMaintenanceWidget = QtGui.QWidget(self.AuthorsTab)
self.AuthorsMaintenanceWidget.setObjectName(u'AuthorsMaintenanceWidget')
self.AuthorsMaintenanceLayout = QtGui.QVBoxLayout(
self.AuthorsMaintenanceWidget)
self.AuthorsMaintenanceLayout.setSpacing(8)
self.AuthorsMaintenanceLayout.setMargin(0)
self.AuthorsMaintenanceLayout.setObjectName(u'AuthorsMaintenanceLayout')
self.AuthorsGroupBox = QtGui.QGroupBox(self.AuthorsMaintenanceWidget)
self.AuthorsGroupBox.setObjectName(u'AuthorsGroupBox')
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsGroupBox)
self.AuthorsLayout.setSpacing(8)
self.AuthorsLayout.setMargin(8)
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.AuthorAddWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorAddWidget.setObjectName(u'AuthorAddWidget')
self.AuthorAddLayout = QtGui.QHBoxLayout(self.AuthorAddWidget)
self.AuthorAddLayout.setSpacing(8)
self.AuthorAddLayout.setMargin(0)
self.AuthorAddLayout.setObjectName(u'AuthorAddLayout')
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(True)
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(
self.verseListWidget.setObjectName(u'verseListWidget')
self.lyricsLabel.setBuddy(self.verseListWidget)
self.lyricsTabLayout.addWidget(self.verseListWidget, 2, 1)
self.verseOrderLabel = QtGui.QLabel(self.lyricsTab)
self.verseOrderLabel.setObjectName(u'verseOrderLabel')
self.lyricsTabLayout.addWidget(self.verseOrderLabel, 3, 0)
self.verseOrderEdit = QtGui.QLineEdit(self.lyricsTab)
self.verseOrderEdit.setObjectName(u'verseOrderEdit')
self.verseOrderLabel.setBuddy(self.verseOrderEdit)
self.lyricsTabLayout.addWidget(self.verseOrderEdit, 3, 1, 1, 2)
self.verseButtonsLayout = QtGui.QVBoxLayout()
self.verseButtonsLayout.setObjectName(u'verseButtonsLayout')
self.verseAddButton = QtGui.QPushButton(self.lyricsTab)
self.verseAddButton.setObjectName(u'verseAddButton')
self.verseButtonsLayout.addWidget(self.verseAddButton)
self.verseEditButton = QtGui.QPushButton(self.lyricsTab)
self.verseEditButton.setObjectName(u'verseEditButton')
self.verseButtonsLayout.addWidget(self.verseEditButton)
self.verseEditAllButton = QtGui.QPushButton(self.lyricsTab)
self.verseEditAllButton.setObjectName(u'verseEditAllButton')
self.verseButtonsLayout.addWidget(self.verseEditAllButton)
self.verseDeleteButton = QtGui.QPushButton(self.lyricsTab)
self.verseDeleteButton.setObjectName(u'verseDeleteButton')
self.verseButtonsLayout.addWidget(self.verseDeleteButton)
self.verseButtonsLayout.addStretch()
self.lyricsTabLayout.addLayout(self.verseButtonsLayout, 2, 2)
self.songTabWidget.addTab(self.lyricsTab, u'')
# authors tab
self.authorsTab = QtGui.QWidget()
self.authorsTab.setObjectName(u'authorsTab')
self.authorsTabLayout = QtGui.QHBoxLayout(self.authorsTab)
self.authorsTabLayout.setObjectName(u'authorsTabLayout')
self.authorsLeftLayout = QtGui.QVBoxLayout()
self.authorsLeftLayout.setObjectName(u'authorsLeftLayout')
self.authorsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.authorsGroupBox.setObjectName(u'authorsGroupBox')
self.authorsLayout = QtGui.QVBoxLayout(self.authorsGroupBox)
self.authorsLayout.setObjectName(u'authorsLayout')
self.authorAddLayout = QtGui.QHBoxLayout()
self.authorAddLayout.setObjectName(u'authorAddLayout')
self.authorsComboBox = QtGui.QComboBox(self.authorsGroupBox)
self.authorsComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8)
self.AuthorsSelectionComboItem.setObjectName(
u'AuthorsSelectionComboItem')
self.AuthorAddLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddButton = QtGui.QPushButton(self.AuthorAddWidget)
self.AuthorAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.AuthorAddButton.setObjectName(u'AuthorAddButton')
self.AuthorAddLayout.addWidget(self.AuthorAddButton)
self.AuthorsLayout.addWidget(self.AuthorAddWidget)
self.AuthorsListView = QtGui.QListWidget(self.AuthorsGroupBox)
self.AuthorsListView.setAlternatingRowColors(True)
self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsLayout.addWidget(self.AuthorsListView)
self.AuthorRemoveWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorRemoveWidget.setObjectName(u'AuthorRemoveWidget')
self.AuthorRemoveLayout = QtGui.QHBoxLayout(self.AuthorRemoveWidget)
self.AuthorRemoveLayout.setSpacing(8)
self.AuthorRemoveLayout.setMargin(0)
self.AuthorRemoveLayout.setObjectName(u'AuthorRemoveLayout')
spacerItem1 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorRemoveLayout.addItem(spacerItem1)
self.AuthorRemoveButton = QtGui.QPushButton(self.AuthorRemoveWidget)
self.AuthorRemoveButton.setObjectName(u'AuthorRemoveButton')
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveButton)
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
self.AuthorsMaintenanceLayout.addWidget(self.AuthorsGroupBox)
self.MaintenanceWidget = QtGui.QWidget(self.AuthorsMaintenanceWidget)
self.MaintenanceWidget.setObjectName(u'MaintenanceWidget')
self.MaintenanceLayout = QtGui.QHBoxLayout(self.MaintenanceWidget)
self.MaintenanceLayout.setSpacing(0)
self.MaintenanceLayout.setMargin(0)
self.MaintenanceLayout.setObjectName(u'MaintenanceLayout')
self.MaintenanceButton = QtGui.QPushButton(self.MaintenanceWidget)
self.MaintenanceButton.setObjectName(u'MaintenanceButton')
self.MaintenanceLayout.addWidget(self.MaintenanceButton)
spacerItem2 = QtGui.QSpacerItem(66, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.MaintenanceLayout.addItem(spacerItem2)
self.AuthorsMaintenanceLayout.addWidget(self.MaintenanceWidget)
self.AuthorsTabLayout.addWidget(self.AuthorsMaintenanceWidget)
self.TopicBookWidget = QtGui.QWidget(self.AuthorsTab)
self.TopicBookWidget.setObjectName(u'TopicBookWidget')
self.TopicBookLayout = QtGui.QVBoxLayout(self.TopicBookWidget)
self.TopicBookLayout.setSpacing(8)
self.TopicBookLayout.setMargin(0)
self.TopicBookLayout.setObjectName(u'TopicBookLayout')
self.TopicGroupBox = QtGui.QGroupBox(self.TopicBookWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicGroupBox.sizePolicy().hasHeightForWidth())
self.TopicGroupBox.setSizePolicy(sizePolicy)
self.TopicGroupBox.setObjectName(u'TopicGroupBox')
self.TopicLayout = QtGui.QVBoxLayout(self.TopicGroupBox)
self.TopicLayout.setSpacing(8)
self.TopicLayout.setMargin(8)
self.TopicLayout.setObjectName(u'TopicLayout')
self.TopicAddWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicAddWidget.setObjectName(u'TopicAddWidget')
self.TopicAddLayout = QtGui.QHBoxLayout(self.TopicAddWidget)
self.TopicAddLayout.setSpacing(8)
self.TopicAddLayout.setMargin(0)
self.TopicAddLayout.setObjectName(u'TopicAddLayout')
self.SongTopicCombo = QtGui.QComboBox(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setEditable(True)
self.SongTopicCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongTopicCombo.setSizePolicy(sizePolicy)
self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo)
self.TopicAddButton = QtGui.QPushButton(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicAddButton.sizePolicy().hasHeightForWidth())
self.TopicAddButton.setSizePolicy(sizePolicy)
self.TopicAddButton.setObjectName(u'TopicAddButton')
self.TopicAddLayout.addWidget(self.TopicAddButton)
self.TopicLayout.addWidget(self.TopicAddWidget)
self.TopicsListView = QtGui.QListWidget(self.TopicGroupBox)
self.TopicsListView.setAlternatingRowColors(True)
self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicLayout.addWidget(self.TopicsListView)
self.TopicRemoveWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicRemoveWidget.setObjectName(u'TopicRemoveWidget')
self.TopicRemoveLayout = QtGui.QHBoxLayout(self.TopicRemoveWidget)
self.TopicRemoveLayout.setSpacing(8)
self.TopicRemoveLayout.setMargin(0)
self.TopicRemoveLayout.setObjectName(u'TopicRemoveLayout')
spacerItem3 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicRemoveLayout.addItem(spacerItem3)
self.TopicRemoveButton = QtGui.QPushButton(self.TopicRemoveWidget)
self.TopicRemoveButton.setObjectName(u'TopicRemoveButton')
self.TopicRemoveLayout.addWidget(self.TopicRemoveButton)
self.TopicLayout.addWidget(self.TopicRemoveWidget)
self.TopicBookLayout.addWidget(self.TopicGroupBox)
self.SongBookGroup = QtGui.QGroupBox(self.TopicBookWidget)
self.SongBookGroup.setObjectName(u'SongBookGroup')
self.SongbookLayout = QtGui.QFormLayout(self.SongBookGroup)
self.SongbookLayout.setMargin(8)
self.SongbookLayout.setSpacing(8)
self.SongbookLayout.setObjectName(u'SongbookLayout')
self.SongbookNameLabel = QtGui.QLabel(self.SongBookGroup)
self.SongbookCombo = QtGui.QComboBox(self.SongBookGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SongbookCombo.sizePolicy().hasHeightForWidth())
self.SongbookCombo.setEditable(True)
self.SongbookCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongbookCombo.setSizePolicy(sizePolicy)
self.SongbookCombo.setObjectName(u'SongbookCombo')
self.SongbookLayout.addRow(self.SongbookNameLabel, self.SongbookCombo)
self.songBookNumberLabel = QtGui.QLabel(self.SongBookGroup)
self.songBookNumberEdit = QtGui.QLineEdit(self.SongBookGroup)
self.SongbookLayout.addRow(self.songBookNumberLabel,
self.authorsComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.authorsComboBox.setEditable(True)
self.authorsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.authorsComboBox.setObjectName(u'authorsComboBox')
self.authorAddLayout.addWidget(self.authorsComboBox)
self.authorAddButton = QtGui.QPushButton(self.authorsGroupBox)
self.authorAddButton.setObjectName(u'authorAddButton')
self.authorAddLayout.addWidget(self.authorAddButton)
self.authorsLayout.addLayout(self.authorAddLayout)
self.authorsListView = QtGui.QListWidget(self.authorsGroupBox)
self.authorsListView.setAlternatingRowColors(True)
self.authorsListView.setObjectName(u'authorsListView')
self.authorsLayout.addWidget(self.authorsListView)
self.authorRemoveLayout = QtGui.QHBoxLayout()
self.authorRemoveLayout.setObjectName(u'authorRemoveLayout')
self.authorRemoveLayout.addStretch()
self.authorRemoveButton = QtGui.QPushButton(self.authorsGroupBox)
self.authorRemoveButton.setObjectName(u'authorRemoveButton')
self.authorRemoveLayout.addWidget(self.authorRemoveButton)
self.authorsLayout.addLayout(self.authorRemoveLayout)
self.authorsLeftLayout.addWidget(self.authorsGroupBox)
self.maintenanceLayout = QtGui.QHBoxLayout()
self.maintenanceLayout.setObjectName(u'maintenanceLayout')
self.maintenanceButton = QtGui.QPushButton(self.authorsTab)
self.maintenanceButton.setObjectName(u'maintenanceButton')
self.maintenanceLayout.addWidget(self.maintenanceButton)
self.maintenanceLayout.addStretch()
self.authorsLeftLayout.addLayout(self.maintenanceLayout)
self.authorsTabLayout.addLayout(self.authorsLeftLayout)
self.authorsRightLayout = QtGui.QVBoxLayout()
self.authorsRightLayout.setObjectName(u'authorsRightLayout')
self.topicsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.topicsGroupBox.setObjectName(u'topicsGroupBox')
self.topicsLayout = QtGui.QVBoxLayout(self.topicsGroupBox)
self.topicsLayout.setObjectName(u'topicsLayout')
self.topicAddLayout = QtGui.QHBoxLayout()
self.topicAddLayout.setObjectName(u'topicAddLayout')
self.topicsComboBox = QtGui.QComboBox(self.topicsGroupBox)
self.topicsComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.topicsComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.topicsComboBox.setEditable(True)
self.topicsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.topicsComboBox.setObjectName(u'topicsComboBox')
self.topicAddLayout.addWidget(self.topicsComboBox)
self.topicAddButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicAddButton.setObjectName(u'topicAddButton')
self.topicAddLayout.addWidget(self.topicAddButton)
self.topicsLayout.addLayout(self.topicAddLayout)
self.topicsListView = QtGui.QListWidget(self.topicsGroupBox)
self.topicsListView.setAlternatingRowColors(True)
self.topicsListView.setObjectName(u'topicsListView')
self.topicsLayout.addWidget(self.topicsListView)
self.topicRemoveLayout = QtGui.QHBoxLayout()
self.topicRemoveLayout.setObjectName(u'topicRemoveLayout')
self.topicRemoveLayout.addStretch()
self.topicRemoveButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicRemoveButton.setObjectName(u'topicRemoveButton')
self.topicRemoveLayout.addWidget(self.topicRemoveButton)
self.topicsLayout.addLayout(self.topicRemoveLayout)
self.authorsRightLayout.addWidget(self.topicsGroupBox)
self.songBookGroupBox = QtGui.QGroupBox(self.authorsTab)
self.songBookGroupBox.setObjectName(u'songBookGroupBox')
self.songBookLayout = QtGui.QFormLayout(self.songBookGroupBox)
self.songBookLayout.setObjectName(u'songBookLayout')
self.songBookNameLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNameLabel.setObjectName(u'songBookNameLabel')
self.songBookComboBox = QtGui.QComboBox(self.songBookGroupBox)
self.songBookComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.songBookComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.songBookComboBox.setEditable(True)
self.songBookComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.songBookComboBox.setObjectName(u'songBookComboBox')
self.songBookNameLabel.setBuddy(self.songBookComboBox)
self.songBookLayout.addRow(self.songBookNameLabel,
self.songBookComboBox)
self.songBookNumberLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNumberLabel.setObjectName(u'songBookNumberLabel')
self.songBookNumberEdit = QtGui.QLineEdit(self.songBookGroupBox)
self.songBookNumberEdit.setObjectName(u'songBookNumberEdit')
self.songBookNumberLabel.setBuddy(self.songBookNumberEdit)
self.songBookLayout.addRow(self.songBookNumberLabel,
self.songBookNumberEdit)
self.TopicBookLayout.addWidget(self.SongBookGroup)
self.AuthorsTabLayout.addWidget(self.TopicBookWidget)
self.SongTabWidget.addTab(self.AuthorsTab, u'')
self.ThemeTab = QtGui.QWidget()
self.ThemeTab.setObjectName(u'ThemeTab')
self.ThemeTabLayout = QtGui.QVBoxLayout(self.ThemeTab)
self.ThemeTabLayout.setSpacing(8)
self.ThemeTabLayout.setMargin(8)
self.ThemeTabLayout.setObjectName(u'ThemeTabLayout')
self.ThemeCopyCommentsWidget = QtGui.QWidget(self.ThemeTab)
self.ThemeCopyCommentsWidget.setObjectName(u'ThemeCopyCommentsWidget')
self.ThemeCopyCommentsLayout = QtGui.QHBoxLayout(
self.ThemeCopyCommentsWidget)
self.ThemeCopyCommentsLayout.setSpacing(8)
self.ThemeCopyCommentsLayout.setMargin(0)
self.ThemeCopyCommentsLayout.setObjectName(u'ThemeCopyCommentsLayout')
self.TextWidget = QtGui.QWidget(self.ThemeCopyCommentsWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TextWidget.sizePolicy().hasHeightForWidth())
self.TextWidget.setSizePolicy(sizePolicy)
self.TextWidget.setObjectName(u'TextWidget')
self.DetailsLayout = QtGui.QVBoxLayout(self.TextWidget)
self.DetailsLayout.setSpacing(8)
self.DetailsLayout.setMargin(0)
self.DetailsLayout.setObjectName(u'DetailsLayout')
self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget)
self.ThemeGroupBox.setObjectName(u'ThemeGroupBox')
self.ThemeLayout = QtGui.QHBoxLayout(self.ThemeGroupBox)
self.ThemeLayout.setSpacing(8)
self.ThemeLayout.setMargin(8)
self.ThemeLayout.setObjectName(u'ThemeLayout')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox)
self.ThemeSelectionComboItem.setEditable(True)
self.ThemeSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem')
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem)
self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox)
self.ThemeAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.ThemeAddButton.setObjectName(u'ThemeAddButton')
self.ThemeLayout.addWidget(self.ThemeAddButton)
self.DetailsLayout.addWidget(self.ThemeGroupBox)
self.CopyrightGroupBox = QtGui.QGroupBox(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CopyrightGroupBox.sizePolicy().hasHeightForWidth())
self.CopyrightGroupBox.setSizePolicy(sizePolicy)
self.CopyrightGroupBox.setObjectName(u'CopyrightGroupBox')
self.CopyrightLayout = QtGui.QVBoxLayout(self.CopyrightGroupBox)
self.CopyrightLayout.setSpacing(8)
self.CopyrightLayout.setMargin(8)
self.CopyrightLayout.setObjectName(u'CopyrightLayout')
self.CopyrightWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CopyrightWidget.setObjectName(u'CopyrightWidget')
self.CopyLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyLayout.setSpacing(8)
self.CopyLayout.setMargin(0)
self.CopyLayout.setObjectName(u'CopyLayout')
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
self.CopyrightEditItem.setObjectName(u'CopyrightEditItem')
self.CopyLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertButton = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertButton.setMaximumSize(QtCore.QSize(29, 16777215))
self.CopyrightInsertButton.setObjectName(u'CopyrightInsertButton')
self.CopyLayout.addWidget(self.CopyrightInsertButton)
self.CopyrightLayout.addWidget(self.CopyrightWidget)
self.CcliWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CcliWidget.setObjectName(u'CcliWidget')
self.CCLILayout = QtGui.QHBoxLayout(self.CcliWidget)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
self.authorsRightLayout.addWidget(self.songBookGroupBox)
self.authorsTabLayout.addLayout(self.authorsRightLayout)
self.songTabWidget.addTab(self.authorsTab, u'')
# theme tab
self.themeTab = QtGui.QWidget()
self.themeTab.setObjectName(u'themeTab')
self.themeTabLayout = QtGui.QHBoxLayout(self.themeTab)
self.themeTabLayout.setObjectName(u'themeTabLayout')
self.themeLeftLayout = QtGui.QVBoxLayout()
self.themeLeftLayout.setObjectName(u'themeLeftLayout')
self.themeGroupBox = QtGui.QGroupBox(self.themeTab)
self.themeGroupBox.setObjectName(u'themeGroupBox')
self.themeLayout = QtGui.QHBoxLayout(self.themeGroupBox)
self.themeLayout.setObjectName(u'themeLayout')
self.themeComboBox = QtGui.QComboBox(self.themeGroupBox)
self.themeComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.themeComboBox.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.themeComboBox.setEditable(True)
self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.themeComboBox.setObjectName(u'themeComboBox')
self.themeLayout.addWidget(self.themeComboBox)
self.themeAddButton = QtGui.QPushButton(self.themeGroupBox)
self.themeAddButton.setObjectName(u'themeAddButton')
self.themeLayout.addWidget(self.themeAddButton)
self.themeLeftLayout.addWidget(self.themeGroupBox)
self.rightsGroupBox = QtGui.QGroupBox(self.themeTab)
self.rightsGroupBox.setObjectName(u'rightsGroupBox')
self.rightsLayout = QtGui.QVBoxLayout(self.rightsGroupBox)
self.rightsLayout.setObjectName(u'rightsLayout')
self.copyrightLayout = QtGui.QHBoxLayout()
self.copyrightLayout.setObjectName(u'copyrightLayout')
self.copyrightEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.copyrightEdit.setObjectName(u'copyrightEdit')
self.copyrightLayout.addWidget(self.copyrightEdit)
self.copyrightInsertButton = QtGui.QToolButton(self.rightsGroupBox)
self.copyrightInsertButton.setObjectName(u'copyrightInsertButton')
self.copyrightLayout.addWidget(self.copyrightInsertButton)
self.rightsLayout.addLayout(self.copyrightLayout)
self.CCLILayout = QtGui.QHBoxLayout()
self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLILabel = QtGui.QLabel(self.CcliWidget)
self.CCLILabel = QtGui.QLabel(self.rightsGroupBox)
self.CCLILabel.setObjectName(u'CCLILabel')
self.CCLILayout.addWidget(self.CCLILabel)
self.CCLNumberEdit = QtGui.QLineEdit(self.CcliWidget)
self.CCLNumberEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.CCLNumberEdit.setValidator(QtGui.QIntValidator())
self.CCLNumberEdit.setObjectName(u'CCLNumberEdit')
self.CCLILayout.addWidget(self.CCLNumberEdit)
self.CopyrightLayout.addWidget(self.CcliWidget)
self.DetailsLayout.addWidget(self.CopyrightGroupBox)
spacerItem4 = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.DetailsLayout.addItem(spacerItem4)
self.ThemeCopyCommentsLayout.addWidget(self.TextWidget)
self.CommentsGroupBox = QtGui.QGroupBox(self.ThemeCopyCommentsWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CommentsGroupBox.sizePolicy().hasHeightForWidth())
self.CommentsGroupBox.setSizePolicy(sizePolicy)
self.CommentsGroupBox.setObjectName(u'CommentsGroupBox')
self.CommentsLayout = QtGui.QVBoxLayout(self.CommentsGroupBox)
self.CommentsLayout.setSpacing(0)
self.CommentsLayout.setMargin(8)
self.CommentsLayout.setObjectName(u'CommentsLayout')
self.CommentsEdit = QtGui.QTextEdit(self.CommentsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CommentsEdit.sizePolicy().hasHeightForWidth())
self.CommentsEdit.setSizePolicy(sizePolicy)
self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.CommentsEdit.setObjectName(u'CommentsEdit')
self.CommentsLayout.addWidget(self.CommentsEdit)
self.ThemeCopyCommentsLayout.addWidget(self.CommentsGroupBox)
self.ThemeTabLayout.addWidget(self.ThemeCopyCommentsWidget)
self.SongTabWidget.addTab(self.ThemeTab, u'')
self.verticalLayout.addWidget(self.SongTabWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongDialog)
self.ButtonBox.setStandardButtons(
self.rightsLayout.addLayout(self.CCLILayout)
self.themeLeftLayout.addWidget(self.rightsGroupBox)
self.themeLeftLayout.addStretch()
self.themeTabLayout.addLayout(self.themeLeftLayout)
self.commentsGroupBox = QtGui.QGroupBox(self.themeTab)
self.commentsGroupBox.setObjectName(u'commentsGroupBox')
self.commentsLayout = QtGui.QVBoxLayout(self.commentsGroupBox)
self.commentsLayout.setObjectName(u'commentsLayout')
self.commentsEdit = QtGui.QTextEdit(self.commentsGroupBox)
self.commentsEdit.setObjectName(u'commentsEdit')
self.commentsLayout.addWidget(self.commentsEdit)
self.themeTabLayout.addWidget(self.commentsGroupBox)
self.songTabWidget.addTab(self.themeTab, u'')
self.dialogLayout.addWidget(self.songTabWidget)
self.buttonBox = QtGui.QDialogButtonBox(editSongDialog)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox')
self.verticalLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongDialog)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editSongDialog)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), editSongDialog.closePressed)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), editSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
def retranslateUi(self, EditSongDialog):
EditSongDialog.setWindowTitle(
def retranslateUi(self, editSongDialog):
editSongDialog.setWindowTitle(
translate('SongsPlugin.EditSongForm', 'Song Editor'))
self.TitleLabel.setText(
self.titleLabel.setText(
translate('SongsPlugin.EditSongForm', '&Title:'))
self.AlternativeTitleLabel.setText(
self.alternativeTitleLabel.setText(
translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
self.LyricsLabel.setText(
self.lyricsLabel.setText(
translate('SongsPlugin.EditSongForm', '&Lyrics:'))
self.VerseOrderLabel.setText(
self.verseOrderLabel.setText(
translate('SongsPlugin.EditSongForm', '&Verse order:'))
self.VerseAddButton.setText(
self.verseAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add'))
self.VerseEditButton.setText(
self.verseEditButton.setText(
translate('SongsPlugin.EditSongForm', '&Edit'))
self.VerseEditAllButton.setText(
self.verseEditAllButton.setText(
translate('SongsPlugin.EditSongForm', 'Ed&it All'))
self.VerseDeleteButton.setText(
self.verseDeleteButton.setText(
translate('SongsPlugin.EditSongForm', '&Delete'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.LyricsTab),
self.songTabWidget.setTabText(
self.songTabWidget.indexOf(self.lyricsTab),
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.AuthorsGroupBox.setTitle(
self.authorsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Authors'))
self.AuthorAddButton.setText(
self.authorAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.AuthorRemoveButton.setText(
self.authorRemoveButton.setText(
translate('SongsPlugin.EditSongForm', '&Remove'))
self.MaintenanceButton.setText(translate('SongsPlugin.EditSongForm',
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
'&Manage Authors, Topics, Song Books'))
self.TopicGroupBox.setTitle(
self.topicsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Topic'))
self.TopicAddButton.setText(
self.topicAddButton.setText(
translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
self.TopicRemoveButton.setText(
self.topicRemoveButton.setText(
translate('SongsPlugin.EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle(
self.songBookGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Song Book'))
self.SongbookNameLabel.setText(translate('SongsPlugin.EditSongForm',
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
'Book:'))
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
'Number:'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab),
self.songTabWidget.setTabText(
self.songTabWidget.indexOf(self.authorsTab),
translate('SongsPlugin.EditSongForm',
'Authors, Topics && Song Book'))
self.ThemeGroupBox.setTitle(
self.themeGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Theme'))
self.ThemeAddButton.setText(
self.themeAddButton.setText(
translate('SongsPlugin.EditSongForm', 'New &Theme'))
self.CopyrightGroupBox.setTitle(
self.rightsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText(
self.copyrightInsertButton.setText(
translate('SongsPlugin.EditSongForm', '\xa9'))
self.CCLILabel.setText(
translate('SongsPlugin.EditSongForm', 'CCLI number:'))
self.CommentsGroupBox.setTitle(
self.commentsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Comments'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.ThemeTab),
self.songTabWidget.setTabText(
self.songTabWidget.indexOf(self.themeTab),
translate('SongsPlugin.EditSongForm',
'Theme, Copyright Info && Comments'))
'Theme, Copyright Info && Comments'))

View File

@ -54,40 +54,40 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.width = 400
self.setupUi(self)
# Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton,
QtCore.QObject.connect(self.authorAddButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
QtCore.QObject.connect(self.AuthorRemoveButton,
QtCore.QObject.connect(self.authorRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked)
QtCore.QObject.connect(self.AuthorsListView,
QtCore.QObject.connect(self.authorsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onAuthorsListViewPressed)
QtCore.QObject.connect(self.TopicAddButton,
QtCore.QObject.connect(self.topicAddButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
QtCore.QObject.connect(self.TopicRemoveButton,
QtCore.QObject.connect(self.topicRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked)
QtCore.QObject.connect(self.TopicsListView,
QtCore.QObject.connect(self.topicsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onTopicListViewPressed)
QtCore.QObject.connect(self.CopyrightInsertButton,
QtCore.QObject.connect(self.copyrightInsertButton,
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered)
QtCore.QObject.connect(self.VerseAddButton,
QtCore.QObject.connect(self.verseAddButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked)
QtCore.QObject.connect(self.VerseListWidget,
QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditButton,
QtCore.QObject.connect(self.verseEditButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditAllButton,
QtCore.QObject.connect(self.verseEditAllButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked)
QtCore.QObject.connect(self.VerseDeleteButton,
QtCore.QObject.connect(self.verseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget,
QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed)
QtCore.QObject.connect(self.ThemeAddButton,
QtCore.QObject.connect(self.themeAddButton,
QtCore.SIGNAL(u'clicked()'),
self.parent.parent.renderManager.theme_manager.onAddTheme)
QtCore.QObject.connect(self.MaintenanceButton,
QtCore.QObject.connect(self.maintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
@ -95,102 +95,102 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(
translate('SongsPlugin.EditSongForm', 'Save && Preview'))
self.ButtonBox.addButton(
self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.ButtonBox,
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms
self.manager = manager
self.verse_form = EditVerseForm(self)
self.initialise()
self.AuthorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True)
self.TopicsListView.setSortingEnabled(False)
self.TopicsListView.setAlternatingRowColors(True)
self.authorsListView.setSortingEnabled(False)
self.authorsListView.setAlternatingRowColors(True)
self.topicsListView.setSortingEnabled(False)
self.topicsListView.setAlternatingRowColors(True)
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
self.whitespace = re.compile(r'\W+', re.UNICODE)
def initialise(self):
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
self.AuthorRemoveButton.setEnabled(False)
self.TopicRemoveButton.setEnabled(False)
self.verseEditButton.setEnabled(False)
self.verseDeleteButton.setEnabled(False)
self.authorRemoveButton.setEnabled(False)
self.topicRemoveButton.setEnabled(False)
def loadAuthors(self):
authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name)
self.AuthorsSelectionComboItem.clear()
self.AuthorsSelectionComboItem.addItem(u'')
self.authorsComboBox.clear()
self.authorsComboBox.addItem(u'')
self.authors = []
for author in authors:
row = self.AuthorsSelectionComboItem.count()
self.AuthorsSelectionComboItem.addItem(author.display_name)
self.AuthorsSelectionComboItem.setItemData(
row = self.authorsComboBox.count()
self.authorsComboBox.addItem(author.display_name)
self.authorsComboBox.setItemData(
row, QtCore.QVariant(author.id))
self.authors.append(author.display_name)
completer = QtGui.QCompleter(self.authors)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(completer)
self.authorsComboBox.setCompleter(completer)
def loadTopics(self):
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
self.SongTopicCombo.clear()
self.SongTopicCombo.addItem(u'')
self.topicsComboBox.clear()
self.topicsComboBox.addItem(u'')
self.topics = []
for topic in topics:
row = self.SongTopicCombo.count()
self.SongTopicCombo.addItem(topic.name)
row = self.topicsComboBox.count()
self.topicsComboBox.addItem(topic.name)
self.topics.append(topic.name)
self.SongTopicCombo.setItemData(row, QtCore.QVariant(topic.id))
self.topicsComboBox.setItemData(row, QtCore.QVariant(topic.id))
completer = QtGui.QCompleter(self.topics)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongTopicCombo.setCompleter(completer)
self.topicsComboBox.setCompleter(completer)
def loadBooks(self):
books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
self.SongbookCombo.clear()
self.SongbookCombo.addItem(u'')
self.songBookComboBox.clear()
self.songBookComboBox.addItem(u'')
self.books = []
for book in books:
row = self.SongbookCombo.count()
self.SongbookCombo.addItem(book.name)
row = self.songBookComboBox.count()
self.songBookComboBox.addItem(book.name)
self.books.append(book.name)
self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id))
self.songBookComboBox.setItemData(row, QtCore.QVariant(book.id))
completer = QtGui.QCompleter(self.books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(completer)
self.songBookComboBox.setCompleter(completer)
def loadThemes(self, theme_list):
self.ThemeSelectionComboItem.clear()
self.ThemeSelectionComboItem.addItem(u'')
self.themeComboBox.clear()
self.themeComboBox.addItem(u'')
self.themes = []
for theme in theme_list:
self.ThemeSelectionComboItem.addItem(theme)
self.themeComboBox.addItem(theme)
self.themes.append(theme)
completer = QtGui.QCompleter(self.themes)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(completer)
self.themeComboBox.setCompleter(completer)
def newSong(self):
log.debug(u'New Song')
self.initialise()
self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setText(u'')
self.AlternativeEdit.setText(u'')
self.CopyrightEditItem.setText(u'')
self.VerseOrderEdit.setText(u'')
self.CommentsEdit.setText(u'')
self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setText(u'')
self.alternativeEdit.setText(u'')
self.copyrightEdit.setText(u'')
self.verseOrderEdit.setText(u'')
self.commentsEdit.setText(u'')
self.CCLNumberEdit.setText(u'')
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.AuthorsListView.clear()
self.TopicsListView.clear()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
self.verseListWidget.clear()
self.verseListWidget.setRowCount(0)
self.authorsListView.clear()
self.topicsListView.clear()
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'')
self.loadAuthors()
self.loadTopics()
self.loadBooks()
self.ThemeSelectionComboItem.setCurrentIndex(0)
self.themeComboBox.setCurrentIndex(0)
# it's a new song to preview is not possible
self.previewButton.setVisible(False)
@ -206,46 +206,46 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
log.debug(u'Load Song')
self.initialise()
self.SongTabWidget.setCurrentIndex(0)
self.songTabWidget.setCurrentIndex(0)
self.loadAuthors()
self.loadTopics()
self.loadBooks()
self.song = self.manager.get_object(Song, id)
self.TitleEditItem.setText(self.song.title)
self.titleEdit.setText(self.song.title)
if self.song.alternate_title:
self.AlternativeEdit.setText(self.song.alternate_title)
self.alternativeEdit.setText(self.song.alternate_title)
else:
self.AlternativeEdit.setText(u'')
self.alternativeEdit.setText(u'')
if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id)
id = self.SongbookCombo.findText(
id = self.songBookComboBox.findText(
unicode(book_name.name), QtCore.Qt.MatchExactly)
if id == -1:
# Not Found
id = 0
self.SongbookCombo.setCurrentIndex(id)
self.songBookComboBox.setCurrentIndex(id)
if self.song.theme_name:
id = self.ThemeSelectionComboItem.findText(
id = self.themeComboBox.findText(
unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
if id == -1:
# Not Found
id = 0
self.song.theme_name = None
self.ThemeSelectionComboItem.setCurrentIndex(id)
self.themeComboBox.setCurrentIndex(id)
if self.song.copyright:
self.CopyrightEditItem.setText(self.song.copyright)
self.copyrightEdit.setText(self.song.copyright)
else:
self.CopyrightEditItem.setText(u'')
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.copyrightEdit.setText(u'')
self.verseListWidget.clear()
self.verseListWidget.setRowCount(0)
if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order)
self.verseOrderEdit.setText(self.song.verse_order)
else:
self.VerseOrderEdit.setText(u'')
self.verseOrderEdit.setText(u'')
if self.song.comments:
self.CommentsEdit.setPlainText(self.song.comments)
self.commentsEdit.setPlainText(self.song.comments)
else:
self.CommentsEdit.setPlainText(u'')
self.commentsEdit.setPlainText(u'')
if self.song.ccli_number:
self.CCLNumberEdit.setText(self.song.ccli_number)
else:
@ -256,9 +256,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.songBookNumberEdit.setText(u'')
# lazy xml migration for now
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.VerseListWidget.setColumnWidth(0, self.width)
self.verseListWidget.clear()
self.verseListWidget.setRowCount(0)
self.verseListWidget.setColumnWidth(0, self.width)
# This is just because occasionally the lyrics come back as a "buffer"
if isinstance(self.song.lyrics, buffer):
self.song.lyrics = unicode(self.song.lyrics)
@ -266,37 +266,37 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
songXML = SongXMLParser(self.song.lyrics)
verseList = songXML.get_verses()
for count, verse in enumerate(verseList):
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QTableWidgetItem(verse[1])
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item)
self.verseListWidget.setItem(count, 0, item)
else:
verses = self.song.lyrics.split(u'\n\n')
for count, verse in enumerate(verses):
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem(verse)
variant = u'%s:%s' % \
(VerseType.to_string(VerseType.Verse), unicode(count + 1))
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item)
self.VerseListWidget.resizeRowsToContents()
self.verseListWidget.setItem(count, 0, item)
self.verseListWidget.resizeRowsToContents()
self.tagRows()
# clear the results
self.AuthorsListView.clear()
self.authorsListView.clear()
for author in self.song.authors:
author_name = QtGui.QListWidgetItem(unicode(author.display_name))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_name)
self.authorsListView.addItem(author_name)
# clear the results
self.TopicsListView.clear()
self.topicsListView.clear()
for topic in self.song.topics:
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_name)
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
self.topicsListView.addItem(topic_name)
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# if not preview hide the preview button
self.previewButton.setVisible(False)
if preview:
@ -307,17 +307,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Tag the Song List rows based on the verse list
"""
rowLabel = []
for row in range(0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0)
for row in range(0, self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0)
data = unicode(item.data(QtCore.Qt.UserRole).toString())
bit = data.split(u':')
rowTag = u'%s%s' % (bit[0][0:1], bit[1])
rowLabel.append(rowTag)
self.VerseListWidget.setVerticalHeaderLabels(rowLabel)
self.verseListWidget.setVerticalHeaderLabels(rowLabel)
def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex())
text = unicode(self.AuthorsSelectionComboItem.currentText())
item = int(self.authorsComboBox.currentIndex())
text = unicode(self.authorsComboBox.currentText())
if item == 0 and text:
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Author'),
@ -336,15 +336,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
unicode(author.display_name))
author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item)
self.authorsListView.addItem(author_item)
self.loadAuthors()
self.AuthorsSelectionComboItem.setCurrentIndex(0)
self.authorsComboBox.setCurrentIndex(0)
else:
return
elif item > 0:
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0]
item_id = (self.authorsComboBox.itemData(item)).toInt()[0]
author = self.manager.get_object(Author, item_id)
if self.AuthorsListView.findItems(unicode(author.display_name),
if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'),
@ -355,8 +355,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
author.display_name))
author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item)
self.AuthorsSelectionComboItem.setCurrentIndex(0)
self.authorsListView.addItem(author_item)
self.authorsComboBox.setCurrentIndex(0)
else:
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Author Selected'),
@ -366,18 +366,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'Song" button to add the new author.'))
def onAuthorsListViewPressed(self):
if self.AuthorsListView.count() > 1:
self.AuthorRemoveButton.setEnabled(True)
if self.authorsListView.count() > 1:
self.authorRemoveButton.setEnabled(True)
def onAuthorRemoveButtonClicked(self):
self.AuthorRemoveButton.setEnabled(False)
item = self.AuthorsListView.currentItem()
row = self.AuthorsListView.row(item)
self.AuthorsListView.takeItem(row)
self.authorRemoveButton.setEnabled(False)
item = self.authorsListView.currentItem()
row = self.authorsListView.row(item)
self.authorsListView.takeItem(row)
def onTopicAddButtonClicked(self):
item = int(self.SongTopicCombo.currentIndex())
text = unicode(self.SongTopicCombo.currentText())
item = int(self.topicsComboBox.currentIndex())
text = unicode(self.topicsComboBox.currentText())
if item == 0 and text:
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Topic'),
@ -390,15 +390,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item)
self.topicsListView.addItem(topic_item)
self.loadTopics()
self.SongTopicCombo.setCurrentIndex(0)
self.topicsComboBox.setCurrentIndex(0)
else:
return
elif item > 0:
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0]
item_id = (self.topicsComboBox.itemData(item)).toInt()[0]
topic = self.manager.get_object(Topic, item_id)
if self.TopicsListView.findItems(unicode(topic.name),
if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'),
@ -408,8 +408,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item)
self.SongTopicCombo.setCurrentIndex(0)
self.topicsListView.addItem(topic_item)
self.topicsComboBox.setCurrentIndex(0)
else:
QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
@ -419,17 +419,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'button to add the new topic.'))
def onTopicListViewPressed(self):
self.TopicRemoveButton.setEnabled(True)
self.topicRemoveButton.setEnabled(True)
def onTopicRemoveButtonClicked(self):
self.TopicRemoveButton.setEnabled(False)
item = self.TopicsListView.currentItem()
row = self.TopicsListView.row(item)
self.TopicsListView.takeItem(row)
self.topicRemoveButton.setEnabled(False)
item = self.topicsListView.currentItem()
row = self.topicsListView.row(item)
self.topicsListView.takeItem(row)
def onVerseListViewPressed(self):
self.VerseEditButton.setEnabled(True)
self.VerseDeleteButton.setEnabled(True)
self.verseEditButton.setEnabled(True)
self.verseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'', True)
@ -439,16 +439,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText)
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
self.VerseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1), 0, item)
self.VerseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents()
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
self.verseListWidget.setItem(
int(self.verseListWidget.rowCount() - 1), 0, item)
self.verseListWidget.setColumnWidth(0, self.width)
self.verseListWidget.resizeRowsToContents()
self.tagRows()
def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem()
item = self.verseListWidget.currentItem()
if item:
tempText = item.text()
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
@ -462,24 +462,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = {}
tempId = {}
for row in range(0, self.VerseListWidget.rowCount()):
tempList[row] = self.VerseListWidget.item(row, 0).text()
tempId[row] = self.VerseListWidget.item(row, 0).\
for row in range(0, self.verseListWidget.rowCount()):
tempList[row] = self.verseListWidget.item(row, 0).text()
tempId[row] = self.verseListWidget.item(row, 0).\
data(QtCore.Qt.UserRole)
self.VerseListWidget.clear()
self.verseListWidget.clear()
for row in range (0, len(tempList)):
item = QtGui.QTableWidgetItem(tempList[row], 0)
item.setData(QtCore.Qt.UserRole, tempId[row])
self.VerseListWidget.setItem(row, 0, item)
self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint()
self.verseListWidget.setItem(row, 0, item)
self.verseListWidget.resizeRowsToContents()
self.verseListWidget.repaint()
self.tagRows()
def onVerseEditAllButtonClicked(self):
verse_list = u''
if self.VerseListWidget.rowCount() > 0:
for row in range(0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0)
if self.verseListWidget.rowCount() > 0:
for row in range(0, self.verseListWidget.rowCount()):
item = self.verseListWidget.item(row, 0)
field = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_list += u'---[%s]---\n' % field
verse_list += item.text()
@ -490,8 +490,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.verse_form.exec_():
verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.verseListWidget.clear()
self.verseListWidget.setRowCount(0)
for row in self.findVerseSplit.split(verse_list):
for match in row.split(u'---['):
for count, parts in enumerate(match.split(u']---\n')):
@ -506,22 +506,22 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(parts)
item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(variant))
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
self.VerseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1),
self.verseListWidget.setRowCount(
self.verseListWidget.rowCount() + 1)
self.verseListWidget.setItem(
int(self.verseListWidget.rowCount() - 1),
0, item)
self.VerseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint()
self.verseListWidget.setColumnWidth(0, self.width)
self.verseListWidget.resizeRowsToContents()
self.verseListWidget.repaint()
self.tagRows()
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
self.verseEditButton.setEnabled(False)
self.verseDeleteButton.setEnabled(False)
def onVerseDeleteButtonClicked(self):
self.VerseListWidget.removeRow(self.VerseListWidget.currentRow())
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
self.verseListWidget.removeRow(self.verseListWidget.currentRow())
self.verseEditButton.setEnabled(False)
self.verseDeleteButton.setEnabled(False)
def _validate_song(self):
"""
@ -530,25 +530,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
log.debug(u'Validate Song')
# Lets be nice and assume the data is correct.
if len(self.TitleEditItem.displayText()) == 0:
self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus()
if len(self.titleEdit.displayText()) == 0:
self.songTabWidget.setCurrentIndex(0)
self.titleEdit.setFocus()
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type in a song title.'))
return False
if self.VerseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus()
if self.verseListWidget.rowCount() == 0:
self.songTabWidget.setCurrentIndex(0)
self.verseListWidget.setFocus()
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type in at least one verse.'))
return False
if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus()
if self.authorsListView.count() == 0:
self.songTabWidget.setCurrentIndex(1)
self.authorsListView.setFocus()
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Warning'),
translate('SongsPlugin.EditSongForm',
@ -564,8 +564,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order.append(item.lower())
verses = []
verse_names = []
for index in range (0, self.VerseListWidget.rowCount()):
verse = self.VerseListWidget.item(index, 0)
for index in range (0, self.verseListWidget.rowCount()):
verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names:
verses.append(
@ -573,8 +573,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_names.append(verse)
for count, item in enumerate(order):
if item not in verses:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
self.songTabWidget.setCurrentIndex(0)
self.verseOrderEdit.setFocus()
valid = verses.pop(0)
for verse in verses:
valid = valid + u', ' + verse
@ -587,8 +587,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return False
for count, verse in enumerate(verses):
if verse not in order:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
self.songTabWidget.setCurrentIndex(0)
self.verseOrderEdit.setFocus()
answer = QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Warning'),
unicode(translate('SongsPlugin.EditSongForm',
@ -601,17 +601,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return True
def onCopyrightInsertButtonTriggered(self):
text = self.CopyrightEditItem.text()
pos = self.CopyrightEditItem.cursorPosition()
text = text[:pos] + '\xa9' + text[pos:]
self.CopyrightEditItem.setText(text)
self.CopyrightEditItem.setFocus()
self.CopyrightEditItem.setCursorPosition(pos + 1)
text = self.copyrightEdit.text()
pos = self.copyrightEdit.cursorPosition()
sign = translate('SongsPlugin.EditSongForm', '\xa9')
text = text[:pos] + sign + text[pos:]
self.copyrightEdit.setText(text)
self.copyrightEdit.setFocus()
self.copyrightEdit.setCursorPosition(pos + len(sign))
def onMaintenanceButtonClicked(self):
temp_song_book = None
item = int(self.SongbookCombo.currentIndex())
text = unicode(self.SongbookCombo.currentText())
item = int(self.songBookComboBox.currentIndex())
text = unicode(self.songBookComboBox.currentText())
if item == 0 and text:
temp_song_book = text
self.parent.song_maintenance_form.exec_()
@ -619,7 +620,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadBooks()
self.loadTopics()
if temp_song_book:
self.SongbookCombo.setEditText(temp_song_book)
self.songBookComboBox.setEditText(temp_song_book)
def onPreview(self, button):
"""
@ -659,9 +660,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.clearCaches()
if not self.song:
self.song = Song()
item = int(self.SongbookCombo.currentIndex())
text = unicode(self.SongbookCombo.currentText())
if self.SongbookCombo.findText(text, QtCore.Qt.MatchExactly) < 0:
item = int(self.songBookComboBox.currentIndex())
text = unicode(self.songBookComboBox.currentText())
if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Book'),
translate('SongsPlugin.EditSongForm', 'This song book does '
@ -684,25 +685,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
``preview``
Should be ``True`` if the song is also previewed (boolean).
"""
self.song.title = unicode(self.TitleEditItem.text())
self.song.alternate_title = unicode(self.AlternativeEdit.text())
self.song.copyright = unicode(self.CopyrightEditItem.text())
self.song.title = unicode(self.titleEdit.text())
self.song.alternate_title = unicode(self.alternativeEdit.text())
self.song.copyright = unicode(self.copyrightEdit.text())
if self.song.alternate_title:
self.song.search_title = self.song.title + u'@' + \
self.song.alternate_title
else:
self.song.search_title = self.song.title
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
self.song.comments = unicode(self.commentsEdit.toPlainText())
self.song.verse_order = unicode(self.verseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
self.song.song_number = unicode(self.songBookNumberEdit.text())
book_name = unicode(self.SongbookCombo.currentText())
book_name = unicode(self.songBookComboBox.currentText())
if book_name:
self.song.book = self.manager.get_object_filtered(Book,
Book.name == book_name)
else:
self.song.book = None
theme_name = unicode(self.ThemeSelectionComboItem.currentText())
theme_name = unicode(self.themeComboBox.currentText())
if theme_name:
self.song.theme_name = theme_name
else:
@ -711,14 +712,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.processLyrics()
self.processTitle()
self.song.authors = []
for row in range(self.AuthorsListView.count()):
item = self.AuthorsListView.item(row)
for row in range(self.authorsListView.count()):
item = self.authorsListView.item(row)
authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.authors.append(self.manager.get_object(Author,
authorId))
self.song.topics = []
for row in range(self.TopicsListView.count()):
item = self.TopicsListView.item(row)
for row in range(self.topicsListView.count()):
item = self.topicsListView.item(row)
topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.topics.append(self.manager.get_object(Topic, topicId))
self.manager.save_object(self.song)
@ -733,13 +734,13 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml = SongXMLBuilder()
text = u''
multiple = []
for i in range(0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(i, 0)
for i in range(0, self.verseListWidget.rowCount()):
item = self.verseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
text = text + self.whitespace.sub(u' ',
unicode(self.VerseListWidget.item(i, 0).text())) + u' '
unicode(self.verseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0])
self.song.search_lyrics = text.lower()

View File

@ -32,31 +32,22 @@ from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object):
def setupUi(self, editVerseDialog):
editVerseDialog.setObjectName(u'editVerseDialog')
editVerseDialog.resize(474, 442)
editVerseDialog.resize(400, 400)
editVerseDialog.setModal(True)
self.editVerseLayout = QtGui.QVBoxLayout(editVerseDialog)
self.editVerseLayout.setSpacing(8)
self.editVerseLayout.setMargin(8)
self.editVerseLayout.setObjectName(u'editVerseLayout')
self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.verseTextEdit = SpellTextEdit(editVerseDialog)
self.verseTextEdit.setObjectName(u'verseTextEdit')
self.editVerseLayout.addWidget(self.verseTextEdit)
self.dialogLayout.addWidget(self.verseTextEdit)
self.verseTypeLayout = QtGui.QHBoxLayout()
self.verseTypeLayout.setSpacing(8)
self.verseTypeLayout.setObjectName(u'verseTypeLayout')
self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
self.verseTypeLabel.setObjectName(u'verseTypeLabel')
self.verseTypeLayout.addWidget(self.verseTypeLabel)
self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog)
self.verseTypeComboBox.addItems([u'', u'', u'', u'', u'', u'', u''])
self.verseTypeComboBox.setObjectName(u'verseTypeComboBox')
self.verseTypeLabel.setBuddy(self.verseTypeComboBox)
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeLayout.addWidget(self.verseTypeComboBox)
self.verseNumberBox = QtGui.QSpinBox(editVerseDialog)
self.verseNumberBox.setMinimum(1)
@ -66,21 +57,18 @@ class Ui_EditVerseDialog(object):
self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
self.insertButton.setObjectName(u'insertButton')
self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.verseTypeLayout.addItem(self.verseTypeSpacer)
self.editVerseLayout.addLayout(self.verseTypeLayout)
self.editButtonBox = QtGui.QDialogButtonBox(editVerseDialog)
self.editButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.editButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
self.verseTypeLayout.addStretch()
self.dialogLayout.addLayout(self.verseTypeLayout)
self.buttonBox = QtGui.QDialogButtonBox(editVerseDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save)
self.editButtonBox.setObjectName(u'editButtonBox')
self.editVerseLayout.addWidget(self.editButtonBox)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editVerseDialog)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'accepted()'),
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
editVerseDialog.accept)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'rejected()'),
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
editVerseDialog.reject)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
@ -104,4 +92,4 @@ class Ui_EditVerseDialog(object):
self.verseTypeComboBox.setItemText(6,
VerseType.to_string(VerseType.Other))
self.insertButton.setText(
translate('SongsPlugin.EditVerseForm', '&Insert'))
translate('SongsPlugin.EditVerseForm', '&Insert'))

View File

@ -172,4 +172,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.'))
return False
QtGui.QDialog.accept(self)
QtGui.QDialog.accept(self)

View File

@ -29,49 +29,42 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SongBookDialog(object):
def setupUi(self, SongBookDialog):
SongBookDialog.setObjectName(u'SongBookDialog')
SongBookDialog.resize(367, 120)
self.SongBookLayout = QtGui.QFormLayout(SongBookDialog)
self.SongBookLayout.setMargin(8)
self.SongBookLayout.setSpacing(8)
self.SongBookLayout.setObjectName(u'SongBookLayout')
self.NameLabel = QtGui.QLabel(SongBookDialog)
self.NameLabel.setObjectName(u'NameLabel')
self.SongBookLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.NameLabel)
self.NameEdit = QtGui.QLineEdit(SongBookDialog)
self.NameEdit.setObjectName(u'NameEdit')
self.NameLabel.setBuddy(self.NameEdit)
self.SongBookLayout.setWidget(0,
QtGui.QFormLayout.FieldRole, self.NameEdit)
self.PublisherLabel = QtGui.QLabel(SongBookDialog)
self.PublisherLabel.setObjectName(u'PublisherLabel')
self.SongBookLayout.setWidget(1,
QtGui.QFormLayout.LabelRole, self.PublisherLabel)
self.PublisherEdit = QtGui.QLineEdit(SongBookDialog)
self.PublisherEdit.setObjectName(u'PublisherEdit')
self.PublisherLabel.setBuddy(self.PublisherEdit)
self.SongBookLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.PublisherEdit)
self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(
def setupUi(self, songBookDialog):
songBookDialog.setObjectName(u'songBookDialog')
songBookDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.bookLayout = QtGui.QFormLayout()
self.bookLayout.setObjectName(u'bookLayout')
self.nameLabel = QtGui.QLabel(songBookDialog)
self.nameLabel.setObjectName(u'nameLabel')
self.nameEdit = QtGui.QLineEdit(songBookDialog)
self.nameEdit.setObjectName(u'nameEdit')
self.nameLabel.setBuddy(self.nameEdit)
self.bookLayout.addRow(self.nameLabel, self.nameEdit)
self.publisherLabel = QtGui.QLabel(songBookDialog)
self.publisherLabel.setObjectName(u'publisherLabel')
self.publisherEdit = QtGui.QLineEdit(songBookDialog)
self.publisherEdit.setObjectName(u'publisherEdit')
self.publisherLabel.setBuddy(self.publisherEdit)
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
self.dialogLayout.addLayout(self.bookLayout)
self.buttonBox = QtGui.QDialogButtonBox(songBookDialog)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.ButtonBox.setObjectName(u'ButtonBox')
self.SongBookLayout.setWidget(2,
QtGui.QFormLayout.FieldRole, self.ButtonBox)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), songBookDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), songBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
self.retranslateUi(SongBookDialog)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(
def retranslateUi(self, songBookDialog):
songBookDialog.setWindowTitle(
translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
self.NameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.PublisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:'))
self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.publisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -42,18 +42,18 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
def exec_(self, clear=True):
if clear:
self.NameEdit.clear()
self.PublisherEdit.clear()
self.NameEdit.setFocus()
self.nameEdit.clear()
self.publisherEdit.clear()
self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self)
def accept(self):
if not self.NameEdit.text():
if not self.nameEdit.text():
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.'))
self.NameEdit.setFocus()
self.nameEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)
return QtGui.QDialog.accept(self)

View File

@ -29,211 +29,145 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
class Ui_SongMaintenanceDialog(object):
def setupUi(self, SongMaintenanceDialog):
SongMaintenanceDialog.setObjectName(u'SongMaintenanceDialog')
SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
SongMaintenanceDialog.resize(582, 361)
self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog)
self.DialogLayout.setSpacing(8)
self.DialogLayout.setMargin(8)
self.DialogLayout.setObjectName(u'DialogLayout')
self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog)
self.ContentWidget.setObjectName(u'ContentWidget')
self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget)
self.ContentLayout.setSpacing(8)
self.ContentLayout.setMargin(0)
self.ContentLayout.setObjectName(u'ContentLayout')
self.TypeListWidget = QtGui.QListWidget(self.ContentWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TypeListWidget.sizePolicy().hasHeightForWidth())
self.TypeListWidget.setSizePolicy(sizePolicy)
self.TypeListWidget.setViewMode(QtGui.QListView.ListMode)
self.TypeListWidget.setIconSize(QtCore.QSize(32, 32))
self.TypeListWidget.setMovement(QtGui.QListView.Static)
self.TypeListWidget.setMaximumWidth(172)
self.TypeListWidget.setSpacing(0)
self.TypeListWidget.setSortingEnabled(False)
self.TypeListWidget.setUniformItemSizes(True)
self.TypeListWidget.setObjectName(u'TypeListWidget')
icon = build_icon(u':/songs/author_maintenance.png')
item = QtGui.QListWidgetItem(self.TypeListWidget)
item.setIcon(icon)
icon1 = build_icon(u':/songs/topic_maintenance.png')
item = QtGui.QListWidgetItem(self.TypeListWidget)
item.setIcon(icon1)
icon2 = build_icon(u':/songs/book_maintenance.png')
item = QtGui.QListWidgetItem(self.TypeListWidget)
item.setIcon(icon2)
self.ContentLayout.addWidget(self.TypeListWidget)
self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget)
self.TypeStackedWidget.setObjectName(u'TypeStackedWidget')
self.AuthorsPage = QtGui.QWidget()
self.AuthorsPage.setObjectName(u'AuthorsPage')
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage)
self.AuthorsLayout.setSpacing(4)
self.AuthorsLayout.setMargin(0)
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage)
self.AuthorsListWidget.setObjectName(u'AuthorsListWidget')
self.AuthorsLayout.addWidget(self.AuthorsListWidget)
self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage)
self.AuthorButtonWidget.setObjectName(u'AuthorButtonWidget')
self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget)
self.AuthorButtonsLayout.setSpacing(8)
self.AuthorButtonsLayout.setMargin(0)
self.AuthorButtonsLayout.setObjectName(u'AuthorButtonsLayout')
spacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorButtonsLayout.addItem(spacerItem)
self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget)
icon3 = build_icon(u':/songs/author_add.png')
self.AuthorAddButton.setIcon(icon3)
self.AuthorAddButton.setObjectName(u'AuthorAddButton')
self.AuthorButtonsLayout.addWidget(self.AuthorAddButton)
self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget)
icon4 = build_icon(u':/songs/author_edit.png')
self.AuthorEditButton.setIcon(icon4)
self.AuthorEditButton.setObjectName(u'AuthorEditButton')
self.AuthorButtonsLayout.addWidget(self.AuthorEditButton)
self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget)
icon5 = build_icon(u':/songs/author_delete.png')
self.AuthorDeleteButton.setIcon(icon5)
self.AuthorDeleteButton.setObjectName(u'AuthorDeleteButton')
self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton)
self.AuthorsLayout.addWidget(self.AuthorButtonWidget)
self.AuthorsLine = QtGui.QFrame(self.AuthorsPage)
self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine)
self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken)
self.AuthorsLine.setObjectName(u'AuthorsLine')
self.AuthorsLayout.addWidget(self.AuthorsLine)
self.TypeStackedWidget.addWidget(self.AuthorsPage)
self.TopicsPage = QtGui.QWidget()
self.TopicsPage.setObjectName(u'TopicsPage')
self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage)
self.TopicLayout.setSpacing(4)
self.TopicLayout.setMargin(0)
self.TopicLayout.setObjectName(u'TopicLayout')
self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage)
self.TopicsListWidget.setObjectName(u'TopicsListWidget')
self.TopicLayout.addWidget(self.TopicsListWidget)
self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage)
self.TopicButtonWidget.setObjectName(u'TopicButtonWidget')
self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget)
self.TopicButtonLayout.setSpacing(8)
self.TopicButtonLayout.setMargin(0)
self.TopicButtonLayout.setObjectName(u'TopicButtonLayout')
TopicSpacerItem = QtGui.QSpacerItem(54, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicButtonLayout.addItem(TopicSpacerItem)
self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget)
icon6 = build_icon(u':/songs/topic_add.png')
self.TopicAddButton.setIcon(icon6)
self.TopicAddButton.setObjectName(u'TopicAddButton')
self.TopicButtonLayout.addWidget(self.TopicAddButton)
self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget)
icon7 = build_icon(u':/songs/topic_edit.png')
self.TopicEditButton.setIcon(icon7)
self.TopicEditButton.setObjectName(u'TopicEditButton')
self.TopicButtonLayout.addWidget(self.TopicEditButton)
self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget)
icon8 = build_icon(u':/songs/topic_delete.png')
self.TopicDeleteButton.setIcon(icon8)
self.TopicDeleteButton.setObjectName(u'TopicDeleteButton')
self.TopicButtonLayout.addWidget(self.TopicDeleteButton)
self.TopicLayout.addWidget(self.TopicButtonWidget)
self.TopicsLine = QtGui.QFrame(self.TopicsPage)
self.TopicsLine.setFrameShape(QtGui.QFrame.HLine)
self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken)
self.TopicsLine.setObjectName(u'TopicsLine')
self.TopicLayout.addWidget(self.TopicsLine)
self.TypeStackedWidget.addWidget(self.TopicsPage)
self.BooksPage = QtGui.QWidget()
self.BooksPage.setObjectName(u'BooksPage')
self.BookLayout = QtGui.QVBoxLayout(self.BooksPage)
self.BookLayout.setSpacing(4)
self.BookLayout.setMargin(0)
self.BookLayout.setObjectName(u'BookLayout')
self.BooksListWidget = QtGui.QListWidget(self.BooksPage)
self.BooksListWidget.setObjectName(u'BooksListWidget')
self.BookLayout.addWidget(self.BooksListWidget)
self.BookButtonWidget = QtGui.QWidget(self.BooksPage)
self.BookButtonWidget.setObjectName(u'BookButtonWidget')
self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget)
self.BookButtonLayout.setSpacing(8)
self.BookButtonLayout.setMargin(0)
self.BookButtonLayout.setObjectName(u'BookButtonLayout')
spacerItem2 = QtGui.QSpacerItem(54, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.BookButtonLayout.addItem(spacerItem2)
self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget)
icon9 = build_icon(u':/songs/book_add.png')
self.BookAddButton.setIcon(icon9)
self.BookAddButton.setObjectName(u'BookAddButton')
self.BookButtonLayout.addWidget(self.BookAddButton)
self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget)
icon10 = build_icon(u':/songs/book_edit.png')
self.BookEditButton.setIcon(icon10)
self.BookEditButton.setObjectName(u'BookEditButton')
self.BookButtonLayout.addWidget(self.BookEditButton)
self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget)
icon11 = build_icon(u':/songs/book_delete.png')
self.BookDeleteButton.setIcon(icon11)
self.BookDeleteButton.setObjectName(u'BookDeleteButton')
self.BookButtonLayout.addWidget(self.BookDeleteButton)
self.BookLayout.addWidget(self.BookButtonWidget)
self.BooksLine = QtGui.QFrame(self.BooksPage)
self.BooksLine.setFrameShape(QtGui.QFrame.HLine)
self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken)
self.BooksLine.setObjectName(u'BooksLine')
self.BookLayout.addWidget(self.BooksLine)
self.TypeStackedWidget.addWidget(self.BooksPage)
self.ContentLayout.addWidget(self.TypeStackedWidget)
self.DialogLayout.addWidget(self.ContentWidget)
self.MaintenanceButtonBox = QtGui.QDialogButtonBox(
SongMaintenanceDialog)
self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.MaintenanceButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Close)
self.MaintenanceButtonBox.setObjectName(u'MaintenanceButtonBox')
self.DialogLayout.addWidget(self.MaintenanceButtonBox)
self.retranslateUi(SongMaintenanceDialog)
self.TypeStackedWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.MaintenanceButtonBox,
QtCore.SIGNAL(u'rejected()'), SongMaintenanceDialog.accept)
QtCore.QObject.connect(self.TypeListWidget,
def setupUi(self, songMaintenanceDialog):
songMaintenanceDialog.setObjectName(u'songMaintenanceDialog')
songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
songMaintenanceDialog.resize(10, 350)
self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
# Caution: fixed widget width
self.typeListWidget.setFixedWidth(172)
self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
self.typeListWidget.setUniformItemSizes(True)
self.typeListWidget.setObjectName(u'typeListWidget')
self.listItemAuthors = QtGui.QListWidgetItem(self.typeListWidget)
self.listItemAuthors.setIcon(
build_icon(u':/songs/author_maintenance.png'))
self.listItemTopics = QtGui.QListWidgetItem(self.typeListWidget)
self.listItemTopics.setIcon(
build_icon(u':/songs/topic_maintenance.png'))
self.listItemBooks = QtGui.QListWidgetItem(self.typeListWidget)
self.listItemBooks.setIcon(
build_icon(u':/songs/book_maintenance.png'))
self.dialogLayout.addWidget(self.typeListWidget, 0, 0)
self.stackedLayout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout')
# authors page
self.authorsPage = QtGui.QWidget(songMaintenanceDialog)
self.authorsPage.setObjectName(u'authorsPage')
self.authorsLayout = QtGui.QVBoxLayout(self.authorsPage)
self.authorsLayout.setObjectName(u'authorsLayout')
self.authorsListWidget = QtGui.QListWidget(self.authorsPage)
self.authorsListWidget.setObjectName(u'authorsListWidget')
self.authorsLayout.addWidget(self.authorsListWidget)
self.authorsButtonsLayout = QtGui.QHBoxLayout()
self.authorsButtonsLayout.setObjectName(u'authorsButtonsLayout')
self.authorsButtonsLayout.addStretch()
self.authorsAddButton = QtGui.QPushButton(self.authorsPage)
self.authorsAddButton.setIcon(build_icon(u':/songs/author_add.png'))
self.authorsAddButton.setObjectName(u'authorsAddButton')
self.authorsButtonsLayout.addWidget(self.authorsAddButton)
self.authorsEditButton = QtGui.QPushButton(self.authorsPage)
self.authorsEditButton.setIcon(build_icon(u':/songs/author_edit.png'))
self.authorsEditButton.setObjectName(u'authorsEditButton')
self.authorsButtonsLayout.addWidget(self.authorsEditButton)
self.authorsDeleteButton = QtGui.QPushButton(self.authorsPage)
self.authorsDeleteButton.setIcon(
build_icon(u':/songs/author_delete.png'))
self.authorsDeleteButton.setObjectName(u'authorsDeleteButton')
self.authorsButtonsLayout.addWidget(self.authorsDeleteButton)
self.authorsLayout.addLayout(self.authorsButtonsLayout)
self.stackedLayout.addWidget(self.authorsPage)
# topics page
self.topicsPage = QtGui.QWidget(songMaintenanceDialog)
self.topicsPage.setObjectName(u'topicsPage')
self.topicsLayout = QtGui.QVBoxLayout(self.topicsPage)
self.topicsLayout.setObjectName(u'topicsLayout')
self.topicsListWidget = QtGui.QListWidget(self.topicsPage)
self.topicsListWidget.setObjectName(u'topicsListWidget')
self.topicsLayout.addWidget(self.topicsListWidget)
self.topicsButtonsLayout = QtGui.QHBoxLayout()
self.topicsButtonsLayout.setObjectName(u'topicsButtonLayout')
self.topicsButtonsLayout.addStretch()
self.topicsAddButton = QtGui.QPushButton(self.topicsPage)
self.topicsAddButton.setIcon(build_icon(u':/songs/topic_add.png'))
self.topicsAddButton.setObjectName(u'topicsAddButton')
self.topicsButtonsLayout.addWidget(self.topicsAddButton)
self.topicsEditButton = QtGui.QPushButton(self.topicsPage)
self.topicsEditButton.setIcon(build_icon(u':/songs/topic_edit.png'))
self.topicsEditButton.setObjectName(u'topicsEditButton')
self.topicsButtonsLayout.addWidget(self.topicsEditButton)
self.topicsDeleteButton = QtGui.QPushButton(self.topicsPage)
self.topicsDeleteButton.setIcon(build_icon(u':/songs/topic_delete.png'))
self.topicsDeleteButton.setObjectName(u'topicsDeleteButton')
self.topicsButtonsLayout.addWidget(self.topicsDeleteButton)
self.topicsLayout.addLayout(self.topicsButtonsLayout)
self.stackedLayout.addWidget(self.topicsPage)
# song books page
self.booksPage = QtGui.QWidget(songMaintenanceDialog)
self.booksPage.setObjectName(u'booksPage')
self.booksLayout = QtGui.QVBoxLayout(self.booksPage)
self.booksLayout.setObjectName(u'booksLayout')
self.booksListWidget = QtGui.QListWidget(self.booksPage)
self.booksListWidget.setObjectName(u'booksListWidget')
self.booksLayout.addWidget(self.booksListWidget)
self.booksButtonsLayout = QtGui.QHBoxLayout()
self.booksButtonsLayout.setObjectName(u'booksButtonLayout')
self.booksButtonsLayout.addStretch()
self.booksAddButton = QtGui.QPushButton(self.booksPage)
self.booksAddButton.setIcon(build_icon(u':/songs/book_add.png'))
self.booksAddButton.setObjectName(u'booksAddButton')
self.booksButtonsLayout.addWidget(self.booksAddButton)
self.booksEditButton = QtGui.QPushButton(self.booksPage)
self.booksEditButton.setIcon(build_icon(u':/songs/book_edit.png'))
self.booksEditButton.setObjectName(u'booksEditButton')
self.booksButtonsLayout.addWidget(self.booksEditButton)
self.booksDeleteButton = QtGui.QPushButton(self.booksPage)
self.booksDeleteButton.setIcon(build_icon(u':/songs/book_delete.png'))
self.booksDeleteButton.setObjectName(u'booksDeleteButton')
self.booksButtonsLayout.addWidget(self.booksDeleteButton)
self.booksLayout.addLayout(self.booksButtonsLayout)
self.stackedLayout.addWidget(self.booksPage)
#
self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(songMaintenanceDialog)
self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(songMaintenanceDialog)
self.stackedLayout.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
songMaintenanceDialog.accept)
QtCore.QObject.connect(self.typeListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'),
self.TypeStackedWidget.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog)
self.stackedLayout.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, SongMaintenanceDialog):
SongMaintenanceDialog.setWindowTitle(
def retranslateUi(self, songMaintenanceDialog):
songMaintenanceDialog.setWindowTitle(
translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
self.TypeListWidget.item(0).setText(
self.listItemAuthors.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Authors'))
self.TypeListWidget.item(1).setText(
self.listItemTopics.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Topics'))
self.TypeListWidget.item(2).setText(
self.listItemBooks.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Song Books'))
self.AuthorAddButton.setText(
self.authorsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.AuthorEditButton.setText(
self.authorsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.AuthorDeleteButton.setText(
self.authorsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.TopicAddButton.setText(
self.topicsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.TopicEditButton.setText(
self.topicsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.TopicDeleteButton.setText(
self.topicsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.BookAddButton.setText(
self.booksAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.BookEditButton.setText(
self.booksEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.BookDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.booksDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete'))

View File

@ -46,31 +46,31 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform = AuthorsForm(self)
self.topicform = TopicsForm(self)
self.bookform = SongBookForm(self)
QtCore.QObject.connect(self.AuthorAddButton,
QtCore.QObject.connect(self.authorsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick)
QtCore.QObject.connect(self.TopicAddButton,
QtCore.QObject.connect(self.topicsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick)
QtCore.QObject.connect(self.BookAddButton,
QtCore.QObject.connect(self.booksAddButton,
QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick)
QtCore.QObject.connect(self.AuthorEditButton,
QtCore.QObject.connect(self.authorsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick)
QtCore.QObject.connect(self.TopicEditButton,
QtCore.QObject.connect(self.topicsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick)
QtCore.QObject.connect(self.BookEditButton,
QtCore.QObject.connect(self.booksEditButton,
QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick)
QtCore.QObject.connect(self.AuthorDeleteButton,
QtCore.QObject.connect(self.authorsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick)
QtCore.QObject.connect(self.TopicDeleteButton,
QtCore.QObject.connect(self.topicsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick)
QtCore.QObject.connect(self.BookDeleteButton,
QtCore.QObject.connect(self.booksDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick)
def exec_(self):
self.TypeListWidget.setCurrentRow(0)
self.typeListWidget.setCurrentRow(0)
self.resetAuthors()
self.resetTopics()
self.resetBooks()
self.TypeListWidget.setFocus()
self.typeListWidget.setFocus()
return QtGui.QDialog.exec_(self)
def _getCurrentItemId(self, ListWidget):
@ -101,7 +101,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Reloads the Authors list.
"""
self.AuthorsListWidget.clear()
self.authorsListWidget.clear()
authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name)
for author in authors:
@ -109,50 +109,50 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
author_name = QtGui.QListWidgetItem(author.display_name)
else:
author_name = QtGui.QListWidgetItem(
u' '.join(author.first_name, author.last_name))
u' '.join([author.first_name, author.last_name]))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListWidget.addItem(author_name)
if self.AuthorsListWidget.count() == 0:
self.AuthorDeleteButton.setEnabled(False)
self.AuthorEditButton.setEnabled(False)
self.authorsListWidget.addItem(author_name)
if self.authorsListWidget.count() == 0:
self.authorsDeleteButton.setEnabled(False)
self.authorsEditButton.setEnabled(False)
else:
self.AuthorDeleteButton.setEnabled(True)
self.AuthorEditButton.setEnabled(True)
self.authorsDeleteButton.setEnabled(True)
self.authorsEditButton.setEnabled(True)
def resetTopics(self):
"""
Reloads the Topics list.
"""
self.TopicsListWidget.clear()
self.topicsListWidget.clear()
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
for topic in topics:
topic_name = QtGui.QListWidgetItem(topic.name)
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListWidget.addItem(topic_name)
if self.TopicsListWidget.count() == 0:
self.TopicDeleteButton.setEnabled(False)
self.TopicEditButton.setEnabled(False)
self.topicsListWidget.addItem(topic_name)
if self.topicsListWidget.count() == 0:
self.topicsDeleteButton.setEnabled(False)
self.topicsEditButton.setEnabled(False)
else:
self.TopicDeleteButton.setEnabled(True)
self.TopicEditButton.setEnabled(True)
self.topicsDeleteButton.setEnabled(True)
self.topicsEditButton.setEnabled(True)
def resetBooks(self):
"""
Reloads the Books list.
"""
self.BooksListWidget.clear()
self.booksListWidget.clear()
books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
for book in books:
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
book.publisher))
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
self.BooksListWidget.addItem(book_name)
if self.BooksListWidget.count() == 0:
self.BookDeleteButton.setEnabled(False)
self.BookEditButton.setEnabled(False)
self.booksListWidget.addItem(book_name)
if self.booksListWidget.count() == 0:
self.booksDeleteButton.setEnabled(False)
self.booksEditButton.setEnabled(False)
else:
self.BookDeleteButton.setEnabled(True)
self.BookEditButton.setEnabled(True)
self.booksDeleteButton.setEnabled(True)
self.booksEditButton.setEnabled(True)
def checkAuthor(self, new_author, edit=False):
"""
@ -222,9 +222,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True)
if self.authorform.exec_():
author = Author.populate(
first_name=unicode(self.authorform.FirstNameEdit.text()),
last_name=unicode(self.authorform.LastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text()))
first_name=unicode(self.authorform.firstNameEdit.text()),
last_name=unicode(self.authorform.lastNameEdit.text()),
display_name=unicode(self.authorform.displayEdit.text()))
if self.checkAuthor(author):
if self.manager.save_object(author):
self.resetAuthors()
@ -241,7 +241,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClick(self):
if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text()))
topic = Topic.populate(name=unicode(self.topicform.nameEdit.text()))
if self.checkTopic(topic):
if self.manager.save_object(topic):
self.resetTopics()
@ -258,8 +258,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClick(self):
if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.NameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text()))
book = Book.populate(name=unicode(self.bookform.nameEdit.text()),
publisher=unicode(self.bookform.publisherEdit.text()))
if self.checkBook(book):
if self.manager.save_object(book):
self.resetBooks()
@ -275,13 +275,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'This book already exists.'))
def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget)
author_id = self._getCurrentItemId(self.authorsListWidget)
if author_id != -1:
author = self.manager.get_object(Author, author_id)
self.authorform.setAutoDisplayName(False)
self.authorform.FirstNameEdit.setText(author.first_name)
self.authorform.LastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name)
self.authorform.firstNameEdit.setText(author.first_name)
self.authorform.lastNameEdit.setText(author.last_name)
self.authorform.displayEdit.setText(author.display_name)
# Save the author's first and last name as well as the display name
# for the case that they have to be restored.
temp_first_name = author.first_name
@ -289,10 +289,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_display_name = author.display_name
if self.authorform.exec_(False):
author.first_name = unicode(
self.authorform.FirstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text())
self.authorform.firstNameEdit.text())
author.last_name = unicode(self.authorform.lastNameEdit.text())
author.display_name = unicode(
self.authorform.DisplayEdit.text())
self.authorform.displayEdit.text())
if self.checkAuthor(author, True):
if self.manager.save_object(author):
self.resetAuthors()
@ -328,14 +328,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'author already exists.'))
def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget)
topic_id = self._getCurrentItemId(self.topicsListWidget)
if topic_id != -1:
topic = self.manager.get_object(Topic, topic_id)
self.topicform.NameEdit.setText(topic.name)
self.topicform.nameEdit.setText(topic.name)
# Save the topic's name for the case that he has to be restored.
temp_name = topic.name
if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text())
topic.name = unicode(self.topicform.nameEdit.text())
if self.checkTopic(topic, True):
if self.manager.save_object(topic):
self.resetTopics()
@ -365,20 +365,20 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'already exists.'))
def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget)
book_id = self._getCurrentItemId(self.booksListWidget)
if book_id != -1:
book = self.manager.get_object(Book, book_id)
if book.publisher is None:
book.publisher = u''
self.bookform.NameEdit.setText(book.name)
self.bookform.PublisherEdit.setText(book.publisher)
self.bookform.nameEdit.setText(book.name)
self.bookform.publisherEdit.setText(book.publisher)
# Save the book's name and publisher for the case that they have to
# be restored.
temp_name = book.name
temp_publisher = book.publisher
if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text())
book.name = unicode(self.bookform.nameEdit.text())
book.publisher = unicode(self.bookform.publisherEdit.text())
if self.checkBook(book, True):
if self.manager.save_object(book):
self.resetBooks()
@ -466,7 +466,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Delete the author if the author is not attached to any songs.
"""
self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors,
self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected author?'),
@ -479,7 +479,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Delete the Book is the Book is not attached to any songs.
"""
self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics,
self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected topic?'),
@ -492,7 +492,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Delete the Book is the Book is not attached to any songs.
"""
self._deleteItem(Book, self.BooksListWidget, self.resetBooks,
self._deleteItem(Book, self.booksListWidget, self.resetBooks,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected book?'),

View File

@ -29,40 +29,35 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_TopicsDialog(object):
def setupUi(self, TopicsDialog):
TopicsDialog.setObjectName(u'TopicsDialog')
TopicsDialog.resize(365, 77)
self.TopicLayout = QtGui.QFormLayout(TopicsDialog)
self.TopicLayout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.TopicLayout.setMargin(8)
self.TopicLayout.setSpacing(8)
self.TopicLayout.setObjectName(u'TopicLayout')
self.NameLabel = QtGui.QLabel(TopicsDialog)
self.NameLabel.setObjectName(u'NameLabel')
self.TopicLayout.setWidget(0,
QtGui.QFormLayout.LabelRole, self.NameLabel)
self.NameEdit = QtGui.QLineEdit(TopicsDialog)
self.NameEdit.setObjectName(u'NameEdit')
self.TopicLayout.setWidget(0,
QtGui.QFormLayout.FieldRole, self.NameEdit)
self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog)
self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.TopicButtonBox.setStandardButtons(
def setupUi(self, topicsDialog):
topicsDialog.setObjectName(u'topicsDialog')
topicsDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.nameLayout = QtGui.QFormLayout()
self.nameLayout.setObjectName(u'nameLayout')
self.nameLabel = QtGui.QLabel(topicsDialog)
self.nameLabel.setObjectName(u'nameLabel')
self.nameEdit = QtGui.QLineEdit(topicsDialog)
self.nameEdit.setObjectName(u'nameEdit')
self.nameLabel.setBuddy(self.nameEdit)
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.dialogLayout.addLayout(self.nameLayout)
self.buttonBox = QtGui.QDialogButtonBox(topicsDialog)
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.TopicButtonBox.setObjectName(u'TopicButtonBox')
self.TopicLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.TopicButtonBox)
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), topicsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), topicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
self.retranslateUi(TopicsDialog)
QtCore.QObject.connect(self.TopicButtonBox,
QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept)
QtCore.QObject.connect(self.TopicButtonBox,
QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(TopicsDialog)
def retranslateUi(self, TopicsDialog):
TopicsDialog.setWindowTitle(
def retranslateUi(self, topicsDialog):
topicsDialog.setWindowTitle(
translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
self.NameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:'))
self.nameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -42,17 +42,17 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
def exec_(self, clear=True):
if clear:
self.NameEdit.clear()
self.NameEdit.setFocus()
self.nameEdit.clear()
self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self)
def accept(self):
if not self.NameEdit.text():
if not self.nameEdit.text():
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm',
'You need to type in a topic name.'))
self.NameEdit.setFocus()
self.nameEdit.setFocus()
return False
else:
return QtGui.QDialog.accept(self)
return QtGui.QDialog.accept(self)

View File

@ -24,6 +24,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from openlp.core.lib import translate
class VerseType(object):
@ -123,6 +124,57 @@ class VerseType(object):
unicode(VerseType.to_string(VerseType.Other)).lower():
return VerseType.Other
def retrieve_windows_encoding(recommendation=None):
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if recommendation in codepage_mapping:
recommendation = codepage_mapping[recommendation]
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin', 'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin', 'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin', 'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin', 'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin', 'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin', 'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin', 'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin', 'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin', 'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin', 'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin', 'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin', 'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin', 'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin', 'Western European (CP-1252)'))]
recommended_index = -1
if recommendation:
for index in range(len(encodings)):
if recommendation == encodings[index][0]:
recommended_index = index
break
if recommended_index > 0:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], recommended_index, False)
else:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'Please choose the character encoding.\n'
'The encoding is responsible for the correct character '
'representation.'), [pair[1] for pair in encodings], 0, False)
if not choice[1]:
return None
return filter(lambda item: item[1] == choice[0], encodings)[0][0]
from xml import LyricsXML, SongXMLBuilder, SongXMLParser, OpenLyricsParser
from songstab import SongsTab
from mediaitem import SongMediaItem
from mediaitem import SongMediaItem

View File

@ -32,6 +32,7 @@ import os
import struct
from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
def strip_rtf(blob, encoding):
@ -163,22 +164,25 @@ class EasyWorshipSongImport(SongImport):
self.encoding = u'cp1250'
# The following codepage to actual encoding mappings have not been
# observed, but merely guessed. Actual example files are needed.
#if code_page == 737:
# self.encoding = u'cp1253'
#if code_page == 775:
# self.encoding = u'cp1257'
#if code_page == 855:
# self.encoding = u'cp1251'
#if code_page == 857:
# self.encoding = u'cp1254'
#if code_page == 866:
# self.encoding = u'cp1251'
#if code_page == 869:
# self.encoding = u'cp1253'
#if code_page == 862:
# self.encoding = u'cp1255'
#if code_page == 874:
# self.encoding = u'cp874'
elif code_page == 737:
self.encoding = u'cp1253'
elif code_page == 775:
self.encoding = u'cp1257'
elif code_page == 855:
self.encoding = u'cp1251'
elif code_page == 857:
self.encoding = u'cp1254'
elif code_page == 866:
self.encoding = u'cp1251'
elif code_page == 869:
self.encoding = u'cp1253'
elif code_page == 862:
self.encoding = u'cp1255'
elif code_page == 874:
self.encoding = u'cp874'
self.encoding = retrieve_windows_encoding(self.encoding)
if not self.encoding:
return False
# There does not appear to be a _reliable_ way of getting the number
# of songs/records, so let's use file blocks for measuring progress.
total_blocks = (db_size - header_size) / (block_size * 1024)
@ -347,4 +351,4 @@ class EasyWorshipSongImport(SongImport):
return u''
return self.memo_file.read(blob_size)
else:
return 0
return 0

View File

@ -74,46 +74,37 @@ class SongMediaItem(MediaManagerItem):
def addEndHeaderBar(self):
self.addToolbarSeparator()
## Song Maintenance Button ##
self.addToolbarButton(
translate('SongsPlugin.MediaItem', 'Song Maintenance'),
translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'),
self.maintenanceAction = self.addToolbarButton(u'', u'',
':/songs/song_maintenance.png', self.onSongMaintenanceClick)
self.pageLayout.setSpacing(4)
self.SearchLayout = QtGui.QFormLayout()
self.SearchLayout.setMargin(0)
self.SearchLayout.setSpacing(4)
self.SearchLayout.setObjectName(u'SearchLayout')
self.SearchTextLabel = QtGui.QLabel(self)
self.SearchTextLabel.setAlignment(
QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft)
self.SearchTextLabel.setObjectName(u'SearchTextLabel')
self.SearchLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel)
self.SearchTextEdit = SearchEdit(self)
self.SearchTextEdit.setObjectName(u'SearchTextEdit')
self.SearchLayout.setWidget(
0, QtGui.QFormLayout.FieldRole, self.SearchTextEdit)
self.pageLayout.addLayout(self.SearchLayout)
self.SearchButtonLayout = QtGui.QHBoxLayout()
self.SearchButtonLayout.setMargin(0)
self.SearchButtonLayout.setSpacing(4)
self.SearchButtonLayout.setObjectName(u'SearchButtonLayout')
self.SearchButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.SearchButtonLayout.addItem(self.SearchButtonSpacer)
self.SearchTextButton = QtGui.QPushButton(self)
self.SearchTextButton.setObjectName(u'SearchTextButton')
self.SearchButtonLayout.addWidget(self.SearchTextButton)
self.pageLayout.addLayout(self.SearchButtonLayout)
self.searchWidget = QtGui.QWidget(self)
self.searchWidget.setObjectName(u'searchWidget')
self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
self.searchLayout.setObjectName(u'searchLayout')
self.searchTextLayout = QtGui.QFormLayout()
self.searchTextLayout.setObjectName(u'searchTextLayout')
self.searchTextLabel = QtGui.QLabel(self.searchWidget)
self.searchTextLabel.setObjectName(u'searchTextLabel')
self.searchTextEdit = SearchEdit(self.searchWidget)
self.searchTextEdit.setObjectName(u'searchTextEdit')
self.searchTextLabel.setBuddy(self.searchTextEdit)
self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
self.searchLayout.addLayout(self.searchTextLayout)
self.searchButtonLayout = QtGui.QHBoxLayout()
self.searchButtonLayout.setObjectName(u'searchButtonLayout')
self.searchButtonLayout.addStretch()
self.searchTextButton = QtGui.QPushButton(self.searchWidget)
self.searchTextButton.setObjectName(u'searchTextButton')
self.searchButtonLayout.addWidget(self.searchTextButton)
self.searchLayout.addLayout(self.searchButtonLayout)
self.pageLayout.addWidget(self.searchWidget)
# Signals and slots
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit,
QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextButton,
QtCore.QObject.connect(self.searchTextButton,
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit,
QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onSearchTextEditChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -126,9 +117,9 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
QtCore.QObject.connect(self.SearchTextEdit,
QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit,
QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick)
@ -144,25 +135,36 @@ class SongMediaItem(MediaManagerItem):
QtCore.QVariant(u'True')).toBool()
def retranslateUi(self):
self.SearchTextLabel.setText(
self.searchTextLabel.setText(
translate('SongsPlugin.MediaItem', 'Search:'))
self.SearchTextButton.setText(
self.searchTextButton.setText(
translate('SongsPlugin.MediaItem', 'Search'))
self.maintenanceAction.setText(
translate('SongsPlugin.MediaItem', 'Song Maintenance'))
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'))
def initialise(self):
self.SearchTextEdit.setSearchTypes([
(1, u':/songs/song_search_all.png', translate('SongsPlugin.MediaItem', 'Entire Song')),
(2, u':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles')),
(3, u':/songs/song_search_lyrics.png', translate('SongsPlugin.MediaItem', 'Lyrics')),
(4, u':/songs/song_search_author.png', translate('SongsPlugin.MediaItem', 'Authors'))
self.searchTextEdit.setSearchTypes([
(1, u':/songs/song_search_all.png',
translate('SongsPlugin.MediaItem', 'Entire Song')),
(2, u':/songs/song_search_title.png',
translate('SongsPlugin.MediaItem', 'Titles')),
(3, u':/songs/song_search_lyrics.png',
translate('SongsPlugin.MediaItem', 'Lyrics')),
(4, u':/songs/song_search_author.png',
translate('SongsPlugin.MediaItem', 'Authors')),
(5, u':/slides/slide_theme.png',
translate('SongsPlugin.MediaItem', 'Themes'))
])
self.configUpdated()
def onSearchTextButtonClick(self):
search_keywords = unicode(self.SearchTextEdit.displayText())
search_keywords = unicode(self.searchTextEdit.displayText())
search_results = []
# search_type = self.SearchTypeComboBox.currentIndex()
search_type = self.SearchTextEdit.currentSearchType()
# search_type = self.searchTypeComboBox.currentIndex()
search_type = self.searchTextEdit.currentSearchType()
if search_type == 1:
log.debug(u'Entire Song Search')
search_results = self.parent.manager.get_all_objects(Song,
@ -189,6 +191,12 @@ class SongMediaItem(MediaManagerItem):
Author.display_name.like(u'%' + search_keywords + u'%'),
Author.display_name.asc())
self.displayResultsAuthor(search_results)
elif search_type == 5:
log.debug(u'Theme Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.theme_name == search_keywords,
Song.search_lyrics.asc())
self.displayResultsSong(search_results)
def onSongListLoad(self):
"""
@ -241,7 +249,7 @@ class SongMediaItem(MediaManagerItem):
"""
Clear the search text.
"""
self.SearchTextEdit.clear()
self.searchTextEdit.clear()
self.onSearchTextButtonClick()
def onSearchTextEditChanged(self, text):
@ -252,9 +260,9 @@ class SongMediaItem(MediaManagerItem):
"""
if self.searchAsYouType:
search_length = 1
if self.SearchTextEdit.currentSearchType() == 1:
if self.searchTextEdit.currentSearchType() == 1:
search_length = 3
elif self.SearchTextEdit.currentSearchType() == 3:
elif self.searchTextEdit.currentSearchType() == 3:
search_length = 7
if len(text) > search_length:
self.onSearchTextButtonClick()

View File

@ -28,13 +28,12 @@ The :mod:`olp1import` module provides the functionality for importing
openlp.org 1.x song databases into the current installation database.
"""
from PyQt4 import QtGui
import logging
from chardet.universaldetector import UniversalDetector
import sqlite
from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport
log = logging.getLogger(__name__)
@ -185,64 +184,4 @@ class OpenLP1SongImport(SongImport):
detector.close()
return detector.result[u'encoding']
detector.close()
guess = detector.result[u'encoding']
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if guess in codepage_mapping:
guess = codepage_mapping[guess]
else:
guess = u'cp1252'
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin.OpenLP1SongImport',
'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin.OpenLP1SongImport',
'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin.OpenLP1SongImport',
'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin.OpenLP1SongImport',
'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin.OpenLP1SongImport',
'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin.OpenLP1SongImport',
'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin.OpenLP1SongImport',
'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin.OpenLP1SongImport',
'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin.OpenLP1SongImport',
'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin.OpenLP1SongImport',
'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin.OpenLP1SongImport',
'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin.OpenLP1SongImport',
'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin.OpenLP1SongImport',
'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin.OpenLP1SongImport',
'Western European (CP-1252)'))]
encoding_index = 0
for index in range(len(encodings)):
if guess == encodings[index][0]:
encoding_index = index
break
chosen_encoding = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin.OpenLP1SongImport',
'Database Character Encoding'),
translate('SongsPlugin.OpenLP1SongImport',
'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], encoding_index, False)
if not chosen_encoding[1]:
return None
return filter(lambda item: item[1] == chosen_encoding[0],
encodings)[0][0]
return retrieve_windows_encoding(detector.result[u'encoding'])

View File

@ -27,10 +27,11 @@
The :mod:`songbeamerimport` module provides the functionality for importing
SongBeamer songs into the OpenLP database.
"""
import logging
import os
import chardet
import codecs
import logging
import os
import re
from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport import SongImport
@ -151,23 +152,25 @@ class SongBeamerImport(SongImport):
(u'</i>', u'{/it}'),
(u'<u>', u'{u}'),
(u'</u>', u'{/u}'),
(u'<br>', u'{st}'),
(u'</br>', u'{st}'),
(u'</ br>', u'{st}'),
(u'<p>', u'{p}'),
(u'</p>', u'{/p}'),
(u'<super>', u'{su}'),
(u'</super>', u'{/su}'),
(u'<sub>', u'{sb}'),
(u'</sub>', u'{/sb}'),
(u'<wordwrap>', u''),
(u'</wordwrap>', u''),
(u'<strike>', u''),
(u'</strike>', u'')
(u'<[/]?br.*?>', u'{st}'),
(u'<[/]?wordwrap>', u''),
(u'<[/]?strike>', u''),
(u'<[/]?h.*?>', u''),
(u'<[/]?s.*?>', u''),
(u'<[/]?linespacing.*?>', u''),
(u'<[/]?c.*?>', u''),
(u'<align.*?>', u''),
(u'<valign.*?>', u'')
]
for pair in tag_pairs:
self.current_verse = self.current_verse.replace(pair[0], pair[1])
# TODO: check for unsupported tags (see wiki) and remove them as well.
self.current_verse = re.compile(pair[0]).sub(pair[1],
self.current_verse)
def parse_tags(self, line):
"""

View File

@ -37,15 +37,10 @@ class SongsTab(SettingsTab):
def setupUi(self):
self.setObjectName(u'SongsTab')
self.SongsLayout = QtGui.QFormLayout(self)
self.SongsLayout.setSpacing(8)
self.SongsLayout.setMargin(8)
self.SongsLayout.setObjectName(u'SongsLayout')
self.SongsModeGroupBox = QtGui.QGroupBox(self)
SettingsTab.setupUi(self)
self.SongsModeGroupBox = QtGui.QGroupBox(self.leftColumn)
self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
self.SongsModeLayout.setSpacing(8)
self.SongsModeLayout.setMargin(8)
self.SongsModeLayout.setObjectName(u'SongsModeLayout')
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
@ -61,8 +56,9 @@ class SongsTab(SettingsTab):
self.SongAddFromServiceCheckBox.setObjectName(
u'SongAddFromServiceCheckBox')
self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox)
self.SongsLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox)
self.leftLayout.addWidget(self.SongsModeGroupBox)
self.leftLayout.addStretch()
self.rightLayout.addStretch()
QtCore.QObject.connect(self.SearchAsTypeCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onSearchAsTypeCheckBoxChanged)
@ -139,4 +135,4 @@ class SongsTab(SettingsTab):
QtCore.QVariant(self.update_edit))
settings.setValue(u'add song from service',
QtCore.QVariant(self.update_load))
settings.endGroup()
settings.endGroup()

View File

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>displayTagEdit</class>
<widget class="QWidget" name="displayTagEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>717</width>
<height>554</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QGroupBox" name="editGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>320</y>
<width>691</width>
<height>181</height>
</rect>
</property>
<property name="title">
<string>Edit Selection</string>
</property>
<widget class="QPushButton" name="updatePushButton">
<property name="geometry">
<rect>
<x>600</x>
<y>140</y>
<width>73</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>571</width>
<height>114</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string>Description</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="descriptionLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="tagLabel">
<property name="text">
<string>Tag</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="tagLineEdit">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="startTagLabel">
<property name="text">
<string>Start tag</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="startTagLineEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="endTagLabel">
<property name="text">
<string>End tag</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="endTagLineEdit"/>
</item>
</layout>
</widget>
</widget>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>540</x>
<y>510</y>
<width>162</width>
<height>26</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QPushButton" name="deletePushButton">
<property name="geometry">
<rect>
<x>530</x>
<y>280</y>
<width>71</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
<widget class="QPushButton" name="addPushButton">
<property name="geometry">
<rect>
<x>610</x>
<y>280</y>
<width>71</width>
<height>26</height>
</rect>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
<widget class="QTableWidget" name="tagTableWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>691</width>
<height>271</height>
</rect>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>Key</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Start Tag</string>
</property>
</column>
<column>
<property name="text">
<string>End Tag</string>
</property>
</column>
</widget>
</widget>
<resources/>
<connections/>
</ui>