This commit is contained in:
rimach 2010-12-26 21:56:51 +01:00
commit 0a98f3038e
40 changed files with 25617 additions and 14976 deletions

View File

@ -113,6 +113,14 @@ class ImageManager(QtCore.QObject):
time.sleep(0.1) time.sleep(0.1)
return self._cache[name].image_bytes return self._cache[name].image_bytes
def del_image(self, name):
"""
Delete the Image from the Cache
"""
log.debug(u'del_image %s' % name)
if name in self._cache:
del self._cache[name]
def add_image(self, name, path): def add_image(self, name, path):
""" """
Add image to cache if it is not already there Add image to cache if it is not already there
@ -125,6 +133,8 @@ class ImageManager(QtCore.QObject):
image.image = resize_image(path, image.image = resize_image(path,
self.width, self.height) self.width, self.height)
self._cache[name] = image self._cache[name] = image
else:
log.debug(u'Image in cache %s:%s' % (name, path))
self._cache_dirty = True self._cache_dirty = True
# only one thread please # only one thread please
if not self._thread_running: if not self._thread_running:

View File

@ -123,7 +123,7 @@ if sys.platform[:3] == u'win':
# Platform support for MacOS # Platform support for MacOS
elif sys.platform == u'darwin': elif sys.platform == u'darwin':
_controllers[u'open']= Controller(u'open') _controllers[u'open'] = Controller(u'open')
_open = _controllers[u'open'].open _open = _controllers[u'open'].open

View File

@ -213,6 +213,8 @@ class RenderManager(object):
# make big page for theme edit dialog to get line count # make big page for theme edit dialog to get line count
if self.force_page: if self.force_page:
verse = verse + verse + verse verse = verse + verse + verse
else:
self.image_manager.del_image(theme_data.theme_name)
footer = [] footer = []
footer.append(u'Arky Arky (Unknown)' ) footer.append(u'Arky Arky (Unknown)' )
footer.append(u'Public Domain') footer.append(u'Public Domain')

View File

@ -166,6 +166,17 @@ class Ui_AboutDialog(object):
' PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/' ' PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/'
'intro\n' 'intro\n'
' Oxygen Icons: http://oxygen-icons.org/\n' ' Oxygen Icons: http://oxygen-icons.org/\n'
'\n'
'Final Credit\n'
' "For God so loved the world that He gave\n'
' His one and only Son, so that whoever\n'
' believes in Him will not perish but inherit\n'
' eternal life." -- John 3:16\n\n'
' And last but not least, final credit goes to\n'
' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\n'
' bring this software to you for free because\n'
' He has set us free.'
)) ))
self.aboutNotebook.setTabText( self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab), self.aboutNotebook.indexOf(self.creditsTab),

View File

@ -23,7 +23,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging
import re import re
import os import os
import platform import platform
@ -59,6 +59,8 @@ from openlp.core.lib.mailto import mailto
from exceptiondialog import Ui_ExceptionDialog from exceptiondialog import Ui_ExceptionDialog
log = logging.getLogger(__name__)
class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
""" """
The exception dialog The exception dialog
@ -103,7 +105,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
filename = QtGui.QFileDialog.getSaveFileName(self, filename = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'), translate('OpenLP.ExceptionForm', 'Save Crash Report'),
SettingsManager.get_last_dir(self.settingsSection), SettingsManager.get_last_dir(self.settingsSection),
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)')) translate('OpenLP.ExceptionForm',
'Text files (*.txt *.log *.text)'))
if filename: if filename:
filename = unicode(QtCore.QDir.toNativeSeparators(filename)) filename = unicode(QtCore.QDir.toNativeSeparators(filename))
SettingsManager.set_last_dir(self.settingsSection, os.path.dirname( SettingsManager.set_last_dir(self.settingsSection, os.path.dirname(
@ -140,4 +143,5 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
if u':' in line: if u':' in line:
exception = line.split(u'\n')[-1].split(u':')[0] exception = line.split(u'\n')[-1].split(u':')[0]
subject = u'Bug report: %s in %s' % (exception, source) subject = u'Bug report: %s in %s' % (exception, source)
mailto(address=u'bugs@openlp.org', subject=subject, body=body % content) mailto(address=u'bugs@openlp.org', subject=subject,
body=body % content)

View File

@ -53,7 +53,5 @@ class Ui_FileRenameDialog(object):
QtCore.QMetaObject.connectSlotsByName(FileRenameDialog) QtCore.QMetaObject.connectSlotsByName(FileRenameDialog)
def retranslateUi(self, FileRenameDialog): def retranslateUi(self, FileRenameDialog):
FileRenameDialog.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename'))
self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm', self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm',
'New File Name:')) 'New File Name:'))

View File

@ -28,6 +28,8 @@ from PyQt4 import QtCore, QtGui
from filerenamedialog import Ui_FileRenameDialog from filerenamedialog import Ui_FileRenameDialog
from openlp.core.lib import translate
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
""" """
The exception dialog The exception dialog
@ -39,3 +41,15 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
self.accept) self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.reject) self.reject)
def exec_(self, copy=False):
"""
Run the Dialog with correct heading.
"""
if copy:
self.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Copy'))
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm',
'File Rename'))
return QtGui.QDialog.exec_(self)

