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 build
resources/innosetup/Output resources/innosetup/Output
_eric4project _eric4project
.pylint.d

View File

@ -1,6 +1,6 @@
# -*- mode: python -*- # -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'openlp.pyw'], 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) pyz = PYZ(a.pure)
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,

View File

@ -18,12 +18,6 @@
.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver .. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
:members: :members:
:mod:`ListWithPreviews`
-----------------------
.. autoclass:: openlp.core.lib.listwithpreviews.ListWithPreviews
:members:
:mod:`MediaManagerItem` :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 :maxdepth: 2
songs songs
bibles
:mod:`bibles` Plugin
--------------------
.. automodule:: openlp.plugins.bibles
:members:
:mod:`presentations` Plugin :mod:`presentations` Plugin
--------------------------- ---------------------------
@ -41,3 +36,8 @@
.. automodule:: openlp.plugins.custom .. automodule:: openlp.plugins.custom
:members: :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.lib import Receiver
from openlp.core.resources import qInitResources from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation, LanguageManager
application_stylesheet = u""" application_stylesheet = u"""
QMainWindow::separator QMainWindow::separator
@ -169,7 +169,7 @@ def main():
filename = os.path.join(log_path, u'openlp.log') filename = os.path.join(log_path, u'openlp.log')
logfile = FileHandler(filename, u'w') logfile = FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter( 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) log.addHandler(logfile)
logging.addLevelName(15, u'Timer') logging.addLevelName(15, u'Timer')
# Parse command line options and deal with them. # Parse command line options and deal with them.
@ -190,6 +190,11 @@ def main():
qInitResources() qInitResources()
# Now create and actually run the application. # Now create and actually run the application.
app = OpenLP(qt_args) app = OpenLP(qt_args)
#i18n Set Language
language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language)
app.installTranslator(appTranslator)
sys.exit(app.run()) sys.exit(app.run())
if __name__ == u'__main__': 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__) 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. 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 This abstracts the translation procedure so that we can change it if at a
@ -48,8 +48,7 @@ def translate(context, text):
``text`` ``text``
The text to put into the translation tables for translation. The text to put into the translation tables for translation.
""" """
return QtGui.QApplication.translate( return QtCore.QCoreApplication.translate(context, text, comment)
context, text, None, QtGui.QApplication.UnicodeUTF8)
def get_text_file_string(text_file): 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') file_handle = open(text_file, u'r')
content_string = file_handle.read() content_string = file_handle.read()
except IOError: 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: finally:
if file_handle: if file_handle:
file_handle.close() file_handle.close()
@ -132,6 +131,9 @@ def contextMenu(base, icon, text):
return action return action
def contextMenuSeparator(base): def contextMenuSeparator(base):
"""
Add a separator to a context menu
"""
action = QtGui.QAction(u'', base) action = QtGui.QAction(u'', base)
action.setSeparator(True) action.setSeparator(True)
return action return action
@ -150,7 +152,8 @@ def resize_image(image, width, height):
realw = preview.width() realw = preview.width()
realh = preview.height() realh = preview.height()
# and move it to the centre of the preview space # 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) newImage.fill(QtCore.Qt.black)
painter = QtGui.QPainter(newImage) painter = QtGui.QPainter(newImage)
painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) painter.drawImage((width - realw) / 2, (height - realh) / 2, preview)
@ -158,6 +161,9 @@ def resize_image(image, width, height):
class ThemeLevel(object): class ThemeLevel(object):
"""
Provides an enumeration for the level a theme applies to
"""
Global = 1 Global = 1
Service = 2 Service = 2
Song = 3 Song = 3
@ -178,5 +184,4 @@ from songxmlhandler import SongXMLBuilder, SongXMLParser
from themexmlhandler import ThemeXML from themexmlhandler import ThemeXML
from renderer import Renderer from renderer import Renderer
from rendermanager import RenderManager from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem
from baselistwithdnd import BaseListWithDnD from baselistwithdnd import BaseListWithDnD

View File

@ -230,7 +230,7 @@ class EventReceiver(QtCore.QObject):
self.emit(QtCore.SIGNAL(event), msg) 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 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 is a static wrapper around the ``EventReceiver`` class. As there is only

View File

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

View File

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

View File

@ -53,7 +53,7 @@ class SettingsManager(object):
self.slidecontroller_image = self.slidecontroller - 50 self.slidecontroller_image = self.slidecontroller - 50
self.showPreviewPanel = QtCore.QSettings().value( 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): def togglePreviewPanel(self, isVisible):
QtCore.QSettings().setValue(u'user interface/preview panel', QtCore.QSettings().setValue(u'user interface/preview panel',

View File

@ -230,7 +230,8 @@ class ThemeXML(object):
#Create indentation name element #Create indentation name element
self.child_element(background, u'indentation', unicode(indentation)) self.child_element(background, u'indentation', unicode(indentation))
#Create indentation name element #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 #Create Location element
element = self.theme_xml.createElement(u'location') 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. The title of the icon to search for.
""" """
title = QtCore.QString(title) title = QtCore.QString(title)
try:
if self.icons[title]: if self.icons[title]:
return self.icons[title] return self.icons[title]
else: except:
log.error(u'getIconFromTitle - no icon for %s' % title) log.exception(u'getIconFromTitle - no icon for %s' % title)
return QtGui.QIcon() return QtGui.QIcon()
def makeWidgetsInvisible(self, widgets): def makeWidgetsInvisible(self, widgets):

View File

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

View File

@ -23,4 +23,4 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # 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: except ValueError:
val = t val = t
if (element.tag.find(u'Color') > 0 or 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 # convert to a wx.Colour
if not delphiColorChange: 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: 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) setattr(self, element.tag, val)
def __str__(self): def __str__(self):

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class GeneralTab(SettingsTab):
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
self.MonitorNumber = settings.value(u'monitor', 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.set_current_display(self.MonitorNumber)
self.screens.monitor_number = self.MonitorNumber self.screens.monitor_number = self.MonitorNumber
self.DisplayOnMonitor = settings.value( self.DisplayOnMonitor = settings.value(

View File

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

View File

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

View File

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

View File

@ -61,9 +61,10 @@ class ScreenList(object):
""" """
Set up the current screen dimensions 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: if number + 1 > self.display_count:
self.current = self.screen_list[0] self.current = self.screen_list[0]
self.override = copy.deepcopy(self.current)
self.current_display = 0 self.current_display = 0
else: else:
self.current = self.screen_list[number] self.current = self.screen_list[number]

View File

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

View File

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

View File

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

View File

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

View File

@ -184,4 +184,7 @@ def add_actions(target, actions):
else: else:
target.addAction(action) 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__) log = logging.getLogger(__name__)
class Display(): class Display(object):
log.info(u'Display Class loaded') log.info(u'Display Class loaded')
@staticmethod @staticmethod

View File

@ -27,7 +27,6 @@ import os
import sys import sys
import sqlite3 import sqlite3
from sqlalchemy import *
from sqlalchemy import create_engine from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker, mapper 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.core.utils import AppLocation
from openlp.plugins.bibles.lib.models import * 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): class TBibleMeta(BaseModel):
""" """
Bible Meta Data Bible Meta Data
@ -109,7 +92,7 @@ def init_models(url):
autocommit=False, bind=engine)) autocommit=False, bind=engine))
return session return session
class MigrateBibles(): class MigrateBibles(object):
def __init__(self, display): def __init__(self, display):
self.display = display self.display = display
self.data_path = AppLocation.get_section_data_path(u'bibles') self.data_path = AppLocation.get_section_data_path(u'bibles')

