This commit is contained in:
Raoul Snyman 2010-05-29 23:25:43 +02:00
commit 0b8d8b8832
114 changed files with 6972 additions and 6131 deletions

View File

@ -15,3 +15,4 @@ OpenLP.egg-info
build
resources/innosetup/Output
_eric4project
.pylint.d

View File

@ -1,6 +1,6 @@
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'openlp.pyw'],
pathex=['c:\\Documents and Settings\\raoul\\My Documents\\My Projects\\openlp\\pyinstaller'])
pathex=[os.path.abspath('.')])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,

View File

@ -18,12 +18,6 @@
.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
:members:
:mod:`ListWithPreviews`
-----------------------
.. autoclass:: openlp.core.lib.listwithpreviews.ListWithPreviews
:members:
:mod:`MediaManagerItem`
-----------------------

View File

@ -0,0 +1,95 @@
.. _plugins-bibles:
:mod:`bibles` Plugin
====================
.. automodule:: openlp.plugins.bibles
:members:
:mod:`BiblePlugin` Class
-------------------------
.. autoclass:: openlp.plugins.bibles.bibleplugin.BiblePlugin
:members:
:mod:`forms` Submodule
----------------------
.. automodule:: openlp.plugins.bibles.forms
:members:
:mod:`BibleImportWizard`
^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: openlp.plugins.bibles.forms.bibleimportwizard.Ui_BibleImportWizard
:members:
.. autoclass:: openlp.plugins.bibles.forms.importwizardform.ImportWizardForm
:members:
:mod:`lib` Submodule
--------------------
.. automodule:: openlp.plugins.bibles.lib
:members:
:mod:`db`
^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.db
:members:
.. autoclass:: openlp.plugins.bibles.lib.db.BibleDB
:members:
:mod:`csv`
^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.csvbible
:members:
.. autoclass:: openlp.plugins.bibles.lib.csvbible.CSVBible
:members:
:mod:`http`
^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.http
:members:
.. autoclass:: openlp.plugins.bibles.lib.http.HTTPBible
:members:
:mod:`bibleOSISimpl`
^^^^^^^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.osis
:members:
.. autoclass:: openlp.plugins.bibles.lib.osis.OSISBible
:members:
:mod:`biblestab`
^^^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.biblestab
:members:
:mod:`common`
^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.common
:members:
:mod:`manager`
^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.manager
:members:
:mod:`mediaitem`
^^^^^^^^^^^^^^^^
.. automodule:: openlp.plugins.bibles.lib.mediaitem
:members:

View File

@ -10,12 +10,7 @@
:maxdepth: 2
songs
:mod:`bibles` Plugin
--------------------
.. automodule:: openlp.plugins.bibles
:members:
bibles
:mod:`presentations` Plugin
---------------------------
@ -41,3 +36,8 @@
.. automodule:: openlp.plugins.custom
:members:
:mod:`songusage` Plugin
-----------------------
.. automodule:: openlp.plugins.songusage
:members:

View File

@ -37,7 +37,7 @@ log = logging.getLogger()
from openlp.core.lib import Receiver
from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import AppLocation
from openlp.core.utils import AppLocation, LanguageManager
application_stylesheet = u"""
QMainWindow::separator
@ -169,7 +169,7 @@ def main():
filename = os.path.join(log_path, u'openlp.log')
logfile = FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-20s %(levelname)-8s %(message)s'))
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
log.addHandler(logfile)
logging.addLevelName(15, u'Timer')
# Parse command line options and deal with them.
@ -190,6 +190,11 @@ def main():
qInitResources()
# Now create and actually run the application.
app = OpenLP(qt_args)
#i18n Set Language
language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language)
app.installTranslator(appTranslator)
sys.exit(app.run())
if __name__ == u'__main__':

View File

@ -1 +1 @@
1.9.0
1.9.1-bzr821

View File

@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
log = logging.getLogger(__name__)
def translate(context, text):
def translate(context, text, comment=None):
"""
A special shortcut method to wrap around the Qt4 translation functions.
This abstracts the translation procedure so that we can change it if at a
@ -48,8 +48,7 @@ def translate(context, text):
``text``
The text to put into the translation tables for translation.
"""
return QtGui.QApplication.translate(
context, text, None, QtGui.QApplication.UnicodeUTF8)
return QtCore.QCoreApplication.translate(context, text, comment)
def get_text_file_string(text_file):
"""
@ -68,7 +67,7 @@ def get_text_file_string(text_file):
file_handle = open(text_file, u'r')
content_string = file_handle.read()
except IOError:
log.error(u'Failed to open text file %s' % text_file)
log.exception(u'Failed to open text file %s' % text_file)
finally:
if file_handle:
file_handle.close()
@ -132,6 +131,9 @@ def contextMenu(base, icon, text):
return action
def contextMenuSeparator(base):
"""
Add a separator to a context menu
"""
action = QtGui.QAction(u'', base)
action.setSeparator(True)
return action
@ -150,7 +152,8 @@ def resize_image(image, width, height):
realw = preview.width()
realh = preview.height()
# and move it to the centre of the preview space
newImage = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32_Premultiplied)
newImage = QtGui.QImage(width, height,
QtGui.QImage.Format_ARGB32_Premultiplied)
newImage.fill(QtCore.Qt.black)
painter = QtGui.QPainter(newImage)
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
@ -158,6 +161,9 @@ def resize_image(image, width, height):
class ThemeLevel(object):
"""
Provides an enumeration for the level a theme applies to
"""
Global = 1
Service = 2
Song = 3
@ -178,5 +184,4 @@ from songxmlhandler import SongXMLBuilder, SongXMLParser
from themexmlhandler import ThemeXML
from renderer import Renderer
from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem
from baselistwithdnd import BaseListWithDnD

View File

@ -230,7 +230,7 @@ class EventReceiver(QtCore.QObject):
self.emit(QtCore.SIGNAL(event), msg)
class Receiver():
class Receiver(object):
"""
Class to allow events to be passed from different parts of the system. This
is a static wrapper around the ``EventReceiver`` class. As there is only

View File

@ -533,6 +533,9 @@ class Renderer(object):
font = self.mainFont
metrics = QtGui.QFontMetrics(font)
w = metrics.width(line)
if footer:
h = metrics.height()
else:
h = metrics.height() + int(self._theme.font_main_line_adjustment)
if draw:
self.painter.setFont(font)

View File

@ -81,6 +81,8 @@ class ServiceItem(object):
self.notes = u''
self.from_plugin = False
self.capabilities = []
self.is_valid = True
self.cache = []
def add_capability(self, capability):
self.capabilities.append(capability)
@ -106,6 +108,7 @@ class ServiceItem(object):
"""
log.debug(u'Render called')
self._display_frames = []
self.cache = []
if self.service_item_type == ServiceItemType.Text:
log.debug(u'Formatting slides')
if self.theme is None:
@ -122,8 +125,10 @@ class ServiceItem(object):
if title == u'':
title = line
lines += line + u'\n'
self._display_frames.append({u'title': title, \
u'text': lines.rstrip(), u'verseTag': slide[u'verseTag'] })
self._display_frames.append({u'title': title,
u'text': lines.rstrip(),
u'verseTag': slide[u'verseTag'] })
self.cache.insert(len(self._display_frames), None)
log.log(15, u'Formatting took %4s' % (time.time() - before))
elif self.service_item_type == ServiceItemType.Image:
for slide in self._raw_frames:
@ -148,11 +153,15 @@ class ServiceItem(object):
self.RenderManager.set_override_theme(self.theme)
format = self._display_frames[row][u'text'].split(u'\n')
#if screen blank then do not display footer
if self.cache[row] is not None:
frame = self.cache[row]
else:
if format[0]:
frame = self.RenderManager.generate_slide(format,
self.raw_footer)
else:
frame = self.RenderManager.generate_slide(format, u'')
self.cache[row] = frame
return frame
def add_from_image(self, path, title, image):
@ -231,7 +240,8 @@ class ServiceItem(object):
service_data.append(slide[u'title'])
elif self.service_item_type == ServiceItemType.Command:
for slide in self._raw_frames:
service_data.append({u'title':slide[u'title'], u'image':slide[u'image']})
service_data.append(
{u'title':slide[u'title'], u'image':slide[u'image']})
return {u'header': service_header, u'data': service_data}
def set_from_service(self, serviceitem, path=None):
@ -268,7 +278,8 @@ class ServiceItem(object):
elif self.service_item_type == ServiceItemType.Command:
for text_image in serviceitem[u'serviceitem'][u'data']:
filename = os.path.join(path, text_image[u'title'])
self.add_from_command(path, text_image[u'title'], text_image[u'image'] )
self.add_from_command(
path, text_image[u'title'], text_image[u'image'] )
def merge(self, other):
"""

View File

@ -53,7 +53,7 @@ class SettingsManager(object):
self.slidecontroller_image = self.slidecontroller - 50
self.showPreviewPanel = QtCore.QSettings().value(
u'user interface/preview panel', True).toBool()
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
def togglePreviewPanel(self, isVisible):
QtCore.QSettings().setValue(u'user interface/preview panel',

View File

@ -230,7 +230,8 @@ class ThemeXML(object):
#Create indentation name element
self.child_element(background, u'indentation', unicode(indentation))
#Create indentation name element
self.child_element(background, u'line_adjustment', unicode(line_adjustment))
self.child_element(
background, u'line_adjustment', unicode(line_adjustment))
#Create Location element
element = self.theme_xml.createElement(u'location')

View File

@ -117,10 +117,11 @@ class OpenLPToolbar(QtGui.QToolBar):
The title of the icon to search for.
"""
title = QtCore.QString(title)
try:
if self.icons[title]:
return self.icons[title]
else:
log.error(u'getIconFromTitle - no icon for %s' % title)
except:
log.exception(u'getIconFromTitle - no icon for %s' % title)
return QtGui.QIcon()
def makeWidgetsInvisible(self, widgets):

View File

@ -102,3 +102,4 @@ class XmlRootClass(object):
if not attrib.startswith(u'_'):
result += u'_%s_' % getattr(self, attrib)
return result

View File

@ -23,4 +23,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from theme import Theme
from openlp.core.theme.theme import Theme

View File

@ -136,12 +136,15 @@ class Theme(object):
except ValueError:
val = t
if (element.tag.find(u'Color') > 0 or
(element.tag.find(u'BackgroundParameter') == 0 and type(val) == type(0))):
(element.tag.find(u'BackgroundParameter') == 0 and
type(val) == type(0))):
# convert to a wx.Colour
if not delphiColorChange:
val = QtGui.QColor(val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
val = QtGui.QColor(
val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF)
else:
val = QtGui.QColor((val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
val = QtGui.QColor(
(val>>16)&0xFF, (val>>8)&0xFF, val&0xFF)
setattr(self, element.tag, val)
def __str__(self):

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_AboutDialog(object):
def setupUi(self, AboutDialog):
@ -113,8 +114,8 @@ class Ui_AboutDialog(object):
QtCore.QMetaObject.connectSlotsByName(AboutDialog)
def retranslateUi(self, AboutDialog):
AboutDialog.setWindowTitle(self.trUtf8('About OpenLP'))
self.AboutTextEdit.setPlainText(self.trUtf8(
AboutDialog.setWindowTitle(translate('AboutForm', 'About OpenLP'))
self.AboutTextEdit.setPlainText(translate('AboutForm',
'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
'\n'
@ -131,8 +132,8 @@ class Ui_AboutDialog(object):
'consider contributing by using the button below.'
))
self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.AboutTab), self.trUtf8('About'))
self.CreditsTextEdit.setPlainText(self.trUtf8(
self.AboutNotebook.indexOf(self.AboutTab), translate('AboutForm', 'About'))
self.CreditsTextEdit.setPlainText(translate('AboutForm',
'Project Lead\n'
' Raoul "superfly" Snyman\n'
'\n'
@ -164,11 +165,10 @@ class Ui_AboutDialog(object):
))
self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.CreditsTab),
self.trUtf8('Credits'))
self.LicenseTextEdit.setPlainText(self.trUtf8(
'Copyright ' + u'\u00a9'.encode('utf8') + ' 2004-2010 Raoul '
'Snyman\n'
'Portions copyright ' + u'\u00a9'.encode('utf8') + ' 2004-2010 '
translate('AboutForm', 'Credits'))
self.LicenseTextEdit.setPlainText(translate('AboutForm',
'Copyright \xa9 2004-2010 Raoul Snyman\n'
'Portions copyright \xa9 2004-2010 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri, '
'Christian Richter, Maikel Stuivenberg, Martin Thompson, Jon '
'Tibble, Carsten Tinggaard\n'
@ -557,6 +557,6 @@ class Ui_AboutDialog(object):
'instead of this License.'))
self.AboutNotebook.setTabText(
self.AboutNotebook.indexOf(self.LicenseTab),
self.trUtf8('License'))
self.ContributeButton.setText(self.trUtf8('Contribute'))
self.CloseButton.setText(self.trUtf8('Close'))
translate('AboutForm', 'License'))
self.ContributeButton.setText(translate('AboutForm', 'Contribute'))
self.CloseButton.setText(translate('AboutForm', 'Close'))

View File

@ -25,6 +25,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon
from openlp.core.lib import translate
class Ui_AmendThemeDialog(object):
def setupUi(self, AmendThemeDialog):
@ -183,6 +184,7 @@ class Ui_AmendThemeDialog(object):
self.MainFontLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainWrapLineAdjustmentLabel)
self.FontMainLineAdjustmentSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
self.FontMainLineAdjustmentSpinBox.setObjectName("FontMainLineAdjustmentSpinBox")
self.FontMainLineAdjustmentSpinBox.setMinimum(-99)
self.MainFontLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.FontMainLineAdjustmentSpinBox)
self.FontMainWrapIndentationLabel = QtGui.QLabel(self.FontMainGroupBox)
self.FontMainWrapIndentationLabel.setObjectName("FontMainWrapIndentationLabel")
@ -601,95 +603,95 @@ class Ui_AmendThemeDialog(object):
AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox)
def retranslateUi(self, AmendThemeDialog):
AmendThemeDialog.setWindowTitle(self.trUtf8('Theme Maintenance'))
self.ThemeNameLabel.setText(self.trUtf8('Theme Name:'))
self.BackgroundLabel.setText(self.trUtf8('Background:'))
self.BackgroundComboBox.setItemText(0, self.trUtf8('Opaque'))
self.BackgroundComboBox.setItemText(1, self.trUtf8('Transparent'))
self.BackgroundTypeLabel.setText(self.trUtf8('Background Type:'))
self.BackgroundTypeComboBox.setItemText(0, self.trUtf8('Solid Color'))
self.BackgroundTypeComboBox.setItemText(1, self.trUtf8('Gradient'))
self.BackgroundTypeComboBox.setItemText(2, self.trUtf8('Image'))
self.Color1Label.setText(self.trUtf8('<Color1>'))
self.Color2Label.setText(self.trUtf8('<Color2>'))
self.ImageLabel.setText(self.trUtf8('Image:'))
self.GradientLabel.setText(self.trUtf8('Gradient :'))
self.GradientComboBox.setItemText(0, self.trUtf8('Horizontal'))
self.GradientComboBox.setItemText(1, self.trUtf8('Vertical'))
self.GradientComboBox.setItemText(2, self.trUtf8('Circular'))
AmendThemeDialog.setWindowTitle(translate('AmendThemeForm', 'Theme Maintenance'))
self.ThemeNameLabel.setText(translate('AmendThemeForm', 'Theme Name:'))
self.BackgroundLabel.setText(translate('AmendThemeForm', 'Background:'))
self.BackgroundComboBox.setItemText(0, translate('AmendThemeForm', 'Opaque'))
self.BackgroundComboBox.setItemText(1, translate('AmendThemeForm', 'Transparent'))
self.BackgroundTypeLabel.setText(translate('AmendThemeForm', 'Background Type:'))
self.BackgroundTypeComboBox.setItemText(0, translate('AmendThemeForm', 'Solid Color'))
self.BackgroundTypeComboBox.setItemText(1, translate('AmendThemeForm', 'Gradient'))
self.BackgroundTypeComboBox.setItemText(2, translate('AmendThemeForm', 'Image'))
self.Color1Label.setText(translate('AmendThemeForm', '<Color1>'))
self.Color2Label.setText(translate('AmendThemeForm', '<Color2>'))
self.ImageLabel.setText(translate('AmendThemeForm', 'Image:'))
self.GradientLabel.setText(translate('AmendThemeForm', 'Gradient :'))
self.GradientComboBox.setItemText(0, translate('AmendThemeForm', 'Horizontal'))
self.GradientComboBox.setItemText(1, translate('AmendThemeForm', 'Vertical'))
self.GradientComboBox.setItemText(2, translate('AmendThemeForm', 'Circular'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.BackgroundTab),
self.trUtf8('Background'))
self.FontMainGroupBox.setTitle(self.trUtf8('Main Font'))
self.FontMainlabel.setText(self.trUtf8('Font:'))
self.FontMainColorLabel.setText(self.trUtf8('Font Color:'))
self.FontMainSize.setText(self.trUtf8('Size:'))
self.FontMainSizeSpinBox.setSuffix(self.trUtf8('pt'))
self.FontMainWrapIndentationLabel.setText(self.trUtf8('Wrap Indentation'))
self.FontMainWrapLineAdjustmentLabel.setText(self.trUtf8('Adjust Line Spacing'))
self.FontMainWeightComboBox.setItemText(0, self.trUtf8('Normal'))
self.FontMainWeightComboBox.setItemText(1, self.trUtf8('Bold'))
self.FontMainWeightComboBox.setItemText(2, self.trUtf8('Italics'))
self.FontMainWeightComboBox.setItemText(3, self.trUtf8('Bold/Italics'))
self.FontMainWeightLabel.setText(self.trUtf8('Font Weight:'))
self.MainLocationGroupBox.setTitle(self.trUtf8('Display Location'))
self.DefaultLocationLabel.setText(self.trUtf8('Use Default Location:'))
self.FontMainXLabel.setText(self.trUtf8('X Position:'))
self.FontMainYLabel.setText(self.trUtf8('Y Position:'))
self.FontMainWidthLabel.setText(self.trUtf8('Width:'))
self.FontMainHeightLabel.setText(self.trUtf8('Height:'))
self.FontMainXSpinBox.setSuffix(self.trUtf8('px'))
self.FontMainYSpinBox.setSuffix(self.trUtf8('px'))
self.FontMainWidthSpinBox.setSuffix(self.trUtf8('px'))
self.FontMainHeightSpinBox.setSuffix(self.trUtf8('px'))
translate('AmendThemeForm', 'Background'))
self.FontMainGroupBox.setTitle(translate('AmendThemeForm', 'Main Font'))
self.FontMainlabel.setText(translate('AmendThemeForm', 'Font:'))
self.FontMainColorLabel.setText(translate('AmendThemeForm', 'Font Color:'))
self.FontMainSize.setText(translate('AmendThemeForm', 'Size:'))
self.FontMainSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt'))
self.FontMainWrapIndentationLabel.setText(translate('AmendThemeForm', 'Wrap Indentation'))
self.FontMainWrapLineAdjustmentLabel.setText(translate('AmendThemeForm', 'Adjust Line Spacing'))
self.FontMainWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal'))
self.FontMainWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold'))
self.FontMainWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics'))
self.FontMainWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics'))
self.FontMainWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:'))
self.MainLocationGroupBox.setTitle(translate('AmendThemeForm', 'Display Location'))
self.DefaultLocationLabel.setText(translate('AmendThemeForm', 'Use Default Location:'))
self.FontMainXLabel.setText(translate('AmendThemeForm', 'X Position:'))
self.FontMainYLabel.setText(translate('AmendThemeForm', 'Y Position:'))
self.FontMainWidthLabel.setText(translate('AmendThemeForm', 'Width:'))
self.FontMainHeightLabel.setText(translate('AmendThemeForm', 'Height:'))
self.FontMainXSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainYSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontMainHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.FontMainTab),
self.trUtf8('Font Main'))
self.FooterFontGroupBox.setTitle(self.trUtf8('Footer Font'))
self.FontFooterLabel.setText(self.trUtf8('Font:'))
self.FontFooterColorLabel.setText(self.trUtf8('Font Color:'))
self.FontFooterSizeLabel.setText(self.trUtf8('Size:'))
self.FontFooterSizeSpinBox.setSuffix(self.trUtf8('pt'))
self.FontFooterWeightComboBox.setItemText(0, self.trUtf8('Normal'))
self.FontFooterWeightComboBox.setItemText(1, self.trUtf8('Bold'))
self.FontFooterWeightComboBox.setItemText(2, self.trUtf8('Italics'))
self.FontFooterWeightComboBox.setItemText(3, self.trUtf8('Bold/Italics'))
self.FontFooterWeightLabel.setText(self.trUtf8('Font Weight:'))
self.LocationFooterGroupBox.setTitle(self.trUtf8('Display Location'))
self.FontFooterDefaultLabel.setText(self.trUtf8('Use Default Location:'))
self.FontFooterXLabel.setText(self.trUtf8('X Position:'))
self.FontFooterYLabel.setText(self.trUtf8('Y Position:'))
self.FontFooterWidthLabel.setText(self.trUtf8('Width:'))
self.FontFooterHeightLabel.setText(self.trUtf8('Height:'))
self.FontFooterXSpinBox.setSuffix(self.trUtf8('px'))
self.FontFooterYSpinBox.setSuffix(self.trUtf8('px'))
self.FontFooterWidthSpinBox.setSuffix(self.trUtf8('px'))
self.FontFooterHeightSpinBox.setSuffix(self.trUtf8('px'))
translate('AmendThemeForm', 'Font Main'))
self.FooterFontGroupBox.setTitle(translate('AmendThemeForm', 'Footer Font'))
self.FontFooterLabel.setText(translate('AmendThemeForm', 'Font:'))
self.FontFooterColorLabel.setText(translate('AmendThemeForm', 'Font Color:'))
self.FontFooterSizeLabel.setText(translate('AmendThemeForm', 'Size:'))
self.FontFooterSizeSpinBox.setSuffix(translate('AmendThemeForm', 'pt'))
self.FontFooterWeightComboBox.setItemText(0, translate('AmendThemeForm', 'Normal'))
self.FontFooterWeightComboBox.setItemText(1, translate('AmendThemeForm', 'Bold'))
self.FontFooterWeightComboBox.setItemText(2, translate('AmendThemeForm', 'Italics'))
self.FontFooterWeightComboBox.setItemText(3, translate('AmendThemeForm', 'Bold/Italics'))
self.FontFooterWeightLabel.setText(translate('AmendThemeForm', 'Font Weight:'))
self.LocationFooterGroupBox.setTitle(translate('AmendThemeForm', 'Display Location'))
self.FontFooterDefaultLabel.setText(translate('AmendThemeForm', 'Use Default Location:'))
self.FontFooterXLabel.setText(translate('AmendThemeForm', 'X Position:'))
self.FontFooterYLabel.setText(translate('AmendThemeForm', 'Y Position:'))
self.FontFooterWidthLabel.setText(translate('AmendThemeForm', 'Width:'))
self.FontFooterHeightLabel.setText(translate('AmendThemeForm', 'Height:'))
self.FontFooterXSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterYSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterWidthSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.FontFooterHeightSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.FontFooterTab),
self.trUtf8('Font Footer'))
self.OutlineGroupBox.setTitle(self.trUtf8('Outline'))
self.OutlineSpinBoxLabel.setText(self.trUtf8('Outline Size:'))
self.OutlineSpinBox.setSuffix(self.trUtf8('px'))
self.OutlineColorLabel.setText(self.trUtf8('Outline Color:'))
self.OutlineEnabledLabel.setText(self.trUtf8('Show Outline:'))
self.ShadowGroupBox.setTitle(self.trUtf8('Shadow'))
self.ShadowSpinBoxLabel.setText(self.trUtf8('Shadow Size:'))
self.ShadowSpinBox.setSuffix(self.trUtf8('px'))
self.ShadowColorLabel.setText(self.trUtf8('Shadow Color:'))
self.ShadowEnabledLabel.setText(self.trUtf8('Show Shadow:'))
self.AlignmentGroupBox.setTitle(self.trUtf8('Alignment'))
self.HorizontalLabel.setText(self.trUtf8('Horizontal Align:'))
self.HorizontalComboBox.setItemText(0, self.trUtf8('Left'))
self.HorizontalComboBox.setItemText(1, self.trUtf8('Right'))
self.HorizontalComboBox.setItemText(2, self.trUtf8('Center'))
self.VerticalLabel.setText(self.trUtf8('Vertical Align:'))
self.VerticalComboBox.setItemText(0, self.trUtf8('Top'))
self.VerticalComboBox.setItemText(1, self.trUtf8('Middle'))
self.VerticalComboBox.setItemText(2, self.trUtf8('Bottom'))
self.TransitionGroupBox.setTitle(self.trUtf8('Slide Transition'))
self.SlideTransitionCheckedBoxLabel.setText(self.trUtf8('Transition Active:'))
translate('AmendThemeForm', 'Font Footer'))
self.OutlineGroupBox.setTitle(translate('AmendThemeForm', 'Outline'))
self.OutlineSpinBoxLabel.setText(translate('AmendThemeForm', 'Outline Size:'))
self.OutlineSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.OutlineColorLabel.setText(translate('AmendThemeForm', 'Outline Color:'))
self.OutlineEnabledLabel.setText(translate('AmendThemeForm', 'Show Outline:'))
self.ShadowGroupBox.setTitle(translate('AmendThemeForm', 'Shadow'))
self.ShadowSpinBoxLabel.setText(translate('AmendThemeForm', 'Shadow Size:'))
self.ShadowSpinBox.setSuffix(translate('AmendThemeForm', 'px'))
self.ShadowColorLabel.setText(translate('AmendThemeForm', 'Shadow Color:'))
self.ShadowEnabledLabel.setText(translate('AmendThemeForm', 'Show Shadow:'))
self.AlignmentGroupBox.setTitle(translate('AmendThemeForm', 'Alignment'))
self.HorizontalLabel.setText(translate('AmendThemeForm', 'Horizontal Align:'))
self.HorizontalComboBox.setItemText(0, translate('AmendThemeForm', 'Left'))
self.HorizontalComboBox.setItemText(1, translate('AmendThemeForm', 'Right'))
self.HorizontalComboBox.setItemText(2, translate('AmendThemeForm', 'Center'))
self.VerticalLabel.setText(translate('AmendThemeForm', 'Vertical Align:'))
self.VerticalComboBox.setItemText(0, translate('AmendThemeForm', 'Top'))
self.VerticalComboBox.setItemText(1, translate('AmendThemeForm', 'Middle'))
self.VerticalComboBox.setItemText(2, translate('AmendThemeForm', 'Bottom'))
self.TransitionGroupBox.setTitle(translate('AmendThemeForm', 'Slide Transition'))
self.SlideTransitionCheckedBoxLabel.setText(translate('AmendThemeForm', 'Transition Active:'))
self.ThemeTabWidget.setTabText(
self.ThemeTabWidget.indexOf(self.OtherOptionsTab),
self.trUtf8('Other Options'))
self.PreviewGroupBox.setTitle(self.trUtf8('Preview'))
translate('AmendThemeForm', 'Other Options'))
self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview'))