View File

@ -312,6 +312,18 @@ class GeneralTab(SettingsTab):
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.overrideCheckBox, QtCore.QObject.connect(self.overrideCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
QtCore.QObject.connect(self.customHeightValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
QtCore.QObject.connect(self.customWidthValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
QtCore.QObject.connect(self.customYValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
QtCore.QObject.connect(self.customXValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
def retranslateUi(self): def retranslateUi(self):
""" """
@ -503,10 +515,19 @@ class GeneralTab(SettingsTab):
def onOverrideCheckBoxToggled(self, checked): def onOverrideCheckBoxToggled(self, checked):
""" """
Toggle screen state depending on check box state Toggle screen state depending on check box state.
``checked``
The state of the check box (boolean).
""" """
self.customXValueEdit.setEnabled(checked) self.customXValueEdit.setEnabled(checked)
self.customYValueEdit.setEnabled(checked) self.customYValueEdit.setEnabled(checked)
self.customHeightValueEdit.setEnabled(checked) self.customHeightValueEdit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked) self.customWidthValueEdit.setEnabled(checked)
self.overrideChanged = True self.overrideChanged = True
def onDisplayPositionChanged(self):
"""
Called when the width, height, x position or y position has changed.
"""
self.overrideChanged = True

View File

@ -148,7 +148,7 @@ class Ui_MainWindow(object):
self.MediaManagerDock.setMinimumWidth( self.MediaManagerDock.setMinimumWidth(
self.settingsmanager.mainwindow_left) self.settingsmanager.mainwindow_left)
self.MediaManagerDock.setObjectName(u'MediaManagerDock') self.MediaManagerDock.setObjectName(u'MediaManagerDock')
self.MediaManagerContents = QtGui.QWidget() self.MediaManagerContents = QtGui.QWidget(MainWindow)
self.MediaManagerContents.setObjectName(u'MediaManagerContents') self.MediaManagerContents.setObjectName(u'MediaManagerContents')
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)

View File

@ -79,7 +79,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
status_text = unicode( status_text = unicode(
translate('OpenLP.PluginForm', '%s (Disabled)')) translate('OpenLP.PluginForm', '%s (Disabled)'))
name_string = plugin.getString(StringContent.Name) name_string = plugin.getString(StringContent.Name)
item.setText(status_text % name_string[u'plural']) item.setText(status_text % name_string[u'singular'])
# If the plugin has an icon, set it! # If the plugin has an icon, set it!
if plugin.icon: if plugin.icon:
item.setIcon(plugin.icon) item.setIcon(plugin.icon)
@ -107,12 +107,12 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
if self.pluginListWidget.currentItem() is None: if self.pluginListWidget.currentItem() is None:
self._clearDetails() self._clearDetails()
return return
plugin_name_plural = \ plugin_name_singular = \
self.pluginListWidget.currentItem().text().split(u' ')[0] self.pluginListWidget.currentItem().text().split(u' ')[0]
self.activePlugin = None self.activePlugin = None
for plugin in self.parent.pluginManager.plugins: for plugin in self.parent.pluginManager.plugins:
name_string = plugin.getString(StringContent.Name) name_string = plugin.getString(StringContent.Name)
if name_string[u'plural'] == plugin_name_plural: if name_string[u'singular'] == plugin_name_singular:
self.activePlugin = plugin self.activePlugin = plugin
break break
if self.activePlugin: if self.activePlugin:
@ -142,4 +142,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
translate('OpenLP.PluginForm', '%s (Disabled)')) translate('OpenLP.PluginForm', '%s (Disabled)'))
name_string = self.activePlugin.getString(StringContent.Name) name_string = self.activePlugin.getString(StringContent.Name)
self.pluginListWidget.currentItem().setText( self.pluginListWidget.currentItem().setText(
status_text % name_string[u'plural']) status_text % name_string[u'singular'])

View File

@ -332,11 +332,12 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if not self.isLive: if not self.isLive:
QtCore.QObject.connect(self.PreviewListWidget, QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onGoLiveClick)
if isLive: if isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
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.loopList) self.Toolbar.makeWidgetsInvisible(self.loopList)
self.Toolbar.actions[u'Stop Loop'].setVisible(False) self.Toolbar.actions[u'Stop Loop'].setVisible(False)
@ -466,7 +467,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.actions[u'Stop Loop'].setVisible(False) self.Toolbar.actions[u'Stop Loop'].setVisible(False)
if item.is_text(): if item.is_text():
if QtCore.QSettings().value( if QtCore.QSettings().value(
self.parent.songsSettingsSection + u'/show songbar', self.parent.songsSettingsSection + u'/display 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 \
@ -560,7 +561,7 @@ class SlideController(QtGui.QWidget):
[serviceItem, self.isLive, blanked, slideno]) [serviceItem, self.isLive, blanked, slideno])
self.slideList = {} self.slideList = {}
width = self.parent.ControlSplitter.sizes()[self.split] width = self.parent.ControlSplitter.sizes()[self.split]
# Set pointing cursor when we have somthing to point at # Set pointing cursor when we have something to point at
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor) self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
self.serviceItem = serviceItem self.serviceItem = serviceItem
self.PreviewListWidget.clear() self.PreviewListWidget.clear()

View File