View File

@ -25,7 +25,7 @@
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
class MigrateFiles(): class MigrateFiles(object):
def __init__(self, display): def __init__(self, display):
self.display = 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'authorid', types.Integer, primary_key=True),
Column(u'songid', types.Integer) 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): class TAuthor(BaseModel):
""" """
@ -109,7 +94,7 @@ class TSongAuthor(BaseModel):
""" """
pass pass
class MigrateSongs(): class MigrateSongs(object):
def __init__(self, display): def __init__(self, display):
self.display = display self.display = display
self.data_path = AppLocation.get_section_data_path(u'songs') self.data_path = AppLocation.get_section_data_path(u'songs')

View File

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

View File

@ -67,7 +67,7 @@ class AlertsManager(QtCore.QObject):
- self.alertHeight - self.alertHeight
self.alertHeight = self.screen[u'size'].height() \ self.alertHeight = self.screen[u'size'].height() \
- self.alertScreenPosition - self.alertScreenPosition
self.parent.maindisplay.setAlertSize(self.alertScreenPosition,\ self.parent.maindisplay.setAlertSize(self.alertScreenPosition,
self.alertHeight) self.alertHeight)
def onAlertText(self, message): 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__) log = logging.getLogger(__name__)
class DBManager(): class DBManager(object):
""" """
The Song Manager provides a central location for all database code. This 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. 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() 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 Saves a Alert show to the database
""" """
log.debug(u'Alert added') log.debug(u'Alert added')
try: try:
self.session.add(AlertItem) self.session.add(alert_item)
self.session.commit() self.session.commit()
log.debug(u'Alert saved') log.debug(u'Alert saved')
return True return True
@ -99,9 +99,9 @@ class DBManager():
Delete a Alert show Delete a Alert show
""" """
if id != 0: if id != 0:
AlertItem = self.get_alert(id) alert_item = self.get_alert(id)
try: try:
self.session.delete(AlertItem) self.session.delete(alert_item)
self.session.commit() self.session.commit()
return True return True
except: except:
@ -110,3 +110,4 @@ class DBManager():
return False return False
else: else:
return True return True

View File

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

View File

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

View File

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

View File

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

View File