View File

@ -42,139 +42,139 @@ class DisplayTab(SettingsTab):
self.tabTitleVisible = self.trUtf8('Displays')
self.layoutWidget = QtGui.QWidget(self)
self.layoutWidget.setGeometry(QtCore.QRect(0, 40, 241, 79))
self.layoutWidget.setObjectName("layoutWidget")
self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.setObjectName(u'verticalLayout')
self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget)
self.CurrentGroupBox.setObjectName("CurrentGroupBox")
self.CurrentGroupBox.setObjectName(u'CurrentGroupBox')
self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox)
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.verticalLayout_6 = QtGui.QVBoxLayout()
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.verticalLayout_6.setObjectName(u'verticalLayout_6')
self.XLabel = QtGui.QLabel(self.CurrentGroupBox)
self.XLabel.setAlignment(QtCore.Qt.AlignCenter)
self.XLabel.setObjectName("XLabel")
self.XLabel.setObjectName(u'XLabel')
self.verticalLayout_6.addWidget(self.XLabel)
self.Xpos = QtGui.QLabel(self.CurrentGroupBox)
self.Xpos.setAlignment(QtCore.Qt.AlignCenter)
self.Xpos.setObjectName("Xpos")
self.Xpos.setObjectName(u'Xpos')
self.verticalLayout_6.addWidget(self.Xpos)
self.horizontalLayout.addLayout(self.verticalLayout_6)
self.verticalLayout_7 = QtGui.QVBoxLayout()
self.verticalLayout_7.setObjectName("verticalLayout_7")
self.verticalLayout_7.setObjectName(u'verticalLayout_7')
self.YLabel = QtGui.QLabel(self.CurrentGroupBox)
self.YLabel.setAlignment(QtCore.Qt.AlignCenter)
self.YLabel.setObjectName("YLabel")
self.YLabel.setObjectName(u'YLabel')
self.verticalLayout_7.addWidget(self.YLabel)
self.Ypos = QtGui.QLabel(self.CurrentGroupBox)
self.Ypos.setAlignment(QtCore.Qt.AlignCenter)
self.Ypos.setObjectName("Ypos")
self.Ypos.setObjectName(u'Ypos')
self.verticalLayout_7.addWidget(self.Ypos)
self.horizontalLayout.addLayout(self.verticalLayout_7)
self.verticalLayout_9 = QtGui.QVBoxLayout()
self.verticalLayout_9.setObjectName("verticalLayout_9")
self.verticalLayout_9.setObjectName(u'verticalLayout_9')
self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox)
self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.HeightLabel.setObjectName("HeightLabel")
self.HeightLabel.setObjectName(u'HeightLabel')
self.verticalLayout_9.addWidget(self.HeightLabel)
self.Height = QtGui.QLabel(self.CurrentGroupBox)
self.Height.setAlignment(QtCore.Qt.AlignCenter)
self.Height.setObjectName("Height")
self.Height.setObjectName(u'Height')
self.verticalLayout_9.addWidget(self.Height)
self.horizontalLayout.addLayout(self.verticalLayout_9)
self.verticalLayout_8 = QtGui.QVBoxLayout()
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.verticalLayout_8.setObjectName(u'verticalLayout_8')
self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox)
self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.WidthLabel.setObjectName("WidthLabel")
self.WidthLabel.setObjectName(u'WidthLabel')
self.verticalLayout_8.addWidget(self.WidthLabel)
self.Width = QtGui.QLabel(self.CurrentGroupBox)
self.Width.setAlignment(QtCore.Qt.AlignCenter)
self.Width.setObjectName("Width")
self.Width.setObjectName(u'Width')
self.verticalLayout_8.addWidget(self.Width)
self.horizontalLayout.addLayout(self.verticalLayout_8)
self.verticalLayout.addWidget(self.CurrentGroupBox)
self.CurrentGroupBox_2 = QtGui.QGroupBox(self)
self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87))
self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215))
self.CurrentGroupBox_2.setObjectName("CurrentGroupBox_2")
self.CurrentGroupBox_2.setObjectName(u'CurrentGroupBox_2')
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.XAmendLabel.setObjectName("XAmendLabel")
self.XAmendLabel.setObjectName(u'XAmendLabel')
self.verticalLayout_2.addWidget(self.XAmendLabel)
self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.XposEdit.setMaxLength(4)
self.XposEdit.setObjectName("XposEdit")
self.XposEdit.setObjectName(u'XposEdit')
self.verticalLayout_2.addWidget(self.XposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_2)
self.verticalLayout_3 = QtGui.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout_3.setObjectName(u'verticalLayout_3')
self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.YAmendLabel.setObjectName("YAmendLabel")
self.YAmendLabel.setObjectName(u'YAmendLabel')
self.verticalLayout_3.addWidget(self.YAmendLabel)
self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.YposEdit.setMaxLength(4)
self.YposEdit.setObjectName("YposEdit")
self.YposEdit.setObjectName(u'YposEdit')
self.verticalLayout_3.addWidget(self.YposEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_3)
self.verticalLayout_4 = QtGui.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.verticalLayout_4.setObjectName(u'verticalLayout_4')
self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.HeightAmendLabel.setObjectName("HeightAmendLabel")
self.HeightAmendLabel.setObjectName(u'HeightAmendLabel')
self.verticalLayout_4.addWidget(self.HeightAmendLabel)
self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.HeightEdit.setMaxLength(4)
self.HeightEdit.setObjectName("HeightEdit")
self.HeightEdit.setObjectName(u'HeightEdit')
self.verticalLayout_4.addWidget(self.HeightEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_4)
self.verticalLayout_5 = QtGui.QVBoxLayout()
self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.verticalLayout_5.setObjectName(u'verticalLayout_5')
self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2)
self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter)
self.WidthAmendLabel.setObjectName("WidthAmendLabel")
self.WidthAmendLabel.setObjectName(u'WidthAmendLabel')
self.verticalLayout_5.addWidget(self.WidthAmendLabel)
self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2)
self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215))
self.WidthEdit.setObjectName("WidthEdit")
self.WidthEdit.setObjectName(u'WidthEdit')
self.verticalLayout_5.addWidget(self.WidthEdit)
self.horizontalLayout_2.addLayout(self.verticalLayout_5)
self.OverrideCheckBox = QtGui.QCheckBox(self)
self.OverrideCheckBox.setGeometry(QtCore.QRect(0, 10, 191, 23))
self.OverrideCheckBox.setObjectName("OverrideCheckBox")
self.OverrideCheckBox.setObjectName(u'OverrideCheckBox')
QtCore.QMetaObject.connectSlotsByName(self)
QtCore.QObject.connect(self.OverrideCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onOverrideCheckBoxChanged)
def retranslateUi(self):
self.setWindowTitle(QtGui.QApplication.translate("self", "Amend Display Settings", None, QtGui.QApplication.UnicodeUTF8))
self.CurrentGroupBox.setTitle(QtGui.QApplication.translate("self", "Default Settings", None, QtGui.QApplication.UnicodeUTF8))
self.XLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8))
self.Xpos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
self.YLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.Ypos.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
self.HeightLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8))
self.Height.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
self.WidthLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8))
self.Width.setText(QtGui.QApplication.translate("self", "0", None, QtGui.QApplication.UnicodeUTF8))
self.CurrentGroupBox_2.setTitle(QtGui.QApplication.translate("self", "Amend Settings", None, QtGui.QApplication.UnicodeUTF8))
self.XAmendLabel.setText(QtGui.QApplication.translate("self", "X", None, QtGui.QApplication.UnicodeUTF8))
self.YAmendLabel.setText(QtGui.QApplication.translate("self", "Y", None, QtGui.QApplication.UnicodeUTF8))
self.HeightAmendLabel.setText(QtGui.QApplication.translate("self", "Height", None, QtGui.QApplication.UnicodeUTF8))
self.WidthAmendLabel.setText(QtGui.QApplication.translate("self", "Width", None, QtGui.QApplication.UnicodeUTF8))
self.OverrideCheckBox.setText(QtGui.QApplication.translate("self", "Override Output Display", None, QtGui.QApplication.UnicodeUTF8))
self.setWindowTitle( self.trUtf8(u'Amend Display Settings'))
self.CurrentGroupBox.setTitle( self.trUtf8(u'Default Settings'))
self.XLabel.setText(self.trUtf8(u'X'))
self.Xpos.setText(u'0')
self.YLabel.setText( self.trUtf8(u'Y'))
self.Ypos.setText(u'0')
self.HeightLabel.setText( self.trUtf8(u'Height'))
self.Height.setText(u'0')
self.WidthLabel.setText( self.trUtf8(u'Width'))
self.Width.setText(u'0')
self.CurrentGroupBox_2.setTitle( self.trUtf8(u'Amend Settings'))
self.XAmendLabel.setText( self.trUtf8(u'X'))
self.YAmendLabel.setText( self.trUtf8(u'Y'))
self.HeightAmendLabel.setText( self.trUtf8(u'Height'))
self.WidthAmendLabel.setText( self.trUtf8(u'Width'))
self.OverrideCheckBox.setText( self.trUtf8(u'Override Output Display'))
def load(self):
settings = QtCore.QSettings()
@ -222,8 +222,8 @@ class DisplayTab(SettingsTab):
self.postSetUp()
def postSetUp(self):
self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),\
int(self.YposEdit.text()), int(self.WidthEdit.text()),\
self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()),
int(self.YposEdit.text()), int(self.WidthEdit.text()),
int(self.HeightEdit.text()))
if self.amend_display:
self.screens.set_override_display()
@ -233,3 +233,4 @@ class DisplayTab(SettingsTab):
if self.amend_display_start != self.amend_display:
self.amend_display_start = self.amend_display
Receiver.send_message(u'config_screen_changed')

View File