@ -289,6 +289,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
""" """
Run the wizard. Run the wizard.
""" """
log.debug(u'Editing theme %s' % self.theme.theme_name)
self.updateThemeAllowed = False self.updateThemeAllowed = False
self.setDefaults() self.setDefaults()
self.updateThemeAllowed = True self.updateThemeAllowed = True
@ -444,7 +445,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
def setPreviewTabValues(self): def setPreviewTabValues(self):
self.setField(u'name', QtCore.QVariant(self.theme.theme_name)) self.setField(u'name', QtCore.QVariant(self.theme.theme_name))
if len(self.theme.theme_name) > 1: if len(self.theme.theme_name) > 0:
self.themeNameEdit.setEnabled(False) self.themeNameEdit.setEnabled(False)
else: else:
self.themeNameEdit.setEnabled(True) self.themeNameEdit.setEnabled(True)

View File

@ -223,15 +223,17 @@ class ThemeManager(QtGui.QWidget):
""" """
Renames an existing theme to a new name Renames an existing theme to a new name
""" """
item = self.themeListWidget.currentItem() action = unicode(translate('OpenLP.ThemeManager', 'Rename'))
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) if self._validate_theme_action(action, False):
self.fileRenameForm.fileNameEdit.setText(oldThemeName) item = self.themeListWidget.currentItem()
self.saveThemeName = u'' oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
if self.fileRenameForm.exec_(): self.fileRenameForm.fileNameEdit.setText(oldThemeName)
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) self.saveThemeName = oldThemeName
oldThemeData = self.getThemeData(oldThemeName) if self.fileRenameForm.exec_():
self.deleteTheme(oldThemeName) newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
self.cloneThemeData(oldThemeData, newThemeName) oldThemeData = self.getThemeData(oldThemeName)
self.deleteTheme(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName)
def onCopyTheme(self): def onCopyTheme(self):
""" """
@ -241,7 +243,7 @@ class ThemeManager(QtGui.QWidget):
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString()) oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName) self.fileRenameForm.fileNameEdit.setText(oldThemeName)
self.saveThemeName = u'' self.saveThemeName = u''
if self.fileRenameForm.exec_(): if self.fileRenameForm.exec_(True):
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text()) newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
themeData = self.getThemeData(oldThemeName) themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName) self.cloneThemeData(themeData, newThemeName)
@ -286,47 +288,13 @@ class ThemeManager(QtGui.QWidget):
""" """
Delete a theme Delete a theme
""" """
self.global_theme = unicode(QtCore.QSettings().value( action = unicode(translate('OpenLP.ThemeManager', 'Delete'))
self.settingsSection + u'/global theme', if self._validate_theme_action(action):
QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget,
translate('OpenLP.ThemeManager',
'You must select a theme to delete.')):
item = self.themeListWidget.currentItem() item = self.themeListWidget.currentItem()
theme = unicode(item.text()) theme = unicode(item.text())
# confirm deletion row = self.themeListWidget.row(item)
answer = QtGui.QMessageBox.question(self, self.themeListWidget.takeItem(row)
translate('OpenLP.ThemeManager', 'Delete Confirmation'), self.deleteTheme(theme)
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))
% theme,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
else:
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(theme):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \
(theme, plugin.name))
return
if unicode(self.serviceComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used by the service manager.')) % theme)
return
row = self.themeListWidget.row(item)
self.themeListWidget.takeItem(row)
self.deleteTheme(theme)
def deleteTheme(self, theme): def deleteTheme(self, theme):
""" """
@ -668,7 +636,6 @@ class ThemeManager(QtGui.QWidget):
plugin.renameTheme(self.saveThemeName, name) plugin.renameTheme(self.saveThemeName, name)
if unicode(self.serviceComboBox.currentText()) == name: if unicode(self.serviceComboBox.currentText()) == name:
editedServiceTheme = True editedServiceTheme = True
self.deleteTheme(self.saveThemeName)
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.
if imageTo and self.oldBackgroundImage and \ if imageTo and self.oldBackgroundImage and \
@ -782,3 +749,50 @@ class ThemeManager(QtGui.QWidget):
theme.parse(themeXml) theme.parse(themeXml)
theme.extend_image_filename(path) theme.extend_image_filename(path)
return theme return theme
def _validate_theme_action(self, action, testPlugin=True):
"""
Check to see if theme has been selected and the destructive action
is allowed.
"""
self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme',
QtCore.QVariant(u'')).toString())
if check_item_selected(self.themeListWidget,
unicode(translate('OpenLP.ThemeManager',
'You must select a theme to %s.')) % action):
item = self.themeListWidget.currentItem()
theme = unicode(item.text())
# confirm deletion
answer = QtGui.QMessageBox.question(self,
unicode(translate('OpenLP.ThemeManager', '%s Confirmation'))
% action,
unicode(translate('OpenLP.ThemeManager', '%s %s theme?'))
% (action, theme),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No:
return False
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'))
else:
if testPlugin:
for plugin in self.parent.pluginManager.plugins:
if plugin.usesTheme(theme):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used in the %s plugin.')) % \
(theme, plugin.name))
return False
if unicode(self.serviceComboBox.currentText()) == theme:
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
unicode(translate('OpenLP.ThemeManager',
'Theme %s is used by the service manager.')) % theme)
return False
return True