@ -418,12 +418,13 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'bibles_nobook') Receiver.send_message(u'bibles_nobook')
return [] return []
db_book = self.create_book(book_details[u'name'], 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 book = db_book.name
if BibleDB.get_verse_count(self, book, reference[1]) == 0: if BibleDB.get_verse_count(self, book, reference[1]) == 0:
Receiver.send_message(u'bibles_showprogress') Receiver.send_message(u'bibles_showprogress')
Receiver.send_message(u'openlp_process_events') 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(): if search_results and search_results.has_verselist():
## We have found a book of the bible lets check to see ## We have found a book of the bible lets check to see
## if it was there. By reusing the returned book name ## if it was there. By reusing the returned book name
@ -433,18 +434,19 @@ class HTTPBible(BibleDB):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# check to see if book/chapter exists # check to see if book/chapter exists
db_book = self.get_book(bookname) 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()) search_results.get_verselist())
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'bibles_hideprogress') Receiver.send_message(u'bibles_hideprogress')
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
return BibleDB.get_verses(self, reference_list) 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 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) log.debug(u'source = %s', self.download_source)
try: try:
if self.download_source.lower() == u'crosswalk': if self.download_source.lower() == u'crosswalk':

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_customEditDialog(object): class Ui_customEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):
@ -152,23 +153,23 @@ class Ui_customEditDialog(object):
customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox) customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox)
def retranslateUi(self, customEditDialog): def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle(self.trUtf8('Edit Custom Slides')) customEditDialog.setWindowTitle(translate('EditCustomForm', 'Edit Custom Slides'))
self.UpButton.setToolTip(self.trUtf8('Move slide Up 1')) self.UpButton.setToolTip(translate('EditCustomForm', 'Move slide Up 1'))
self.DownButton.setToolTip(self.trUtf8('Move slide down 1')) self.DownButton.setToolTip(translate('EditCustomForm', 'Move slide down 1'))
self.TitleLabel.setText(self.trUtf8('Title:')) self.TitleLabel.setText(translate('EditCustomForm', 'Title:'))
self.AddButton.setText(self.trUtf8('Add New')) self.AddButton.setText(translate('EditCustomForm', 'Add New'))
self.AddButton.setToolTip(self.trUtf8('Add new slide at bottom')) self.AddButton.setToolTip(translate('EditCustomForm', 'Add new slide at bottom'))
self.EditButton.setText(self.trUtf8('Edit')) self.EditButton.setText(translate('EditCustomForm', 'Edit'))
self.EditButton.setToolTip(self.trUtf8('Edit selected slide')) self.EditButton.setToolTip(translate('EditCustomForm', 'Edit selected slide'))
self.EditAllButton.setText(self.trUtf8('Edit All')) self.EditAllButton.setText(translate('EditCustomForm', 'Edit All'))
self.EditAllButton.setToolTip(self.trUtf8('Edit all slides')) self.EditAllButton.setToolTip(translate('EditCustomForm', 'Edit all slides'))
self.SaveButton.setText(self.trUtf8('Save')) self.SaveButton.setText(translate('EditCustomForm', 'Save'))
self.SaveButton.setToolTip(self.trUtf8('Replace edited slide')) self.SaveButton.setToolTip(translate('EditCustomForm', 'Replace edited slide'))
self.DeleteButton.setText(self.trUtf8('Delete')) self.DeleteButton.setText(translate('EditCustomForm', 'Delete'))
self.DeleteButton.setToolTip(self.trUtf8('Delete selected slide')) self.DeleteButton.setToolTip(translate('EditCustomForm', 'Delete selected slide'))
self.ClearButton.setText(self.trUtf8('Clear')) self.ClearButton.setText(translate('EditCustomForm', 'Clear'))
self.ClearButton.setToolTip(self.trUtf8('Clear edit area')) self.ClearButton.setToolTip(translate('EditCustomForm', 'Clear edit area'))
self.SplitButton.setText(self.trUtf8('Split Slide')) self.SplitButton.setText(translate('EditCustomForm', 'Split Slide'))
self.SplitButton.setToolTip(self.trUtf8('Add slide split')) self.SplitButton.setToolTip(translate('EditCustomForm', 'Add slide split'))
self.ThemeLabel.setText(self.trUtf8('Theme:')) self.ThemeLabel.setText(translate('EditCustomForm', 'Theme:'))
self.CreditLabel.setText(self.trUtf8('Credits:')) 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__) log = logging.getLogger(__name__)
class CustomManager(): class CustomManager(object):
""" """
The Song Manager provides a central location for all database code. This 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. 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): def generateSlideData(self, service_item, item=None):
items = self.ListView.selectedIndexes() items = self.ListView.selectedIndexes()
if items: 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.AllowsMaintain)
service_item.add_capability(ItemCapabilities.AllowsPreview) service_item.add_capability(ItemCapabilities.AllowsPreview)
service_item.add_capability(ItemCapabilities.AllowsLoop) service_item.add_capability(ItemCapabilities.AllowsLoop)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib import build_icon from openlp.core.lib import build_icon
@ -69,8 +70,12 @@ class Ui_EditSongDialog(object):
QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.LyricsLabel.setObjectName(u'LyricsLabel') self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1) self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
self.VerseListWidget = QtGui.QListWidget(self.LyricsTab) self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
self.VerseListWidget.setSpacing(2) 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.setAlternatingRowColors(True)
self.VerseListWidget.setObjectName(u'VerseListWidget') self.VerseListWidget.setObjectName(u'VerseListWidget')
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1) self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1)
@ -418,36 +423,36 @@ class Ui_EditSongDialog(object):
EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox) EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox)
def retranslateUi(self, EditSongDialog): def retranslateUi(self, EditSongDialog):
EditSongDialog.setWindowTitle(self.trUtf8('Song Editor')) EditSongDialog.setWindowTitle(translate('EditSongForm', 'Song Editor'))
self.TitleLabel.setText(self.trUtf8('Title:')) self.TitleLabel.setText(translate('EditSongForm', 'Title:'))
self.AlternativeTitleLabel.setText(self.trUtf8('Alternative Title:')) self.AlternativeTitleLabel.setText(translate('EditSongForm', 'Alternative Title:'))
self.LyricsLabel.setText(self.trUtf8('Lyrics:')) self.LyricsLabel.setText(translate('EditSongForm', 'Lyrics:'))
self.VerseOrderLabel.setText(self.trUtf8('Verse Order:')) self.VerseOrderLabel.setText(translate('EditSongForm', 'Verse Order:'))
self.VerseAddButton.setText(self.trUtf8('Add')) self.VerseAddButton.setText(translate('EditSongForm', 'Add'))
self.VerseEditButton.setText(self.trUtf8('Edit')) self.VerseEditButton.setText(translate('EditSongForm', 'Edit'))
self.VerseEditAllButton.setText(self.trUtf8('Edit All')) self.VerseEditAllButton.setText(translate('EditSongForm', 'Edit All'))
self.VerseDeleteButton.setText(self.trUtf8('Delete')) self.VerseDeleteButton.setText(translate('EditSongForm', 'Delete'))
self.SongTabWidget.setTabText( self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.LyricsTab), self.SongTabWidget.indexOf(self.LyricsTab),
self.trUtf8('Title && Lyrics')) translate('EditSongForm', 'Title && Lyrics'))
self.AuthorsGroupBox.setTitle(self.trUtf8('Authors')) self.AuthorsGroupBox.setTitle(translate('EditSongForm', 'Authors'))
self.AuthorAddButton.setText(self.trUtf8('&Add to Song')) self.AuthorAddButton.setText(translate('EditSongForm', '&Add to Song'))
self.AuthorRemoveButton.setText(self.trUtf8('&Remove')) self.AuthorRemoveButton.setText(translate('EditSongForm', '&Remove'))
self.MaintenanceButton.setText( self.MaintenanceButton.setText(
self.trUtf8('&Manage Authors, Topics, Books')) translate('EditSongForm', '&Manage Authors, Topics, Books'))
self.TopicGroupBox.setTitle(self.trUtf8('Topic')) self.TopicGroupBox.setTitle(translate('EditSongForm', 'Topic'))
self.TopicAddButton.setText(self.trUtf8('A&dd to Song')) self.TopicAddButton.setText(translate('EditSongForm', 'A&dd to Song'))
self.TopicRemoveButton.setText(self.trUtf8('R&emove')) self.TopicRemoveButton.setText(translate('EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle(self.trUtf8('Song Book')) self.SongBookGroup.setTitle(translate('EditSongForm', 'Song Book'))
self.SongTabWidget.setTabText( self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab), self.SongTabWidget.indexOf(self.AuthorsTab),
self.trUtf8('Authors, Topics && Book')) translate('EditSongForm', 'Authors, Topics && Book'))
self.ThemeGroupBox.setTitle(self.trUtf8('Theme')) self.ThemeGroupBox.setTitle(translate('EditSongForm', 'Theme'))
self.ThemeAddButton.setText(self.trUtf8('Add a Theme')) self.ThemeAddButton.setText(translate('EditSongForm', 'Add a Theme'))
self.CopyrightGroupBox.setTitle(self.trUtf8('Copyright Information')) self.CopyrightGroupBox.setTitle(translate('EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText(self.trUtf8(u'\u00a9'.encode('utf8'))) self.CopyrightInsertButton.setText(translate('EditSongForm', u'\xa9'))
self.CCLILabel.setText(self.trUtf8('CCLI Number:')) self.CCLILabel.setText(translate('EditSongForm', 'CCLI Number:'))
self.CommentsGroupBox.setTitle(self.trUtf8('Comments')) self.CommentsGroupBox.setTitle(translate('EditSongForm', 'Comments'))
self.SongTabWidget.setTabText( self.SongTabWidget.setTabText(
self.SongTabWidget.indexOf(self.ThemeTab), 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__) log.info(u'%s EditSongForm loaded', __name__)
def __init__(self, songmanager, parent=None): def __init__(self, parent, songmanager):
""" """
Constructor Constructor
""" """
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.parent = parent self.parent = parent
#can this be automated?
self.width = 400
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton, QtCore.QObject.connect(self.AuthorAddButton,
@ -77,7 +79,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.QObject.connect(self.VerseDeleteButton, QtCore.QObject.connect(self.VerseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget, QtCore.QObject.connect(self.VerseListWidget,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed) self.onVerseListViewPressed)
QtCore.QObject.connect(self.SongbookCombo, QtCore.QObject.connect(self.SongbookCombo,
QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged) QtCore.SIGNAL(u'activated(int)'), self.onSongBookComboChanged)
@ -106,7 +108,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview) QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms # Create other objects and forms
self.songmanager = songmanager self.songmanager = songmanager
self.verse_form = EditVerseForm() self.verse_form = EditVerseForm(self)
self.initialise() self.initialise()
self.AuthorsListView.setSortingEnabled(False) self.AuthorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True) self.AuthorsListView.setAlternatingRowColors(True)
@ -125,8 +127,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
authorsCompleter = QtGui.QCompleter( authorsCompleter = QtGui.QCompleter(
[author.display_name for author in authors], [author.display_name for author in authors],
self.AuthorsSelectionComboItem) self.AuthorsSelectionComboItem)
authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); authorsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(authorsCompleter); self.AuthorsSelectionComboItem.setCompleter(authorsCompleter)
self.AuthorsSelectionComboItem.clear() self.AuthorsSelectionComboItem.clear()
for author in authors: for author in authors:
row = self.AuthorsSelectionComboItem.count() row = self.AuthorsSelectionComboItem.count()
@ -137,10 +139,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadTopics(self): def loadTopics(self):
topics = self.songmanager.get_topics() topics = self.songmanager.get_topics()
topicsCompleter = QtGui.QCompleter( topicsCompleter = QtGui.QCompleter(
[topic.name for topic in topics], [topic.name for topic in topics], self.SongTopicCombo)
self.SongTopicCombo) topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
topicsCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); self.SongTopicCombo.setCompleter(topicsCompleter)
self.SongTopicCombo.setCompleter(topicsCompleter);
self.SongTopicCombo.clear() self.SongTopicCombo.clear()
for topic in topics: for topic in topics:
row = self.SongTopicCombo.count() row = self.SongTopicCombo.count()
@ -151,8 +152,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
books = self.songmanager.get_books() books = self.songmanager.get_books()
booksCompleter = QtGui.QCompleter( booksCompleter = QtGui.QCompleter(
[book.name for book in books], self.SongbookCombo) [book.name for book in books], self.SongbookCombo)
booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); booksCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(booksCompleter); self.SongbookCombo.setCompleter(booksCompleter)
self.SongbookCombo.clear() self.SongbookCombo.clear()
self.SongbookCombo.addItem(u' ') self.SongbookCombo.addItem(u' ')
for book in books: for book in books:
@ -164,8 +165,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
themesCompleter = QtGui.QCompleter( themesCompleter = QtGui.QCompleter(
[theme for theme in theme_list], [theme for theme in theme_list],
self.ThemeSelectionComboItem) self.ThemeSelectionComboItem)
themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive); themesCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(themesCompleter); self.ThemeSelectionComboItem.setCompleter(themesCompleter)
self.ThemeSelectionComboItem.clear() self.ThemeSelectionComboItem.clear()
self.ThemeSelectionComboItem.addItem(u' ') self.ThemeSelectionComboItem.addItem(u' ')
for theme in theme_list: for theme in theme_list:
@ -182,6 +183,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.CommentsEdit.setText(u'') self.CommentsEdit.setText(u'')
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.setText(u'')
self.VerseListWidget.clear() self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
self.AuthorsListView.clear() self.AuthorsListView.clear()
self.TopicsListView.clear() self.TopicsListView.clear()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason) self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
@ -223,6 +225,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else: else:
self.CopyrightEditItem.setText(u'') self.CopyrightEditItem.setText(u'')
self.VerseListWidget.clear() self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
if self.song.verse_order: if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order) self.VerseOrderEdit.setText(self.song.verse_order)
else: else:
@ -236,21 +239,30 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else: else:
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.setText(u'')
#lazy xml migration for now #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='): if self.song.lyrics.startswith(u'<?xml version='):
songXML = SongXMLParser(self.song.lyrics) songXML = SongXMLParser(self.song.lyrics)
verseList = songXML.get_verses() 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']) 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)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.addItem(item) self.VerseListWidget.setItem(count, 0, item)
else: else:
verses = self.song.lyrics.split(u'\n\n') verses = self.song.lyrics.split(u'\n\n')
for count, verse in enumerate(verses): 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) variant = u'Verse:%s' % unicode(count + 1)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) 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 # clear the results
self.AuthorsListView.clear() self.AuthorsListView.clear()
for author in self.song.authors: for author in self.song.authors:
@ -270,6 +282,19 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if preview: if preview:
self.previewButton.setVisible(True) 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): def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex()) item = int(self.AuthorsSelectionComboItem.currentIndex())
if item > -1: if item > -1:
@ -336,22 +361,26 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseDeleteButton.setEnabled(True) self.VerseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self): def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'', self.VerseListWidget.count() + 1, True) self.verse_form.setVerse(u'', True)
if self.verse_form.exec_(): if self.verse_form.exec_():
afterText, verse, subVerse = self.verse_form.getVerse() afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' % (verse, subVerse) data = u'%s:%s' % (verse, subVerse)
item = QtGui.QListWidgetItem(afterText) item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText) 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): def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem() item = self.VerseListWidget.currentItem()
if item: if item:
tempText = item.text() tempText = item.text()
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()) verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
self.verse_form.setVerse( self.verse_form.setVerse(tempText, True, verseId)
tempText, self.VerseListWidget.count(), True, verseId)
if self.verse_form.exec_(): if self.verse_form.exec_():
afterText, verse, subVerse = self.verse_form.getVerse() afterText, verse, subVerse = self.verse_form.getVerse()
data = u'%s:%s' % (verse, subVerse) 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')): if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = {} tempList = {}
tempId = {} tempId = {}
for row in range(0, self.VerseListWidget.count()): for row in range(0, self.VerseListWidget.rowCount()):
tempList[row] = self.VerseListWidget.item(row).text() tempList[row] = self.VerseListWidget.item(row, 0).text()
tempId[row] = self.VerseListWidget.item(row).\ tempId[row] = self.VerseListWidget.item(row, 0).\
data(QtCore.Qt.UserRole) data(QtCore.Qt.UserRole)
self.VerseListWidget.clear() self.VerseListWidget.clear()
for row in range (0, len(tempList)): 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]) item.setData(QtCore.Qt.UserRole, tempId[row])
self.VerseListWidget.addItem(item) self.VerseListWidget.setItem(row, 0, item)
self.VerseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint() self.VerseListWidget.repaint()
self.VerseEditButton.setEnabled(False) self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.VerseDeleteButton.setEnabled(False)
self.tagRows()
def onVerseEditAllButtonClicked(self): def onVerseEditAllButtonClicked(self):
verse_list = u'' verse_list = u''
if self.VerseListWidget.count() > 0: if self.VerseListWidget.rowCount() > 0:
for row in range(0, self.VerseListWidget.count()): for row in range(0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(row) item = self.VerseListWidget.item(row, 0)
field = unicode((item.data(QtCore.Qt.UserRole)).toString()) field = unicode((item.data(QtCore.Qt.UserRole)).toString())
verse_list += u'---[%s]---\n' % field verse_list += u'---[%s]---\n' % field
verse_list += item.text() verse_list += item.text()
@ -390,6 +421,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_list = self.verse_form.getVerseAll() verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n')) verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
self.VerseListWidget.clear() self.VerseListWidget.clear()
self.VerseListWidget.setRowCount(0)
for row in self.findVerseSplit.split(verse_list): for row in self.findVerseSplit.split(verse_list):
for match in row.split(u'---['): for match in row.split(u'---['):
for count, parts in enumerate(match.split(u']---\n')): for count, parts in enumerate(match.split(u']---\n')):
@ -401,13 +433,20 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
else: else:
if parts.endswith(u'\n'): if parts.endswith(u'\n'):
parts = parts.rstrip(u'\n') parts = parts.rstrip(u'\n')
item = QtGui.QListWidgetItem(parts) item = QtGui.QTableWidgetItem(parts)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) item.setData(
self.VerseListWidget.addItem(item) 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.VerseListWidget.repaint()
self.tagRows()
def onVerseDeleteButtonClicked(self): def onVerseDeleteButtonClicked(self):
self.VerseListWidget.takeItem(self.VerseListWidget.currentRow()) self.VerseListWidget.removeRow(self.VerseListWidget.currentRow())
self.VerseEditButton.setEnabled(False) self.VerseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.VerseDeleteButton.setEnabled(False)
@ -422,12 +461,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus() self.TitleEditItem.setFocus()
return False, self.trUtf8('You need to enter a song title.') 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.SongTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus() self.VerseListWidget.setFocus()
return False, self.trUtf8('You need to enter some verses.') return False, self.trUtf8('You need to enter some verses.')
if self.AuthorsListView.count() == 0: if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(2) self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus() self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing #split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bitped')) taglist = unicode(self.trUtf8(' bitped'))
@ -480,6 +519,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadTopics() self.loadTopics()
def onPreview(self, button): 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') log.debug(u'onPreview')
if button.text() == unicode(self.trUtf8('Save && Preview')) \ if button.text() == unicode(self.trUtf8('Save && Preview')) \
and self.saveSong(): and self.saveSong():
@ -521,12 +564,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml.new_document() sxml.new_document()
sxml.add_lyrics_to_song() sxml.add_lyrics_to_song()
text = u' ' text = u' '
for i in range (0, self.VerseListWidget.count()): for i in range (0, self.VerseListWidget.rowCount()):
item = self.VerseListWidget.item(i) item = self.VerseListWidget.item(i, 0)
verseId = unicode((item.data(QtCore.Qt.UserRole)).toString()) verseId = unicode((item.data(QtCore.Qt.UserRole)).toString())
bits = verseId.split(u':') bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text())) 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'') 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 = 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) self.song.search_title = unicode(self.song.search_title)

View File

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

View File

@ -23,9 +23,60 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import re
import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from editversedialog import Ui_EditVerseDialog 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): class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
""" """
This is the form that is used to edit the verses of the song. 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) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.addVerse, QtCore.QObject.connect(
QtCore.SIGNAL(u'clicked()'), self.onAddVerse) self.InsertButton,
QtCore.QObject.connect(self.addChorus, QtCore.SIGNAL(u'clicked()'),
QtCore.SIGNAL(u'clicked()'), self.onAddChorus) self.onInsertButtonClicked
QtCore.QObject.connect(self.addBridge, )
QtCore.SIGNAL(u'clicked()'), self.onAddBridge) QtCore.QObject.connect(
QtCore.QObject.connect(self.addIntro, self.VerseTextEdit,
QtCore.SIGNAL(u'clicked()'), self.onAddIntro) QtCore.SIGNAL(u'cursorPositionChanged()'),
QtCore.QObject.connect(self.addOther, self.onCursorPositionChanged
QtCore.SIGNAL(u'clicked()'), self.onAddOther) )
QtCore.QObject.connect(self.addPreChorus, # QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'clicked()'), self.onAddPreChorus) # QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
QtCore.QObject.connect(self.addEnding, self.verse_regex = re.compile(r'---\[([-\w]+):([\d]+)\]---')
QtCore.SIGNAL(u'clicked()'), self.onAddEnding)
QtCore.QObject.connect(self.VerseListComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerseComboChanged)
def startNewLine(self): def insertVerse(self, title, num=1):
if self.VerseTextEdit.textCursor().columnNumber() != 0: if self.VerseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'\n') self.VerseTextEdit.insertPlainText(u'\n')
self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n' % (title, num))
def onAddIntro(self):
self.startNewLine()
self.VerseTextEdit.insertPlainText(u'---[Intro:1]---\n')
self.VerseTextEdit.setFocus() self.VerseTextEdit.setFocus()
def onAddEnding(self): def onInsertButtonClicked(self):
self.startNewLine() if self.VerseTextEdit.textCursor().columnNumber() != 0:
self.VerseTextEdit.insertPlainText(u'---[Ending:1]---\n') self.VerseTextEdit.insertPlainText(u'\n')
self.VerseTextEdit.setFocus() 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): def onCursorPositionChanged(self):
self.startNewLine() position = self.VerseTextEdit.textCursor().position()
self.VerseTextEdit.insertPlainText(u'---[Other:1]---\n') text = unicode(self.VerseTextEdit.toPlainText())
self.VerseTextEdit.setFocus() 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): def setVerse(self, text, single=False, tag=u'Verse:1'):
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')
if single: if single:
id = tag.split(u':') verse_type, verse_number = tag.split(u':')
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly) self.VerseTypeComboBox.setCurrentIndex(VerseType.from_string(verse_type))
posSub = self.SubVerseListComboBox.findText(id[1], QtCore.Qt.MatchExactly) self.VerseNumberBox.setValue(int(verse_number))
if posVerse == -1: self.InsertButton.setVisible(False)
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)
else: else:
self.VerseListComboBox.setEnabled(False) if not text:
self.SubVerseListComboBox.setEnabled(False) text = u'---[Verse:1]---\n'
self.addBridge.setEnabled(True) self.VerseTypeComboBox.setCurrentIndex(0)
self.addChorus.setEnabled(True) self.VerseNumberBox.setValue(1)
self.addVerse.setEnabled(True) self.InsertButton.setVisible(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)
self.VerseTextEdit.setPlainText(text) self.VerseTextEdit.setPlainText(text)
self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason) self.VerseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.onVerseComboChanged(0)
self.VerseTextEdit.moveCursor(QtGui.QTextCursor.Down)
def getVerse(self): def getVerse(self):
return self.VerseTextEdit.toPlainText(), \ return self.VerseTextEdit.toPlainText(), \
unicode(self.VerseListComboBox.currentText()), \ VerseType.to_string(self.VerseTypeComboBox.currentIndex()), \
unicode(self.SubVerseListComboBox.currentText()) unicode(self.VerseNumberBox.value())
def getVerseAll(self): def getVerseAll(self):
text = self.VerseTextEdit.toPlainText() text = self.VerseTextEdit.toPlainText()
@ -151,10 +175,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
text = u'---[Verse:1]---\n%s' % text text = u'---[Verse:1]---\n%s' % text
return 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 PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_OpenLPExportDialog(object): class Ui_OpenLPExportDialog(object):
def setupUi(self, OpenLPExportDialog): def setupUi(self, OpenLPExportDialog):
@ -285,21 +286,21 @@ class Ui_OpenLPExportDialog(object):
QtCore.QMetaObject.connectSlotsByName(OpenLPExportDialog) QtCore.QMetaObject.connectSlotsByName(OpenLPExportDialog)
def retranslateUi(self, OpenLPExportDialog): def retranslateUi(self, OpenLPExportDialog):
OpenLPExportDialog.setWindowTitle(self.trUtf8('openlp.org Song Exporter')) OpenLPExportDialog.setWindowTitle(translate('OpenLPExportForm', 'openlp.org Song Exporter'))
self.ExportFileLabel.setText(self.trUtf8('Select openlp.org export filename:')) self.ExportFileLabel.setText(translate('OpenLPExportForm', 'Select openlp.org export filename:'))
self.ExportListLabel.setText(self.trUtf8('Full Song List')) self.ExportListLabel.setText(translate('OpenLPExportForm', 'Full Song List'))
self.ExportListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title')) self.ExportListTable.horizontalHeaderItem(0).setText(translate('OpenLPExportForm', 'Song Title'))
self.ExportListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author')) self.ExportListTable.horizontalHeaderItem(1).setText(translate('OpenLPExportForm', 'Author'))
self.ExportSelectAllPushButton.setText(self.trUtf8('Select All')) self.ExportSelectAllPushButton.setText(translate('OpenLPExportForm', 'Select All'))
self.ExportFilterComboBox.setItemText(0, self.trUtf8('Lyrics')) self.ExportFilterComboBox.setItemText(0, translate('OpenLPExportForm', 'Lyrics'))
self.ExportFilterComboBox.setItemText(1, self.trUtf8('Title')) self.ExportFilterComboBox.setItemText(1, translate('OpenLPExportForm', 'Title'))
self.ExportFilterComboBox.setItemText(2, self.trUtf8('Author')) self.ExportFilterComboBox.setItemText(2, translate('OpenLPExportForm', 'Author'))
self.SelectedListLabel.setText(self.trUtf8('Song Export List')) self.SelectedListLabel.setText(translate('OpenLPExportForm', 'Song Export List'))
self.SelectedListTable.horizontalHeaderItem(0).setText(self.trUtf8('Song Title')) self.SelectedListTable.horizontalHeaderItem(0).setText(translate('OpenLPExportForm', 'Song Title'))
self.SelectedListTable.horizontalHeaderItem(1).setText(self.trUtf8('Author')) self.SelectedListTable.horizontalHeaderItem(1).setText(translate('OpenLPExportForm', 'Author'))
self.SelectedSelectAllPushButton.setText(self.trUtf8('Select All')) self.SelectedSelectAllPushButton.setText(translate('OpenLPExportForm', 'Select All'))
self.SelectedRemoveSelectedButton.setText(self.trUtf8('Remove Selected')) self.SelectedRemoveSelectedButton.setText(translate('OpenLPExportForm', 'Remove Selected'))
self.ProgressGroupBox.setTitle(self.trUtf8('Progress:')) self.ProgressGroupBox.setTitle(translate('OpenLPExportForm', 'Progress:'))
self.ProgressLabel.setText(self.trUtf8('Ready to export')) self.ProgressLabel.setText(translate('OpenLPExportForm', 'Ready to export'))
self.ExportPushButton.setText(self.trUtf8('Export')) self.ExportPushButton.setText(translate('OpenLPExportForm', 'Export'))
self.ClosePushButton.setText(self.trUtf8('Close')) self.ClosePushButton.setText(translate('OpenLPExportForm', 'Close'))

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@
############################################################################### ###############################################################################
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, SongBookDialog): def setupUi(self, SongBookDialog):
@ -65,6 +66,6 @@ class Ui_SongBookDialog(object):
QtCore.QMetaObject.connectSlotsByName(SongBookDialog) QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
def retranslateUi(self, SongBookDialog): def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(self.trUtf8('Edit Book')) SongBookDialog.setWindowTitle(translate('SongBookForm', 'Edit Book'))
self.NameLabel.setText(self.trUtf8('Name:')) self.NameLabel.setText(translate('SongBookForm', 'Name:'))
self.PublisherLabel.setText(self.trUtf8('Publisher:')) 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 PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon from openlp.core.lib import build_icon, translate
class Ui_SongMaintenanceDialog(object): class Ui_SongMaintenanceDialog(object):
def setupUi(self, SongMaintenanceDialog): def setupUi(self, SongMaintenanceDialog):
@ -208,16 +208,16 @@ class Ui_SongMaintenanceDialog(object):
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog)
def retranslateUi(self, SongMaintenanceDialog): def retranslateUi(self, SongMaintenanceDialog):
SongMaintenanceDialog.setWindowTitle(self.trUtf8('Song Maintenance')) SongMaintenanceDialog.setWindowTitle(translate('SongMaintenanceForm', 'Song Maintenance'))
self.TypeListWidget.item(0).setText(self.trUtf8('Authors')) self.TypeListWidget.item(0).setText(translate('SongMaintenanceForm', 'Authors'))
self.TypeListWidget.item(1).setText(self.trUtf8('Topics')) self.TypeListWidget.item(1).setText(translate('SongMaintenanceForm', 'Topics'))
self.TypeListWidget.item(2).setText(self.trUtf8('Books/Hymnals')) self.TypeListWidget.item(2).setText(translate('SongMaintenanceForm', 'Books/Hymnals'))
self.AuthorAddButton.setText(self.trUtf8('Add')) self.AuthorAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.AuthorEditButton.setText(self.trUtf8('Edit')) self.AuthorEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.AuthorDeleteButton.setText(self.trUtf8('Delete')) self.AuthorDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))
self.TopicAddButton.setText(self.trUtf8('Add')) self.TopicAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.TopicEditButton.setText(self.trUtf8('Edit')) self.TopicEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.TopicDeleteButton.setText(self.trUtf8('Delete')) self.TopicDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))
self.BookAddButton.setText(self.trUtf8('Add')) self.BookAddButton.setText(translate('SongMaintenanceForm', 'Add'))
self.BookEditButton.setText(self.trUtf8('Edit')) self.BookEditButton.setText(translate('SongMaintenanceForm', 'Edit'))
self.BookDeleteButton.setText(self.trUtf8('Delete')) self.BookDeleteButton.setText(translate('SongMaintenanceForm', 'Delete'))

View File

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

View File

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

View File

@ -50,7 +50,8 @@ class Book(BaseModel):
Book model Book model
""" """
def __repr__(self): 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): class Song(BaseModel):
""" """

View File

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

View File

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

View File

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

View File

@ -23,6 +23,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging
import sys import sys
import os import os
@ -32,6 +33,9 @@ sys.path.append(os.path.abspath(u'./../../../..'))
from openlp.core.lib import XmlRootClass from openlp.core.lib import XmlRootClass
log = logging.getLogger(__name__)
class SongException(Exception): class SongException(Exception):
pass pass
@ -71,7 +75,7 @@ _blankOpenSongXml = \
''' '''
class _OpenSong(XmlRootClass): class _OpenSong(XmlRootClass):
"""Class for import of OpenSogn""" """Class for import of OpenSong"""
def __init__(self, xmlContent = None): def __init__(self, xmlContent = None):
"""Initialize from given xml content""" """Initialize from given xml content"""
@ -80,7 +84,6 @@ class _OpenSong(XmlRootClass):
def _reset(self): def _reset(self):
"""Reset all song attributes""" """Reset all song attributes"""
global _blankOpenSongXml
self._setFromXml(_blankOpenSongXml, 'song') self._setFromXml(_blankOpenSongXml, 'song')
def from_buffer(self, xmlContent): def from_buffer(self, xmlContent):
@ -110,8 +113,7 @@ class _OpenSong(XmlRootClass):
res.append(self.theme) res.append(self.theme)
if self.alttheme: if self.alttheme:
res.append(self.alttheme) res.append(self.alttheme)
s = u', u'.join(res) return u', u'.join(res)
return s
def _reorder_verse(self, tag, tmpVerse): def _reorder_verse(self, tag, tmpVerse):
""" """
@ -120,28 +122,28 @@ class _OpenSong(XmlRootClass):
tmpVerse -- list of strings tmpVerse -- list of strings
""" """
res = [] res = []
for c in '1234567890 ': for digit in '1234567890 ':
tagPending = True tagPending = True
for l in tmpVerse: for line in tmpVerse:
if l.startswith(c): if line.startswith(digit):
if tagPending: if tagPending:
tagPending = False tagPending = False
t = tag.strip(u'[]').lower() tagChar = tag.strip(u'[]').lower()
if 'v' == t: if 'v' == tagChar:
newtag = "Verse" newtag = "Verse"
elif 'c' == t: elif 'c' == tagChar:
newtag = "Chorus" newtag = "Chorus"
elif 'b' == t: elif 'b' == tagChar:
newtag = "Bridge" newtag = "Bridge"
elif 'p' == t: elif 'p' == tagChar:
newtag = "Pre-chorus" newtag = "Pre-chorus"
else: else:
newtag = t newtag = tagChar
s = (u'# %s %s' % (newtag, c)).rstrip() tagString = (u'# %s %s' % (newtag, digit)).rstrip()
res.append(s) res.append(tagString)
res.append(l[1:]) res.append(line[1:])
if (len(l) == 0) and (not tagPending): if (len(line) == 0) and (not tagPending):
res.append(l) res.append(line)
return res return res
def get_lyrics(self): def get_lyrics(self):
@ -162,13 +164,13 @@ class _OpenSong(XmlRootClass):
if line.startswith(u'['): if line.startswith(u'['):
tag = line tag = line
else: else:
r = self._reorder_verse(tag, tmpVerse) reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r) finalLyrics.extend(reorderedVerse)
tag = "" tag = ""
tmpVerse = [] tmpVerse = []
# catch up final verse # catch up final verse
r = self._reorder_verse(tag, tmpVerse) reorderedVerse = self._reorder_verse(tag, tmpVerse)
finalLyrics.extend(r) finalLyrics.extend(reorderedVerse)
return finalLyrics return finalLyrics
@ -301,7 +303,7 @@ class Song(object):
string = title string = title
for char in punctuation: for char in punctuation:
string = string.replace(char, '') string = string.replace(char, '')
return s return string
def set_title(self, title): def set_title(self, title):
"""Set the song title """Set the song title
@ -341,36 +343,36 @@ class Song(object):
sCopyright = "" sCopyright = ""
sCcli = "" sCcli = ""
lastpart = 0 lastpart = 0
n = 0 lineCount = 0
metMisc = False metMisc = False
lyrics = [] lyrics = []
for l in textList: for line in textList:
n += 1 lineCount += 1
if lastpart > 0: if lastpart > 0:
lastpart += 1 lastpart += 1
if lastpart == 2: if lastpart == 2:
sCopyright = l[1:].strip() sCopyright = line[1:].strip()
if lastpart == 3: if lastpart == 3:
sAuthor = l sAuthor = line
elif l.startswith(u'CCLI Song'): elif line.startswith(u'CCLI Song'):
sCcli = l[13:].strip() sCcli = line[13:].strip()
lastpart = 1 lastpart = 1
else: else:
if metMisc: if metMisc:
metMisc = False metMisc = False
if l.upper().startswith(u'(BRIDGE)'): if line.upper().startswith(u'(BRIDGE)'):
lyrics.append(u'# Bridge') lyrics.append(u'# Bridge')
# otherwise unknown misc keyword # otherwise unknown misc keyword
elif l.startswith(u'Misc'): elif line.startswith(u'Misc'):
metMisc = True metMisc = True
elif l.startswith(u'Verse') or l.startswith(u'Chorus'): elif line.startswith(u'Verse') or line.startswith(u'Chorus'):
lyrics.append(u'# %s'%l) lyrics.append(u'# %s' % line)
else: else:
# should we remove multiple blank lines? # should we remove multiple blank lines?
if n == 1: if lineCount == 1:
sName = l sName = line
else: else:
lyrics.append(l) lyrics.append(line)
# split on known separators # split on known separators
lst = sAuthor.split(u'/') lst = sAuthor.split(u'/')
if len(lst) < 2: if len(lst) < 2:
@ -403,7 +405,7 @@ class Song(object):
if string_in is None: if string_in is None:
string_out = "" string_out = ""
else: else:
string_out = unicode(s) string_out = unicode(string_in)
return string_out return string_out
def _split_to_list(self, aString): 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.core.lib import Plugin, build_icon, PluginStatus, Receiver
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \ from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \
SofImport, OooImport SofImport, OooImport
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
OpenSongImportForm, OpenLPExportForm
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
""" """
This is the number 1 plugin, if importance were placed on any 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) Plugin.__init__(self, u'Songs', u'1.9.1', plugin_helpers)
self.weight = -10 self.weight = -10
self.songmanager = SongManager() self.manager = SongManager()
self.openlp_import_form = OpenLPImportForm()
self.opensong_import_form = OpenSongImportForm()
self.openlp_export_form = OpenLPExportForm()
self.opensong_export_form = OpenSongExportForm()
self.icon = build_icon(u':/media/media_song.png') self.icon = build_icon(u':/media/media_song.png')
self.status = PluginStatus.Active self.status = PluginStatus.Active
@ -68,16 +63,16 @@ class SongsPlugin(Plugin):
# self.songmanager = SongManager() # self.songmanager = SongManager()
Plugin.initialise(self) Plugin.initialise(self)
self.insert_toolbox_item() self.insert_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(True) #self.ImportSongMenu.menuAction().setVisible(True)
self.ExportSongMenu.menuAction().setVisible(True) #self.ExportSongMenu.menuAction().setVisible(True)
self.media_item.displayResultsSong(self.songmanager.get_songs()) self.media_item.displayResultsSong(self.manager.get_songs())
def finalise(self): def finalise(self):
log.info(u'Plugin Finalise') log.info(u'Plugin Finalise')
Plugin.finalise(self) Plugin.finalise(self)
self.remove_toolbox_item() self.remove_toolbox_item()
self.ImportSongMenu.menuAction().setVisible(False) #self.ImportSongMenu.menuAction().setVisible(False)
self.ExportSongMenu.menuAction().setVisible(False) #self.ExportSongMenu.menuAction().setVisible(False)
def get_media_manager_item(self): def get_media_manager_item(self):
""" """
@ -95,64 +90,47 @@ class SongsPlugin(Plugin):
The actual **Import** menu item, so that your actions can The actual **Import** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
self.ImportSongMenu = QtGui.QMenu(import_menu) # Main song import menu item - will eventually be the only one
self.ImportSongMenu.setObjectName(u'ImportSongMenu') self.SongImportItem = QtGui.QAction(import_menu)
self.ImportOpenSongItem = QtGui.QAction(import_menu) self.SongImportItem.setObjectName(u'SongImportItem')
self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem') self.SongImportItem.setText(import_menu.trUtf8('&Song'))
self.ImportOpenlp1Item = QtGui.QAction(import_menu) self.SongImportItem.setToolTip(
self.ImportOpenlp1Item.setObjectName(u'ImportOpenlp1Item') import_menu.trUtf8('Import songs using the import wizard.'))
self.ImportOpenlp2Item = QtGui.QAction(import_menu) import_menu.addAction(self.SongImportItem)
self.ImportOpenlp2Item.setObjectName(u'ImportOpenlp2Item') # 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 = QtGui.QAction(import_menu)
self.ImportSofItem.setObjectName(u'ImportSofItem') 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( self.ImportSofItem.setText(
import_menu.trUtf8('Songs of Fellowship')) import_menu.trUtf8('Songs of Fellowship (temp menu item)'))
self.ImportSofItem.setToolTip( self.ImportSofItem.setToolTip(
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \ import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books')) + '.rtf and sof4words.rtf supplied with the music books'))
self.ImportSofItem.setStatusTip( self.ImportSofItem.setStatusTip(
import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \ import_menu.trUtf8('Import songs from the VOLS1_2.RTF, sof3words' \
+ '.rtf and sof4words.rtf supplied with the music books')) + '.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( self.ImportOooItem.setText(
import_menu.trUtf8('Generic Document/Presentation Import')) import_menu.trUtf8('Generic Document/Presentation Import '
'(temp menu item)'))
self.ImportOooItem.setToolTip( 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( 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 # Signals and slots
QtCore.QObject.connect(self.ImportOpenlp1Item, QtCore.QObject.connect(self.SongImportItem,
QtCore.SIGNAL(u'triggered()'), self.onImportOpenlp1ItemClick) QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
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.ImportSofItem, QtCore.QObject.connect(self.ImportSofItem,
QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick) QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick)
QtCore.QObject.connect(self.ImportOooItem, QtCore.QObject.connect(self.ImportOooItem,
QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick) QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick)
self.ImportSongMenu.menuAction().setVisible(False)
def add_export_menu_item(self, export_menu): 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 The actual **Export** menu item, so that your actions can
use it as their parent. use it as their parent.
""" """
self.ExportSongMenu = QtGui.QMenu(export_menu) # No menu items for now.
self.ExportSongMenu.setObjectName(u'ExportSongMenu') pass
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)
def onImportOpenlp1ItemClick(self): def onSongImportItemClicked(self):
self.openlp_import_form.show() if self.media_item:
self.media_item.onImportClick()
def onImportOpenSongItemClick(self):
self.opensong_import_form.show()
def onImportSofItemClick(self): def onImportSofItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames( filenames = QtGui.QFileDialog.getOpenFileNames(
@ -200,16 +154,16 @@ class SongsPlugin(Plugin):
u'', u'Songs of Fellowship file (*.rtf *.RTF)') u'', u'Songs of Fellowship file (*.rtf *.RTF)')
try: try:
for filename in filenames: for filename in filenames:
sofimport = SofImport(self.songmanager) sofimport = SofImport(self.manager)
sofimport.import_sof(unicode(filename)) sofimport.import_sof(unicode(filename))
except: except:
log.exception('Could not import SoF file') log.exception('Could not import SoF file')
QtGui.QMessageBox.critical(None, QtGui.QMessageBox.critical(None,
self.ImportSongMenu.trUtf8('Import Error'), self.ImportSongMenu.trUtf8('Import Error'),
self.ImportSongMenu.trUtf8('Error importing Songs of ' self.ImportSongMenu.trUtf8('Error importing Songs of '
+ 'Fellowship file.\nOpenOffice.org must be installed' 'Fellowship file.\nOpenOffice.org must be installed'
+ ' and you must be using an unedited copy of the RTF' ' and you must be using an unedited copy of the RTF'
+ ' included with the Songs of Fellowship Music Editions'), ' included with the Songs of Fellowship Music Editions'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok) QtGui.QMessageBox.Ok)
Receiver.send_message(u'songs_load_list') Receiver.send_message(u'songs_load_list')
@ -218,22 +172,17 @@ class SongsPlugin(Plugin):
filenames = QtGui.QFileDialog.getOpenFileNames( filenames = QtGui.QFileDialog.getOpenFileNames(
None, self.trUtf8('Open documents or presentations'), None, self.trUtf8('Open documents or presentations'),
u'', u'All Files(*.*)') u'', u'All Files(*.*)')
oooimport = OooImport(self.songmanager) oooimport = OooImport(self.manager)
oooimport.import_docs(filenames) oooimport.import_docs(filenames)
Receiver.send_message(u'songs_load_list') 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): def about(self):
about_text = self.trUtf8('<b>Song Plugin</b> <br>This plugin allows ' about_text = self.trUtf8('<strong>Song Plugin</strong><br />'
'Songs to be managed and displayed.<br>') 'This plugin allows songs to be managed and displayed.')
return about_text return about_text
def can_delete_theme(self, theme): 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 True
return False return False

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>474</width>
<height>521</height> <height>442</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,93 +16,13 @@
<property name="modal"> <property name="modal">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QWidget" name="layoutWidget"> <layout class="QVBoxLayout" name="EditVerseLayout">
<property name="geometry"> <property name="spacing">
<rect> <number>8</number>
<x>11</x>
<y>1</y>
<width>471</width>
<height>491</height>
</rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <property name="margin">
<item> <number>8</number>
<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> </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> <item>
<widget class="QTextEdit" name="VerseTextEdit"> <widget class="QTextEdit" name="VerseTextEdit">
<property name="acceptRichText"> <property name="acceptRichText">
@ -111,64 +31,87 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="VerseTypeLayout">
<property name="spacing">
<number>8</number>
</property>
<item> <item>
<widget class="QPushButton" name="addBridge"> <widget class="QLabel" name="VerseTypeLabel">
<property name="text"> <property name="text">
<string>Bridge</string> <string>Verse Type:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="addVerse"> <widget class="QComboBox" name="VerseTypeComboBox">
<item>
<property name="text"> <property name="text">
<string>Verse</string> <string>Verse</string>
</property> </property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="addChorus">
<property name="text"> <property name="text">
<string>Chorus</string> <string>Chorus</string>
</property> </property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <property name="text">
<string>Bridge</string>
</property>
</item>
<item> <item>
<widget class="QPushButton" name="addPreChorus">
<property name="text"> <property name="text">
<string>Pre-Chorus</string> <string>Pre-Chorus</string>
</property> </property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="addIntro">
<property name="text"> <property name="text">
<string>Intro</string> <string>Intro</string>
</property> </property>
</widget>
</item> </item>
<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"> <property name="text">
<string>Ending</string> <string>Ending</string>
</property> </property>
</item>
<item>
<property name="text">
<string>Other</string>
</property>
</item>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="ButtonBox"> <widget class="QDialogButtonBox" name="EditButtonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -179,11 +122,12 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</widget> <resources>
<resources/> <include location="../images/openlp-2.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>ButtonBox</sender> <sender>EditButtonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>EditVerseDialog</receiver> <receiver>EditVerseDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
@ -199,7 +143,7 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>ButtonBox</sender> <sender>EditButtonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>EditVerseDialog</receiver> <receiver>EditVerseDialog</receiver>
<slot>reject()</slot> <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