@ -44,7 +44,7 @@ class GeneralTab(SettingsTab):
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
self.MonitorNumber = settings.value(u'monitor',
QtCore.QVariant(self.screens.monitor_number)).toInt()[0]
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
self.screens.set_current_display(self.MonitorNumber)
self.screens.monitor_number = self.MonitorNumber
self.DisplayOnMonitor = settings.value(

View File

@ -116,9 +116,15 @@ class MainDisplay(DisplayWidget):
"""
log.debug(u'Initialisation started')
DisplayWidget.__init__(self, parent)
self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
self.setWindowState(QtCore.Qt.WindowFullScreen)
self.parent = parent
self.setWindowTitle(u'OpenLP Display')
# WA_TranslucentBackground is not available in QT4.4
try:
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
except AttributeError:
pass
self.screens = screens
self.display_image = QtGui.QLabel(self)
self.display_image.setScaledContents(True)
@ -340,8 +346,14 @@ class VideoDisplay(Phonon.VideoWidget):
self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory)
Phonon.createPath(self.mediaObject, self)
Phonon.createPath(self.mediaObject, self.audioObject)
self.setWindowFlags(QtCore.Qt.WindowStaysOnBottomHint |
QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog)
flags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Dialog
# WindowsStaysOnBottomHint is not available in QT4.4
try:
flags = flags | QtCore.Qt.WindowStaysOnBottomHint
except AttributeError:
pass
self.setWindowFlags(flags)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_hide'), self.mediaHide)
QtCore.QObject.connect(Receiver.get_receiver(),

View File

@ -25,14 +25,15 @@
import logging
import time
import re
from PyQt4 import QtCore, QtGui
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, DisplayManager
from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \
SettingsManager, PluginManager, Receiver
from openlp.core.utils import check_latest_version, AppLocation, add_actions
SettingsManager, PluginManager, Receiver, translate
from openlp.core.utils import check_latest_version, AppLocation, add_actions, LanguageManager
log = logging.getLogger(__name__)
@ -60,6 +61,7 @@ class VersionThread(QtCore.QThread):
QtCore.QThread.__init__(self, parent)
self.parent = parent
self.app_version = app_version
self.version_splitter = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))')
def run(self):
"""
@ -68,8 +70,29 @@ class VersionThread(QtCore.QThread):
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
#new version has arrived
if version != self.app_version[u'full']:
remote_version = {}
local_version = {}
match = self.version_splitter.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
remote_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3:
remote_version[u'revision'] = int(match.group(4))
match = self.version_splitter.match(self.app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
local_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3:
local_version[u'revision'] = int(match.group(4))
if remote_version[u'major'] > local_version[u'major'] or \
remote_version[u'minor'] > local_version[u'minor'] or \
remote_version[u'release'] > local_version[u'release']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
elif remote_version.get(u'revision') and \
local_version.get(u'revision') and \
remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class Ui_MainWindow(object):
@ -252,10 +275,22 @@ class Ui_MainWindow(object):
self.HelpOnlineHelpItem.setEnabled(False)
self.HelpWebSiteItem = QtGui.QAction(MainWindow)
self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem')
self.LanguageTranslateItem = QtGui.QAction(MainWindow)
self.LanguageTranslateItem.setObjectName(u'LanguageTranslateItem')
self.LanguageEnglishItem = QtGui.QAction(MainWindow)
self.LanguageEnglishItem.setObjectName(u'LanguageEnglishItem')
#i18n Language Items
self.AutoLanguageItem = QtGui.QAction(MainWindow)
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
self.AutoLanguageItem.setCheckable(True)
self.LanguageGroup = QtGui.QActionGroup(MainWindow)
qmList = LanguageManager.get_qm_list()
savedLanguage = LanguageManager.get_language()
self.AutoLanguageItem.setChecked(LanguageManager.AutoLanguage)
for key in sorted(qmList.keys()):
languageItem = QtGui.QAction(MainWindow)
languageItem.setObjectName(key)
languageItem.setCheckable(True)
if qmList[key] == savedLanguage:
languageItem.setChecked(True)
add_actions(self.LanguageGroup, [languageItem])
self.LanguageGroup.setDisabled(LanguageManager.AutoLanguage)
self.ToolsAddToolItem = QtGui.QAction(MainWindow)
AddToolIcon = build_icon(u':/tools/tools_add.png')
self.ToolsAddToolItem.setIcon(AddToolIcon)
@ -281,8 +316,9 @@ class Ui_MainWindow(object):
add_actions(self.OptionsViewMenu, (self.ViewModeMenu.menuAction(),
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
self.ViewThemeManagerItem, None, self.action_Preview_Panel))
add_actions(self.OptionsLanguageMenu, (self.LanguageEnglishItem, None,
self.LanguageTranslateItem))
#i18n add Language Actions
add_actions(self.OptionsLanguageMenu, (self.AutoLanguageItem, None))
add_actions(self.OptionsLanguageMenu, self.LanguageGroup.actions())
add_actions(self.OptionsMenu, (self.OptionsLanguageMenu.menuAction(),
self.OptionsViewMenu.menuAction(), None, self.OptionsSettingsItem))
add_actions(self.ToolsMenu,
@ -316,98 +352,111 @@ class Ui_MainWindow(object):
"""
Set up the translation system
"""
MainWindow.mainTitle = self.trUtf8('OpenLP 2.0')
MainWindow.defaultThemeText = self.trUtf8(
MainWindow.mainTitle = translate('MainWindow', 'OpenLP 2.0')
MainWindow.language = translate('MainWindow', 'English')
MainWindow.defaultThemeText = translate('MainWindow',
'Default Theme: ')
MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(self.trUtf8('&File'))
self.FileImportMenu.setTitle(self.trUtf8('&Import'))
self.FileExportMenu.setTitle(self.trUtf8('&Export'))
self.OptionsMenu.setTitle(self.trUtf8('&Options'))
self.OptionsViewMenu.setTitle(self.trUtf8('&View'))
self.ViewModeMenu.setTitle(self.trUtf8('M&ode'))
self.OptionsLanguageMenu.setTitle(self.trUtf8(
self.FileMenu.setTitle(translate('MainWindow', '&File'))
self.FileImportMenu.setTitle(translate('MainWindow', '&Import'))
self.FileExportMenu.setTitle(translate('MainWindow', '&Export'))
self.OptionsMenu.setTitle(translate('MainWindow', '&Options'))
self.OptionsViewMenu.setTitle(translate('MainWindow', '&View'))
self.ViewModeMenu.setTitle(translate('MainWindow', 'M&ode'))
self.OptionsLanguageMenu.setTitle(translate('MainWindow',
u'&Language'))
self.ToolsMenu.setTitle(self.trUtf8('&Tools'))
self.HelpMenu.setTitle(self.trUtf8('&Help'))
self.ToolsMenu.setTitle(translate('MainWindow', '&Tools'))
self.HelpMenu.setTitle(translate('MainWindow', '&Help'))
self.MediaManagerDock.setWindowTitle(
self.trUtf8('Media Manager'))
translate('MainWindow', 'Media Manager'))
self.ServiceManagerDock.setWindowTitle(
self.trUtf8('Service Manager'))
translate('MainWindow', 'Service Manager'))
self.ThemeManagerDock.setWindowTitle(
self.trUtf8('Theme Manager'))
self.FileNewItem.setText(self.trUtf8('&New'))
self.FileNewItem.setToolTip(self.trUtf8('New Service'))
self.FileNewItem.setStatusTip(self.trUtf8('Create a new Service'))
self.FileNewItem.setShortcut(self.trUtf8('Ctrl+N'))
self.FileOpenItem.setText(self.trUtf8('&Open'))
self.FileOpenItem.setToolTip(self.trUtf8('Open Service'))
self.FileOpenItem.setStatusTip(self.trUtf8('Open an existing service'))
self.FileOpenItem.setShortcut(self.trUtf8('Ctrl+O'))
self.FileSaveItem.setText(self.trUtf8('&Save'))
self.FileSaveItem.setToolTip(self.trUtf8('Save Service'))
translate('MainWindow', 'Theme Manager'))
self.FileNewItem.setText(translate('MainWindow', '&New'))
self.FileNewItem.setToolTip(translate('MainWindow', 'New Service'))
self.FileNewItem.setStatusTip(
translate('MainWindow', 'Create a new Service'))
self.FileNewItem.setShortcut(translate('MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('MainWindow', '&Open'))
self.FileOpenItem.setToolTip(translate('MainWindow', 'Open Service'))
self.FileOpenItem.setStatusTip(
translate('MainWindow', 'Open an existing service'))
self.FileOpenItem.setShortcut(translate('MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('MainWindow', '&Save'))
self.FileSaveItem.setToolTip(translate('MainWindow', 'Save Service'))
self.FileSaveItem.setStatusTip(
self.trUtf8('Save the current service to disk'))
self.FileSaveItem.setShortcut(self.trUtf8('Ctrl+S'))
self.FileSaveAsItem.setText(self.trUtf8('Save &As...'))
self.FileSaveAsItem.setToolTip(self.trUtf8('Save Service As'))
self.FileSaveAsItem.setStatusTip(
self.trUtf8('Save the current service under a new name'))
self.FileSaveAsItem.setShortcut(self.trUtf8('F12'))
self.FileExitItem.setText(self.trUtf8('E&xit'))
self.FileExitItem.setStatusTip(self.trUtf8('Quit OpenLP'))
self.FileExitItem.setShortcut(self.trUtf8('Alt+F4'))
self.ImportThemeItem.setText(self.trUtf8('&Theme'))
self.ImportLanguageItem.setText(self.trUtf8('&Language'))
self.ExportThemeItem.setText(self.trUtf8('&Theme'))
self.ExportLanguageItem.setText(self.trUtf8('&Language'))
self.actionLook_Feel.setText(self.trUtf8('Look && &Feel'))
self.OptionsSettingsItem.setText(self.trUtf8('&Settings'))
self.ViewMediaManagerItem.setText(self.trUtf8('&Media Manager'))
translate('MainWindow', 'Save the current service to disk'))
self.FileSaveItem.setShortcut(translate('MainWindow', 'Ctrl+S'))
self.FileSaveAsItem.setText(translate('MainWindow', 'Save &As...'))
self.FileSaveAsItem.setToolTip(
translate('MainWindow', 'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate('MainWindow',
'Save the current service under a new name'))
self.FileSaveAsItem.setShortcut(translate('MainWindow', 'F12'))
self.FileExitItem.setText(translate('MainWindow', 'E&xit'))
self.FileExitItem.setStatusTip(translate('MainWindow', 'Quit OpenLP'))
self.FileExitItem.setShortcut(translate('MainWindow', 'Alt+F4'))
self.ImportThemeItem.setText(translate('MainWindow', '&Theme'))
self.ImportLanguageItem.setText(translate('MainWindow', '&Language'))
self.ExportThemeItem.setText(translate('MainWindow', '&Theme'))
self.ExportLanguageItem.setText(translate('MainWindow', '&Language'))
self.actionLook_Feel.setText(translate('MainWindow', 'Look && &Feel'))
self.OptionsSettingsItem.setText(translate('MainWindow', '&Settings'))
self.ViewMediaManagerItem.setText(
translate('MainWindow', '&Media Manager'))
self.ViewMediaManagerItem.setToolTip(
self.trUtf8('Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(
self.trUtf8('Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setShortcut(self.trUtf8('F8'))
self.ViewThemeManagerItem.setText(self.trUtf8('&Theme Manager'))
translate('MainWindow', 'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setShortcut(translate('MainWindow', 'F8'))
self.ViewThemeManagerItem.setText(
translate('MainWindow', '&Theme Manager'))
self.ViewThemeManagerItem.setToolTip(
self.trUtf8('Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(
self.trUtf8('Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setShortcut(self.trUtf8('F10'))
self.ViewServiceManagerItem.setText(self.trUtf8('&Service Manager'))
translate('MainWindow', 'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setShortcut(translate('MainWindow', 'F10'))
self.ViewServiceManagerItem.setText(
translate('MainWindow', '&Service Manager'))
self.ViewServiceManagerItem.setToolTip(
self.trUtf8('Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(
self.trUtf8('Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setShortcut(self.trUtf8('F9'))
self.action_Preview_Panel.setText(self.trUtf8('&Preview Panel'))
translate('MainWindow', 'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setShortcut(translate('MainWindow', 'F9'))
self.action_Preview_Panel.setText(
translate('MainWindow', '&Preview Panel'))
self.action_Preview_Panel.setToolTip(
self.trUtf8('Toggle Preview Panel'))
self.action_Preview_Panel.setStatusTip(
self.trUtf8('Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setShortcut(self.trUtf8('F11'))
self.PluginItem.setText(self.trUtf8('&Plugin List'))
self.PluginItem.setStatusTip(self.trUtf8('List the Plugins'))
self.PluginItem.setShortcut(self.trUtf8('Alt+F7'))
self.HelpDocumentationItem.setText(self.trUtf8('&User Guide'))
self.HelpAboutItem.setText(self.trUtf8('&About'))
translate('MainWindow', 'Toggle Preview Panel'))
self.action_Preview_Panel.setStatusTip(translate('MainWindow',
'Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setShortcut(translate('MainWindow', 'F11'))
self.PluginItem.setText(translate('MainWindow', '&Plugin List'))
self.PluginItem.setStatusTip(
translate('MainWindow', 'List the Plugins'))
self.PluginItem.setShortcut(translate('MainWindow', 'Alt+F7'))
self.HelpDocumentationItem.setText(
translate('MainWindow', '&User Guide'))
self.HelpAboutItem.setText(translate('MainWindow', '&About'))
self.HelpAboutItem.setStatusTip(
self.trUtf8('More information about OpenLP'))
self.HelpAboutItem.setShortcut(self.trUtf8('Ctrl+F1'))
self.HelpOnlineHelpItem.setText(self.trUtf8('&Online Help'))
self.HelpWebSiteItem.setText(self.trUtf8('&Web Site'))
self.LanguageTranslateItem.setText(self.trUtf8('&Translate'))
self.LanguageTranslateItem.setStatusTip(
self.trUtf8('Translate the interface to your language'))
self.LanguageEnglishItem.setText(self.trUtf8('English'))
self.LanguageEnglishItem.setStatusTip(
self.trUtf8('Set the interface language to English'))
self.ToolsAddToolItem.setText(self.trUtf8('Add &Tool...'))
translate('MainWindow', 'More information about OpenLP'))
self.HelpAboutItem.setShortcut(translate('MainWindow', 'Ctrl+F1'))
self.HelpOnlineHelpItem.setText(translate('MainWindow', '&Online Help'))
self.HelpWebSiteItem.setText(translate('MainWindow', '&Web Site'))
#i18n
self.AutoLanguageItem.setText(translate('MainWindow', '&Auto Detect'))
self.AutoLanguageItem.setStatusTip(
translate('MainWindow', 'Choose System language, if available'))
for item in self.LanguageGroup.actions():
item.setText(item.objectName())
item.setStatusTip(translate('MainWindow',
'Set the interface language to %1').arg(item.objectName()))
self.ToolsAddToolItem.setText(translate('MainWindow', 'Add &Tool...'))
self.ToolsAddToolItem.setStatusTip(
self.trUtf8('Add an application to the list of tools'))
self.action_Preview_Panel.setText(self.trUtf8('&Preview Pane'))
self.ModeLiveItem.setText(self.trUtf8('&Live'))
translate('MainWindow', 'Add an application to the list of tools'))
self.action_Preview_Panel.setText(
translate('MainWindow', '&Preview Pane'))
self.ModeLiveItem.setText(translate('MainWindow', '&Live'))
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
@ -508,6 +557,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(self.FileSaveAsItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onSaveService)
#i18n set signals for languages
QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'),
self.setAutoLanguage)
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
#warning cyclic dependency
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
@ -550,6 +604,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Load data from Settings')
self.settingsForm.postSetUp()
#i18n
def setAutoLanguage(self, value):
self.LanguageGroup.setDisabled(value)
LanguageManager.AutoLanguage = value
LanguageManager.set_language(self.LanguageGroup.checkedAction())
def versionCheck(self, version):
"""
Checks the version of the Application called from openlp.pyw

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_PluginViewDialog(object):
def setupUi(self, PluginViewDialog):
@ -98,11 +99,11 @@ class Ui_PluginViewDialog(object):
QtCore.QMetaObject.connectSlotsByName(PluginViewDialog)
def retranslateUi(self, PluginViewDialog):
PluginViewDialog.setWindowTitle(self.trUtf8('Plugin List'))
self.PluginInfoGroupBox.setTitle(self.trUtf8('Plugin Details'))
self.VersionLabel.setText(self.trUtf8('Version:'))
self.VersionNumberLabel.setText(self.trUtf8('TextLabel'))
self.AboutLabel.setText(self.trUtf8('About:'))
self.StatusLabel.setText(self.trUtf8('Status:'))
self.StatusComboBox.setItemText(0, self.trUtf8('Active'))
self.StatusComboBox.setItemText(1, self.trUtf8('Inactive'))
PluginViewDialog.setWindowTitle(translate('PluginForm', 'Plugin List'))
self.PluginInfoGroupBox.setTitle(translate('PluginForm', 'Plugin Details'))
self.VersionLabel.setText(translate('PluginForm', 'Version:'))
self.VersionNumberLabel.setText(translate('PluginForm', 'TextLabel'))
self.AboutLabel.setText(translate('PluginForm', 'About:'))
self.StatusLabel.setText(translate('PluginForm', 'Status:'))
self.StatusComboBox.setItemText(0, translate('PluginForm', 'Active'))
self.StatusComboBox.setItemText(1, translate('PluginForm', 'Inactive'))

View File

@ -61,9 +61,10 @@ class ScreenList(object):
"""
Set up the current screen dimensions
"""
log.debug(u'set_override_display %s', number, )
log.debug(u'set_current_display %s', number, )
if number + 1 > self.display_count:
self.current = self.screen_list[0]
self.override = copy.deepcopy(self.current)
self.current_display = 0
else:
self.current = self.screen_list[number]

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_ServiceItemEditDialog(object):
def setupUi(self, ServiceItemEditDialog):
@ -66,8 +67,8 @@ class Ui_ServiceItemEditDialog(object):
QtCore.QMetaObject.connectSlotsByName(ServiceItemEditDialog)
def retranslateUi(self, ServiceItemEditDialog):
ServiceItemEditDialog.setWindowTitle(self.trUtf8('Service Item Maintenance'))
self.upButton.setText(self.trUtf8('Up'))
self.deleteButton.setText(self.trUtf8('Delete'))
self.downButton.setText(self.trUtf8('Down'))
ServiceItemEditDialog.setWindowTitle(translate('ServiceItemEditForm', 'Service Item Maintenance'))
self.upButton.setText(translate('ServiceItemEditForm', 'Up'))
self.deleteButton.setText(translate('ServiceItemEditForm', 'Delete'))
self.downButton.setText(translate('ServiceItemEditForm', 'Down'))

View File

@ -101,6 +101,7 @@ class ServiceManager(QtGui.QWidget):
self.parent = parent
self.serviceItems = []
self.serviceName = u''
self.suffixes = []
self.droppos = 0
#is a new service and has not been saved
self.isNew = True
@ -228,6 +229,9 @@ class ServiceManager(QtGui.QWidget):
self.themeMenu = QtGui.QMenu(self.trUtf8(u'&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
def supportedSuffixes(self, suffix):
self.suffixes.append(suffix)
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item is None:
@ -495,6 +499,7 @@ class ServiceManager(QtGui.QWidget):
for itemcount, item in enumerate(self.serviceItems):
serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
if serviceitem.is_valid:
if serviceitem.notes:
icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
@ -508,6 +513,8 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem.setIcon(0, build_icon(icon))
else:
treewidgetitem.setIcon(0, serviceitem.iconic_representation)
else:
treewidgetitem.setIcon(0, build_icon(u':/general/general_delete.png'))
treewidgetitem.setText(0, serviceitem.title)
treewidgetitem.setToolTip(0, serviceitem.notes)
treewidgetitem.setData(0, QtCore.Qt.UserRole,
@ -651,7 +658,7 @@ class ServiceManager(QtGui.QWidget):
serviceitem = ServiceItem()
serviceitem.RenderManager = self.parent.RenderManager
serviceitem.set_from_service(item, self.servicePath)
if self.validateItem(serviceitem):
self.validateItem(serviceitem)
self.addServiceItem(serviceitem)
try:
if os.path.isfile(p_file):
@ -671,12 +678,14 @@ class ServiceManager(QtGui.QWidget):
self.parent.serviceChanged(True, self.serviceName)
def validateItem(self, serviceItem):
# print "---"
# print serviceItem.name
# print serviceItem.title
# print serviceItem.service_item_path
# print serviceItem.service_item_type
return True
"""
Validates the service item and if the suffix matches an accepted
one it allows the item to be displayed
"""
if serviceItem.is_command():
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
if type not in self.suffixes:
serviceItem.is_valid = False
def cleanUp(self):
"""
@ -702,6 +711,10 @@ class ServiceManager(QtGui.QWidget):
self.regenerateServiceItems()
def regenerateServiceItems(self):
"""
Rebuild the service list as things have changed and a
repaint is the easiest way to do this.
"""
#force reset of renderer as theme data has changed
self.parent.RenderManager.themedata = None
if self.serviceItems:
@ -760,8 +773,17 @@ class ServiceManager(QtGui.QWidget):
Send the current item to the Preview slide controller
"""
item, count = self.findServiceItem()
if self.serviceItems[item][u'service_item'].is_valid:
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
else:
QtGui.QMessageBox.critical(self,
self.trUtf8('Missing Display Handler'),
self.trUtf8('Your item cannot be displayed as '
'there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getServiceItem(self):
"""
@ -778,6 +800,7 @@ class ServiceManager(QtGui.QWidget):
Send the current item to the Live slide controller
"""
item, count = self.findServiceItem()
if self.serviceItems[item][u'service_item'].is_valid:
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
if QtCore.QSettings().value(
@ -789,6 +812,14 @@ class ServiceManager(QtGui.QWidget):
ItemCapabilities.AllowsPreview):
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
else:
QtGui.QMessageBox.critical(self,
self.trUtf8('Missing Display Handler'),
self.trUtf8('Your item cannot be displayed as '
'there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def remoteEdit(self):
"""
@ -866,8 +897,9 @@ class ServiceManager(QtGui.QWidget):
#we are over somthing so lets investigate
pos = self._getParentItemData(item) - 1
serviceItem = self.serviceItems[pos]
if plugin == serviceItem[u'service_item'].name \
and serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsAdditions):
if (plugin == serviceItem[u'service_item'].name and
serviceItem[u'service_item'].is_capable(
ItemCapabilities.AllowsAdditions)):
action = self.dndMenu.exec_(QtGui.QCursor.pos())
#New action required
if action == self.newAction:

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_ServiceNoteEdit(object):
def setupUi(self, ServiceNoteEdit):
@ -46,4 +47,4 @@ class Ui_ServiceNoteEdit(object):
QtCore.QMetaObject.connectSlotsByName(ServiceNoteEdit)
def retranslateUi(self, ServiceNoteEdit):
ServiceNoteEdit.setWindowTitle(self.trUtf8('Service Item Notes'))
ServiceNoteEdit.setWindowTitle(translate('ServiceNoteForm', 'Service Item Notes'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SettingsDialog(object):
def setupUi(self, SettingsDialog):
@ -59,4 +60,4 @@ class Ui_SettingsDialog(object):
QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
def retranslateUi(self, SettingsDialog):
SettingsDialog.setWindowTitle(self.trUtf8('Settings'))
SettingsDialog.setWindowTitle(translate('SettingsForm', 'Settings'))

View File

@ -36,6 +36,24 @@ ItemCapabilities
log = logging.getLogger(__name__)
class SlideThread(QtCore.QThread):
"""
A special Qt thread class to speed up the display of text based frames.
This is threaded so it loads the frames in background
"""
def __init__(self, parent, prefix, count):
QtCore.QThread.__init__(self, parent)
self.prefix = prefix
self.count = count
def run(self):
"""
Run the thread.
"""
time.sleep(1)
for i in range(0, self.count):
Receiver.send_message(u'%s_slide_cache' % self.prefix, i)
class SlideList(QtGui.QTableWidget):
"""
Customised version of QTableWidget which can respond to keyboard
@ -44,7 +62,7 @@ class SlideList(QtGui.QTableWidget):
def __init__(self, parent=None, name=None):
QtGui.QTableWidget.__init__(self, parent.Controller)
self.parent = parent
self.hotkey_map = {
self.hotkeyMap = {
QtCore.Qt.Key_Return: 'servicemanager_next_item',
QtCore.Qt.Key_Space: 'slidecontroller_live_next_noloop',
QtCore.Qt.Key_Enter: 'slidecontroller_live_next_noloop',
@ -66,8 +84,8 @@ class SlideList(QtGui.QTableWidget):
elif event.key() == QtCore.Qt.Key_PageDown:
self.parent.onSlideSelectedLast()
event.accept()
elif event.key() in self.hotkey_map and self.parent.isLive:
Receiver.send_message(self.hotkey_map[event.key()])
elif event.key() in self.hotkeyMap and self.parent.isLive:
Receiver.send_message(self.hotkeyMap[event.key()])
event.accept()
event.ignore()
else:
@ -87,19 +105,15 @@ class SlideController(QtGui.QWidget):
self.isLive = isLive
self.parent = parent
self.mainDisplay = self.parent.displayManager.mainDisplay
self.loop_list = [
self.loopList = [
u'Start Loop',
u'Stop Loop',
u'Loop Separator',
u'Image SpinBox'
]
self.song_edit_list = [
self.songEditList = [
u'Edit Song',
]
if isLive:
self.labelWidth = 20
else:
self.labelWidth = 0
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@ -115,11 +129,11 @@ class SlideController(QtGui.QWidget):
if self.isLive:
self.TypeLabel.setText(self.trUtf8('Live'))
self.split = 1
self.type_prefix = u'live'
self.typePrefix = u'live'
else:
self.TypeLabel.setText(self.trUtf8('Preview'))
self.split = 0
self.type_prefix = u'preview'
self.typePrefix = u'preview'
self.TypeLabel.setStyleSheet(u'font-weight: bold; font-size: 12pt;')
self.TypeLabel.setAlignment(QtCore.Qt.AlignCenter)
self.PanelLayout.addWidget(self.TypeLabel)
@ -139,12 +153,10 @@ class SlideController(QtGui.QWidget):
self.ControllerLayout.setMargin(0)
# Controller list view
self.PreviewListWidget = SlideList(self)
self.PreviewListWidget.setColumnCount(2)
self.PreviewListWidget.setColumnCount(1)
self.PreviewListWidget.horizontalHeader().setVisible(False)
self.PreviewListWidget.verticalHeader().setVisible(False)
self.PreviewListWidget.setColumnWidth(1, self.labelWidth)
self.PreviewListWidget.setColumnWidth(
1, self.Controller.width() - self.labelWidth)
0, self.Controller.width())
self.PreviewListWidget.isLive = self.isLive
self.PreviewListWidget.setObjectName(u'PreviewListWidget')
self.PreviewListWidget.setSelectionBehavior(1)
@ -309,51 +321,53 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
self.receiveSpinDelay)
if isLive:
self.Toolbar.makeWidgetsInvisible(self.loop_list)
self.Toolbar.makeWidgetsInvisible(self.loopList)
else:
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
self.Toolbar.makeWidgetsInvisible(self.songEditList)
self.Mediabar.setVisible(False)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_stop_loop' % self.typePrefix),
self.onStopLoop)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_first' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_first' % self.typePrefix),
self.onSlideSelectedFirst)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_next' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_next' % self.typePrefix),
self.onSlideSelectedNext)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix),
self.onSlideSelectedPrevious)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.typePrefix),
self.onSlideSelectedNextNoloop)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' %
self.type_prefix),
self.typePrefix),
self.onSlideSelectedPreviousNoloop)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_last' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_last' % self.typePrefix),
self.onSlideSelectedLast)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_change' % self.typePrefix),
self.onSlideChange)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_set' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_set' % self.typePrefix),
self.onSlideSelectedIndex)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_blank' % self.typePrefix),
self.onSlideBlank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix),
self.onSlideUnblank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.type_prefix),
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
self.onTextRequest)
QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_slide_cache' % self.typePrefix), self.slideCache)
def widthChanged(self):
"""
@ -362,8 +376,7 @@ class SlideController(QtGui.QWidget):
"""
width = self.parent.ControlSplitter.sizes()[self.split]
height = width * self.parent.RenderManager.screen_ratio
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
self.PreviewListWidget.setColumnWidth(0, width)
#Sort out image hights (Songs , bibles excluded)
if self.serviceItem and not self.serviceItem.is_text():
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
@ -404,20 +417,21 @@ class SlideController(QtGui.QWidget):
self.Toolbar.setVisible(True)
self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
self.Toolbar.makeWidgetsInvisible(self.loop_list)
self.Toolbar.makeWidgetsInvisible(self.loopList)
if item.is_text():
self.Toolbar.makeWidgetsInvisible(self.loop_list)
self.Toolbar.makeWidgetsInvisible(self.loopList)
if QtCore.QSettings().value(
self.parent.songsSettingsSection + u'/show songbar',
QtCore.QVariant(True)).toBool() and len(self.slideList) > 0:
self.Toolbar.makeWidgetsVisible([u'Song Menu'])
if item.is_capable(ItemCapabilities.AllowsLoop) and \
len(item.get_frames()) > 1:
self.Toolbar.makeWidgetsVisible(self.loop_list)
self.Toolbar.makeWidgetsVisible(self.loopList)
if item.is_media():
self.Toolbar.setVisible(False)
self.Mediabar.setVisible(True)
#self.volumeSlider.setAudioOutput(self.mainDisplay.videoDisplay.audio)
#self.volumeSlider.setAudioOutput(
# self.mainDisplay.videoDisplay.audio)
def enablePreviewToolBar(self, item):
"""
@ -425,9 +439,9 @@ class SlideController(QtGui.QWidget):
"""
self.Toolbar.setVisible(True)
self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
self.Toolbar.makeWidgetsInvisible(self.songEditList)
if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
self.Toolbar.makeWidgetsVisible(self.songEditList)
elif item.is_media():
self.Toolbar.setVisible(False)
self.Mediabar.setVisible(True)
@ -486,6 +500,7 @@ class SlideController(QtGui.QWidget):
Display the slide number passed
"""
log.debug(u'processManagerItem')
self.onStopLoop()
#If old item was a command tell it to stop
if self.serviceItem and self.serviceItem.is_command():
self.onMediaStop()
@ -502,24 +517,25 @@ class SlideController(QtGui.QWidget):
#Set pointing cursor when we have somthing to point at
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
before = time.time()
#Clear the old serviceItem cache to release memory
if self.serviceItem:
self.serviceItem.cache = []
self.serviceItem = serviceItem
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1, width - self.labelWidth)
self.PreviewListWidget.setColumnWidth(0, width)
if self.isLive:
self.SongMenu.menu().clear()
row = 0
text = []
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
self.PreviewListWidget.setRowCount(
self.PreviewListWidget.rowCount() + 1)
rowitem = QtGui.QTableWidgetItem()
item = QtGui.QTableWidgetItem()
slide_height = 0
slideHeight = 0
#It is a based Text Render
if self.serviceItem.is_text():
if self.isLive and frame[u'verseTag'] is not None:
#only load the slot once
if frame[u'verseTag']:
bits = frame[u'verseTag'].split(u':')
tag = None
#If verse handle verse number else tag only
@ -532,12 +548,13 @@ class SlideController(QtGui.QWidget):
tag = bits[0]
tag1 = tag
row = bits[0][0:1]
else:
row += 1
if self.isLive and frame[u'verseTag'] is not None:
if tag1 not in self.slideList:
self.slideList[tag1] = framenumber
self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
self.onSongBarHandler)
else:
row += 1
item.setText(frame[u'text'])
else:
label = QtGui.QLabel()
@ -547,20 +564,18 @@ class SlideController(QtGui.QWidget):
self.parent.RenderManager.height)
label.setScaledContents(True)
label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
self.PreviewListWidget.setCellWidget(framenumber, 1, label)
slide_height = width * self.parent.RenderManager.screen_ratio
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
slideHeight = width * self.parent.RenderManager.screen_ratio
row += 1
rowitem.setText(unicode(row))
rowitem.setTextAlignment(QtCore.Qt.AlignVCenter)
self.PreviewListWidget.setItem(framenumber, 0, rowitem)
self.PreviewListWidget.setItem(framenumber, 1, item)
if slide_height != 0:
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
text.append(unicode(row))
self.PreviewListWidget.setItem(framenumber, 0, item)
if slideHeight != 0:
self.PreviewListWidget.setRowHeight(framenumber, slideHeight)
self.PreviewListWidget.setVerticalHeaderLabels(text)
if self.serviceItem.is_text():
self.PreviewListWidget.resizeRowsToContents()
self.PreviewListWidget.setColumnWidth(0, self.labelWidth)
self.PreviewListWidget.setColumnWidth(1,
self.PreviewListWidget.viewport().size().width() - self.labelWidth)
self.PreviewListWidget.setColumnWidth(0,
self.PreviewListWidget.viewport().size().width())
if slideno > self.PreviewListWidget.rowCount():
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else:
@ -568,8 +583,12 @@ class SlideController(QtGui.QWidget):
self.enableToolBar(serviceItem)
self.onSlideSelected()
self.PreviewListWidget.setFocus()
Receiver.send_message(u'slidecontroller_%s_started' % self.type_prefix,
Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix,
[serviceItem])
if self.serviceItem.is_text():
st = SlideThread(
self, self.typePrefix, len(self.serviceItem.get_frames()))
st.start()
log.log(15, u'Display Rendering took %4s' % (time.time() - before))
def onTextRequest(self):
@ -579,18 +598,18 @@ class SlideController(QtGui.QWidget):
data = []
if self.serviceItem:
for framenumber, frame in enumerate(self.serviceItem.get_frames()):
data_item = {}
dataItem = {}
if self.serviceItem.is_text():
data_item[u'tag'] = unicode(frame[u'verseTag'])
data_item[u'text'] = unicode(frame[u'text'])
dataItem[u'tag'] = unicode(frame[u'verseTag'])
dataItem[u'text'] = unicode(frame[u'text'])
else:
data_item[u'tag'] = unicode(framenumber)
data_item[u'text'] = u''
data_item[u'selected'] = \
dataItem[u'tag'] = unicode(framenumber)
dataItem[u'text'] = u''
dataItem[u'selected'] = \
(self.PreviewListWidget.currentRow() == framenumber)
data.append(data_item)
data.append(dataItem)
Receiver.send_message(u'slidecontroller_%s_text_response'
% self.type_prefix, data)
% self.typePrefix, data)
#Screen event methods
def onSlideSelectedFirst(self):
@ -674,10 +693,10 @@ class SlideController(QtGui.QWidget):
self.themeButton.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
self.blankPlugin(True)
self.hidePlugin(True)
else:
Receiver.send_message(u'maindisplay_show')
self.blankPlugin(False)
self.hidePlugin(False)
def blankPlugin(self, blank):
"""
@ -693,6 +712,27 @@ class SlideController(QtGui.QWidget):
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
def hidePlugin(self, hide):
"""
Blank the display screen.
"""
if self.serviceItem is not None:
if hide:
Receiver.send_message(u'%s_hide'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
else:
Receiver.send_message(u'%s_unblank'
% self.serviceItem.name.lower(),
[self.serviceItem, self.isLive])
def slideCache(self, slide):
"""
Generate a slide cache item rendered and ready for use
in the background.
"""
self.serviceItem.get_rendered_frame(int(slide))
def onSlideSelected(self):
"""
Generate the preview when you click on a slide.
@ -722,7 +762,7 @@ class SlideController(QtGui.QWidget):
if self.isLive:
self.mainDisplay.frameView(frame, True)
self.selectedRow = row
Receiver.send_message(u'slidecontroller_%s_changed' % self.type_prefix,
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
row)
def onSlideChange(self, row):
@ -731,7 +771,7 @@ class SlideController(QtGui.QWidget):
"""
self.PreviewListWidget.selectRow(row)
self.updatePreview()
Receiver.send_message(u'slidecontroller_%s_changed' % self.type_prefix,
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
row)
def updatePreview(self):
@ -827,7 +867,9 @@ class SlideController(QtGui.QWidget):
"""
Stop the timer loop running
"""
if self.timer_id != 0:
self.killTimer(self.timer_id)
self.timer_id = 0
def timerEvent(self, event):
"""

View File

@ -450,8 +450,6 @@ class ThemeManager(QtGui.QWidget):
'would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
else:
result == QtGui.QMessageBox.Yes
if result == QtGui.QMessageBox.Yes:
# Save the theme, overwriting the existing theme if necessary.
outfile = None

View File

@ -184,4 +184,7 @@ def add_actions(target, actions):
else:
target.addAction(action)
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions']
from languagemanager import LanguageManager
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
u'LanguageManager']

View File

@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import logging
import os
from PyQt4 import QtCore, QtGui
from openlp.core.utils import AppLocation
from openlp.core.lib import translate
log = logging.getLogger()
class LanguageManager(object):
"""
Helper for Language selection
"""
__qmList__ = None
AutoLanguage = False
@staticmethod
def get_translator(language):
if LanguageManager.AutoLanguage :
language = QtCore.QLocale.system().name()
lang_Path = AppLocation.get_directory(AppLocation.AppDir)
lang_Path = os.path.join(lang_Path, u'resources', u'i18n')
appTranslator = QtCore.QTranslator()
if appTranslator.load("openlp_" + language, lang_Path):
return appTranslator
@staticmethod
def find_qm_files():
trans_dir = AppLocation.get_directory(AppLocation.AppDir)
trans_dir = QtCore.QDir(os.path.join(trans_dir, u'resources', u'i18n'))
fileNames = trans_dir.entryList(QtCore.QStringList("*.qm"),
QtCore.QDir.Files, QtCore.QDir.Name)
for i in fileNames:
fileNames.replaceInStrings(i, trans_dir.filePath(i))
return fileNames
@staticmethod
def language_name(qmFile):
translator = QtCore.QTranslator()
translator.load(qmFile)
return translator.translate(u'MainWindow', u'English')
@staticmethod
def get_language():
settings = QtCore.QSettings(u'OpenLP', u'OpenLP')
language = unicode(settings.value(
u'general/language', QtCore.QVariant(u'[en]')).toString())
log.info(u'Language file: \'%s\' Loaded from conf file' % language)
regEx = QtCore.QRegExp("^\[(.*)\]")
if regEx.exactMatch(language):
LanguageManager.AutoLanguage = True
language = regEx.cap(1)
return language
@staticmethod
def set_language(action):
actionName = u'%s' % action.objectName()
qmList = LanguageManager.get_qm_list()
if LanguageManager.AutoLanguage :
language = u'[%s]' % qmList[actionName]
else:
language = u'%s' % qmList[actionName]
QtCore.QSettings().setValue(
u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language)
QtGui.QMessageBox.information(None,
translate('LanguageManager', 'Language'),
translate('LanguageManager',
'After restart new Language settings will be used.'))
@staticmethod
def init_qm_list():
LanguageManager.__qmList__ = {}
qmFiles = LanguageManager.find_qm_files()
for i, qmf in enumerate(qmFiles):
regEx = QtCore.QRegExp("^.*openlp_(.*).qm")
if regEx.exactMatch(qmf):
langName = regEx.cap(1)
LanguageManager.__qmList__[u'%#2i %s' % (i+1,
LanguageManager.language_name(qmf))] = langName
@staticmethod
def get_qm_list():
if LanguageManager.__qmList__ == None:
LanguageManager.init_qm_list()
return LanguageManager.__qmList__

View File

@ -27,7 +27,7 @@ import logging
log = logging.getLogger(__name__)
class Display():
class Display(object):
log.info(u'Display Class loaded')
@staticmethod

View File

@ -27,7 +27,6 @@ import os
import sys
import sqlite3
from sqlalchemy import *
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, mapper
@ -35,22 +34,6 @@ from openlp.core.lib import SettingsManager
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.models import *
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
class TBibleMeta(BaseModel):
"""
Bible Meta Data
@ -109,7 +92,7 @@ def init_models(url):
autocommit=False, bind=engine))
return session
class MigrateBibles():
class MigrateBibles(object):
def __init__(self, display):
self.display = display
self.data_path = AppLocation.get_section_data_path(u'bibles')

View File

@ -25,7 +25,7 @@
from openlp.core.utils import AppLocation
class MigrateFiles():
class MigrateFiles(object):
def __init__(self, display):
self.display = display

View File

@ -75,21 +75,6 @@ temp_authors_songs_table = Table(u'songauthors_temp', metadata,
Column(u'authorid', types.Integer, primary_key=True),
Column(u'songid', types.Integer)
)
class BaseModel(object):
"""
BaseModel provides a base object with a set of generic functions
"""
@classmethod
def populate(cls, **kwargs):
"""
Creates an instance of a class and populates it, returning the instance
"""
me = cls()
keys = kwargs.keys()
for key in keys:
me.__setattr__(key, kwargs[key])
return me
class TAuthor(BaseModel):
"""
@ -109,7 +94,7 @@ class TSongAuthor(BaseModel):
"""
pass
class MigrateSongs():
class MigrateSongs(object):
def __init__(self, display):
self.display = display
self.data_path = AppLocation.get_section_data_path(u'songs')

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_AlertDialog(object):
def setupUi(self, AlertDialog):
@ -32,10 +33,10 @@ class Ui_AlertDialog(object):
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
AlertDialog.setWindowIcon(icon)
self.AlertFormLayout = QtGui.QVBoxLayout(AlertDialog)
self.AlertFormLayout.setSpacing(8)
self.AlertFormLayout.setMargin(8)
self.AlertFormLayout.setObjectName(u'AlertFormLayout')
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)
@ -57,7 +58,7 @@ class Ui_AlertDialog(object):
self.AlertTextEdit = QtGui.QLineEdit(AlertDialog)
self.AlertTextEdit.setObjectName(u'AlertTextEdit')
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AlertTextEdit)
self.AlertFormLayout.addLayout(self.AlertTextLayout)
self.AlertDialogLayout.addLayout(self.AlertTextLayout)
self.ManagementLayout = QtGui.QHBoxLayout()
self.ManagementLayout.setSpacing(8)
self.ManagementLayout.setContentsMargins(-1, -1, -1, 0)
@ -91,7 +92,7 @@ class Ui_AlertDialog(object):
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.ManageButtonLayout.addItem(spacerItem)
self.ManagementLayout.addLayout(self.ManageButtonLayout)
self.AlertFormLayout.addLayout(self.ManagementLayout)
self.AlertDialogLayout.addLayout(self.ManagementLayout)
self.AlertButtonLayout = QtGui.QHBoxLayout()
self.AlertButtonLayout.setSpacing(8)
self.AlertButtonLayout.setObjectName(u'AlertButtonLayout')
@ -116,7 +117,7 @@ class Ui_AlertDialog(object):
self.CloseButton.setIcon(icon5)
self.CloseButton.setObjectName(u'CloseButton')
self.AlertButtonLayout.addWidget(self.CloseButton)
self.AlertFormLayout.addLayout(self.AlertButtonLayout)
self.AlertDialogLayout.addLayout(self.AlertButtonLayout)
self.AlertEntryLabel.setBuddy(self.AlertTextEdit)
self.AlertParameter.setBuddy(self.ParameterEdit)
@ -133,13 +134,13 @@ class Ui_AlertDialog(object):
AlertDialog.setTabOrder(self.DisplayCloseButton, self.CloseButton)
def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle(self.trUtf8('Alert Message'))
self.AlertEntryLabel.setText(self.trUtf8('Alert &text:'))
self.AlertParameter.setText(self.trUtf8('&Parameter(s):'))
self.NewButton.setText(self.trUtf8('&New'))
self.SaveButton.setText(self.trUtf8('&Save'))
self.DeleteButton.setText(self.trUtf8('&Delete'))
self.DisplayButton.setText(self.trUtf8('Displ&ay'))
self.DisplayCloseButton.setText(self.trUtf8('Display && Cl&ose'))
self.CloseButton.setText(self.trUtf8('&Close'))
AlertDialog.setWindowTitle(translate('AlertForm', 'Alert Message'))
self.AlertEntryLabel.setText(translate('AlertForm', 'Alert &text:'))
self.AlertParameter.setText(translate('AlertForm', '&Parameter(s):'))
self.NewButton.setText(translate('AlertForm', '&New'))
self.SaveButton.setText(translate('AlertForm', '&Save'))
self.DeleteButton.setText(translate('AlertForm', '&Delete'))
self.DisplayButton.setText(translate('AlertForm', 'Displ&ay'))
self.DisplayCloseButton.setText(translate('AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText(translate('AlertForm', '&Close'))

View File

@ -67,7 +67,7 @@ class AlertsManager(QtCore.QObject):
- self.alertHeight
self.alertHeight = self.screen[u'size'].height() \
- self.alertScreenPosition
self.parent.maindisplay.setAlertSize(self.alertScreenPosition,\
self.parent.maindisplay.setAlertSize(self.alertScreenPosition,
self.alertHeight)
def onAlertText(self, message):

View File

@ -32,7 +32,7 @@ from openlp.plugins.alerts.lib.models import init_models, metadata, AlertItem
log = logging.getLogger(__name__)
class DBManager():
class DBManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.
@ -70,13 +70,13 @@ class DBManager():
"""
return self.session.query(AlertItem).order_by(AlertItem.text).all()
def save_alert(self, AlertItem):
def save_alert(self, alert_item):
"""
Saves a Alert show to the database
"""
log.debug(u'Alert added')
try:
self.session.add(AlertItem)
self.session.add(alert_item)
self.session.commit()
log.debug(u'Alert saved')
return True
@ -99,9 +99,9 @@ class DBManager():
Delete a Alert show
"""
if id != 0:
AlertItem = self.get_alert(id)
alert_item = self.get_alert(id)
try:
self.session.delete(AlertItem)
self.session.delete(alert_item)
self.session.commit()
return True
except:
@ -110,3 +110,4 @@ class DBManager():
return False
else:
return True

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_BibleImportWizard(object):
def setupUi(self, BibleImportWizard):
@ -32,8 +33,8 @@ class Ui_BibleImportWizard(object):
BibleImportWizard.setModal(True)
BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
BibleImportWizard.setOptions(
QtGui.QWizard.IndependentPages | \
QtGui.QWizard.NoBackButtonOnStartPage | \
QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
self.WelcomePage = QtGui.QWizardPage()
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
@ -276,7 +277,7 @@ class Ui_BibleImportWizard(object):
self.CopyrightEdit)
self.PermissionLabel = QtGui.QLabel(self.LicenseDetailsPage)
self.PermissionLabel.setObjectName(u'PermissionLabel')
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,\
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.PermissionLabel)
self.PermissionEdit = QtGui.QLineEdit(self.LicenseDetailsPage)
self.PermissionEdit.setObjectName(u'PermissionEdit')
@ -307,47 +308,49 @@ class Ui_BibleImportWizard(object):
QtCore.QMetaObject.connectSlotsByName(BibleImportWizard)
def retranslateUi(self, BibleImportWizard):
BibleImportWizard.setWindowTitle(self.trUtf8('Bible Import Wizard'))
BibleImportWizard.setWindowTitle(translate('ImportWizardForm', 'Bible Import Wizard'))
self.TitleLabel.setText(
u'<span style=\" font-size:14pt; font-weight:600;\">' + \
self.trUtf8('Welcome to the Bible Import Wizard') + u'</span>')
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('ImportWizardForm', 'Welcome to the Bible Import Wizard'))
self.InformationLabel.setText(
self.trUtf8('This wizard will help you to import Bibles from a '
translate('ImportWizardForm', 'This wizard will help you to import Bibles from a '
'variety of formats. Click the next button below to start the '
'process by selecting a format to import from.'))
self.SelectPage.setTitle(self.trUtf8('Select Import Source'))
self.SelectPage.setTitle(translate('ImportWizardForm', 'Select Import Source'))
self.SelectPage.setSubTitle(
self.trUtf8('Select the import format, and where to import from.'))
self.FormatLabel.setText(self.trUtf8('Format:'))
self.FormatComboBox.setItemText(0, self.trUtf8('OSIS'))
self.FormatComboBox.setItemText(1, self.trUtf8('CSV'))
self.FormatComboBox.setItemText(2, self.trUtf8('OpenSong'))
self.FormatComboBox.setItemText(3, self.trUtf8('Web Download'))
self.OsisLocationLabel.setText(self.trUtf8('File Location:'))
self.BooksLocationLabel.setText(self.trUtf8('Books Location:'))
self.VerseLocationLabel.setText(self.trUtf8('Verse Location:'))
self.OpenSongFileLabel.setText(self.trUtf8('Bible Filename:'))
self.LocationLabel.setText(self.trUtf8('Location:'))
self.LocationComboBox.setItemText(0, self.trUtf8('Crosswalk'))
self.LocationComboBox.setItemText(1, self.trUtf8('BibleGateway'))
self.BibleLabel.setText(self.trUtf8('Bible:'))
translate('ImportWizardForm', 'Select the import format, and where to import from.'))
self.FormatLabel.setText(translate('ImportWizardForm', 'Format:'))
self.FormatComboBox.setItemText(0, translate('ImportWizardForm', 'OSIS'))
self.FormatComboBox.setItemText(1, translate('ImportWizardForm', 'CSV'))
self.FormatComboBox.setItemText(2, translate('ImportWizardForm', 'OpenSong'))
self.FormatComboBox.setItemText(3, translate('ImportWizardForm', 'Web Download'))
self.OsisLocationLabel.setText(translate('ImportWizardForm', 'File Location:'))
self.BooksLocationLabel.setText(translate('ImportWizardForm', 'Books Location:'))
self.VerseLocationLabel.setText(translate('ImportWizardForm', 'Verse Location:'))
self.OpenSongFileLabel.setText(translate('ImportWizardForm', 'Bible Filename:'))
self.LocationLabel.setText(translate('ImportWizardForm', 'Location:'))
self.LocationComboBox.setItemText(0, translate('ImportWizardForm', 'Crosswalk'))
self.LocationComboBox.setItemText(1, translate('ImportWizardForm', 'BibleGateway'))
self.BibleLabel.setText(translate('ImportWizardForm', 'Bible:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab),
self.trUtf8('Download Options'))
self.AddressLabel.setText(self.trUtf8('Server:'))
self.UsernameLabel.setText(self.trUtf8('Username:'))
self.PasswordLabel.setText(self.trUtf8('Password:'))
translate('ImportWizardForm', 'Download Options'))
self.AddressLabel.setText(translate('ImportWizardForm', 'Server:'))
self.UsernameLabel.setText(translate('ImportWizardForm', 'Username:'))
self.PasswordLabel.setText(translate('ImportWizardForm', 'Password:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.ProxyServerTab),
self.trUtf8('Proxy Server (Optional)'))
self.LicenseDetailsPage.setTitle(self.trUtf8('License Details'))
translate('ImportWizardForm', 'Proxy Server (Optional)'))
self.LicenseDetailsPage.setTitle(translate('ImportWizardForm', 'License Details'))
self.LicenseDetailsPage.setSubTitle(
self.trUtf8('Set up the Bible\'s license details.'))
self.VersionNameLabel.setText(self.trUtf8('Version Name:'))
self.CopyrightLabel.setText(self.trUtf8('Copyright:'))
self.PermissionLabel.setText(self.trUtf8('Permission:'))
self.ImportPage.setTitle(self.trUtf8('Importing'))
translate('ImportWizardForm', 'Set up the Bible\'s license details.'))
self.VersionNameLabel.setText(translate('ImportWizardForm', 'Version Name:'))
self.CopyrightLabel.setText(translate('ImportWizardForm', 'Copyright:'))
self.PermissionLabel.setText(translate('ImportWizardForm', 'Permission:'))
self.ImportPage.setTitle(translate('ImportWizardForm', 'Importing'))
self.ImportPage.setSubTitle(
self.trUtf8('Please wait while your Bible is imported.'))
self.ImportProgressLabel.setText(self.trUtf8('Ready.'))
translate('ImportWizardForm', 'Please wait while your Bible is imported.'))
self.ImportProgressLabel.setText(translate('ImportWizardForm', 'Ready.'))
self.ImportProgressBar.setFormat(u'%p%')

View File

@ -427,3 +427,5 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'openlp_process_events')

View File

@ -257,8 +257,8 @@ def unescape(text):
@param text The HTML (or XML) source text.
@return The plain text, as a Unicode string, if necessary.
"""
def fixup(m):
text = m.group(0)
def fixup(markup):
text = markup.group(0)
if text[:2] == u'&#':
# character reference
try:

View File

@ -27,6 +27,8 @@ import logging
import chardet
import csv
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from db import BibleDB
@ -89,7 +91,7 @@ class CSVBible(BibleDB):
verse_file = None
try:
book_ptr = None
verse_file = open(versesfile, 'r')
verse_file = open(self.versesfile, 'r')
dialect = csv.Sniffer().sniff(verse_file.read(1024))
verse_file.seek(0)
verse_reader = csv.reader(verse_file, dialect)
@ -118,3 +120,5 @@ class CSVBible(BibleDB):
return False
else:
return success

View File

@ -418,12 +418,13 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'bibles_nobook')
return []
db_book = self.create_book(book_details[u'name'],
book_details[u'abbreviation'], book_details[u'testament_id'])
book_details[u'abbreviation'],
book_details[u'testament_id'])
book = db_book.name
if BibleDB.get_verse_count(self, book, reference[1]) == 0:
Receiver.send_message(u'bibles_showprogress')
Receiver.send_message(u'openlp_process_events')
search_results = self.get_chapter(self.name, book, reference[1])
search_results = self.get_chapter(book, reference[1])
if search_results and search_results.has_verselist():
## We have found a book of the bible lets check to see
## if it was there. By reusing the returned book name
@ -433,18 +434,19 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'openlp_process_events')
# check to see if book/chapter exists
db_book = self.get_book(bookname)
self.create_chapter(db_book.id, search_results.get_chapter(),
self.create_chapter(db_book.id,
search_results.get_chapter(),
search_results.get_verselist())
Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'bibles_hideprogress')
Receiver.send_message(u'openlp_process_events')
return BibleDB.get_verses(self, reference_list)
def get_chapter(self, version, book, chapter):
def get_chapter(self, book, chapter):
"""
Receive the request and call the relevant handler methods
"""
log.debug(u'get_chapter %s, %s, %s', version, book, chapter)
log.debug(u'get_chapter %s, %s', book, chapter)
log.debug(u'source = %s', self.download_source)
try:
if self.download_source.lower() == u'crosswalk':

View File

@ -36,7 +36,7 @@ log = logging.getLogger(__name__)
class BibleListView(BaseListWithDnD):
"""
Drag and drop capable list for Bibles.
Custom list view descendant, required for drag and drop.
"""
def __init__(self, parent=None):
self.PluginName = u'Bibles'
@ -337,6 +337,7 @@ class BibleMediaItem(MediaManagerItem):
# load bibles into the combo boxes
first = True
for bible in bibles:
if bible:
self.QuickVersionComboBox.addItem(bible)
self.QuickSecondBibleComboBox.addItem(bible)
self.AdvancedVersionComboBox.addItem(bible)
@ -462,7 +463,19 @@ class BibleMediaItem(MediaManagerItem):
bible2_verses.extend(self.parent.manager.get_verses(bible2, scripture))
bible2_version = self.parent.manager.get_meta_data(bible2, u'Version')
bible2_copyright = self.parent.manager.get_meta_data(bible2, u'Copyright')
bible2_permission = self.parent.manager.get_meta_data(bible2, u'Permission')
bible2_permission = self.parent.manager.get_meta_data(bible2, u'Permissions')
if bible2_version:
bible2_version = bible2_version.value
else:
bible2_version = u''
if bible2_copyright:
bible2_copyright = bible2_copyright.value
else:
bible2_copyright = u''
if bible2_permission:
bible2_permission = bible2_permission.value
else:
bible2_permission = u''
# Let's loop through the main lot, and assemble our verses
for item in items:
bitem = self.ListView.item(item.row())
@ -491,8 +504,8 @@ class BibleMediaItem(MediaManagerItem):
if footer not in raw_footer:
raw_footer.append(footer)
if bible2:
footer = u'%s (%s %s)' % (book, version, copyright)
#If not found add to footer
footer = u'%s (%s %s)' % (book, bible2_version, bible2_copyright)
#If not found add second version and copyright to footer
if footer not in raw_footer:
raw_footer.append(footer)
bible_text = u'%s %s \n\n %s %s' % \
@ -518,7 +531,7 @@ class BibleMediaItem(MediaManagerItem):
else:
service_item.theme = self.parent.settings_tab.bible_theme
#if we are verse per slide we have already been added
if self.parent.settings_tab.layout_style != 0:
if self.parent.settings_tab.layout_style != 0 and not bible2:
raw_slides.append(bible_text)
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
@ -579,7 +592,7 @@ class BibleMediaItem(MediaManagerItem):
def displayResults(self, bible):
version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
permission = self.parent.manager.get_meta_data(bible, u'Permission')
permission = self.parent.manager.get_meta_data(bible, u'Permissions')
if not permission:
permission = u''
else:

View File

@ -108,3 +108,5 @@ class OpenSongBible(BibleDB):
return False
else:
return success

View File

@ -184,3 +184,5 @@ class OSISBible(BibleDB):
return False
else:
return success

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_customEditDialog(object):
def setupUi(self, customEditDialog):
@ -152,23 +153,23 @@ class Ui_customEditDialog(object):
customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox)
def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle(self.trUtf8('Edit Custom Slides'))
self.UpButton.setToolTip(self.trUtf8('Move slide Up 1'))
self.DownButton.setToolTip(self.trUtf8('Move slide down 1'))
self.TitleLabel.setText(self.trUtf8('Title:'))
self.AddButton.setText(self.trUtf8('Add New'))
self.AddButton.setToolTip(self.trUtf8('Add new slide at bottom'))
self.EditButton.setText(self.trUtf8('Edit'))
self.EditButton.setToolTip(self.trUtf8('Edit selected slide'))
self.EditAllButton.setText(self.trUtf8('Edit All'))
self.EditAllButton.setToolTip(self.trUtf8('Edit all slides'))
self.SaveButton.setText(self.trUtf8('Save'))
self.SaveButton.setToolTip(self.trUtf8('Replace edited slide'))
self.DeleteButton.setText(self.trUtf8('Delete'))
self.DeleteButton.setToolTip(self.trUtf8('Delete selected slide'))
self.ClearButton.setText(self.trUtf8('Clear'))
self.ClearButton.setToolTip(self.trUtf8('Clear edit area'))
self.SplitButton.setText(self.trUtf8('Split Slide'))
self.SplitButton.setToolTip(self.trUtf8('Add slide split'))
self.ThemeLabel.setText(self.trUtf8('Theme:'))
self.CreditLabel.setText(self.trUtf8('Credits:'))
customEditDialog.setWindowTitle(translate('EditCustomForm', 'Edit Custom Slides'))
self.UpButton.setToolTip(translate('EditCustomForm', 'Move slide Up 1'))
self.DownButton.setToolTip(translate('EditCustomForm', 'Move slide down 1'))
self.TitleLabel.setText(translate('EditCustomForm', 'Title:'))
self.AddButton.setText(translate('EditCustomForm', 'Add New'))
self.AddButton.setToolTip(translate('EditCustomForm', 'Add new slide at bottom'))
self.EditButton.setText(translate('EditCustomForm', 'Edit'))
self.EditButton.setToolTip(translate('EditCustomForm', 'Edit selected slide'))
self.EditAllButton.setText(translate('EditCustomForm', 'Edit All'))
self.EditAllButton.setToolTip(translate('EditCustomForm', 'Edit all slides'))
self.SaveButton.setText(translate('EditCustomForm', 'Save'))
self.SaveButton.setToolTip(translate('EditCustomForm', 'Replace edited slide'))
self.DeleteButton.setText(translate('EditCustomForm', 'Delete'))
self.DeleteButton.setToolTip(translate('EditCustomForm', 'Delete selected slide'))
self.ClearButton.setText(translate('EditCustomForm', 'Clear'))
self.ClearButton.setToolTip(translate('EditCustomForm', 'Clear edit area'))
self.SplitButton.setText(translate('EditCustomForm', 'Split Slide'))
self.SplitButton.setToolTip(translate('EditCustomForm', 'Add slide split'))
self.ThemeLabel.setText(translate('EditCustomForm', 'Theme:'))
self.CreditLabel.setText(translate('EditCustomForm', 'Credits:'))

View File

@ -32,7 +32,7 @@ from openlp.plugins.custom.lib.models import init_models, metadata, CustomSlide
log = logging.getLogger(__name__)
class CustomManager():
class CustomManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.

View File

@ -143,7 +143,7 @@ class ImageMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None):
items = self.ListView.selectedIndexes()
if items:
service_item.title = self.trUtf8('Image(s)')
service_item.title = unicode(self.trUtf8('Image(s)'))
service_item.add_capability(ItemCapabilities.AllowsMaintain)
service_item.add_capability(ItemCapabilities.AllowsPreview)
service_item.add_capability(ItemCapabilities.AllowsLoop)

View File

@ -58,6 +58,7 @@ class MediaPlugin(Plugin):
if len(value) == 2:
if list.find(value[1]) == -1:
list += u'*.%s ' % value[1]
self.service_manager.supportedSuffixes(value[1])
type = u''
return list, type

View File

@ -74,6 +74,7 @@ class PresentationMediaItem(MediaManagerItem):
for type in types:
if fileType.find(type) == -1:
fileType += u'*%s ' % type
self.parent.service_manager.supportedSuffixes(type)
self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType)
def requiredIcons(self):

View File

@ -160,6 +160,16 @@ class Controller(object):
return
self.doc.blank_screen()
def stop(self):
log.debug(u'Live = %s, stop' % self.isLive)
if not self.isLive:
return
if not self.doc.is_loaded():
return
if not self.doc.is_active():
return
self.doc.stop_presentation()
def unblank(self):
log.debug(u'Live = %s, unblank' % self.isLive)
if not self.isLive:
@ -190,6 +200,8 @@ class MessageListener(object):
QtCore.SIGNAL(u'presentations_start'), self.startup)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'presentations_stop'), self.shutdown)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'presentations_hide'), self.hide)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'presentations_first'), self.first)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -279,6 +291,11 @@ class MessageListener(object):
else:
self.previewHandler.shutdown()
def hide(self, message):
isLive, item = self.decode_message(message)
if isLive:
self.liveHandler.stop()
def blank(self, message):
isLive, item = self.decode_message(message)
if isLive:

View File

@ -105,7 +105,7 @@ class PresentationController(object):
if self.available:
self.enabled = QtCore.QSettings().value(
self.settingsSection + u'/' + name,
QtCore.Qt.Unchecked).toInt()[0] == QtCore.Qt.Checked
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == QtCore.Qt.Checked
else:
self.enabled = False
self.thumbnailroot = os.path.join(

View File

@ -95,10 +95,9 @@ class PresentationPlugin(Plugin):
log.debug(u'Importing controller %s', modulename)
try:
__import__(modulename, globals(), locals(), [])
except ImportError, e:
log.error(
u'Failed to import %s on path %s for reason %s',
modulename, path, e.args[0])
except ImportError:
log.exception(u'Failed to import %s on path %s',
modulename, path)
controller_classes = PresentationController.__subclasses__()
for controller_class in controller_classes:
controller = controller_class(self)
@ -114,3 +113,4 @@ class PresentationPlugin(Plugin):
'programs. The choice of available presentation programs is '
'available to the user in a drop down box.')
return about_text

View File

@ -95,7 +95,7 @@ function response(eventname, req){
html += ' style="font-weight: bold"';
html += '>';
html += '<td>' + data[row]['tag'] + '</td>';
html += '<td>' + data[row]['text'].replace(/\\n/g, '<br>');
html += '<td>' + data[row]['text'].replace(/\n/g, '<br>');
html += '</td></tr>';
}
html += '</table>';
@ -181,10 +181,12 @@ send_event("remotes_poll_request");
<hr>
<input type='button' value='Order of service'
onclick='send_event("servicemanager_list_request");'>
<i>(Click service item to go live.)</i>
<div id='service'></div>
<hr>
<input type='button' value='Current item'
onclick='send_event("slidecontroller_live_text_request");'>
<i>(Click verse to display.)</i>
<div id='currentitem'></div>
<hr>
<a href="http://www.openlp.org/">OpenLP website</a>

View File

@ -152,29 +152,33 @@ class HttpConnection(object):
log.debug(u'received: ' + data)
words = data.split(u' ')
html = None
mimetype = None
if words[0] == u'GET':
url = urlparse.urlparse(words[1])
params = self.load_params(url.query)
folders = url.path.split(u'/')
if folders[1] == u'':
html = self.serve_file(u'')
mimetype, html = self.serve_file(u'')
elif folders[1] == u'files':
html = self.serve_file(folders[2])
mimetype, html = self.serve_file(os.sep.join(folders[2:]))
elif folders[1] == u'send':
html = self.process_event(folders[2], params)
elif folders[1] == u'request':
if self.process_request(folders[2], params):
return
if html:
html = self.get_200_ok() + html + u'\n'
if mimetype:
self.send_200_ok(mimetype)
else:
html = self.get_404_not_found()
self.send_200_ok()
self.socket.write(html)
else:
self.send_404_not_found()
self.close()
def serve_file(self, filename):
"""
Send a file to the socket. For now, just .html files
Send a file to the socket. For now, just a subset of file types
and must be top level inside the html folder.
If subfolders requested return 404, easier for security for the present.
@ -184,26 +188,42 @@ class HttpConnection(object):
log.debug(u'serve file request %s' % filename)
if not filename:
filename = u'index.html'
if os.path.basename(filename) != filename:
path = os.path.normpath(os.path.join(self.parent.html_dir, filename))
if not path.startswith(self.parent.html_dir):
return None
(fileroot, ext) = os.path.splitext(filename)
if not ext in [u'.html', u'.js', u'.css', u'.png']:
return None
path = os.path.join(self.parent.html_dir, filename)
if ext == u'.html':
mimetype = u'text/html'
elif ext == u'.css':
mimetype = u'text/css'
elif ext == u'.js':
mimetype = u'application/x-javascript'
elif ext == u'.jpg':
mimetype = u'image/jpeg'
elif ext == u'.gif':
mimetype = u'image/gif'
elif ext == u'.png':
mimetype = u'image/png'
else:
return (None, None)
file_handle = None
try:
f = open(path, u'rb')
except:
file_handle = open(path, u'rb')
log.debug(u'Opened %s' % path)
html = file_handle.read()
except IOError:
log.exception(u'Failed to open %s' % path)
return None
log.debug(u'Opened %s' % path)
html = f.read()
f.close()
return html
finally:
if file_handle:
file_handle.close()
return (mimetype, html)
def load_params(self, query):
"""
Decode the query string parameters sent from the browser
"""
log.debug(u'loading params %s' % query)
params = urlparse.parse_qs(query)
if not params:
return None
@ -216,6 +236,7 @@ class HttpConnection(object):
Currently lets anything through. Later we should restrict and perform
basic parameter checking, otherwise rogue clients could crash openlp
"""
log.debug(u'Processing event %s' % event)
if params:
Receiver.send_message(event, params)
else:
@ -233,6 +254,7 @@ class HttpConnection(object):
is just waiting for slide change/song change activity. This can wait
longer (one minute)
"""
log.debug(u'Processing request %s' % event)
if not event.endswith(u'_request'):
return False
self.event = event
@ -258,36 +280,36 @@ class HttpConnection(object):
The recipient of a _request signal has sent data. Convert this to
json and return it to client
"""
log.debug(u'Processing response for %s' % self.event)
if not self.socket:
return
self.timer.stop()
html = json.dumps(data)
html = self.get_200_ok() + html + u'\n'
self.send_200_ok()
self.socket.write(html)
self.close()
def get_200_ok(self):
def send_200_ok(self, mimetype='text/html; charset="utf-8"'):
"""
Successful request. Send OK headers. Assume html for now.
"""
return u'HTTP/1.1 200 OK\r\n' + \
u'Content-Type: text/html; charset="utf-8"\r\n' + \
u'\r\n'
self.socket.write(u'HTTP/1.1 200 OK\r\n' + \
u'Content-Type: %s\r\n\r\n' % mimetype)
def get_404_not_found(self):
def send_404_not_found(self):
"""
Invalid url. Say so
"""
return u'HTTP/1.1 404 Not Found\r\n'+ \
self.socket.write(u'HTTP/1.1 404 Not Found\r\n'+ \
u'Content-Type: text/html; charset="utf-8"\r\n' + \
u'\r\n'
u'\r\n')
def get_408_timeout(self):
def send_408_timeout(self):
"""
A _request hasn't returned anything in the timeout period.
Return timeout
"""
return u'HTTP/1.1 408 Request Timeout\r\n'
self.socket.write(u'HTTP/1.1 408 Request Timeout\r\n')
def timeout(self):
"""
@ -295,8 +317,7 @@ class HttpConnection(object):
"""
if not self.socket:
return
html = self.get_408_timeout()
self.socket.write(html)
self.send_408_timeout()
self.close()
def disconnected(self):
@ -316,4 +337,3 @@ class HttpConnection(object):
self.socket.close()
self.socket = None
self.parent.close_connection(self)

View File

@ -25,9 +25,7 @@
import logging
from PyQt4 import QtNetwork, QtCore
from openlp.core.lib import Plugin, Receiver
from openlp.core.lib import Plugin
from openlp.plugins.remotes.lib import RemoteTab, HttpServer
log = logging.getLogger(__name__)

View File

@ -30,7 +30,9 @@ from editverseform import EditVerseForm
from editsongform import EditSongForm
from songmaintenanceform import SongMaintenanceForm
from openlpexportform import OpenLPExportForm
from openlpimportform import OpenLPImportForm
from opensongexportform import OpenSongExportForm
from opensongimportform import OpenSongImportForm
#from openlpexportform import OpenLPExportForm
#from openlpimportform import OpenLPImportForm
#from opensongexportform import OpenSongExportForm
#from opensongimportform import OpenSongImportForm
from songimportform import ImportWizardForm

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_AuthorsDialog(object):
def setupUi(self, AuthorsDialog):
@ -73,7 +74,7 @@ class Ui_AuthorsDialog(object):
QtCore.QMetaObject.connectSlotsByName(AuthorsDialog)
def retranslateUi(self, AuthorsDialog):
AuthorsDialog.setWindowTitle(self.trUtf8('Author Maintenance'))
self.DisplayLabel.setText(self.trUtf8('Display name:'))
self.FirstNameLabel.setText(self.trUtf8('First name:'))
self.LastNameLabel.setText(self.trUtf8('Last name:'))
AuthorsDialog.setWindowTitle(translate('AuthorsForm', 'Author Maintenance'))
self.DisplayLabel.setText(translate('AuthorsForm', 'Display name:'))
self.FirstNameLabel.setText(translate('AuthorsForm', 'First name:'))
self.LastNameLabel.setText(translate('AuthorsForm', 'Last name:'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib import build_icon
@ -69,8 +70,12 @@ class Ui_EditSongDialog(object):
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.QListWidget(self.LyricsTab)
self.VerseListWidget.setSpacing(2)
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
self.VerseListWidget.setColumnCount(1)
self.VerseListWidget.horizontalHeader().setVisible(False)
self.VerseListWidget.setSelectionBehavior(1)
self.VerseListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers)
self.VerseListWidget.setAlternatingRowColors(True)
self.VerseListWidget.setObjectName(u'VerseListWidget')
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1)
@ -418,36 +423,36 @@ class Ui_EditSongDialog(object):
EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox)
def retranslateUi(self, EditSongDialog):
EditSongDialog.setWindowTitle(self.trUtf8('Song Editor'))
self.TitleLabel.setText(self.trUtf8('Title:'))
self.AlternativeTitleLabel.setText(self.trUtf8('Alternative Title:'))
self.LyricsLabel.setText(self.trUtf8('Lyrics:'))
self.VerseOrderLabel.setText(self.trUtf8('Verse Order:'))
self.VerseAddButton.setText(self.trUtf8('Add'))
self.VerseEditButton.setText(self.trUtf8('Edit'))
self.VerseEditAllButton.setText(self.trUtf8('Edit All'))
self.VerseDeleteButton.setText(self.trUtf8('Delete'))
EditSongDialog.setWindowTitle(translate('EditSongForm', 'Song Editor'))
self.TitleLabel.setText(translate('EditSongForm', 'Title:'))
self.AlternativeTitleLabel.setText(translate('EditSongForm', 'Alternative Title:'))
self.LyricsLabel.setText(translate('EditSongForm', 'Lyrics:'))
self.VerseOrderLabel.setText(translate('EditSongForm', 'Verse Order:'))
self.VerseAddButton.setText(translate('EditSongForm', 'Add'))
self.VerseEditButton.setText(translate('EditSongForm', 'Edit'))
self.VerseEditAllButton.setText(translate('EditSongForm', 'Edit All'))
self.VerseDeleteButton.setText(translate('EditSongForm', 'Delete'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.LyricsTab),
self.trUtf8('Title && Lyrics'))
self.AuthorsGroupBox.setTitle(self.trUtf8('Authors'))
self.AuthorAddButton.setText(self.trUtf8('&Add to Song'))
self.AuthorRemoveButton.setText(self.trUtf8('&Remove'))
translate('EditSongForm', 'Title && Lyrics'))
self.AuthorsGroupBox.setTitle(translate('EditSongForm', 'Authors'))
self.AuthorAddButton.setText(translate('EditSongForm', '&Add to Song'))
self.AuthorRemoveButton.setText(translate('EditSongForm', '&Remove'))
self.MaintenanceButton.setText(
self.trUtf8('&Manage Authors, Topics, Books'))
self.TopicGroupBox.setTitle(self.trUtf8('Topic'))
self.TopicAddButton.setText(self.trUtf8('A&dd to Song'))
self.TopicRemoveButton.setText(self.trUtf8('R&emove'))
self.SongBookGroup.setTitle(self.trUtf8('Song Book'))
translate('EditSongForm', '&Manage Authors, Topics, Books'))
self.TopicGroupBox.setTitle(translate('EditSongForm', 'Topic'))
self.TopicAddButton.setText(translate('EditSongForm', 'A&dd to Song'))
self.TopicRemoveButton.setText(translate('EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle(translate('EditSongForm', 'Song Book'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab),
self.trUtf8('Authors, Topics && Book'))
self.ThemeGroupBox.setTitle(self.trUtf8('Theme'))
self.ThemeAddButton.setText(self.trUtf8('Add a Theme'))
self.CopyrightGroupBox.setTitle(self.trUtf8('Copyright Information'))
self.CopyrightInsertButton.setText(self.trUtf8(u'\u00a9'.encode('utf8')))
self.CCLILabel.setText(self.trUtf8('CCLI Number:'))
self.CommentsGroupBox.setTitle(self.trUtf8('Comments'))
translate('EditSongForm', 'Authors, Topics && Book'))
self.ThemeGroupBox.setTitle(translate('EditSongForm', 'Theme'))
self.ThemeAddButton.setText(translate('EditSongForm', 'Add a Theme'))
self.CopyrightGroupBox.setTitle(translate('EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText(translate('EditSongForm', u'\xa9'))
self.CCLILabel.setText(translate('EditSongForm', 'CCLI Number:'))
self.CommentsGroupBox.setTitle(translate('EditSongForm', 'Comments'))
self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.ThemeTab),
self.trUtf8('Theme, Copyright Info && Comments'))
translate('EditSongForm', 'Theme, Copyright Info && Comments'))

View File

@ -41,12 +41,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
log.info(u'%s EditSongForm loaded', __name__)
def __init__(self, songmanager, parent=None):
def __init__(self, parent, songmanager):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
self.parent = parent
#can this be automated?
self.width = 400
self.setupUi(self)
# Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton,
@ -77,7 +79,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.QObject.connect(self.VerseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed)
QtCore.QObject.connect(self.SongbookCombo,
QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
@ -106,7 +108,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms
self.songmanager = songmanager
self.verse_form = EditVerseForm()
self.verse_form = EditVerseForm(self)
self.initialise()
self.AuthorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True)
@ -125,8 +127,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
authorsCompleter = QtGui.QCompleter(
[author.display_name for author in authors],
self.AuthorsSelectionComboItem)
authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.AuthorsSelectionComboItem.setCompleter(authorsCompleter);
authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(authorsCompleter)
self.AuthorsSelectionComboItem.clear()
for author in authors:
row = self.AuthorsSelectionComboItem.count()
@ -137,10 +139,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadTopics(self):
topics = self.songmanager.get_topics()
topicsCompleter = QtGui.QCompleter(
[topic.name for topic in topics],
self.SongTopicCombo)
topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.SongTopicCombo.setCompleter(topicsCompleter);
[topic.name for topic in topics], self.SongTopicCombo)
topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongTopicCombo.setCompleter(topicsCompleter)
self.SongTopicCombo.clear()
for topic in topics:
row = self.SongTopicCombo.count()
@ -151,8 +152,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
books = self.songmanager.get_books()
booksCompleter = QtGui.QCompleter(
[book.name for book in books], self.SongbookCombo)
booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.SongbookCombo.setCompleter(booksCompleter);
booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(booksCompleter)
self.SongbookCombo.clear()
self.SongbookCombo.addItem(u' ')
for book in books:
@ -164,8 +165,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
themesCompleter = QtGui.QCompleter(
[theme for theme in theme_list],
self.ThemeSelectionComboItem)
themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive);
self.ThemeSelectionComboItem.setCompleter(themesCompleter);
themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(themesCompleter)
self.ThemeSelectionComboItem.clear()
self.ThemeSelectionComboItem.addItem(u' ')
for theme in theme_list:
@ -182,6 +183,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
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)
@ -223,6 +225,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
self.CopyrightEditItem.setText(u'')
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order)
else:
@ -236,21 +239,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
self.CCLNumberEdit.setText(u'')
#lazy xml migration for now
self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.VerseListWidget.setColumnWidth(0, self.width)
if self.song.lyrics.startswith(u'<?xml version='):
songXML = SongXMLParser(self.song.lyrics)
verseList = songXML.get_verses()
for verse in verseList:
for count, verse in enumerate(verseList):
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QListWidgetItem(verse[1])
item = QtGui.QTableWidgetItem(verse[1])
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.addItem(item)
self.VerseListWidget.setItem(count, 0, item)
else:
verses = self.song.lyrics.split(u'\n\n')
for count, verse in enumerate(verses):
item = QtGui.QListWidgetItem(verse)
self.VerseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem(verse)
variant = u'Verse:%s' % unicode(count + 1)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.addItem(item)
self.VerseListWidget.setItem(count, 0, item)
self.VerseListWidget.resizeRowsToContents()
self.tagRows()
# clear the results
self.AuthorsListView.clear()
for author in self.song.authors:
@ -270,6 +282,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if preview:
self.previewButton.setVisible(True)
def tagRows(self):
"""
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)
data = unicode((item.data(QtCore.Qt.UserRole)).toString())
bit = data.split(u':')
rowTag = u'%s\n%s' % (bit[0][0:1], bit[1])
rowLabel.append(rowTag)
self.VerseListWidget.setVerticalHeaderLabels(rowLabel)
def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex())
if item > -1:
@ -336,22 +361,26 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'', self.VerseListWidget.count() + 1, True)
self.verse_form.setVerse(u'', True)
if self.verse_form.exec_():
afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' % (verse, subVerse)
item = QtGui.QListWidgetItem(afterText)
item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText)
self.VerseListWidget.addItem(item)
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()
if item:
tempText = item.text()
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
self.verse_form.setVerse(
tempText, self.VerseListWidget.count(), True, verseId)
self.verse_form.setVerse(tempText, True, verseId)
if self.verse_form.exec_():
afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' % (verse, subVerse)
@ -361,24 +390,26 @@ 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.count()):
tempList[row] = self.VerseListWidget.item(row).text()
tempId[row] = self.VerseListWidget.item(row).\
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()
for row in range (0, len(tempList)):
item = QtGui.QListWidgetItem(tempList[row])
item = QtGui.QTableWidgetItem(tempList[row], 0)
item.setData(QtCore.Qt.UserRole, tempId[row])
self.VerseListWidget.addItem(item)
self.VerseListWidget.setItem(row, 0, item)
self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint()
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
self.tagRows()
def onVerseEditAllButtonClicked(self):
verse_list = u''
if self.VerseListWidget.count() > 0:
for row in range(0, self.VerseListWidget.count()):
item = self.VerseListWidget.item(row)
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()
@ -390,6 +421,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
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')):
@ -401,13 +433,20 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else:
if parts.endswith(u'\n'):
parts = parts.rstrip(u'\n')
item = QtGui.QListWidgetItem(parts)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.addItem(item)
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), 0, item)
self.VerseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint()
self.tagRows()
def onVerseDeleteButtonClicked(self):
self.VerseListWidget.takeItem(self.VerseListWidget.currentRow())
self.VerseListWidget.removeRow(self.VerseListWidget.currentRow())
self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False)
@ -422,12 +461,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus()
return False, self.trUtf8('You need to enter a song title.')
if self.VerseListWidget.count() == 0:
if self.VerseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus()
return False, self.trUtf8('You need to enter some verses.')
if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(2)
self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bitped'))
@ -480,6 +519,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadTopics()
def onPreview(self, button):
"""
Save and Preview button pressed.
The Song is valid so as the plugin to add it to preview to see.
"""
log.debug(u'onPreview')
if button.text() == unicode(self.trUtf8('Save && Preview')) \
and self.saveSong():
@ -521,12 +564,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml.new_document()
sxml.add_lyrics_to_song()
text = u' '
for i in range (0, self.VerseListWidget.count()):
item = self.VerseListWidget.item(i)
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 + unicode(self.VerseListWidget.item(i).text()) + u' '
text = text + unicode(self.VerseListWidget.item(i, 0).text()) + u' '
text = text.replace(u'\'', u'')
text = text.replace(u',', u'')
text = text.replace(u';', u'')
@ -556,3 +599,5 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song.search_title = self.song.search_title.replace(u'}', u'')
self.song.search_title = self.song.search_title.replace(u'?', u'')
self.song.search_title = unicode(self.song.search_title)

View File

@ -24,106 +24,81 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_EditVerseDialog(object):
def setupUi(self, EditVerseDialog):
EditVerseDialog.setObjectName(u'EditVerseDialog')
EditVerseDialog.resize(500, 521)
EditVerseDialog.resize(474, 442)
EditVerseDialog.setModal(True)
self.layoutWidget = QtGui.QWidget(EditVerseDialog)
self.layoutWidget.setGeometry(QtCore.QRect(11, 1, 471, 491))
self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout_3 = QtGui.QVBoxLayout(self.layoutWidget)
self.verticalLayout_3.setObjectName(u'verticalLayout_3')
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.VerseTypeLabel = QtGui.QLabel(self.layoutWidget)
self.VerseTypeLabel.setTextFormat(QtCore.Qt.PlainText)
self.VerseTypeLabel.setAlignment(QtCore.Qt.AlignCenter)
self.VerseTypeLabel.setObjectName(u'VerseTypeLabel')
self.verticalLayout.addWidget(self.VerseTypeLabel)
self.VerseListComboBox = QtGui.QComboBox(self.layoutWidget)
self.VerseListComboBox.setObjectName(u'VerseListComboBox')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.VerseListComboBox.addItem(u'')
self.verticalLayout.addWidget(self.VerseListComboBox)
self.horizontalLayout.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.VerseNumberLabel = QtGui.QLabel(self.layoutWidget)
self.VerseNumberLabel.setAlignment(QtCore.Qt.AlignCenter)
self.VerseNumberLabel.setObjectName(u'VerseNumberLabel')
self.verticalLayout_2.addWidget(self.VerseNumberLabel)
self.SubVerseListComboBox = QtGui.QComboBox(self.layoutWidget)
self.SubVerseListComboBox.setObjectName(u'SubVerseListComboBox')
self.verticalLayout_2.addWidget(self.SubVerseListComboBox)
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.verticalLayout_3.addLayout(self.horizontalLayout)
self.VerseTextEdit = QtGui.QTextEdit(self.layoutWidget)
self.VerseTextEdit.setAcceptRichText(False)
self.EditVerseLayout = QtGui.QVBoxLayout(EditVerseDialog)
self.EditVerseLayout.setSpacing(8)
self.EditVerseLayout.setMargin(8)
self.EditVerseLayout.setObjectName(u'EditVerseLayout')
self.VerseTextEdit = QtGui.QPlainTextEdit(EditVerseDialog)
self.VerseTextEdit.setObjectName(u'VerseTextEdit')
self.verticalLayout_3.addWidget(self.VerseTextEdit)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.addBridge = QtGui.QPushButton(self.layoutWidget)
self.addBridge.setObjectName(u'addBridge')
self.horizontalLayout_2.addWidget(self.addBridge)
self.addVerse = QtGui.QPushButton(self.layoutWidget)
self.addVerse.setObjectName(u'addVerse')
self.horizontalLayout_2.addWidget(self.addVerse)
self.addChorus = QtGui.QPushButton(self.layoutWidget)
self.addChorus.setObjectName(u'addChorus')
self.horizontalLayout_2.addWidget(self.addChorus)
self.verticalLayout_3.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(u'horizontalLayout_3')
self.addPreChorus = QtGui.QPushButton(self.layoutWidget)
self.addPreChorus.setObjectName(u'addPreChorus')
self.horizontalLayout_3.addWidget(self.addPreChorus)
self.addIntro = QtGui.QPushButton(self.layoutWidget)
self.addIntro.setObjectName(u'addIntro')
self.horizontalLayout_3.addWidget(self.addIntro)
self.addOther = QtGui.QPushButton(self.layoutWidget)
self.addOther.setObjectName(u'addOther')
self.horizontalLayout_3.addWidget(self.addOther)
self.addEnding = QtGui.QPushButton(self.layoutWidget)
self.addEnding.setObjectName(u'addEnding')
self.horizontalLayout_3.addWidget(self.addEnding)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
self.ButtonBox = QtGui.QDialogButtonBox(self.layoutWidget)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox')
self.verticalLayout_3.addWidget(self.ButtonBox)
self.EditVerseLayout.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.setObjectName(u'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)
self.VerseNumberBox.setObjectName(u'VerseNumberBox')
self.VerseTypeLayout.addWidget(self.VerseNumberBox)
self.InsertButton = QtGui.QPushButton(EditVerseDialog)
self.AddIcon = QtGui.QIcon()
self.AddIcon.addPixmap(QtGui.QPixmap(u':/general/general_add.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.InsertButton.setIcon(self.AddIcon)
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 | QtGui.QDialogButtonBox.Save)
self.EditButtonBox.setObjectName(u'EditButtonBox')
self.EditVerseLayout.addWidget(self.EditButtonBox)
self.retranslateUi(EditVerseDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'accepted()'), EditVerseDialog.accept)
QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'rejected()'), EditVerseDialog.reject)
QtCore.QObject.connect(
self.EditButtonBox,
QtCore.SIGNAL(u'accepted()'),
EditVerseDialog.accept
)
QtCore.QObject.connect(
self.EditButtonBox,
QtCore.SIGNAL(u'rejected()'),
EditVerseDialog.reject
)
QtCore.QMetaObject.connectSlotsByName(EditVerseDialog)
def retranslateUi(self, EditVerseDialog):
EditVerseDialog.setWindowTitle(self.trUtf8('Edit Verse'))
self.VerseTypeLabel.setText(self.trUtf8('Verse Type'))
self.VerseListComboBox.setItemText(0, self.trUtf8('Intro'))
self.VerseListComboBox.setItemText(1, self.trUtf8('Verse'))
self.VerseListComboBox.setItemText(2, self.trUtf8('Pre-Chorus'))
self.VerseListComboBox.setItemText(3, self.trUtf8('Chorus'))
self.VerseListComboBox.setItemText(4, self.trUtf8('Bridge'))
self.VerseListComboBox.setItemText(5, self.trUtf8('Ending'))
self.VerseListComboBox.setItemText(6, self.trUtf8('Other'))
self.VerseNumberLabel.setText(self.trUtf8('Number'))
self.addBridge.setText(self.trUtf8('Bridge'))
self.addVerse.setText(self.trUtf8('Verse'))
self.addChorus.setText(self.trUtf8('Chorus'))
self.addPreChorus.setText(self.trUtf8('Pre-Chorus'))
self.addIntro.setText(self.trUtf8('Intro'))
self.addOther.setText(self.trUtf8('Other'))
self.addEnding.setText(self.trUtf8('Ending'))
EditVerseDialog.setWindowTitle(translate('EditVerseForm', 'Edit Verse'))
self.VerseTypeLabel.setText(translate('EditVerseForm', 'Verse Type:'))
self.VerseTypeComboBox.setItemText(0, translate('EditVerseForm', 'Verse'))
self.VerseTypeComboBox.setItemText(1, translate('EditVerseForm', 'Chorus'))
self.VerseTypeComboBox.setItemText(2, translate('EditVerseForm', 'Bridge'))
self.VerseTypeComboBox.setItemText(3, translate('EditVerseForm', 'Pre-Chorus'))
self.VerseTypeComboBox.setItemText(4, translate('EditVerseForm', 'Intro'))
self.VerseTypeComboBox.setItemText(5, translate('EditVerseForm', 'Ending'))
self.VerseTypeComboBox.setItemText(6, translate('EditVerseForm', 'Other'))
self.InsertButton.setText(translate('EditVerseForm', 'Insert'))

View File

@ -23,9 +23,60 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import re
import logging
from PyQt4 import QtCore, QtGui
from editversedialog import Ui_EditVerseDialog
log = logging.getLogger(__name__)
class VerseType(object):
Verse = 0
Chorus = 1
Bridge = 2
PreChorus = 3
Intro = 4
Ending = 5
Other = 6
@staticmethod
def to_string(verse_type):
if verse_type == VerseType.Verse:
return u'Verse'
elif verse_type == VerseType.Chorus:
return u'Chorus'
elif verse_type == VerseType.Bridge:
return u'Bridge'
elif verse_type == VerseType.PreChorus:
return u'Pre-Chorus'
elif verse_type == VerseType.Intro:
return u'Intro'
elif verse_type == VerseType.Ending:
return u'Ending'
elif verse_type == VerseType.Other:
return u'Other'
@staticmethod
def from_string(verse_type):
verse_type = verse_type.lower()
if verse_type == u'verse':
return VerseType.Verse
elif verse_type == u'chorus':
return VerseType.Chorus
elif verse_type == u'bridge':
return VerseType.Bridge
elif verse_type == u'pre-chorus':
return VerseType.PreChorus
elif verse_type == u'intro':
return VerseType.Intro
elif verse_type == u'ending':
return VerseType.Ending
elif verse_type == u'other':
return VerseType.Other
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
"""
This is the form that is used to edit the verses of the song.
@ -36,114 +87,87 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
"""
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
QtCore.QObject.connect(self.addVerse,
QtCore.SIGNAL(u'clicked()'), self.onAddVerse)
QtCore.QObject.connect(self.addChorus,
QtCore.SIGNAL(u'clicked()'), self.onAddChorus)
QtCore.QObject.connect(self.addBridge,
QtCore.SIGNAL(u'clicked()'), self.onAddBridge)
QtCore.QObject.connect(self.addIntro,
QtCore.SIGNAL(u'clicked()'), self.onAddIntro)
QtCore.QObject.connect(self.addOther,
QtCore.SIGNAL(u'clicked()'), self.onAddOther)
QtCore.QObject.connect(self.addPreChorus,
QtCore.SIGNAL(u'clicked()'), self.onAddPreChorus)
QtCore.QObject.connect(self.addEnding,
QtCore.SIGNAL(u'clicked()'), self.onAddEnding)
QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
QtCore.QObject.connect(
self.InsertButton,
QtCore.SIGNAL(u'clicked()'),
self.onInsertButtonClicked
)
QtCore.QObject.connect(
self.VerseTextEdit,
QtCore.SIGNAL(u'cursorPositionChanged()'),
self.onCursorPositionChanged
)
# QtCore.QObject.connect(self.VerseListComboBox,
# QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
self.verse_regex = re.compile(r'---\[([-\w]+):([\d]+)\]---')
def startNewLine(self):
def insertVerse(self, title, num=1):
if self.VerseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'\n')
def onAddIntro(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Intro:1]---\n')
self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
self.VerseTextEdit.setFocus()
def onAddEnding(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Ending:1]---\n')
self.VerseTextEdit.setFocus()
def onInsertButtonClicked(self):
if self.VerseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'\n')
verse_type = self.VerseTypeComboBox.currentIndex()
if verse_type == VerseType.Verse:
self.insertVerse('Verse', self.VerseNumberBox.value())
elif verse_type == VerseType.Chorus:
self.insertVerse('Chorus', self.VerseNumberBox.value())
elif verse_type == VerseType.Bridge:
self.insertVerse('Bridge')
elif verse_type == VerseType.PreChorus:
self.insertVerse('Pre-Chorus')
elif verse_type == VerseType.Intro:
self.insertVerse('Intro')
elif verse_type == VerseType.Ending:
self.insertVerse('Ending')
elif verse_type == VerseType.Other:
self.insertVerse('Other')
def onAddOther(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Other:1]---\n')
self.VerseTextEdit.setFocus()
def onCursorPositionChanged(self):
position = self.VerseTextEdit.textCursor().position()
text = unicode(self.VerseTextEdit.toPlainText())
if not text:
return
if text.rfind(u'[', 0, position) > text.rfind(u']', 0, position) and \
text.find(u']', position) < text.find(u'[', position):
return
position = text.rfind(u'---[', 0, position)
if position == -1:
return
text = text[position:]
position = text.find(u']---')
if position == -1:
return
text = text[:position + 4]
match = self.verse_regex.match(text)
if match:
verse_type = match.group(1)
verse_number = int(match.group(2))
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
self.VerseNumberBox.setValue(verse_number)
def onAddPreChorus(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Pre-Chorus:1]---\n')
self.VerseTextEdit.setFocus()
def onAddBridge(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---\n')
self.VerseTextEdit.setFocus()
def onAddChorus(self):
self.startNewLine()
count = self.VerseTextEdit.toPlainText().\
count(u'---[Chorus')
self.VerseTextEdit.insertPlainText(u'---[Chorus:%s]---\n'
% unicode(count + 1))
self.VerseTextEdit.setFocus()
def onAddVerse(self):
self.startNewLine()
count = self.VerseTextEdit.toPlainText().\
count(u'---[Verse')
self.VerseTextEdit.insertPlainText(u'---[Verse:%s]---\n'
% unicode(count + 1))
self.VerseTextEdit.setFocus()
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
posVerse = 0
posSub = 0
if len(text) == 0 and not single:
text = u'---[%s:1]---\n' % self.trUtf8('Verse')
def setVerse(self, text, single=False, tag=u'Verse:1'):
if single:
id = tag.split(u':')
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
posSub = self.SubVerseListComboBox.findText(id[1], QtCore.Qt.MatchExactly)
if posVerse == -1:
posVerse = 0
if posSub == -1:
posSub = 0
self.VerseListComboBox.setEnabled(True)
self.SubVerseListComboBox.setEnabled(True)
self.SubVerseListComboBox.clear()
for i in range(1, verseCount + 1):
self.SubVerseListComboBox.addItem(u'%s'% i)
self.addBridge.setEnabled(False)
self.addChorus.setEnabled(False)
self.addVerse.setEnabled(False)
self.addIntro.setEnabled(False)
self.addPreChorus.setEnabled(False)
self.addOther.setEnabled(False)
self.addEnding.setEnabled(False)
verse_type, verse_number = tag.split(u':')
self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
self.VerseNumberBox.setValue(int(verse_number))
self.InsertButton.setVisible(False)
else:
self.VerseListComboBox.setEnabled(False)
self.SubVerseListComboBox.setEnabled(False)
self.addBridge.setEnabled(True)
self.addChorus.setEnabled(True)
self.addVerse.setEnabled(True)
self.addIntro.setEnabled(True)
self.addPreChorus.setEnabled(True)
self.addOther.setEnabled(True)
self.addEnding.setEnabled(True)
self.VerseListComboBox.setCurrentIndex(posVerse)
self.SubVerseListComboBox.setCurrentIndex(posSub)
if not text:
text = u'---[Verse:1]---\n'
self.VerseTypeComboBox.setCurrentIndex(0)
self.VerseNumberBox.setValue(1)
self.InsertButton.setVisible(True)
self.VerseTextEdit.setPlainText(text)
self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.onVerseComboChanged(0)
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
def getVerse(self):
return self.VerseTextEdit.toPlainText(), \
unicode(self.VerseListComboBox.currentText()), \
unicode(self.SubVerseListComboBox.currentText())
VerseType.to_string(self.VerseTypeComboBox.currentIndex()), \
unicode(self.VerseNumberBox.value())
def getVerseAll(self):
text = self.VerseTextEdit.toPlainText()
@ -151,10 +175,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
text = u'---[Verse:1]---\n%s' % text
return text
def onVerseComboChanged(self, id):
if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse') or \
unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Chrous'):
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setEnabled(False)
self.SubVerseListComboBox.setCurrentIndex(0)

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_OpenLPExportDialog(object):
def setupUi(self, OpenLPExportDialog):
@ -285,21 +286,21 @@ class Ui_OpenLPExportDialog(object):
QtCore.QMetaObject.connectSlotsByName(OpenLPExportDialog)
def retranslateUi(self, OpenLPExportDialog):
OpenLPExportDialog.setWindowTitle(self.trUtf8('openlp.org Song Exporter'))
self.ExportFileLabel.setText(self.trUtf8('Select openlp.org export filename:'))
self.ExportListLabel.setText(self.trUtf8('Full Song List'))
self.ExportListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.ExportListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.ExportSelectAllPushButton.setText(self.trUtf8('Select All'))
self.ExportFilterComboBox.setItemText(0, self.trUtf8('Lyrics'))
self.ExportFilterComboBox.setItemText(1, self.trUtf8('Title'))
self.ExportFilterComboBox.setItemText(2, self.trUtf8('Author'))
self.SelectedListLabel.setText(self.trUtf8('Song Export List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.SelectedSelectAllPushButton.setText(self.trUtf8('Select All'))
self.SelectedRemoveSelectedButton.setText(self.trUtf8('Remove Selected'))
self.ProgressGroupBox.setTitle(self.trUtf8('Progress:'))
self.ProgressLabel.setText(self.trUtf8('Ready to export'))
self.ExportPushButton.setText(self.trUtf8('Export'))
self.ClosePushButton.setText(self.trUtf8('Close'))
OpenLPExportDialog.setWindowTitle(translate('OpenLPExportForm', 'openlp.org Song Exporter'))
self.ExportFileLabel.setText(translate('OpenLPExportForm', 'Select openlp.org export filename:'))
self.ExportListLabel.setText(translate('OpenLPExportForm', 'Full Song List'))
self.ExportListTable.horizontalHeaderItem(0).setText(translate('OpenLPExportForm', 'Song Title'))
self.ExportListTable.horizontalHeaderItem(1).setText(translate('OpenLPExportForm', 'Author'))
self.ExportSelectAllPushButton.setText(translate('OpenLPExportForm', 'Select All'))
self.ExportFilterComboBox.setItemText(0, translate('OpenLPExportForm', 'Lyrics'))
self.ExportFilterComboBox.setItemText(1, translate('OpenLPExportForm', 'Title'))
self.ExportFilterComboBox.setItemText(2, translate('OpenLPExportForm', 'Author'))
self.SelectedListLabel.setText(translate('OpenLPExportForm', 'Song Export List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(translate('OpenLPExportForm', 'Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(translate('OpenLPExportForm', 'Author'))
self.SelectedSelectAllPushButton.setText(translate('OpenLPExportForm', 'Select All'))
self.SelectedRemoveSelectedButton.setText(translate('OpenLPExportForm', 'Remove Selected'))
self.ProgressGroupBox.setTitle(translate('OpenLPExportForm', 'Progress:'))
self.ProgressLabel.setText(translate('OpenLPExportForm', 'Ready to export'))
self.ExportPushButton.setText(translate('OpenLPExportForm', 'Export'))
self.ClosePushButton.setText(translate('OpenLPExportForm', 'Close'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_OpenLPImportDialog(object):
def setupUi(self, OpenLPImportDialog):
@ -285,21 +286,21 @@ class Ui_OpenLPImportDialog(object):
QtCore.QMetaObject.connectSlotsByName(OpenLPImportDialog)
def retranslateUi(self, OpenLPImportDialog):
OpenLPImportDialog.setWindowTitle(self.trUtf8('openlp.org Song Importer'))
self.ImportFileLabel.setText(self.trUtf8('Select openlp.org songfile to import:'))
self.ImportListLabel.setText(self.trUtf8('Import File Song List'))
self.ImportListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.ImportListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.ImportSelectAllPushButton.setText(self.trUtf8('Select All'))
self.ImportFilterComboBox.setItemText(0, self.trUtf8('Lyrics'))
self.ImportFilterComboBox.setItemText(1, self.trUtf8('Title'))
self.ImportFilterComboBox.setItemText(2, self.trUtf8('Author'))
self.SelectedListLabel.setText(self.trUtf8('Song Import List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.SelectedSelectAllPushButton.setText(self.trUtf8('Select All'))
self.SelectedRemoveSelectedButton.setText(self.trUtf8('Remove Selected'))
self.ProgressGroupBox.setTitle(self.trUtf8('Progress:'))
self.ProgressLabel.setText(self.trUtf8('Ready to import'))
self.ImportPushButton.setText(self.trUtf8('Import'))
self.ClosePushButton.setText(self.trUtf8('Close'))
OpenLPImportDialog.setWindowTitle(translate('OpenLPImportForm', 'openlp.org Song Importer'))
self.ImportFileLabel.setText(translate('OpenLPImportForm', 'Select openlp.org songfile to import:'))
self.ImportListLabel.setText(translate('OpenLPImportForm', 'Import File Song List'))
self.ImportListTable.horizontalHeaderItem(0).setText(translate('OpenLPImportForm', 'Song Title'))
self.ImportListTable.horizontalHeaderItem(1).setText(translate('OpenLPImportForm', 'Author'))
self.ImportSelectAllPushButton.setText(translate('OpenLPImportForm', 'Select All'))
self.ImportFilterComboBox.setItemText(0, translate('OpenLPImportForm', 'Lyrics'))
self.ImportFilterComboBox.setItemText(1, translate('OpenLPImportForm', 'Title'))
self.ImportFilterComboBox.setItemText(2, translate('OpenLPImportForm', 'Author'))
self.SelectedListLabel.setText(translate('OpenLPImportForm', 'Song Import List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(translate('OpenLPImportForm', 'Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(translate('OpenLPImportForm', 'Author'))
self.SelectedSelectAllPushButton.setText(translate('OpenLPImportForm', 'Select All'))
self.SelectedRemoveSelectedButton.setText(translate('OpenLPImportForm', 'Remove Selected'))
self.ProgressGroupBox.setTitle(translate('OpenLPImportForm', 'Progress:'))
self.ProgressLabel.setText(translate('OpenLPImportForm', 'Ready to import'))
self.ImportPushButton.setText(translate('OpenLPImportForm', 'Import'))
self.ClosePushButton.setText(translate('OpenLPImportForm', 'Close'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_OpenSongExportDialog(object):
def setupUi(self, OpenSongExportDialog):
@ -285,21 +286,21 @@ class Ui_OpenSongExportDialog(object):
QtCore.QMetaObject.connectSlotsByName(OpenSongExportDialog)
def retranslateUi(self, OpenSongExportDialog):
OpenSongExportDialog.setWindowTitle(self.trUtf8('OpenSong Song Exporter'))
self.ExportFileLabel.setText(self.trUtf8('Select OpenSong song folder:'))
self.ExportListLabel.setText(self.trUtf8('Full Song List'))
self.ExportListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.ExportListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.ExportSelectAllPushButton.setText(self.trUtf8('Select All'))
self.ExportFilterComboBox.setItemText(0, self.trUtf8('Lyrics'))
self.ExportFilterComboBox.setItemText(1, self.trUtf8('Title'))
self.ExportFilterComboBox.setItemText(2, self.trUtf8('Author'))
self.SelectedListLabel.setText(self.trUtf8('Song Export List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author'))
self.SelectedSelectAllPushButton.setText(self.trUtf8('Select All'))
self.SelectedRemoveSelectedButton.setText(self.trUtf8('Remove Selected'))
self.ProgressGroupBox.setTitle(self.trUtf8('Progress:'))
self.ProgressLabel.setText(self.trUtf8('Ready to export'))
self.ExportPushButton.setText(self.trUtf8('Export'))
self.ClosePushButton.setText(self.trUtf8('Close'))
OpenSongExportDialog.setWindowTitle(translate('OpenSongExportForm', 'OpenSong Song Exporter'))
self.ExportFileLabel.setText(translate('OpenSongExportForm', 'Select OpenSong song folder:'))
self.ExportListLabel.setText(translate('OpenSongExportForm', 'Full Song List'))
self.ExportListTable.horizontalHeaderItem(0).setText(translate('OpenSongExportForm', 'Song Title'))
self.ExportListTable.horizontalHeaderItem(1).setText(translate('OpenSongExportForm', 'Author'))
self.ExportSelectAllPushButton.setText(translate('OpenSongExportForm', 'Select All'))
self.ExportFilterComboBox.setItemText(0, translate('OpenSongExportForm', 'Lyrics'))
self.ExportFilterComboBox.setItemText(1, translate('OpenSongExportForm', 'Title'))
self.ExportFilterComboBox.setItemText(2, translate('OpenSongExportForm', 'Author'))
self.SelectedListLabel.setText(translate('OpenSongExportForm', 'Song Export List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(translate('OpenSongExportForm', 'Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(translate('OpenSongExportForm', 'Author'))
self.SelectedSelectAllPushButton.setText(translate('OpenSongExportForm', 'Select All'))
self.SelectedRemoveSelectedButton.setText(translate('OpenSongExportForm', 'Remove Selected'))
self.ProgressGroupBox.setTitle(translate('OpenSongExportForm', 'Progress:'))
self.ProgressLabel.setText(translate('OpenSongExportForm', 'Ready to export'))
self.ExportPushButton.setText(translate('OpenSongExportForm', 'Export'))
self.ClosePushButton.setText(translate('OpenSongExportForm', 'Close'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_OpenSongImportDialog(object):
def setupUi(self, OpenSongImportDialog):
@ -100,9 +101,9 @@ class Ui_OpenSongImportDialog(object):
QtCore.QMetaObject.connectSlotsByName(OpenSongImportDialog)
def retranslateUi(self, OpenSongImportDialog):
OpenSongImportDialog.setWindowTitle(self.trUtf8('OpenSong Song Importer'))
self.ImportFileLabel.setText(self.trUtf8('OpenSong Folder:'))
self.ProgressGroupBox.setTitle(self.trUtf8('Progress:'))
self.ProgressLabel.setText(self.trUtf8('Ready to import'))
self.ImportPushButton.setText(self.trUtf8('Import'))
self.ClosePushButton.setText(self.trUtf8('Close'))
OpenSongImportDialog.setWindowTitle(translate('OpenSongImportForm', 'OpenSong Song Importer'))
self.ImportFileLabel.setText(translate('OpenSongImportForm', 'OpenSong Folder:'))
self.ProgressGroupBox.setTitle(translate('OpenSongImportForm', 'Progress:'))
self.ProgressLabel.setText(translate('OpenSongImportForm', 'Ready to import'))
self.ImportPushButton.setText(translate('OpenSongImportForm', 'Import'))
self.ClosePushButton.setText(translate('OpenSongImportForm', 'Close'))

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SongBookDialog(object):
def setupUi(self, SongBookDialog):
@ -65,6 +66,6 @@ class Ui_SongBookDialog(object):
QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(self.trUtf8('Edit Book'))
self.NameLabel.setText(self.trUtf8('Name:'))
self.PublisherLabel.setText(self.trUtf8('Publisher:'))
SongBookDialog.setWindowTitle(translate('SongBookForm', 'Edit Book'))
self.NameLabel.setText(translate('SongBookForm', 'Name:'))
self.PublisherLabel.setText(translate('SongBookForm', 'Publisher:'))

View File

@ -0,0 +1,248 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import logging
from PyQt4 import QtCore, QtGui
from songimportwizard import Ui_SongImportWizard
from openlp.core.lib import Receiver, SettingsManager
#from openlp.core.utils import AppLocation, variant_to_unicode
from openlp.plugins.songs.lib.manager import SongFormat
log = logging.getLogger(__name__)
class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
"""
This is the Bible Import Wizard, which allows easy importing of Bibles
into OpenLP from other formats like OSIS, CSV and OpenSong.
"""
log.info(u'BibleImportForm loaded')
def __init__(self, parent, manager, songsplugin):
"""
Instantiate the wizard, and run any extra setup we need to.
``parent``
The QWidget-derived parent of the wizard.
``config``
The configuration object for storing and retrieving settings.
``manager``
The Bible manager.
``bibleplugin``
The Bible plugin.
"""
QtGui.QWizard.__init__(self, parent)
self.setupUi(self)
self.registerFields()
self.finishButton = self.button(QtGui.QWizard.FinishButton)
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
self.manager = manager
self.songsplugin = songsplugin
#self.manager.set_process_dialog(self)
# QtCore.QObject.connect(self.OsisFileButton,
# QtCore.SIGNAL(u'clicked()'),
# self.onOsisFileButtonClicked)
# QtCore.QObject.connect(self.BooksFileButton,
# QtCore.SIGNAL(u'clicked()'),
# self.onBooksFileButtonClicked)
# QtCore.QObject.connect(self.CsvVersesFileButton,
# QtCore.SIGNAL(u'clicked()'),
# self.onCsvVersesFileButtonClicked)
# QtCore.QObject.connect(self.OpenSongBrowseButton,
# QtCore.SIGNAL(u'clicked()'),
# self.onOpenSongBrowseButtonClicked)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked(bool)'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged)
def exec_(self):
"""
Run the wizard.
"""
self.setDefaults()
return QtGui.QWizard.exec_(self)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
"""
if self.currentId() == 0:
# Welcome page
return True
elif self.currentId() == 1:
# Select page
source_format = self.field(u'source_format').toInt()[0]
if source_format == SongFormat.OpenLyrics:
if self.OpenLyricsFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
self.trUtf8('No OpenLyrics Files Selected'),
self.trUtf8('You need to add at least one OpenLyrics '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenLyricsAddButton.setFocus()
return False
elif source_format == SongFormat.OpenSong:
if self.OpenSongFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
self.trUtf8('No OpenSong Files Selected'),
self.trUtf8('You need to add at least one OpenSong '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongAddButton.setFocus()
return False
elif source_format == SongFormat.CCLI:
if self.CCLIFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self,
self.trUtf8('No CCLI Files Selected'),
self.trUtf8('You need to add at least one CCLI file '
'to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CCLIAddButton.setFocus()
return False
elif source_format == SongFormat.CSV:
if self.CSVFilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self,
self.trUtf8('No CSV File Selected'),
self.trUtf8('You need to specify a CSV file to import '
'from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CSVFilenameEdit.setFocus()
return False
return True
elif self.currentId() == 2:
# Progress page
return True
def onCancelButtonClicked(self, checked):
"""
Stop the import on pressing the cancel button.
"""
log.debug('Cancel button pressed!')
if self.currentId() == 3:
Receiver.send_message(u'openlp_stop_song_import')
def onCurrentIdChanged(self, id):
if id == 3:
self.preImport()
self.performImport()
self.postImport()
def registerFields(self):
self.SourcePage.registerField(u'source_format', self.FormatComboBox)
def setDefaults(self):
self.setField(u'source_format', QtCore.QVariant(0))
self.OpenLyricsFileListWidget.clear()
self.OpenSongFileListWidget.clear()
self.CCLIFileListWidget.clear()
self.CSVFilenameEdit.setText(u'')
def getFileName(self, title, editbox):
filename = QtGui.QFileDialog.getOpenFileName(self, title,
SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1))
if filename:
editbox.setText(filename)
self.config.set_last_dir(filename, 1)
def incrementProgressBar(self, status_text):
log.debug(u'IncrementBar %s', status_text)
self.ImportProgressLabel.setText(status_text)
self.ImportProgressBar.setValue(self.ImportProgressBar.value() + 1)
Receiver.send_message(u'process_events')
def preImport(self):
self.finishButton.setVisible(False)
self.ImportProgressBar.setMinimum(0)
self.ImportProgressBar.setMaximum(1188)
self.ImportProgressBar.setValue(0)
self.ImportProgressLabel.setText(self.trUtf8('Starting import...'))
Receiver.send_message(u'process_events')
def performImport(self):
pass
# source_format = self.field(u'source_format').toInt()[0]
# importer = None
# if bible_type == BibleFormat.OSIS:
# # Import an OSIS bible
# importer = self.manager.import_bible(BibleFormat.OSIS,
# name=license_version,
# filename=variant_to_unicode(self.field(u'osis_location'))
# )
# elif bible_type == BibleFormat.CSV:
# # Import a CSV bible
# importer = self.manager.import_bible(BibleFormat.CSV,
# name=license_version,
# booksfile=variant_to_unicode(self.field(u'csv_booksfile')),
# versefile=variant_to_unicode(self.field(u'csv_versefile'))
# )
# elif bible_type == BibleFormat.OpenSong:
# # Import an OpenSong bible
# importer = self.manager.import_bible(BibleFormat.OpenSong,
# name=license_version,
# filename=variant_to_unicode(self.field(u'opensong_file'))
# )
# elif bible_type == BibleFormat.WebDownload:
# # Import a bible from the web
# self.ImportProgressBar.setMaximum(1)
# download_location = self.field(u'web_location').toInt()[0]
# bible_version = self.BibleComboBox.currentText()
# if not isinstance(bible_version, unicode):
# bible_version = unicode(bible_version, u'utf8')
# if download_location == WebDownload.Crosswalk:
# bible = self.web_bible_list[WebDownload.Crosswalk][bible_version]
# elif download_location == WebDownload.BibleGateway:
# bible = self.web_bible_list[WebDownload.BibleGateway][bible_version]
# importer = self.manager.import_bible(
# BibleFormat.WebDownload,
# name=license_version,
# download_source=WebDownload.get_name(download_location),
# download_name=bible,
# proxy_server=variant_to_unicode(self.field(u'proxy_server')),
# proxy_username=variant_to_unicode(self.field(u'proxy_username')),
# proxy_password=variant_to_unicode(self.field(u'proxy_password'))
# )
# success = importer.do_import()
# if success:
# self.manager.save_meta_data(license_version, license_version,
# license_copyright, license_permission)
# self.manager.reload_bibles()
# self.ImportProgressLabel.setText(self.trUtf8('Finished import.'))
# else:
# self.ImportProgressLabel.setText(
# self.trUtf8('Your Bible import failed.'))
# importer.delete()
def postImport(self):
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'process_events')

View File

@ -0,0 +1,255 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
class Ui_SongImportWizard(object):
def setupUi(self, SongImportWizard):
SongImportWizard.setObjectName(u'SongImportWizard')
SongImportWizard.resize(550, 386)
SongImportWizard.setModal(True)
SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
SongImportWizard.setOptions(
QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
self.WelcomePage = QtGui.QWizardPage()
self.WelcomePage.setObjectName(u'WelcomePage')
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
QtGui.QPixmap(u':/wizards/wizard_importsong.bmp'))
self.WelcomeLayout = QtGui.QHBoxLayout(self.WelcomePage)
self.WelcomeLayout.setSpacing(8)
self.WelcomeLayout.setMargin(0)
self.WelcomeLayout.setObjectName(u'WelcomeLayout')
self.WelcomeTextLayout = QtGui.QVBoxLayout()
self.WelcomeTextLayout.setSpacing(8)
self.WelcomeTextLayout.setObjectName(u'WelcomeTextLayout')
self.TitleLabel = QtGui.QLabel(self.WelcomePage)
self.TitleLabel.setObjectName(u'TitleLabel')
self.WelcomeTextLayout.addWidget(self.TitleLabel)
self.WelcomeTopSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.WelcomeTextLayout.addItem(self.WelcomeTopSpacer)
self.InformationLabel = QtGui.QLabel(self.WelcomePage)
self.InformationLabel.setWordWrap(True)
self.InformationLabel.setMargin(10)
self.InformationLabel.setObjectName(u'InformationLabel')
self.WelcomeTextLayout.addWidget(self.InformationLabel)
self.WelcomeBottomSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.WelcomeTextLayout.addItem(self.WelcomeBottomSpacer)
self.WelcomeLayout.addLayout(self.WelcomeTextLayout)
SongImportWizard.addPage(self.WelcomePage)
self.SourcePage = QtGui.QWizardPage()
self.SourcePage.setObjectName(u'SourcePage')
self.SourceLayout = QtGui.QVBoxLayout(self.SourcePage)
self.SourceLayout.setSpacing(8)
self.SourceLayout.setMargin(20)
self.SourceLayout.setObjectName(u'SourceLayout')
self.FormatLayout = QtGui.QHBoxLayout()
self.FormatLayout.setSpacing(8)
self.FormatLayout.setObjectName(u'FormatLayout')
self.FormatLabel = QtGui.QLabel(self.SourcePage)
self.FormatLabel.setObjectName(u'FormatLabel')
self.FormatLayout.addWidget(self.FormatLabel)
self.FormatComboBox = QtGui.QComboBox(self.SourcePage)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FormatComboBox.sizePolicy().hasHeightForWidth())
self.FormatComboBox.setSizePolicy(sizePolicy)
self.FormatComboBox.setObjectName(u'FormatComboBox')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatLayout.addWidget(self.FormatComboBox)
self.FormatSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.FormatLayout.addItem(self.FormatSpacer)
self.SourceLayout.addLayout(self.FormatLayout)
self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage)
self.FormatStackedWidget.setObjectName(u'FormatStackedWidget')
self.OpenLyricsPage = QtGui.QWidget()
self.OpenLyricsPage.setObjectName(u'OpenLyricsPage')
self.OpenLyricsLayout = QtGui.QVBoxLayout(self.OpenLyricsPage)
self.OpenLyricsLayout.setSpacing(8)
self.OpenLyricsLayout.setMargin(0)
self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout')
self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage)
self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget)
self.OpenLyricsButtonLayout = QtGui.QHBoxLayout()
self.OpenLyricsButtonLayout.setSpacing(8)
self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenIcon = QtGui.QIcon()
self.OpenIcon.addPixmap(QtGui.QPixmap(u':/general/general_open.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.DeleteIcon = QtGui.QIcon()
self.DeleteIcon.addPixmap(QtGui.QPixmap(u':/general/general_delete.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OpenLyricsAddButton.setIcon(self.OpenIcon)
self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton)
self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer)
self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage)
self.OpenLyricsRemoveButton.setIcon(self.DeleteIcon)
self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton)
self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout)
self.FormatStackedWidget.addWidget(self.OpenLyricsPage)
self.OpenSongPage = QtGui.QWidget()
self.OpenSongPage.setObjectName(u'OpenSongPage')
self.OpenSongLayout = QtGui.QVBoxLayout(self.OpenSongPage)
self.OpenSongLayout.setSpacing(8)
self.OpenSongLayout.setMargin(0)
self.OpenSongLayout.setObjectName(u'OpenSongLayout')
self.OpenSongFileListWidget = QtGui.QListWidget(self.OpenSongPage)
self.OpenSongFileListWidget.setObjectName(u'OpenSongFileListWidget')
self.OpenSongLayout.addWidget(self.OpenSongFileListWidget)
self.OpenSongButtonLayout = QtGui.QHBoxLayout()
self.OpenSongButtonLayout.setSpacing(8)
self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongAddButton.setIcon(self.OpenIcon)
self.OpenSongAddButton.setObjectName(u'OpenSongAddButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton)
self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer)
self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage)
self.OpenSongRemoveButton.setIcon(self.DeleteIcon)
self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton)
self.OpenSongLayout.addLayout(self.OpenSongButtonLayout)
self.FormatStackedWidget.addWidget(self.OpenSongPage)
self.CCLIPage = QtGui.QWidget()
self.CCLIPage.setObjectName(u'CCLIPage')
self.CCLILayout = QtGui.QVBoxLayout(self.CCLIPage)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLIFileListWidget = QtGui.QListWidget(self.CCLIPage)
self.CCLIFileListWidget.setObjectName(u'CCLIFileListWidget')
self.CCLILayout.addWidget(self.CCLIFileListWidget)
self.CCLIButtonLayout = QtGui.QHBoxLayout()
self.CCLIButtonLayout.setSpacing(8)
self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout')
self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIAddButton.setIcon(self.OpenIcon)
self.CCLIAddButton.setObjectName(u'CCLIAddButton')
self.CCLIButtonLayout.addWidget(self.CCLIAddButton)
self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer)
self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage)
self.CCLIRemoveButton.setIcon(self.DeleteIcon)
self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton')
self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton)
self.CCLILayout.addLayout(self.CCLIButtonLayout)
self.FormatStackedWidget.addWidget(self.CCLIPage)
self.CSVPage = QtGui.QWidget()
self.CSVPage.setObjectName(u'CSVPage')
self.CSVLayout = QtGui.QFormLayout(self.CSVPage)
self.CSVLayout.setMargin(0)
self.CSVLayout.setSpacing(8)
self.CSVLayout.setObjectName(u'CSVLayout')
self.CSVFilenameLabel = QtGui.QLabel(self.CSVPage)
self.CSVFilenameLabel.setObjectName(u'CSVFilenameLabel')
self.CSVLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.CSVFilenameLabel)
self.CSVFileLayout = QtGui.QHBoxLayout()
self.CSVFileLayout.setSpacing(8)
self.CSVFileLayout.setObjectName(u'CSVFileLayout')
self.CSVFilenameEdit = QtGui.QLineEdit(self.CSVPage)
self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit')
self.CSVFileLayout.addWidget(self.CSVFilenameEdit)
self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage)
self.CSVBrowseButton.setIcon(self.OpenIcon)
self.CSVBrowseButton.setObjectName(u'CSVBrowseButton')
self.CSVFileLayout.addWidget(self.CSVBrowseButton)
self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, self.CSVFileLayout)
self.FormatStackedWidget.addWidget(self.CSVPage)
self.SourceLayout.addWidget(self.FormatStackedWidget)
SongImportWizard.addPage(self.SourcePage)
self.ImportPage = QtGui.QWizardPage()
self.ImportPage.setObjectName(u'ImportPage')
self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage)
self.ImportLayout.setSpacing(8)
self.ImportLayout.setMargin(50)
self.ImportLayout.setObjectName(u'ImportLayout')
self.ImportProgressLabel = QtGui.QLabel(self.ImportPage)
self.ImportProgressLabel.setObjectName(u'ImportProgressLabel')
self.ImportLayout.addWidget(self.ImportProgressLabel)
self.ImportProgressBar = QtGui.QProgressBar(self.ImportPage)
self.ImportProgressBar.setProperty(u'value', 0)
self.ImportProgressBar.setInvertedAppearance(False)
self.ImportProgressBar.setObjectName(u'ImportProgressBar')
self.ImportLayout.addWidget(self.ImportProgressBar)
SongImportWizard.addPage(self.ImportPage)
self.retranslateUi(SongImportWizard)
self.FormatStackedWidget.setCurrentIndex(0)
QtCore.QObject.connect(
self.FormatComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.FormatStackedWidget.setCurrentIndex
)
QtCore.QMetaObject.connectSlotsByName(SongImportWizard)
def retranslateUi(self, SongImportWizard):
SongImportWizard.setWindowTitle(self.trUtf8('Song Import Wizard'))
self.TitleLabel.setText(
'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
self.trUtf8('Welcome to the Song Import Wizard'))
self.InformationLabel.setText(self.trUtf8('This wizard will help you '
'to import songs from a variety of formats. Click the next button '
'below to start the process by selecting a format to import from.'))
self.SourcePage.setTitle(self.trUtf8('Select Import Source'))
self.SourcePage.setSubTitle(self.trUtf8('Select the import format, '
'and where to import from.'))
self.FormatLabel.setText(self.trUtf8('Format:'))
self.FormatComboBox.setItemText(0, self.trUtf8('OpenLyrics'))
self.FormatComboBox.setItemText(1, self.trUtf8('OpenSong'))
self.FormatComboBox.setItemText(2, self.trUtf8('CCLI'))
self.FormatComboBox.setItemText(3, self.trUtf8('CSV'))
self.OpenLyricsAddButton.setText(self.trUtf8('Add Files...'))
self.OpenLyricsRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.OpenSongAddButton.setText(self.trUtf8('Add Files...'))
self.OpenSongRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.CCLIAddButton.setText(self.trUtf8('Add Files...'))
self.CCLIRemoveButton.setText(self.trUtf8('Remove File(s)'))
self.CSVFilenameLabel.setText(self.trUtf8('Filename:'))
self.CSVBrowseButton.setText(self.trUtf8('Browse...'))
self.ImportPage.setTitle(self.trUtf8('Importing'))
self.ImportPage.setSubTitle(self.trUtf8('Please wait while your songs '
'are imported.'))
self.ImportProgressLabel.setText(self.trUtf8('Ready.'))
self.ImportProgressBar.setFormat(self.trUtf8('%p%'))

View File

@ -25,7 +25,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon
from openlp.core.lib import build_icon, translate
class Ui_SongMaintenanceDialog(object):
def setupUi(self, SongMaintenanceDialog):
@ -208,16 +208,16 @@ class Ui_SongMaintenanceDialog(object):
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog)
def retranslateUi(self, SongMaintenanceDialog):
SongMaintenanceDialog.setWindowTitle(self.trUtf8('Song Maintenance'))
self.TypeListWidget.item(0).setText(self.trUtf8('Authors'))
self.TypeListWidget.item(1).setText(self.trUtf8('Topics'))
self.TypeListWidget.item(2).setText(self.trUtf8('Books/Hymnals'))
self.AuthorAddButton.setText(self.trUtf8('Add'))
self.AuthorEditButton.setText(self.trUtf8('Edit'))
self.AuthorDeleteButton.setText(self.trUtf8('Delete'))
self.TopicAddButton.setText(self.trUtf8('Add'))
self.TopicEditButton.setText(self.trUtf8('Edit'))
self.TopicDeleteButton.setText(self.trUtf8('Delete'))
self.BookAddButton.setText(self.trUtf8('Add'))
self.BookEditButton.setText(self.trUtf8('Edit'))
self.BookDeleteButton.setText(self.trUtf8('Delete'))
SongMaintenanceDialog.setWindowTitle(translate('SongMaintenanceForm', 'Song Maintenance'))
self.TypeListWidget.item(0).setText(translate('SongMaintenanceForm', 'Authors'))
self.TypeListWidget.item(1).setText(translate('SongMaintenanceForm', 'Topics'))
self.TypeListWidget.item(2).setText(translate('SongMaintenanceForm', 'Books/Hymnals'))
self.AuthorAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.AuthorEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.AuthorDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))
self.TopicAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.TopicEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.TopicDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))
self.BookAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.BookEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.BookDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))

View File

@ -93,11 +93,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
del_func(item.id)
reset_func()
else:
QtGui.QMessageBox.critical(self, dlg_title, err_text,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtGui.QMessageBox.critical(self, dlg_title, err_text)
else:
QtGui.QMessageBox.critical(self, dlg_title, sel_text,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtGui.QMessageBox.critical(self, dlg_title, sel_text)
def resetAuthors(self):
self.AuthorsListWidget.clear()
@ -131,39 +129,41 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True)
if self.authorform.exec_():
author = Author.populate(
first_name=unicode(self.authorform.FirstNameEdit.text(), u'utf-8'),
last_name=unicode(self.authorform.LastNameEdit.text(), u'utf-8'),
display_name=unicode(self.authorform.DisplayEdit.text(), u'utf-8'))
first_name=unicode(
self.authorform.FirstNameEdit.text(), u'utf-8'),
last_name=unicode(
self.authorform.LastNameEdit.text(), u'utf-8'),
display_name=unicode(
self.authorform.DisplayEdit.text(), u'utf-8'))
if self.songmanager.save_author(author):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your author.'))
def onTopicAddButtonClick(self):
if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
topic = Topic.populate(
name=unicode(self.topicform.NameEdit.text(), u'utf-8'))
if self.songmanager.save_topic(topic):
self.resetTopics()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your topic.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your topic.'))
def onBookAddButtonClick(self):
if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
book = Book.populate(
name=unicode(self.bookform.NameEdit.text(), u'utf-8'),
publisher=unicode(self.bookform.PublisherEdit.text(), u'utf-8'))
if self.songmanager.save_book(book):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t add your book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t add your book.'))
def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget)
@ -174,16 +174,18 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.LastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name)
if self.authorform.exec_(False):
author.first_name = unicode(self.authorform.FirstNameEdit.text(), u'utf-8')
author.last_name = unicode(self.authorform.LastNameEdit.text(), u'utf-8')
author.display_name = unicode(self.authorform.DisplayEdit.text(), u'utf-8')
author.first_name = unicode(
self.authorform.FirstNameEdit.text(), u'utf-8')
author.last_name = unicode(
self.authorform.LastNameEdit.text(), u'utf-8')
author.display_name = unicode(
self.authorform.DisplayEdit.text(), u'utf-8')
if self.songmanager.save_author(author):
self.resetAuthors()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your author.'))
def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget)
@ -197,8 +199,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your topic.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your topic.'))
def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget)
@ -208,14 +209,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.bookform.PublisherEdit.setText(book.publisher)
if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text(), u'utf-8')
book.publisher = unicode(self.bookform.PublisherEdit.text(), u'utf-8')
book.publisher = unicode(
self.bookform.PublisherEdit.text(), u'utf-8')
if self.songmanager.save_book(book):
self.resetBooks()
else:
QtGui.QMessageBox.critical(
self, self.trUtf8('Error'),
self.trUtf8('Couldn\'t save your book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.trUtf8('Couldn\'t save your book.'))
def onAuthorDeleteButtonClick(self):
"""

View File

@ -24,6 +24,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_TopicsDialog(object):
def setupUi(self, TopicsDialog):
@ -59,5 +60,5 @@ class Ui_TopicsDialog(object):
QtCore.QMetaObject.connectSlotsByName(TopicsDialog)
def retranslateUi(self, TopicsDialog):
TopicsDialog.setWindowTitle(self.trUtf8('Topic Maintenance'))
self.NameLabel.setText(self.trUtf8('Topic name:'))
TopicsDialog.setWindowTitle(translate('TopicsForm', 'Topic Maintenance'))
self.NameLabel.setText(translate('TopicsForm', 'Topic name:'))

View File

@ -50,7 +50,8 @@ class Book(BaseModel):
Book model
"""
def __repr__(self):
return u'<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
return u'<Book id="%s" name="%s" publisher="%s" />' % (
str(self.id), self.name, self.publisher)
class Song(BaseModel):
"""

View File

@ -30,10 +30,56 @@ from PyQt4 import QtCore
from openlp.core.utils import AppLocation
from openlp.plugins.songs.lib.models import init_models, metadata, Song, \
Author, Topic, Book
#from openlp.plugins.songs.lib import OpenLyricsSong, OpenSongSong, CCLISong, \
# CSVSong
log = logging.getLogger(__name__)
class SongManager():
class SongFormat(object):
"""
This is a special enumeration class that holds the various types of songs,
plus a few helper functions to facilitate generic handling of song types
for importing.
"""
Unknown = -1
OpenLyrics = 0
OpenSong = 1
CCLI = 2
CSV = 3
@staticmethod
def get_class(id):
"""
Return the appropriate imeplementation class.
``id``
The song format.
"""
# if id == SongFormat.OpenLyrics:
# return OpenLyricsSong
# elif id == SongFormat.OpenSong:
# return OpenSongSong
# elif id == SongFormat.CCLI:
# return CCLISong
# elif id == SongFormat.CSV:
# return CSVSong
# else:
return None
@staticmethod
def list():
"""
Return a list of the supported song formats.
"""
return [
SongFormat.OpenLyrics,
SongFormat.OpenSong,
SongFormat.CCLI,
SongFormat.CSV
]
class SongManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.
@ -50,7 +96,7 @@ class SongManager():
settings.beginGroup(u'songs')
self.db_url = u''
db_type = unicode(
settings.value(u'songs/db type', u'sqlite').toString())
settings.value(u'songs/db type', QtCore.QVariant(u'sqlite')).toString())
if db_type == u'sqlite':
self.db_url = u'sqlite:///%s/songs.sqlite' % \
AppLocation.get_section_data_path(u'songs')

View File

@ -29,7 +29,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
BaseListWithDnD, Receiver, ItemCapabilities
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
ImportWizardForm
log = logging.getLogger(__name__)
@ -49,10 +50,11 @@ class SongMediaItem(MediaManagerItem):
self.IconPath = u'songs/song'
self.ListViewWithDnD_class = SongListView
MediaManagerItem.__init__(self, parent, icon, title)
self.edit_song_form = EditSongForm(self, self.parent.manager)
self.singleServiceItem = False
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
#self.edit_song_form = EditSongForm(self.parent.manager, self)
self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
self.parent.manager, self)
# Holds information about whether the edit is remotly triggered and
# which Song is required.
self.remoteSong = -1
@ -154,17 +156,17 @@ class SongMediaItem(MediaManagerItem):
search_type = self.SearchTypeComboBox.currentIndex()
if search_type == 0:
log.debug(u'Titles Search')
search_results = self.parent.songmanager.search_song_title(
search_results = self.parent.manager.search_song_title(
search_keywords)
self.displayResultsSong(search_results)
elif search_type == 1:
log.debug(u'Lyrics Search')
search_results = self.parent.songmanager.search_song_lyrics(
search_results = self.parent.manager.search_song_lyrics(
search_keywords)
self.displayResultsSong(search_results)
elif search_type == 2:
log.debug(u'Authors Search')
search_results = self.parent.songmanager.get_song_from_author(
search_results = self.parent.manager.get_song_from_author(
search_keywords)
self.displayResultsAuthor(search_results)
#Called to redisplay the song list screen edith from a search
@ -226,6 +228,11 @@ class SongMediaItem(MediaManagerItem):
if len(text) > search_length:
self.onSearchTextButtonClick()
def onImportClick(self):
songimportform = ImportWizardForm(self, self.parent.manager,
self.parent)
songimportform.exec_()
def onNewClick(self):
self.edit_song_form.newSong()
self.edit_song_form.exec_()
@ -256,14 +263,14 @@ class SongMediaItem(MediaManagerItem):
type of display is required.
"""
fields = songid.split(u':')
valid = self.parent.songmanager.get_song(fields[1])
valid = self.parent.manager.get_song(fields[1])
if valid:
self.remoteSong = fields[1]
self.remoteTriggered = fields[0]
self.edit_song_form.loadSong(fields[1], (fields[0] == u'P'))
self.edit_song_form.exec_()
def onEditClick(self, preview=False):
def onEditClick(self):
item = self.ListView.currentItem()
if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
@ -276,7 +283,8 @@ class SongMediaItem(MediaManagerItem):
if len(items) == 1:
del_message = self.trUtf8('Delete song?')
else:
del_message = unicode(self.trUtf8('Delete %d songs?')) % len(items)
del_message = unicode(
self.trUtf8('Delete %d songs?')) % len(items)
ans = QtGui.QMessageBox.question(self,
self.trUtf8('Delete Confirmation'), del_message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok|
@ -286,7 +294,7 @@ class SongMediaItem(MediaManagerItem):
return
for item in items:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.parent.songmanager.delete_song(item_id)
self.parent.manager.delete_song(item_id)
self.onSearchTextButtonClick()
def generateSlideData(self, service_item, item=None):
@ -307,17 +315,19 @@ class SongMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.AllowsEdit)
service_item.add_capability(ItemCapabilities.AllowsPreview)
service_item.add_capability(ItemCapabilities.AllowsLoop)
song = self.parent.songmanager.get_song(item_id)
song = self.parent.manager.get_song(item_id)
service_item.theme = song.theme_name
service_item.editId = item_id
if song.lyrics.startswith(u'<?xml version='):
songXML = SongXMLParser(song.lyrics)
verseList = songXML.get_verses()
#no verse list or only 1 space (in error)
if song.verse_order is None or \
song.verse_order == u'' or song.verse_order == u' ':
if not song.verse_order or not song.verse_order.strip():
for verse in verseList:
service_item.add_from_text(verse[1][:30], unicode(verse[1]))
verseTag = u'%s:%s' % (
verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text(\
verse[1][:30], unicode(verse[1]), verseTag)
else:
#Loop through the verse list and expand the song accordingly.
for order in song.verse_order.upper().split(u' '):
@ -363,3 +373,4 @@ class SongMediaItem(MediaManagerItem):
song.title, author_audit, song.copyright, song.ccli_number
]
return True

View File

@ -332,105 +332,205 @@ class SofImport(OooImport):
Because someone at Kingsway forgot to check the 1+2 RTF file,
some verses were not formatted correctly.
"""
if song_number == 11: return 8
if song_number == 18: return 5
if song_number == 21: return 6
if song_number == 23: return 4
if song_number == 24: return 7
if song_number == 27: return 4
if song_number == 31: return 6
if song_number == 49: return 4
if song_number == 50: return 8
if song_number == 70: return 4
if song_number == 75: return 8
if song_number == 79: return 6
if song_number == 97: return 7
if song_number == 107: return 4
if song_number == 109: return 4
if song_number == 133: return 4
if song_number == 155: return 10
if song_number == 156: return 8
if song_number == 171: return 4
if song_number == 188: return 7
if song_number == 192: return 4
if song_number == 208: return 8
if song_number == 215: return 8
if song_number == 220: return 4
if song_number == 247: return 6
if song_number == 248: return 6
if song_number == 251: return 8
if song_number == 295: return 8
if song_number == 307: return 5
if song_number == 314: return 6
if song_number == 325: return 8
if song_number == 386: return 6
if song_number == 415: return 4
if song_number == 426: return 4
if song_number == 434: return 5
if song_number == 437: return 4
if song_number == 438: return 6
if song_number == 456: return 8
if song_number == 461: return 4
if song_number == 469: return 4
if song_number == 470: return 5
if song_number == 476: return 6
if song_number == 477: return 7
if song_number == 480: return 8
if song_number == 482: return 4
if song_number == 512: return 4
if song_number == 513: return 8
if song_number == 518: return 5
if song_number == 520: return 4
if song_number == 523: return 6
if song_number == 526: return 8
if song_number == 527: return 4
if song_number == 529: return 4
if song_number == 537: return 4
if song_number == 555: return 6
if song_number == 581: return 4
if song_number == 589: return 6
if song_number == 590: return 4
if song_number == 593: return 8
if song_number == 596: return 4
if song_number == 610: return 6
if song_number == 611: return 6
if song_number == 619: return 8
if song_number == 645: return 5
if song_number == 653: return 6
if song_number == 683: return 7
if song_number == 686: return 4
if song_number == 697: return 8
if song_number == 698: return 4
if song_number == 704: return 6
if song_number == 716: return 4
if song_number == 717: return 6
if song_number == 730: return 4
if song_number == 731: return 8
if song_number == 732: return 8
if song_number == 738: return 4
if song_number == 756: return 9
if song_number == 815: return 6
if song_number == 830: return 8
if song_number == 831: return 4
if song_number == 876: return 6
if song_number == 877: return 6
if song_number == 892: return 4
if song_number == 894: return 6
if song_number == 902: return 8
if song_number == 905: return 8
if song_number == 921: return 6
if song_number == 940: return 7
if song_number == 955: return 9
if song_number == 968: return 8
if song_number == 972: return 7
if song_number == 974: return 4
if song_number == 988: return 6
if song_number == 991: return 5
if song_number == 1002: return 8
if song_number == 1024: return 8
if song_number == 1044: return 9
if song_number == 1088: return 6
if song_number == 1117: return 6
if song_number == 1119: return 7
if song_number == 11:
return 8
if song_number == 18:
return 5
if song_number == 21:
return 6
if song_number == 23:
return 4
if song_number == 24:
return 7
if song_number == 27:
return 4
if song_number == 31:
return 6
if song_number == 49:
return 4
if song_number == 50:
return 8
if song_number == 70:
return 4
if song_number == 75:
return 8
if song_number == 79:
return 6
if song_number == 97:
return 7
if song_number == 107:
return 4
if song_number == 109:
return 4
if song_number == 133:
return 4
if song_number == 155:
return 10
if song_number == 156:
return 8
if song_number == 171:
return 4
if song_number == 188:
return 7
if song_number == 192:
return 4
if song_number == 208:
return 8
if song_number == 215:
return 8
if song_number == 220:
return 4
if song_number == 247:
return 6
if song_number == 248:
return 6
if song_number == 251:
return 8
if song_number == 295:
return 8
if song_number == 307:
return 5
if song_number == 314:
return 6
if song_number == 325:
return 8
if song_number == 386:
return 6
if song_number == 415:
return 4
if song_number == 426:
return 4
if song_number == 434:
return 5
if song_number == 437:
return 4
if song_number == 438:
return 6
if song_number == 456:
return 8
if song_number == 461:
return 4
if song_number == 469:
return 4
if song_number == 470:
return 5
if song_number == 476:
return 6
if song_number == 477:
return 7
if song_number == 480:
return 8
if song_number == 482:
return 4
if song_number == 512:
return 4
if song_number == 513:
return 8
if song_number == 518:
return 5
if song_number == 520:
return 4
if song_number == 523:
return 6
if song_number == 526:
return 8
if song_number == 527:
return 4
if song_number == 529:
return 4
if song_number == 537:
return 4
if song_number == 555:
return 6
if song_number == 581:
return 4
if song_number == 589:
return 6
if song_number == 590:
return 4
if song_number == 593:
return 8
if song_number == 596:
return 4
if song_number == 610:
return 6
if song_number == 611:
return 6
if song_number == 619:
return 8
if song_number == 645:
return 5
if song_number == 653:
return 6
if song_number == 683:
return 7
if song_number == 686:
return 4
if song_number == 697:
return 8
if song_number == 698:
return 4
if song_number == 704:
return 6
if song_number == 716:
return 4
if song_number == 717:
return 6
if song_number == 730:
return 4
if song_number == 731:
return 8
if song_number == 732:
return 8
if song_number == 738:
return 4
if song_number == 756:
return 9
if song_number == 815:
return 6
if song_number == 830:
return 8
if song_number == 831:
return 4
if song_number == 876:
return 6
if song_number == 877:
return 6
if song_number == 892:
return 4
if song_number == 894:
return 6
if song_number == 902:
return 8
if song_number == 905:
return 8
if song_number == 921:
return 6
if song_number == 940:
return 7
if song_number == 955:
return 9
if song_number == 968:
return 8
if song_number == 972:
return 7
if song_number == 974:
return 4
if song_number == 988:
return 6
if song_number == 991:
return 5
if song_number == 1002:
return 8
if song_number == 1024:
return 8
if song_number == 1044:
return 9
if song_number == 1088:
return 6
if song_number == 1117:
return 6
if song_number == 1119:
return 7
return None

View File

@ -122,8 +122,9 @@ class SongImport(object):
or text.lower().find(self.copyright_symbol) >= 0:
copyright_found = False
for line in lines:
if copyright_found or line.lower().find(self.copyright_string) >= 0\
or line.lower().find(self.copyright_symbol) >= 0:
if (copyright_found or
line.lower().find(self.copyright_string) >= 0 or
line.lower().find(self.copyright_symbol) >= 0):
copyright_found = True
self.add_copyright(line)
else:
@ -264,8 +265,8 @@ class SongImport(object):
"""
Remove punctuation from the string for searchable fields
"""
for c in string.punctuation:
text = text.replace(c, u'')
for character in string.punctuation:
text = text.replace(character, u'')
return text
def finish(self):

View File

@ -23,6 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import logging
import sys
import os
@ -32,6 +33,9 @@ sys.path.append(os.path.abspath(u'./../../../..'))
from openlp.core.lib import XmlRootClass
log = logging.getLogger(__name__)
class SongException(Exception):
pass
@ -71,7 +75,7 @@ _blankOpenSongXml = \
'''
class _OpenSong(XmlRootClass):
"""Class for import of OpenSogn"""
"""Class for import of OpenSong"""
def __init__(self, xmlContent = None):
"""Initialize from given xml content"""
@ -80,7 +84,6 @@ class _OpenSong(XmlRootClass):
def _reset(self):
"""Reset all song attributes"""
global _blankOpenSongXml
self._setFromXml(_blankOpenSongXml, 'song')
def from_buffer(self, xmlContent):
@ -110,8 +113,7 @@ class _OpenSong(XmlRootClass):
res.append(self.theme)
if self.alttheme:
res.append(self.alttheme)
s = u', u'.join(res)
return s
return u', u'.join(res)
def _reorder_verse(self, tag, tmpVerse):
"""
@ -120,28 +122,28 @@ class _OpenSong(XmlRootClass):
tmpVerse -- list of strings
"""
res = []
for c in '1234567890 ':
for digit in '1234567890 ':
tagPending = True
for l in tmpVerse:
if l.startswith(c):
for line in tmpVerse:
if line.startswith(digit):
if tagPending:
tagPending = False
t = tag.strip(u'[]').lower()
if 'v' == t:
tagChar = tag.strip(u'[]').lower()
if 'v' == tagChar:
newtag = "Verse"
elif 'c' == t:
elif 'c' == tagChar:
newtag = "Chorus"
elif 'b' == t:
elif 'b' == tagChar:
newtag = "Bridge"
elif 'p' == t:
elif 'p' == tagChar:
newtag = "Pre-chorus"
else:
newtag = t
s = (u'# %s %s' % (newtag, c)).rstrip()
res.append(s)
res.append(l[1:])
if (len(l) == 0) and (not tagPending):
res.append(l)
newtag = tagChar
tagString = (u'# %s %s' % (newtag, digit)).rstrip()
res.append(tagString)
res.append(line[1:])
if (len(line) == 0) and (not tagPending):
res.append(line)
return res
def get_lyrics(self):
@ -162,13 +164,13 @@ class _OpenSong(XmlRootClass):
if line.startswith(u'['):
tag = line
else:
r = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r)
reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(reorderedVerse)
tag = ""
tmpVerse = []
# catch up final verse
r = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r)
reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(reorderedVerse)
return finalLyrics
@ -301,7 +303,7 @@ class Song(object):
string = title
for char in punctuation:
string = string.replace(char, '')
return s
return string
def set_title(self, title):
"""Set the song title
@ -341,36 +343,36 @@ class Song(object):
sCopyright = ""
sCcli = ""
lastpart = 0
n = 0
lineCount = 0
metMisc = False
lyrics = []
for l in textList:
n += 1
for line in textList:
lineCount += 1
if lastpart > 0:
lastpart += 1
if lastpart == 2:
sCopyright = l[1:].strip()
sCopyright = line[1:].strip()
if lastpart == 3:
sAuthor = l
elif l.startswith(u'CCLI Song'):
sCcli = l[13:].strip()
sAuthor = line
elif line.startswith(u'CCLI Song'):
sCcli = line[13:].strip()
lastpart = 1
else:
if metMisc:
metMisc = False
if l.upper().startswith(u'(BRIDGE)'):
if line.upper().startswith(u'(BRIDGE)'):
lyrics.append(u'# Bridge')
# otherwise unknown misc keyword
elif l.startswith(u'Misc'):
elif line.startswith(u'Misc'):
metMisc = True
elif l.startswith(u'Verse') or l.startswith(u'Chorus'):
lyrics.append(u'# %s'%l)
elif line.startswith(u'Verse') or line.startswith(u'Chorus'):
lyrics.append(u'# %s' % line)
else:
# should we remove multiple blank lines?
if n == 1:
sName = l
if lineCount == 1:
sName = line
else:
lyrics.append(l)
lyrics.append(line)
# split on known separators
lst = sAuthor.split(u'/')
if len(lst) < 2:
@ -403,7 +405,7 @@ class Song(object):
if string_in is None:
string_out = ""
else:
string_out = unicode(s)
string_out = unicode(string_in)
return string_out
def _split_to_list(self, aString):

View File

@ -0,0 +1,138 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
# Thompson, Jon Tibble, Carsten Tinggaard #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from lxml import objectify
class LyricsXML(object):
"""
This class represents the XML in the ``lyrics`` field of a song.
The basic XML looks like this::
<?xml version="1.0" encoding="UTF-8"?>
<song version="1.0">
<lyrics language="en">
<verse type="chorus" label="1">
<![CDATA[ ... ]]>
</verse>
</lyrics>
</song>
"""
def __init__(self, song=None):
if song:
if song.lyrics.startswith(u'<?xml'):
self.parse(song.lyrics)
else:
self.extract(song.lyrics)
else:
self.languages = []
def parse(self, xml):
"""
Parse XML from the ``lyrics`` field in the database, and set the list
of verses from it.
``xml``
The XML to parse.
"""
try:
self.languages = []
song = objectify.fromstring(xml)
for lyrics in song.lyrics:
language = {
u'language': lyrics.attrib[u'language'],
u'verses': []
}
for verse in lyrics.verse:
language[u'verses'].append({
u'type': verse.attrib[u'type'],
u'label': verse.attrib[u'label'],
u'text': unicode(verse.text)
})
self.lyrics.append(language)
return True
except:
return False
def extract(self, text):
"""
If the ``lyrics`` field in the database is not XML, this method is
called and used to construct the verse structure similar to the output
of the ``parse`` function.
``text``
The text to pull verses out of.
"""
text = text.replace('\r\n', '\n')
verses = text.split('\n\n')
self.languages = [{u'language': u'en', u'verses': []}]
counter = 0
for verse in verses:
counter = counter + 1
self.languages[0][u'verses'].append({
u'type': u'verse',
u'label': unicode(counter),
u'text': verse
})
return True
def add_verse(self, type, label, text):
"""
Add a verse to the list of verses.
``type``
The type of list, one of "verse", "chorus", "bridge", "pre-chorus",
"intro", "outtro".
``label``
The number associated with this verse, like 1 or 2.
``text``
The text of the verse.
"""
self.verses.append({
u'type': type,
u'label': label,
u'text': text
})
def export(self):
"""
Build up the XML for the verse structure.
"""
lyrics_output = u''
for language in self.languages:
verse_output = u''
for verse in language[u'verses']:
verse_output = verse_output + \
u'<verse type="%s" label="%s"><![CDATA[%s]]></verse>' % \
(verse[u'type'], verse[u'label'], verse[u'text'])
lyrics_output = lyrics_output + \
u'<lyrics language="%s">%s</lyrics>' % \
(language[u'language'], verse_output)
song_output = u'<?xml version="1.0" encoding="UTF-8"?>' + \
u'<song version="1.0">%s</song>' % lyrics_output
return song_output

View File

@ -30,11 +30,10 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \
SofImport, OooImport
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
OpenSongImportForm, OpenLPExportForm
log = logging.getLogger(__name__)
class SongsPlugin(Plugin):
"""
This is the number 1 plugin, if importance were placed on any
@ -51,11 +50,7 @@ class SongsPlugin(Plugin):
"""
Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
self.weight = -10
self.songmanager = SongManager()
self.openlp_import_form = OpenLPImportForm()
self.opensong_import_form = OpenSongImportForm()
self.openlp_export_form = OpenLPExportForm()
self.opensong_export_form = OpenSongExportForm()
self.manager = SongManager()
self.icon = build_icon(u':/media/media_song.png')
self.status = PluginStatus.Active
@ -68,16 +63,16 @@ class SongsPlugin(Plugin):
# self.songmanager = SongManager()
Plugin.initialise(self)
self.insert_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(True)
self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.songmanager.get_songs())
#self.ImportSongMenu.menuAction().setVisible(True)
#self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.manager.get_songs())
def finalise(self):
log.info(u'Plugin Finalise')
Plugin.finalise(self)
self.remove_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(False)
self.ExportSongMenu.menuAction().setVisible(False)
#self.ImportSongMenu.menuAction().setVisible(False)
#self.ExportSongMenu.menuAction().setVisible(False)
def get_media_manager_item(self):
"""
@ -95,64 +90,47 @@ class SongsPlugin(Plugin):
The actual **Import** menu item, so that your actions can
use it as their parent.
"""
self.ImportSongMenu = QtGui.QMenu(import_menu)
self.ImportSongMenu.setObjectName(u'ImportSongMenu')
self.ImportOpenSongItem = QtGui.QAction(import_menu)
self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem')
self.ImportOpenlp1Item = QtGui.QAction(import_menu)
self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item')
self.ImportOpenlp2Item = QtGui.QAction(import_menu)
self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item')
# Main song import menu item - will eventually be the only one
self.SongImportItem = QtGui.QAction(import_menu)
self.SongImportItem.setObjectName(u'SongImportItem')
self.SongImportItem.setText(import_menu.trUtf8('&Song'))
self.SongImportItem.setToolTip(
import_menu.trUtf8('Import songs using the import wizard.'))
import_menu.addAction(self.SongImportItem)
# Songs of Fellowship import menu item - will be removed and the
# functionality will be contained within the import wizard
self.ImportSofItem = QtGui.QAction(import_menu)
self.ImportSofItem.setObjectName(u'ImportSofItem')
self.ImportOooItem = QtGui.QAction(import_menu)
self.ImportOooItem.setObjectName(u'ImportOooItem')
# Add to menus
self.ImportSongMenu.addAction(self.ImportOpenlp1Item)
self.ImportSongMenu.addAction(self.ImportOpenlp2Item)
self.ImportSongMenu.addAction(self.ImportOpenSongItem)
self.ImportSongMenu.addAction(self.ImportSofItem)
self.ImportSongMenu.addAction(self.ImportOooItem)
import_menu.addAction(self.ImportSongMenu.menuAction())
# Translations...
self.ImportSongMenu.setTitle(import_menu.trUtf8('&Song'))
self.ImportOpenSongItem.setText(import_menu.trUtf8('OpenSong'))
self.ImportOpenlp1Item.setText(import_menu.trUtf8('openlp.org 1.0'))
self.ImportOpenlp1Item.setToolTip(
import_menu.trUtf8('Import songs in openlp.org 1.0 format'))
self.ImportOpenlp1Item.setStatusTip(
import_menu.trUtf8('Import songs in openlp.org 1.0 format'))
self.ImportOpenlp2Item.setText(import_menu.trUtf8('OpenLP 2.0'))
self.ImportOpenlp2Item.setToolTip(
import_menu.trUtf8('Import songs in OpenLP 2.0 format'))
self.ImportOpenlp2Item.setStatusTip(
import_menu.trUtf8('Import songs in OpenLP 2.0 format'))
self.ImportSofItem.setText(
import_menu.trUtf8('Songs of Fellowship'))
import_menu.trUtf8('Songs of Fellowship (temp menu item)'))
self.ImportSofItem.setToolTip(
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books'))
self.ImportSofItem.setStatusTip(
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books'))
import_menu.addAction(self.ImportSofItem)
# OpenOffice.org import menu item - will be removed and the
# functionality will be contained within the import wizard
self.ImportOooItem = QtGui.QAction(import_menu)
self.ImportOooItem.setObjectName(u'ImportOooItem')
self.ImportOooItem.setText(
import_menu.trUtf8('Generic Document/Presentation Import'))
import_menu.trUtf8('Generic Document/Presentation Import '
'(temp menu item)'))
self.ImportOooItem.setToolTip(
import_menu.trUtf8('Import songs from Word/Writer/Powerpoint/Impress'))
import_menu.trUtf8('Import songs from '
'Word/Writer/Powerpoint/Impress'))
self.ImportOooItem.setStatusTip(
import_menu.trUtf8('Import songs from Word/Writer/Powerpoint/Impress'))
import_menu.trUtf8('Import songs from '
'Word/Writer/Powerpoint/Impress'))
import_menu.addAction(self.ImportOooItem)
# Signals and slots
QtCore.QObject.connect(self.ImportOpenlp1Item,
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
QtCore.QObject.connect(self.ImportOpenlp2Item,
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick)
QtCore.QObject.connect(self.ImportOpenSongItem,
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
QtCore.QObject.connect(self.SongImportItem,
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
QtCore.QObject.connect(self.ImportSofItem,
QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
QtCore.QObject.connect(self.ImportOooItem,
QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
self.ImportSongMenu.menuAction().setVisible(False)
def add_export_menu_item(self, export_menu):
"""
@ -163,36 +141,12 @@ class SongsPlugin(Plugin):
The actual **Export** menu item, so that your actions can
use it as their parent.
"""
self.ExportSongMenu = QtGui.QMenu(export_menu)
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
self.ExportOpenSongItem = QtGui.QAction(export_menu)
self.ExportOpenSongItem.setObjectName(u'ExportOpenSongItem')
self.ExportOpenlp1Item = QtGui.QAction(export_menu)
self.ExportOpenlp1Item.setObjectName(u'ExportOpenlp1Item')
self.ExportOpenlp2Item = QtGui.QAction(export_menu)
self.ExportOpenlp2Item.setObjectName(u'ExportOpenlp2Item')
# Add to menus
self.ExportSongMenu.addAction(self.ExportOpenlp1Item)
self.ExportSongMenu.addAction(self.ExportOpenlp2Item)
self.ExportSongMenu.addAction(self.ExportOpenSongItem)
export_menu.addAction(self.ExportSongMenu.menuAction())
# Translations...
self.ExportSongMenu.setTitle(export_menu.trUtf8('&Song'))
self.ExportOpenSongItem.setText(export_menu.trUtf8('OpenSong'))
self.ExportOpenlp1Item.setText(export_menu.trUtf8('openlp.org 1.0'))
self.ExportOpenlp2Item.setText(export_menu.trUtf8('OpenLP 2.0'))
# Signals and slots
QtCore.QObject.connect(self.ExportOpenlp1Item,
QtCore.SIGNAL(u'triggered()'), self.onExportOpenlp1ItemClicked)
QtCore.QObject.connect(self.ExportOpenSongItem,
QtCore.SIGNAL(u'triggered()'), self.onExportOpenSongItemClicked)
self.ExportSongMenu.menuAction().setVisible(False)
# No menu items for now.
pass
def onImportOpenlp1ItemClick(self):
self.openlp_import_form.show()
def onImportOpenSongItemClick(self):
self.opensong_import_form.show()
def onSongImportItemClicked(self):
if self.media_item:
self.media_item.onImportClick()
def onImportSofItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames(
@ -200,16 +154,16 @@ class SongsPlugin(Plugin):
u'', u'Songs of Fellowship file (*.rtf *.RTF)')
try:
for filename in filenames:
sofimport = SofImport(self.songmanager)
sofimport = SofImport(self.manager)
sofimport.import_sof(unicode(filename))
except:
log.exception('Could not import SoF file')
QtGui.QMessageBox.critical(None,
self.ImportSongMenu.trUtf8('Import Error'),
self.ImportSongMenu.trUtf8('Error importing Songs of '
+ 'Fellowship file.\nOpenOffice.org must be installed'
+ ' and you must be using an unedited copy of the RTF'
+ ' included with the Songs of Fellowship Music Editions'),
'Fellowship file.\nOpenOffice.org must be installed'
' and you must be using an unedited copy of the RTF'
' included with the Songs of Fellowship Music Editions'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
Receiver.send_message(u'songs_load_list')
@ -218,22 +172,17 @@ class SongsPlugin(Plugin):
filenames = QtGui.QFileDialog.getOpenFileNames(
None, self.trUtf8('Open documents or presentations'),
u'', u'All Files(*.*)')
oooimport = OooImport(self.songmanager)
oooimport = OooImport(self.manager)
oooimport.import_docs(filenames)
Receiver.send_message(u'songs_load_list')
def onExportOpenlp1ItemClicked(self):
self.openlp_export_form.show()
def onExportOpenSongItemClicked(self):
self.opensong_export_form.show()
def about(self):
about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows '
'Songs to be managed and displayed.<br>')
about_text = self.trUtf8('<strong>Song Plugin</strong><br />'
'This plugin allows songs to be managed and displayed.')
return about_text
def can_delete_theme(self, theme):
if len(self.songmanager.get_songs_for_theme(theme)) == 0:
if len(self.manager.get_songs_for_theme(theme)) == 0:
return True
return False

View File

@ -24,12 +24,13 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SongUsageDeleteDialog(object):
def setupUi(self, AuditDeleteDialog):
AuditDeleteDialog.setObjectName(u'AuditDeleteDialog')
AuditDeleteDialog.resize(291, 243)
self.layoutWidget = QtGui.QWidget(AuditDeleteDialog)
def setupUi(self, SongUsageDeleteDialog):
SongUsageDeleteDialog.setObjectName(u'SongUsageDeleteDialog')
SongUsageDeleteDialog.resize(291, 243)
self.layoutWidget = QtGui.QWidget(SongUsageDeleteDialog)
self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 247, 181))
self.layoutWidget.setObjectName(u'layoutWidget')
self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
@ -41,20 +42,20 @@ class Ui_SongUsageDeleteDialog(object):
QtGui.QCalendarWidget.NoVerticalHeader)
self.DeleteCalendar.setObjectName(u'DeleteCalendar')
self.verticalLayout.addWidget(self.DeleteCalendar)
self.buttonBox = QtGui.QDialogButtonBox(AuditDeleteDialog)
self.buttonBox = QtGui.QDialogButtonBox(SongUsageDeleteDialog)
self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25))
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.retranslateUi(AuditDeleteDialog)
self.retranslateUi(SongUsageDeleteDialog)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'accepted()'),
AuditDeleteDialog.accept)
SongUsageDeleteDialog.accept)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'rejected()'),
AuditDeleteDialog.close)
QtCore.QMetaObject.connectSlotsByName(AuditDeleteDialog)
SongUsageDeleteDialog.close)
QtCore.QMetaObject.connectSlotsByName(SongUsageDeleteDialog)
def retranslateUi(self, AuditDeleteDialog):
AuditDeleteDialog.setWindowTitle(self.trUtf8('Song Usage Delete'))
def retranslateUi(self, SongUsageDeleteDialog):
SongUsageDeleteDialog.setWindowTitle(translate('AuditDeleteDialog', 'Song Usage Delete'))

View File

@ -24,14 +24,15 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SongUsageDetailDialog(object):
def setupUi(self, AuditDetailDialog):
AuditDetailDialog.setObjectName(u'AuditDetailDialog')
AuditDetailDialog.resize(609, 413)
self.verticalLayout = QtGui.QVBoxLayout(AuditDetailDialog)
def setupUi(self, SongUsageDetailDialog):
SongUsageDetailDialog.setObjectName(u'SongUsageDetailDialog')
SongUsageDetailDialog.resize(609, 413)
self.verticalLayout = QtGui.QVBoxLayout(SongUsageDetailDialog)
self.verticalLayout.setObjectName(u'verticalLayout')
self.DateRangeGroupBox = QtGui.QGroupBox(AuditDetailDialog)
self.DateRangeGroupBox = QtGui.QGroupBox(SongUsageDetailDialog)
self.DateRangeGroupBox.setObjectName(u'DateRangeGroupBox')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.DateRangeGroupBox)
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
@ -68,25 +69,25 @@ class Ui_SongUsageDetailDialog(object):
self.verticalLayout_4.addLayout(self.horizontalLayout)
self.verticalLayout_2.addWidget(self.FileGroupBox)
self.verticalLayout.addWidget(self.DateRangeGroupBox)
self.buttonBox = QtGui.QDialogButtonBox(AuditDetailDialog)
self.buttonBox = QtGui.QDialogButtonBox(SongUsageDetailDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(AuditDetailDialog)
self.retranslateUi(SongUsageDetailDialog)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'),
AuditDetailDialog.accept)
SongUsageDetailDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'),
AuditDetailDialog.close)
SongUsageDetailDialog.close)
QtCore.QObject.connect(self.SaveFilePushButton,
QtCore.SIGNAL(u'pressed()'),
AuditDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(AuditDetailDialog)
SongUsageDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(SongUsageDetailDialog)
def retranslateUi(self, AuditDetailDialog):
AuditDetailDialog.setWindowTitle(self.trUtf8('Song Usage Extraction'))
self.DateRangeGroupBox.setTitle(self.trUtf8('Select Date Range'))
self.ToLabel.setText(self.trUtf8('to'))
self.FileGroupBox.setTitle(self.trUtf8('Report Location'))
def retranslateUi(self, SongUsageDetailDialog):
SongUsageDetailDialog.setWindowTitle(translate('AuditDetailDialog', 'Song Usage Extraction'))
self.DateRangeGroupBox.setTitle(translate('AuditDetailDialog', 'Select Date Range'))
self.ToLabel.setText(translate('AuditDetailDialog', 'to'))
self.FileGroupBox.setTitle(translate('AuditDetailDialog', 'Report Location'))

View File

@ -35,10 +35,11 @@ from songusagedetaildialog import Ui_SongUsageDetailDialog
log = logging.getLogger(__name__)
class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
log.info(u'SongUsage Detail Form loaded')
"""
Class documentation goes here.
"""
log.info(u'SongUsage Detail Form Loaded')
def __init__(self, parent=None):
"""
Constructor

View File

@ -33,7 +33,7 @@ from openlp.plugins.songusage.lib.models import init_models, metadata, \
log = logging.getLogger(__name__)
class SongUsageManager():
class SongUsageManager(object):
"""
The Song Manager provides a central location for all database code. This
class takes care of connecting to the database and running all the queries.

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>521</height>
<width>474</width>
<height>442</height>
</rect>
</property>
<property name="windowTitle">
@ -16,93 +16,13 @@
<property name="modal">
<bool>true</bool>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>11</x>
<y>1</y>
<width>471</width>
<height>491</height>
</rect>
<layout class="QVBoxLayout" name="EditVerseLayout">
<property name="spacing">
<number>8</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="VerseTypeLabel">
<property name="text">
<string>Verse Type</string>
<property name="margin">
<number>8</number>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="VerseListComboBox">
<item>
<property name="text">
<string>Intro</string>
</property>
</item>
<item>
<property name="text">
<string>Verse</string>
</property>
</item>
<item>
<property name="text">
<string>Pre-Chorus</string>
</property>
</item>
<item>
<property name="text">
<string>Chorus</string>
</property>
</item>
<item>
<property name="text">
<string>Bridge</string>
</property>
</item>
<item>
<property name="text">
<string>Ending</string>
</property>
</item>
<item>
<property name="text">
<string>Other</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="VerseNumberLabel">
<property name="text">
<string>Number</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="SubVerseListComboBox"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="VerseTextEdit">
<property name="acceptRichText">
@ -111,64 +31,87 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="VerseTypeLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="addBridge">
<widget class="QLabel" name="VerseTypeLabel">
<property name="text">
<string>Bridge</string>
<string>Verse Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addVerse">
<widget class="QComboBox" name="VerseTypeComboBox">
<item>
<property name="text">
<string>Verse</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addChorus">
<property name="text">
<string>Chorus</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="text">
<string>Bridge</string>
</property>
</item>
<item>
<widget class="QPushButton" name="addPreChorus">
<property name="text">
<string>Pre-Chorus</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addIntro">
<property name="text">
<string>Intro</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addOther">
<property name="text">
<string>Other</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addEnding">
<property name="text">
<string>Ending</string>
</property>
</item>
<item>
<property name="text">
<string>Other</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QSpinBox" name="VerseNumberBox"/>
</item>
<item>
<widget class="QPushButton" name="InsertButton">
<property name="text">
<string>Insert</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_add.png</normaloff>:/general/general_add.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="VerseTypeSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox">
<widget class="QDialogButtonBox" name="EditButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -179,11 +122,12 @@
</item>
</layout>
</widget>
</widget>
<resources/>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<connections>
<connection>
<sender>ButtonBox</sender>
<sender>EditButtonBox</sender>
<signal>accepted()</signal>
<receiver>EditVerseDialog</receiver>
<slot>accept()</slot>
@ -199,7 +143,7 @@
</hints>
</connection>
<connection>
<sender>ButtonBox</sender>
<sender>EditButtonBox</sender>
<signal>rejected()</signal>
<receiver>EditVerseDialog</receiver>
<slot>reject()</slot>

View File

@ -0,0 +1,467 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SongImportWizard</class>
<widget class="QWizard" name="SongImportWizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>386</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>166</width>
<height>386</height>
</size>
</property>
<property name="windowTitle">
<string>Song Import Wizard</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<property name="wizardStyle">
<enum>QWizard::ModernStyle</enum>
</property>
<property name="options">
<set>QWizard::NoBackButtonOnLastPage|QWizard::NoBackButtonOnStartPage</set>
</property>
<widget class="QWizardPage" name="WelcomePage">
<layout class="QHBoxLayout" name="WelcomeLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="ImportSongImage">
<property name="minimumSize">
<size>
<width>163</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>163</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images/openlp-2.qrc">:/wizards/wizard_importsong.bmp</pixmap>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="WelcomeTextLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="TitleLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Welcome to the Song Import Wizard&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="WelcomeTopSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="InformationLabel">
<property name="text">
<string>This wizard will help you to import songs from a variety of formats. Click the next button below to start the process by selecting a format to import from.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="WelcomeBottomSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="SourcePage">
<property name="title">
<string>Select Import Source</string>
</property>
<property name="subTitle">
<string>Select the import format, and where to import from.</string>
</property>
<layout class="QVBoxLayout" name="SourceLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>20</number>
</property>
<item>
<layout class="QHBoxLayout" name="FormatLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="FormatLabel">
<property name="text">
<string>Format:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="FormatComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>OpenLyrics</string>
</property>
</item>
<item>
<property name="text">
<string>OpenSong</string>
</property>
</item>
<item>
<property name="text">
<string>CCLI</string>
</property>
</item>
<item>
<property name="text">
<string>CSV</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="FormatSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="FormatStackedWidget">
<property name="currentIndex">
<number>3</number>
</property>
<widget class="QWidget" name="OpenLyricsPage">
<layout class="QVBoxLayout" name="OpenLyricsLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="OpenLyricsFileListWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="OpenLyricsButtonLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="OpenLyricsAddButton">
<property name="text">
<string>Add Files...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="OpenLyricsButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OpenLyricsRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="OpenSongPage">
<layout class="QVBoxLayout" name="OpenSongLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="OpenSongFileListWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="OpenSongButtonLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="OpenSongAddButton">
<property name="text">
<string>Add Files...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="OpenSongButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="OpenSongRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="CCLIPage">
<layout class="QVBoxLayout" name="CCLILayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="CCLIFileListWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="CCLIButtonLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="CCLIAddButton">
<property name="text">
<string>Add Files...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="CCLIButtonSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="CCLIRemoveButton">
<property name="text">
<string>Remove File(s)</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_delete.png</normaloff>:/general/general_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="CSVPage">
<layout class="QFormLayout" name="CSVLayout">
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="CSVFilenameLabel">
<property name="text">
<string>Filename:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="CSVFileLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QLineEdit" name="CSVFilenameEdit"/>
</item>
<item>
<widget class="QToolButton" name="CSVBrowseButton">
<property name="text">
<string>Browse...</string>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/general/general_open.png</normaloff>:/general/general_open.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="ImportPage">
<property name="title">
<string>Importing</string>
</property>
<property name="subTitle">
<string>Please wait while your songs are imported.</string>
</property>
<layout class="QVBoxLayout" name="ImportLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>50</number>
</property>
<item>
<widget class="QLabel" name="ImportProgressLabel">
<property name="text">
<string>Ready.</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="ImportProgressBar">
<property name="value">
<number>0</number>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="format">
<string>%p</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<connections>
<connection>
<sender>FormatComboBox</sender>
<signal>currentIndexChanged(int)</signal>
<receiver>FormatStackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>122</x>
<y>92</y>
</hint>
<hint type="destinationlabel">
<x>274</x>
<y>222</y>
</hint>
</hints>
</connection>
</connections>
</ui>

BIN
resources/i18n/openlp_af.qm Normal file

Binary file not shown.

BIN
resources/i18n/openlp_de.qm Normal file

Binary file not shown.

BIN
resources/i18n/openlp_en.qm Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

BIN
resources/i18n/openlp_es.qm Normal file

Binary file not shown.

BIN
resources/i18n/openlp_hu.qm Normal file

Binary file not shown.

BIN
resources/i18n/openlp_ko.qm Normal file

Binary file not shown.

BIN
resources/i18n/openlp_nb.qm Normal file

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More