View File

@ -555,7 +555,8 @@ class Ui_ThemeWizard(object):
u'footerDefaultPositionCheckBox') u'footerDefaultPositionCheckBox')
self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.footerPositionLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.footerDefaultPositionCheckBox) self.footerDefaultPositionCheckBox)
self.areaPositionLayout.addWidget(self.footerPositionGroupBox, 1, 1, 1, 1) self.areaPositionLayout.addWidget(
self.footerPositionGroupBox, 1, 1, 1, 1)
ThemeWizard.addPage(self.areaPositionPage) ThemeWizard.addPage(self.areaPositionPage)
self.previewPage = QtGui.QWizardPage() self.previewPage = QtGui.QWizardPage()
self.previewPage.setObjectName(u'previewPage') self.previewPage.setObjectName(u'previewPage')
@ -720,8 +721,8 @@ class Ui_ThemeWizard(object):
self.areaPositionPage.setTitle( self.areaPositionPage.setTitle(
translate('OpenLP.ThemeWizard', 'Output Area Locations')) translate('OpenLP.ThemeWizard', 'Output Area Locations'))
self.areaPositionPage.setSubTitle( self.areaPositionPage.setSubTitle(
translate('OpenLP.ThemeWizard', 'Allows you to change and move the ' translate('OpenLP.ThemeWizard', 'Allows you to change and move the'
'main and footer areas.')) ' main and footer areas.'))
self.mainPositionGroupBox.setTitle( self.mainPositionGroupBox.setTitle(
translate('OpenLP.ThemeWizard', '&Main Area')) translate('OpenLP.ThemeWizard', '&Main Area'))
self.mainDefaultPositionCheckBox.setText( self.mainDefaultPositionCheckBox.setText(
@ -733,18 +734,24 @@ class Ui_ThemeWizard(object):
self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.mainWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.mainWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:')) self.mainWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:'))
self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.mainHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.mainHeightLabel.setText(translate('OpenLP.ThemeWizard', 'Height:')) self.mainHeightLabel.setText(
translate('OpenLP.ThemeWizard', 'Height:'))
self.footerPositionGroupBox.setTitle( self.footerPositionGroupBox.setTitle(
translate('OpenLP.ThemeWizard', 'Footer Area')) translate('OpenLP.ThemeWizard', 'Footer Area'))
self.footerXLabel.setText(translate('OpenLP.ThemeWizard', 'X position:')) self.footerXLabel.setText(
translate('OpenLP.ThemeWizard', 'X position:'))
self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.footerXSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.footerYLabel.setText(translate('OpenLP.ThemeWizard', 'Y position:')) self.footerYLabel.setText(
translate('OpenLP.ThemeWizard', 'Y position:'))
self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.footerYSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.footerWidthLabel.setText(translate('OpenLP.ThemeWizard', 'Width:')) self.footerWidthLabel.setText(
self.footerWidthSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) translate('OpenLP.ThemeWizard', 'Width:'))
self.footerWidthSpinBox.setSuffix(
translate('OpenLP.ThemeWizard', 'px'))
self.footerHeightLabel.setText( self.footerHeightLabel.setText(
translate('OpenLP.ThemeWizard', 'Height:')) translate('OpenLP.ThemeWizard', 'Height:'))
self.footerHeightSpinBox.setSuffix(translate('OpenLP.ThemeWizard', 'px')) self.footerHeightSpinBox.setSuffix(
translate('OpenLP.ThemeWizard', 'px'))
self.footerDefaultPositionCheckBox.setText( self.footerDefaultPositionCheckBox.setText(
translate('OpenLP.ThemeWizard', 'Use default location')) translate('OpenLP.ThemeWizard', 'Use default location'))
self.previewPage.setTitle( self.previewPage.setTitle(

View File

@ -171,24 +171,23 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# We found '<>' in the alert text, but the ParameterEdit field is # We found '<>' in the alert text, but the ParameterEdit field is
# empty. # empty.
if text.find(u'<>') != -1 and not self.ParameterEdit.text() and \ if text.find(u'<>') != -1 and not self.ParameterEdit.text() and \
QtGui.QMessageBox.question(self, translate( QtGui.QMessageBox.question(self,
'AlertPlugin.AlertForm', 'No Parameter found'), translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'You have not entered a ' translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue ' 'parameter to be replaced.\nDo you want to continue anyway?'),
'anyway?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.ParameterEdit.setFocus()
return False return False
# The ParameterEdit field is not empty, but we have not found '<>' # The ParameterEdit field is not empty, but we have not found '<>'
# in the alert text. # in the alert text.
elif text.find(u'<>') == -1 and self.ParameterEdit.text() and \ elif text.find(u'<>') == -1 and self.ParameterEdit.text() and \
QtGui.QMessageBox.question(self, translate( QtGui.QMessageBox.question(self,
'AlertPlugin.AlertForm', 'No Placeholder found'), translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'The alert text does not' translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'), ' contain \'<>\'.\nDo want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.ParameterEdit.setFocus()
return False return False
text = text.replace(u'<>', unicode(self.ParameterEdit.text())) text = text.replace(u'<>', unicode(self.ParameterEdit.text()))

View File

@ -253,14 +253,16 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
""" """
self.getFileName( self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'), translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
self.booksLocationEdit) self.booksLocationEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onCsvVersesFileButtonClicked(self): def onCsvVersesFileButtonClicked(self):
""" """
Show the file open dialog for the verses CSV file. Show the file open dialog for the verses CSV file.
""" """
self.getFileName(translate('BiblesPlugin.ImportWizardForm', self.getFileName(translate('BiblesPlugin.ImportWizardForm',
'Open Verses CSV File'), self.csvVerseLocationEdit) 'Open Verses CSV File'), self.csvVerseLocationEdit, u'%s (*.csv)'
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onOpenSongBrowseButtonClicked(self): def onOpenSongBrowseButtonClicked(self):
""" """
@ -276,7 +278,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
""" """
self.getFileName( self.getFileName(
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Open openlp.org 1.x Bible'), self.openlp1LocationEdit) 'Open openlp.org 1.x Bible'), self.openlp1LocationEdit,
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
'openlp.org 1.x bible'))
def onCurrentIdChanged(self, pageId): def onCurrentIdChanged(self, pageId):
if pageId == 3: if pageId == 3:
@ -402,9 +406,29 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
if books_file: if books_file:
books_file.close() books_file.close()
def getFileName(self, title, editbox): def getFileName(self, title, editbox, filters=u''):
"""
Opens a QFileDialog and saves the filename to the given editbox.
``title``
The title of the dialog (unicode).
``editbox``
A editbox (QLineEdit).
``filters``
The file extension filters. It should contain the file description as
well as the file extension. For example::
u'openlp.org 1.x bible (*.bible)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % translate('BiblesPlugin.ImportWizardForm',
'All Files')
filename = QtGui.QFileDialog.getOpenFileName(self, title, filename = QtGui.QFileDialog.getOpenFileName(self, title,
SettingsManager.get_last_dir(self.bibleplugin.settingsSection, 1)) os.path.dirname(SettingsManager.get_last_dir(
self.bibleplugin.settingsSection, 1)), filters)
if filename: if filename:
editbox.setText(filename) editbox.setText(filename)
SettingsManager.set_last_dir( SettingsManager.set_last_dir(

View File

@ -244,7 +244,7 @@ class BSExtract(object):
""" """
Extract verses from Bibleserver.com Extract verses from Bibleserver.com
""" """
def __init__(self,proxyurl=None): def __init__(self, proxyurl=None):
log.debug(u'init %s', proxyurl) log.debug(u'init %s', proxyurl)
self.proxyurl = proxyurl self.proxyurl = proxyurl
@ -284,6 +284,7 @@ class BSExtract(object):
if not soup: if not soup:
return None return None
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
content = None
try: try:
content = soup.find(u'div', u'content').find(u'div').findAll(u'div') content = soup.find(u'div', u'content').find(u'div').findAll(u'div')
except: except:

View File

@ -73,7 +73,7 @@ class BibleMediaItem(MediaManagerItem):
self.hasNewIcon = False self.hasNewIcon = False
self.hasEditIcon = False self.hasEditIcon = False
self.hasDeleteIcon = False self.hasDeleteIcon = False
self.addToServiceItem = True self.addToServiceItem = False
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self) self.SearchTabWidget = QtGui.QTabWidget(self)

View File

@ -109,7 +109,7 @@ class CustomPlugin(Plugin):
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('CustomsPlugin', 'Customs') u'title': translate('CustomsPlugin', 'Custom')
} }
# Middle Header Bar # Middle Header Bar
## Import Button ## ## Import Button ##

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
context_menu_action, ItemCapabilities, SettingsManager, translate, \ context_menu_action, ItemCapabilities, SettingsManager, translate, \
check_item_selected check_item_selected, Receiver
from openlp.core.utils import AppLocation, get_images_filter from openlp.core.utils import AppLocation, get_images_filter
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -139,6 +139,8 @@ class ImageMediaItem(MediaManagerItem):
self.settingsSection, self.getFileList()) self.settingsSection, self.getFileList())
def loadList(self, list): def loadList(self, list):
self.listView.setCursor(QtCore.Qt.BusyCursor)
Receiver.send_message(u'openlp_process_events')
for file in list: for file in list:
filename = os.path.split(unicode(file))[1] filename = os.path.split(unicode(file))[1]
thumb = os.path.join(self.servicePath, filename) thumb = os.path.join(self.servicePath, filename)
@ -153,6 +155,8 @@ class ImageMediaItem(MediaManagerItem):
item_name.setIcon(icon) item_name.setIcon(icon)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
self.listView.addItem(item_name) self.listView.addItem(item_name)
self.listView.setCursor(QtCore.Qt.ArrowCursor)
Receiver.send_message(u'openlp_process_events')
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()

View File

@ -206,8 +206,12 @@ OpenLP.Namespace.create("OpenLP.Remote", {
}, },
sendLiveSet: function (e) sendLiveSet: function (e)
{ {
var id = OpenLP.Events.getElement(e).parent().attr("value"); var tr = OpenLP.Events.getElement(e).parent();
OpenLP.Remote.sendEvent("slidecontroller_live_set", id); if (tr[0].tagName != "TR")
{
tr = tr.parent();
}
OpenLP.Remote.sendEvent("slidecontroller_live_set", tr.attr("value"));
return false; return false;
}, },
sendSetItem: function (e) sendSetItem: function (e)

View File

@ -89,5 +89,5 @@ class RemotesPlugin(Plugin):
} }
## Name for MediaDockManager, SettingsManager ## ## Name for MediaDockManager, SettingsManager ##
self.textStrings[StringContent.VisibleName] = { self.textStrings[StringContent.VisibleName] = {
u'title': translate('RemotePlugin', 'Remotes') u'title': translate('RemotePlugin', 'Remote')
} }

View File

@ -146,8 +146,7 @@ class Ui_EditSongDialog(object):
self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth()) self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy) self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(True) self.AuthorsSelectionComboItem.setEditable(True)
self.AuthorsSelectionComboItem.setInsertPolicy( self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
QtGui.QComboBox.InsertAlphabetically)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy( self.AuthorsSelectionComboItem.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength) QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8) self.AuthorsSelectionComboItem.setMinimumContentsLength(8)
@ -224,6 +223,7 @@ class Ui_EditSongDialog(object):
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
self.SongTopicCombo.sizePolicy().hasHeightForWidth()) self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setEditable(True) self.SongTopicCombo.setEditable(True)
self.SongTopicCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongTopicCombo.setSizePolicy(sizePolicy) self.SongTopicCombo.setSizePolicy(sizePolicy)
self.SongTopicCombo.setObjectName(u'SongTopicCombo') self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo) self.TopicAddLayout.addWidget(self.SongTopicCombo)
@ -271,6 +271,7 @@ class Ui_EditSongDialog(object):
sizePolicy.setHeightForWidth( sizePolicy.setHeightForWidth(
self.SongbookCombo.sizePolicy().hasHeightForWidth()) self.SongbookCombo.sizePolicy().hasHeightForWidth())
self.SongbookCombo.setEditable(True) self.SongbookCombo.setEditable(True)
self.SongbookCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongbookCombo.setSizePolicy(sizePolicy) self.SongbookCombo.setSizePolicy(sizePolicy)
self.SongbookCombo.setObjectName(u'SongbookCombo') self.SongbookCombo.setObjectName(u'SongbookCombo')
self.SongbookLayout.addRow(self.SongbookNameLabel, self.SongbookCombo) self.SongbookLayout.addRow(self.SongbookNameLabel, self.SongbookCombo)
@ -315,6 +316,7 @@ class Ui_EditSongDialog(object):
self.ThemeLayout.setObjectName(u'ThemeLayout') self.ThemeLayout.setObjectName(u'ThemeLayout')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox) self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox)
self.ThemeSelectionComboItem.setEditable(True) self.ThemeSelectionComboItem.setEditable(True)
self.ThemeSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem') self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem')
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem) self.ThemeLayout.addWidget(self.ThemeSelectionComboItem)
self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox) self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox)

View File

@ -547,14 +547,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.AuthorsListView.count() == 0: if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(1) self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus() self.AuthorsListView.setFocus()
answer = QtGui.QMessageBox.warning(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Warning'), translate('SongsPlugin.EditSongForm', 'Warning'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You have not added any authors for this song. Do you ' 'You need to have an author for this song.'))
'want to add an author now?'), return False
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.Yes:
return False
if self.song.verse_order: if self.song.verse_order:
order = [] order = []
order_names = self.song.verse_order.split() order_names = self.song.verse_order.split()
@ -739,7 +736,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
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 + whitespace.sub(u' ', text = text + self.whitespace.sub(u' ',
unicode(self.VerseListWidget.item(i, 0).text())) + u' ' unicode(self.VerseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple): if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0]) multiple.append(bits[0][0])

View File

@ -29,7 +29,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType, translate
from editversedialog import Ui_EditVerseDialog from editversedialog import Ui_EditVerseDialog
@ -131,6 +131,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
def setVerse(self, text, single=False, def setVerse(self, text, single=False,
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)): tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
self.hasSingleVerse = single
if single: if single:
verse_type, verse_number = tag.split(u':') verse_type, verse_number = tag.split(u':')
verse_type_index = VerseType.from_string(verse_type) verse_type_index = VerseType.from_string(verse_type)
@ -159,3 +160,16 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse), text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
text) text)
return text return text
def accept(self):
if self.hasSingleVerse:
value = unicode(self.getVerse()[0])
else:
value = self.getVerse()[0].split(u'\n')[1]
if len(value) == 0:
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.'))
return False
QtGui.QDialog.accept(self)

View File

@ -152,101 +152,101 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
if self.openLP2FilenameEdit.text().isEmpty(): if self.openLP2FilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No OpenLP 2.0 Song Database Selected'), 'No OpenLP 2.0 Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an OpenLP 2.0 song database ' 'You need to select an OpenLP 2.0 song database '
'file to import from.')) 'file to import from.'))
self.openLP2BrowseButton.setFocus() self.openLP2BrowseButton.setFocus()
return False return False
elif source_format == SongFormat.OpenLP1: elif source_format == SongFormat.OpenLP1:
if self.openLP1FilenameEdit.text().isEmpty(): if self.openLP1FilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No openlp.org 1.x Song Database Selected'), 'No openlp.org 1.x Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an openlp.org 1.x song ' 'You need to select an openlp.org 1.x song '
'database file to import from.')) 'database file to import from.'))
self.openLP1BrowseButton.setFocus() self.openLP1BrowseButton.setFocus()
return False return False
elif source_format == SongFormat.OpenLyrics: elif source_format == SongFormat.OpenLyrics:
#if self.openLyricsFileListWidget.count() == 0: # if self.openLyricsFileListWidget.count() == 0:
# QtGui.QMessageBox.critical(self, # QtGui.QMessageBox.critical(self,
# translate('SongsPlugin.ImportWizardForm', # translate('SongsPlugin.ImportWizardForm',
# 'No OpenLyrics Files Selected'), # 'No OpenLyrics Files Selected'),
# translate('SongsPlugin.ImportWizardForm', # translate('SongsPlugin.ImportWizardForm',
# 'You need to add at least one OpenLyrics ' # 'You need to add at least one OpenLyrics '
# 'song file to import from.')) # 'song file to import from.'))
# self.openLyricsAddButton.setFocus() # self.openLyricsAddButton.setFocus()
# return False # return False
return False return False
elif source_format == SongFormat.OpenSong: elif source_format == SongFormat.OpenSong:
if self.openSongFileListWidget.count() == 0: if self.openSongFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No OpenSong Files Selected'), 'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenSong ' 'You need to add at least one OpenSong '
'song file to import from.')) 'song file to import from.'))
self.openSongAddButton.setFocus() self.openSongAddButton.setFocus()
return False return False
elif source_format == SongFormat.WordsOfWorship: elif source_format == SongFormat.WordsOfWorship:
if self.wordsOfWorshipFileListWidget.count() == 0: if self.wordsOfWorshipFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No Words of Worship Files Selected'), 'No Words of Worship Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one Words of Worship ' 'You need to add at least one Words of Worship '
'file to import from.')) 'file to import from.'))
self.wordsOfWorshipAddButton.setFocus() self.wordsOfWorshipAddButton.setFocus()
return False return False
elif source_format == SongFormat.CCLI: elif source_format == SongFormat.CCLI:
if self.ccliFileListWidget.count() == 0: if self.ccliFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No CCLI Files Selected'), 'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one CCLI file ' 'You need to add at least one CCLI file '
'to import from.')) 'to import from.'))
self.ccliAddButton.setFocus() self.ccliAddButton.setFocus()
return False return False
elif source_format == SongFormat.SongsOfFellowship: elif source_format == SongFormat.SongsOfFellowship:
if self.songsOfFellowshipFileListWidget.count() == 0: if self.songsOfFellowshipFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No Songs of Fellowship File Selected'), 'No Songs of Fellowship File Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one Songs of Fellowship ' 'You need to add at least one Songs of Fellowship '
'file to import from.')) 'file to import from.'))
self.songsOfFellowshipAddButton.setFocus() self.songsOfFellowshipAddButton.setFocus()
return False return False
elif source_format == SongFormat.Generic: elif source_format == SongFormat.Generic:
if self.genericFileListWidget.count() == 0: if self.genericFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No Document/Presentation Selected'), 'No Document/Presentation Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one document or ' 'You need to add at least one document or '
'presentation file to import from.')) 'presentation file to import from.'))
self.genericAddButton.setFocus() self.genericAddButton.setFocus()
return False return False
elif source_format == SongFormat.EasyWorship: elif source_format == SongFormat.EasyWorship:
if self.ewFilenameEdit.text().isEmpty(): if self.ewFilenameEdit.text().isEmpty():
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No EasyWorship Song Database Selected'), 'No EasyWorship Song Database Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to select an EasyWorship song database ' 'You need to select an EasyWorship song database '
'file to import from.')) 'file to import from.'))
self.ewBrowseButton.setFocus() self.ewBrowseButton.setFocus()
return False return False
elif source_format == SongFormat.SongBeamer: elif source_format == SongFormat.SongBeamer:
if self.songBeamerFileListWidget.count() == 0: if self.songBeamerFileListWidget.count() == 0:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'No SongBeamer File Selected'), 'No SongBeamer File Selected'),
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'You need to add at least one SongBeamer ' 'You need to add at least one SongBeamer '
'file to import from.')) 'file to import from.'))
self.songBeamerAddButton.setFocus() self.songBeamerAddButton.setFocus()
return False return False
return True return True
@ -254,24 +254,57 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
# Progress page # Progress page
return True return True
def getFileName(self, title, editbox, def getFileName(self, title, editbox, filters=u''):
filters = '%s (*)' % translate('SongsPlugin.ImportWizardForm', """
'All Files')): Opens a QFileDialog and writes the filename to the given editbox.
``title``
The title of the dialog (unicode).
``editbox``
A editbox (QLineEdit).
``filters``
The file extension filters. It should contain the file descriptions
as well as the file extensions. For example::
u'OpenLP 2.0 Databases (*.sqlite)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
'All Files')
filename = QtGui.QFileDialog.getOpenFileName(self, title, filename = QtGui.QFileDialog.getOpenFileName(self, title,
SettingsManager.get_last_dir(self.plugin.settingsSection, 1), os.path.dirname(SettingsManager.get_last_dir(
filters) self.plugin.settingsSection, 1)), filters)
if filename: if filename:
editbox.setText(filename) editbox.setText(filename)
SettingsManager.set_last_dir( SettingsManager.set_last_dir(self.plugin.settingsSection,
self.plugin.settingsSection,
os.path.split(unicode(filename))[0], 1) os.path.split(unicode(filename))[0], 1)
def getFiles(self, title, listbox, def getFiles(self, title, listbox, filters=u''):
filters = u'%s (*)' % translate('SongsPlugin.ImportWizardForm', """
'All Files')): Opens a QFileDialog and writes the filenames to the given listbox.
``title``
The title of the dialog (unicode).
``listbox``
A listbox (QListWidget).
``filters``
The file extension filters. It should contain the file descriptions
as well as the file extensions. For example::
u'SongBeamer files (*.sng)'
"""
if filters:
filters += u';;'
filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
'All Files')
filenames = QtGui.QFileDialog.getOpenFileNames(self, title, filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
SettingsManager.get_last_dir(self.plugin.settingsSection, 1), os.path.dirname(SettingsManager.get_last_dir(
filters) self.plugin.settingsSection, 1)), filters)
if filenames: if filenames:
listbox.addItems(filenames) listbox.addItems(filenames)
SettingsManager.set_last_dir( SettingsManager.set_last_dir(
@ -293,24 +326,18 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
self.getFileName( self.getFileName(
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select OpenLP 2.0 Database File'), 'Select OpenLP 2.0 Database File'),
self.openLP2FilenameEdit, self.openLP2FilenameEdit, u'%s (*.sqlite)'
u'%s (*.sqlite);;%s (*)'
% (translate('SongsPlugin.ImportWizardForm', % (translate('SongsPlugin.ImportWizardForm',
'OpenLP 2.0 Databases'), 'OpenLP 2.0 Databases'))
translate('SongsPlugin.ImportWizardForm',
'All Files'))
) )
def onOpenLP1BrowseButtonClicked(self): def onOpenLP1BrowseButtonClicked(self):
self.getFileName( self.getFileName(
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select openlp.org 1.x Database File'), 'Select openlp.org 1.x Database File'),
self.openLP1FilenameEdit, self.openLP1FilenameEdit, u'%s (*.olp)'
u'%s (*.olp);;%s (*)' % translate('SongsPlugin.ImportWizardForm',
% (translate('SongsPlugin.ImportWizardForm', 'openlp.org v1.x Databases')
'openlp.org v1.x Databases'),
translate('SongsPlugin.ImportWizardForm',
'All Files'))
) )
#def onOpenLyricsAddButtonClicked(self): #def onOpenLyricsAddButtonClicked(self):
@ -337,12 +364,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
self.getFiles( self.getFiles(
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select Words of Worship Files'), 'Select Words of Worship Files'),
self.wordsOfWorshipFileListWidget, self.wordsOfWorshipFileListWidget, u'%s (*.wsg *.wow-song)'
u'%s (*.wsg *.wow-song);;%s (*)' % translate('SongsPlugin.ImportWizardForm',
% (translate('SongsPlugin.ImportWizardForm', 'Words Of Worship Song Files')
'Words Of Worship Song Files'),
translate('SongsPlugin.ImportWizardForm',
'All Files'))
) )
def onWordsOfWorshipRemoveButtonClicked(self): def onWordsOfWorshipRemoveButtonClicked(self):
@ -362,12 +386,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
self.getFiles( self.getFiles(
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select Songs of Fellowship Files'), 'Select Songs of Fellowship Files'),
self.songsOfFellowshipFileListWidget, self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
u'%s (*.rtf);;%s (*)' % translate('SongsPlugin.ImportWizardForm',
% (translate('SongsPlugin.ImportWizardForm', 'Songs Of Felloship Song Files')
'Songs Of Felloship Song Files'),
translate('SongsPlugin.ImportWizardForm',
'All Files'))
) )
def onSongsOfFellowshipRemoveButtonClicked(self): def onSongsOfFellowshipRemoveButtonClicked(self):
@ -394,7 +415,8 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
self.getFiles( self.getFiles(
translate('SongsPlugin.ImportWizardForm', translate('SongsPlugin.ImportWizardForm',
'Select SongBeamer Files'), 'Select SongBeamer Files'),
self.songBeamerFileListWidget self.songBeamerFileListWidget, u'%s (*.sng)' %
translate('SongsPlugin.ImportWizardForm', 'SongBeamer files')
) )
def onSongBeamerRemoveButtonClicked(self): def onSongBeamerRemoveButtonClicked(self):

View File

@ -71,7 +71,8 @@ class VerseType(object):
The string to return a VerseType for The string to return a VerseType for
""" """
verse_type = verse_type.lower() verse_type = verse_type.lower()
if verse_type == unicode(VerseType.to_string(VerseType.Verse)).lower()[0]: if verse_type == \
unicode(VerseType.to_string(VerseType.Verse)).lower()[0]:
return translate('SongsPlugin.VerseType', 'Verse') return translate('SongsPlugin.VerseType', 'Verse')
elif verse_type == \ elif verse_type == \
unicode(VerseType.to_string(VerseType.Chorus)).lower()[0]: unicode(VerseType.to_string(VerseType.Chorus)).lower()[0]:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff