openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20555
[Merge] lp:~googol/openlp/short-lines into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/short-lines into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~googol/openlp/short-lines/+merge/159956
Hello,
- fixed short lines
- renamed attributes and methods
Passed functional tests
--
https://code.launchpad.net/~googol/openlp/short-lines/+merge/159956
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2013-04-14 15:59:57 +0000
+++ openlp/core/lib/mediamanageritem.py 2013-04-20 20:36:31 +0000
@@ -427,7 +427,7 @@
"""
raise NotImplementedError(u'MediaManagerItem.on_delete_click needs to be defined by the plugin')
- def onFocus(self):
+ def on_focus(self):
"""
Run when a tab in the media manager gains focus. This gives the media
item a chance to focus any elements it wants to.
=== modified file 'openlp/core/ui/firsttimelanguagedialog.py'
--- openlp/core/ui/firsttimelanguagedialog.py 2013-02-01 20:36:27 +0000
+++ openlp/core/ui/firsttimelanguagedialog.py 2013-04-20 20:36:31 +0000
@@ -39,39 +39,39 @@
"""
The UI widgets of the language selection dialog.
"""
- def setupUi(self, languageDialog):
+ def setupUi(self, language_dialog):
"""
Set up the UI.
"""
- languageDialog.setObjectName(u'languageDialog')
- languageDialog.resize(300, 50)
- self.dialogLayout = QtGui.QVBoxLayout(languageDialog)
- self.dialogLayout.setContentsMargins(8, 8, 8, 8)
- self.dialogLayout.setSpacing(8)
- self.dialogLayout.setObjectName(u'dialog_layout')
- self.infoLabel = QtGui.QLabel(languageDialog)
- self.infoLabel.setObjectName(u'infoLabel')
- self.dialogLayout.addWidget(self.infoLabel)
- self.languageLayout = QtGui.QHBoxLayout()
- self.languageLayout.setObjectName(u'languageLayout')
- self.languageLabel = QtGui.QLabel(languageDialog)
- self.languageLabel.setObjectName(u'languageLabel')
- self.languageLayout.addWidget(self.languageLabel)
- self.languageComboBox = QtGui.QComboBox(languageDialog)
- self.languageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
- self.languageComboBox.setObjectName("languageComboBox")
- self.languageLayout.addWidget(self.languageComboBox)
- self.dialogLayout.addLayout(self.languageLayout)
- self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
- self.dialogLayout.addWidget(self.button_box)
- self.retranslateUi(languageDialog)
+ language_dialog.setObjectName(u'language_dialog')
+ language_dialog.resize(300, 50)
+ self.dialog_layout = QtGui.QVBoxLayout(language_dialog)
+ self.dialog_layout.setContentsMargins(8, 8, 8, 8)
+ self.dialog_layout.setSpacing(8)
+ self.dialog_layout.setObjectName(u'dialog_layout')
+ self.info_label = QtGui.QLabel(language_dialog)
+ self.info_label.setObjectName(u'info_label')
+ self.dialog_layout.addWidget(self.info_label)
+ self.language_layout = QtGui.QHBoxLayout()
+ self.language_layout.setObjectName(u'language_layout')
+ self.language_label = QtGui.QLabel(language_dialog)
+ self.language_label.setObjectName(u'language_label')
+ self.language_layout.addWidget(self.language_label)
+ self.language_combo_box = QtGui.QComboBox(language_dialog)
+ self.language_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
+ self.language_combo_box.setObjectName("language_combo_box")
+ self.language_layout.addWidget(self.language_combo_box)
+ self.dialog_layout.addLayout(self.language_layout)
+ self.button_box = create_button_box(language_dialog, u'button_box', [u'cancel', u'ok'])
+ self.dialog_layout.addWidget(self.button_box)
+ self.retranslateUi(language_dialog)
self.setMaximumHeight(self.sizeHint().height())
- def retranslateUi(self, languageDialog):
+ def retranslateUi(self, language_dialog):
"""
Translate the UI on the fly.
"""
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', 'Select Translation'))
- self.infoLabel.setText(
+ self.info_label.setText(
translate('OpenLP.FirstTimeLanguageForm', 'Choose the translation you\'d like to use in OpenLP.'))
- self.languageLabel.setText(translate('OpenLP.FirstTimeLanguageForm', 'Translation:'))
+ self.language_label.setText(translate('OpenLP.FirstTimeLanguageForm', 'Translation:'))
=== modified file 'openlp/core/ui/firsttimelanguageform.py'
--- openlp/core/ui/firsttimelanguageform.py 2013-03-01 09:20:26 +0000
+++ openlp/core/ui/firsttimelanguageform.py 2013-04-20 20:36:31 +0000
@@ -47,8 +47,8 @@
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.qmList = LanguageManager.get_qm_list()
- self.languageComboBox.addItem(u'Autodetect')
- self.languageComboBox.addItems(sorted(self.qmList.keys()))
+ self.language_combo_box.addItem(u'Autodetect')
+ self.language_combo_box.addItems(sorted(self.qmList.keys()))
def exec_(self):
"""
@@ -61,12 +61,12 @@
Run when the dialog is OKed.
"""
# It's the first row so must be Automatic
- if self.languageComboBox.currentIndex() == 0:
+ if self.language_combo_box.currentIndex() == 0:
LanguageManager.auto_language = True
LanguageManager.set_language(False, False)
else:
LanguageManager.auto_language = False
- action = create_action(None, self.languageComboBox.currentText())
+ action = create_action(None, self.language_combo_box.currentText())
LanguageManager.set_language(action, False)
return QtGui.QDialog.accept(self)
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2013-03-30 08:40:49 +0000
+++ openlp/core/ui/mainwindow.py 2013-04-20 20:36:31 +0000
@@ -559,7 +559,7 @@
"""
widget = self.media_tool_box.widget(index)
if widget:
- widget.onFocus()
+ widget.on_focus()
def version_notice(self, version):
"""
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2013-04-05 19:37:56 +0000
+++ openlp/core/ui/servicemanager.py 2013-04-20 20:36:31 +0000
@@ -1394,7 +1394,7 @@
item = self.find_service_item()[0]
if self.service_items[item][u'service_item'].is_capable(ItemCapabilities.CanEdit):
new_item = Registry().get(self.service_items[item][u'service_item'].name). \
- onRemoteEdit(self.service_items[item][u'service_item'].edit_id)
+ on_remote_edit(self.service_items[item][u'service_item'].edit_id)
if new_item:
self.add_service_item(new_item, replace=True)
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2013-04-08 16:53:26 +0000
+++ openlp/core/ui/slidecontroller.py 2013-04-20 20:36:31 +0000
@@ -1233,7 +1233,7 @@
From the preview display requires the service Item to be editied
"""
self.song_edit = True
- new_item = Registry().get(self.service_item.name).onRemoteEdit(self.service_item.edit_id, True)
+ new_item = Registry().get(self.service_item.name).on_remote_edit(self.service_item.edit_id, True)
if new_item:
self.add_service_item(new_item)
=== modified file 'openlp/plugins/alerts/__init__.py'
--- openlp/plugins/alerts/__init__.py 2013-01-01 16:33:41 +0000
+++ openlp/plugins/alerts/__init__.py 2013-04-20 20:36:31 +0000
@@ -27,6 +27,5 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`alerts` module provides the Alerts plugin for producing impromptu
-on-screen announcements during a service.
+The :mod:`alerts` module provides the Alerts plugin for producing impromptu on-screen announcements during a service.
"""
=== modified file 'openlp/plugins/alerts/alertsplugin.py'
--- openlp/plugins/alerts/alertsplugin.py 2013-03-25 07:13:40 +0000
+++ openlp/plugins/alerts/alertsplugin.py 2013-04-20 20:36:31 +0000
@@ -115,13 +115,13 @@
"""
__default_settings__ = {
- u'alerts/font face': QtGui.QFont().family(),
- u'alerts/font size': 40,
- u'alerts/db type': u'sqlite',
- u'alerts/location': AlertLocation.Bottom,
- u'alerts/background color': u'#660000',
- u'alerts/font color': u'#ffffff',
- u'alerts/timeout': 5
+ u'alerts/font face': QtGui.QFont().family(),
+ u'alerts/font size': 40,
+ u'alerts/db type': u'sqlite',
+ u'alerts/location': AlertLocation.Bottom,
+ u'alerts/background color': u'#660000',
+ u'alerts/font color': u'#ffffff',
+ u'alerts/timeout': 5
}
@@ -139,12 +139,10 @@
def add_tools_menu_item(self, tools_menu):
"""
- Give the alerts plugin the opportunity to add items to the
- **Tools** menu.
+ Give the alerts plugin the opportunity to add items to the **Tools** menu.
``tools_menu``
- The actual **Tools** menu item, so that your actions can
- use it as their parent.
+ The actual **Tools** menu item, so that your actions can use it as their parent.
"""
log.info(u'add tools menu')
self.tools_alert_item = create_action(tools_menu, u'toolsAlertItem',
=== modified file 'openlp/plugins/alerts/forms/__init__.py'
--- openlp/plugins/alerts/forms/__init__.py 2013-01-17 21:58:38 +0000
+++ openlp/plugins/alerts/forms/__init__.py 2013-04-20 20:36:31 +0000
@@ -27,20 +27,16 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-Forms in OpenLP are made up of two classes. One class holds all the graphical
-elements, like buttons and lists, and the other class holds all the functional
-code, like slots and loading and saving.
-
-The first class, commonly known as the **Dialog** class, is typically named
-``Ui_<name>Dialog``. It is a slightly modified version of the class that the
-``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()``
-function for translating strings.
-
-The second class, commonly known as the **Form** class, is typically named
-``<name>Form``. This class is the one which is instantiated and used. It uses
-dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class
-mentioned above, like so::
+Forms in OpenLP are made up of two classes. One class holds all the graphical elements, like buttons and lists, and the
+other class holds all the functional code, like slots and loading and saving.
+
+The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
+modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
+converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings.
+
+The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
+is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
+above, like so::
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
@@ -48,9 +44,8 @@
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
-This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
-them separate from the functionality, so that it is easier to recreate the GUI
-from the .ui files later if necessary.
+This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
+so that it is easier to recreate the GUI from the .ui files later if necessary.
"""
from alertform import AlertForm
=== modified file 'openlp/plugins/alerts/forms/alertdialog.py'
--- openlp/plugins/alerts/forms/alertdialog.py 2013-02-14 21:31:17 +0000
+++ openlp/plugins/alerts/forms/alertdialog.py 2013-04-20 20:36:31 +0000
@@ -71,7 +71,7 @@
self.save_button.setObjectName(u'save_button')
self.manage_button_layout.addWidget(self.save_button)
self.delete_button = create_button(alert_dialog, u'delete_button', role=u'delete', enabled=False,
- click=alert_dialog.onDeleteButtonClicked)
+ click=alert_dialog.on_delete_button_clicked)
self.manage_button_layout.addWidget(self.delete_button)
self.manage_button_layout.addStretch()
self.alert_dialog_layout.addLayout(self.manage_button_layout, 1, 1)
=== modified file 'openlp/plugins/alerts/forms/alertform.py'
--- openlp/plugins/alerts/forms/alertform.py 2013-03-13 08:54:39 +0000
+++ openlp/plugins/alerts/forms/alertform.py 2013-04-20 20:36:31 +0000
@@ -93,7 +93,7 @@
if self.trigger_alert(self.alert_text_edit.text()):
self.close()
- def onDeleteButtonClicked(self):
+ def on_delete_button_clicked(self):
"""
Deletes the selected item.
"""
@@ -160,8 +160,7 @@
def on_single_click(self):
"""
- List item has been single clicked to add it to the edit field so it can
- be changed.
+ List item has been single clicked to add it to the edit field so it can be changed.
"""
item = self.alert_list_widget.selectedIndexes()[0]
bitem = self.alert_list_widget.item(item.row())
@@ -186,7 +185,7 @@
translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n'
'Do you want to continue anyway?'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameter_edit.setFocus()
return False
# The ParameterEdit field is not empty, but we have not found '<>'
@@ -195,7 +194,7 @@
translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
'Do you want to continue anyway?'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameter_edit.setFocus()
return False
text = text.replace(u'<>', self.parameter_edit.text())
@@ -204,8 +203,8 @@
def on_current_row_changed(self, row):
"""
- Called when the *alert_list_widget*'s current row has been changed. This
- enables or disables buttons which require an item to act on.
+ Called when the *alert_list_widget*'s current row has been changed. This enables or disables buttons which
+ require an item to act on.
``row``
The row (int). If there is no current row, the value is -1.
=== modified file 'openlp/plugins/alerts/lib/alertsmanager.py'
--- openlp/plugins/alerts/lib/alertsmanager.py 2013-03-29 08:25:33 +0000
+++ openlp/plugins/alerts/lib/alertsmanager.py 2013-04-20 20:36:31 +0000
@@ -27,8 +27,8 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of
-the plugin which manages storing and displaying of alerts.
+The :mod:`~openlp.plugins.alerts.lib.alertsmanager` module contains the part of the plugin which manages storing and
+displaying of alerts.
"""
import logging
@@ -58,15 +58,14 @@
def alert_text(self, message):
"""
- Called via a alerts_text event. Message is single element array
- containing text
+ Called via a alerts_text event. Message is single element array containing text.
"""
if message:
self.display_alert(message[0])
def display_alert(self, text=u''):
"""
- Called from the Alert Tab to display an alert
+ Called from the Alert Tab to display an alert.
``text``
display text
@@ -83,7 +82,7 @@
def generate_alert(self):
"""
- Format and request the Alert and start the timer
+ Format and request the Alert and start the timer.
"""
log.debug(u'Generate Alert called')
if not self.alert_list:
@@ -97,8 +96,7 @@
def timerEvent(self, event):
"""
- Time has finished so if our time then request the next Alert
- if there is one and reset the timer.
+ Time has finished so if our time then request the next Alert if there is one and reset the timer.
``event``
the QT event that has been triggered.
=== modified file 'openlp/plugins/alerts/lib/db.py'
--- openlp/plugins/alerts/lib/db.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/alerts/lib/db.py 2013-04-20 20:36:31 +0000
@@ -27,8 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`db` module provides the database and schema that is the backend for
-the Alerts plugin
+The :mod:`db` module provides the database and schema that is the backend for the Alerts plugin.
"""
from sqlalchemy import Column, Table, types
@@ -36,12 +35,14 @@
from openlp.core.lib.db import BaseModel, init_db
+
class AlertItem(BaseModel):
"""
AlertItem model
"""
pass
+
def init_schema(url):
"""
Setup the alerts database connection and initialise the database schema
=== modified file 'openlp/plugins/bibles/__init__.py'
--- openlp/plugins/bibles/__init__.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/bibles/__init__.py 2013-04-20 20:36:31 +0000
@@ -27,6 +27,5 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`bibles` module provides the Bible plugin to enable OpenLP to display
-scripture.
+The :mod:`bibles` module provides the Bible plugin to enable OpenLP to display scripture.
"""
=== modified file 'openlp/plugins/bibles/bibleplugin.py'
--- openlp/plugins/bibles/bibleplugin.py 2013-03-19 20:05:13 +0000
+++ openlp/plugins/bibles/bibleplugin.py 2013-04-20 20:36:31 +0000
@@ -43,25 +43,25 @@
__default_settings__ = {
- u'bibles/db type': u'sqlite',
- u'bibles/last search type': BibleSearch.Reference,
- u'bibles/verse layout style': LayoutStyle.VersePerSlide,
- u'bibles/book name language': LanguageSelection.Bible,
- u'bibles/display brackets': DisplayStyle.NoBrackets,
- u'bibles/display new chapter': False,
- u'bibles/second bibles': True,
- u'bibles/advanced bible': u'',
- u'bibles/quick bible': u'',
- u'bibles/proxy name': u'',
- u'bibles/proxy address': u'',
- u'bibles/proxy username': u'',
- u'bibles/proxy password': u'',
- u'bibles/bible theme': u'',
- u'bibles/verse separator': u'',
- u'bibles/range separator': u'',
- u'bibles/list separator': u'',
- u'bibles/end separator': u'',
- u'bibles/last directory import': u''
+ u'bibles/db type': u'sqlite',
+ u'bibles/last search type': BibleSearch.Reference,
+ u'bibles/verse layout style': LayoutStyle.VersePerSlide,
+ u'bibles/book name language': LanguageSelection.Bible,
+ u'bibles/display brackets': DisplayStyle.NoBrackets,
+ u'bibles/display new chapter': False,
+ u'bibles/second bibles': True,
+ u'bibles/advanced bible': u'',
+ u'bibles/quick bible': u'',
+ u'bibles/proxy name': u'',
+ u'bibles/proxy address': u'',
+ u'bibles/proxy username': u'',
+ u'bibles/proxy password': u'',
+ u'bibles/bible theme': u'',
+ u'bibles/verse separator': u'',
+ u'bibles/range separator': u'',
+ u'bibles/list separator': u'',
+ u'bibles/end separator': u'',
+ u'bibles/last directory import': u''
}
@@ -124,18 +124,15 @@
def add_export_menu_Item(self, export_menu):
self.export_bible_item = create_action(export_menu, u'exportBibleItem',
- text=translate('BiblesPlugin', '&Bible'),
- visible=False)
+ text=translate('BiblesPlugin', '&Bible'), visible=False)
export_menu.addAction(self.export_bible_item)
def add_tools_menu_item(self, tools_menu):
"""
- Give the bible plugin the opportunity to add items to the
- **Tools** menu.
+ Give the bible plugin the opportunity to add items to the **Tools** menu.
``tools_menu``
- The actual **Tools** menu item, so that your actions can
- use it as their parent.
+ The actual **Tools** menu item, so that your actions can use it as their parent.
"""
log.debug(u'add tools menu')
self.tools_upgrade_item = create_action(tools_menu, u'toolsUpgradeItem',
@@ -166,25 +163,23 @@
def uses_theme(self, theme):
"""
- Called to find out if the bible plugin is currently using a theme.
- Returns ``True`` if the theme is being used, otherwise returns
- ``False``.
+ Called to find out if the bible plugin is currently using a theme. Returns ``True`` if the theme is being used,
+ otherwise returns ``False``.
"""
return unicode(self.settings_tab.bible_theme) == theme
- def rename_theme(self, oldTheme, newTheme):
+ def rename_theme(self, old_theme, new_theme):
"""
Rename the theme the bible plugin is using making the plugin use the
new name.
- ``oldTheme``
- The name of the theme the plugin should stop using. Unused for
- this particular plugin.
+ ``old_theme``
+ The name of the theme the plugin should stop using. Unused for this particular plugin.
- ``newTheme``
+ ``new_theme``
The new name the plugin should now use.
"""
- self.settings_tab.bible_theme = newTheme
+ self.settings_tab.bible_theme = new_theme
self.settings_tab.save()
def set_plugin_text_strings(self):
=== modified file 'openlp/plugins/bibles/forms/__init__.py'
--- openlp/plugins/bibles/forms/__init__.py 2013-01-01 16:33:41 +0000
+++ openlp/plugins/bibles/forms/__init__.py 2013-04-20 20:36:31 +0000
@@ -28,30 +28,25 @@
###############################################################################
"""
-Forms in OpenLP are made up of two classes. One class holds all the graphical
-elements, like buttons and lists, and the other class holds all the functional
-code, like slots and loading and saving.
-
-The first class, commonly known as the **Dialog** class, is typically named
-``Ui_<name>Dialog``. It is a slightly modified version of the class that the
-``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()``
-function for translating strings.
-
-The second class, commonly known as the **Form** class, is typically named
-``<name>Form``. This class is the one which is instantiated and used. It uses
-dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class
-mentioned above, like so::
+Forms in OpenLP are made up of two classes. One class holds all the graphical elements, like buttons and lists, and the
+other class holds all the functional code, like slots and loading and saving.
+
+The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
+modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
+converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings.
+
+The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
+is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
+above, like so::
class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
- def __init__(self, parent, manager, bibleplugin):
+ def __init__(self, parent, manager, bible_plugin):
QtGui.QWizard.__init__(self, parent)
self.setupUi(self)
-This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
-them separate from the functionality, so that it is easier to recreate the GUI
-from the .ui files later if necessary.
+This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality,
+so that it is easier to recreate the GUI from the .ui files later if necessary.
"""
from booknameform import BookNameForm
from languageform import LanguageForm
@@ -59,5 +54,4 @@
from bibleupgradeform import BibleUpgradeForm
from editbibleform import EditBibleForm
-__all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm',
- u'BibleUpgradeForm', u'EditBibleForm']
+__all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm', u'BibleUpgradeForm', u'EditBibleForm']
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2013-04-05 17:41:01 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2013-04-20 20:36:31 +0000
@@ -58,12 +58,12 @@
class BibleImportForm(OpenLPWizard):
"""
- This is the Bible Import Wizard, which allows easy importing of Bibles
- into OpenLP from other formats like OSIS, CSV and OpenSong.
+ This is the 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, bibleplugin):
+ def __init__(self, parent, manager, bible_plugin):
"""
Instantiate the wizard, and run any extra setup we need to.
@@ -73,12 +73,12 @@
``manager``
The Bible manager.
- ``bibleplugin``
+ ``bible_plugin``
The Bible plugin.
"""
self.manager = manager
self.web_bible_list = {}
- OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp')
+ OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp')
def setupUi(self, image):
"""
=== modified file 'openlp/plugins/bibles/forms/bibleupgradeform.py'
--- openlp/plugins/bibles/forms/bibleupgradeform.py 2013-03-19 20:05:13 +0000
+++ openlp/plugins/bibles/forms/bibleupgradeform.py 2013-04-20 20:36:31 +0000
@@ -48,8 +48,8 @@
class BibleUpgradeForm(OpenLPWizard):
"""
- This is the Bible Upgrade Wizard, which allows easy importing of Bibles
- into OpenLP from older OpenLP2 database versions.
+ This is the Bible Upgrade Wizard, which allows easy importing of Bibles into OpenLP from older OpenLP2 database
+ versions.
"""
log.info(u'BibleUpgradeForm loaded')
@@ -63,7 +63,7 @@
``manager``
The Bible manager.
- ``bibleplugin``
+ ``bible_plugin``
The Bible plugin.
"""
self.manager = manager
@@ -74,7 +74,7 @@
self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
self.files = self.manager.old_bible_databases
self.success = {}
- self.newbibles = {}
+ self.new_bibles = {}
OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp')
def setupUi(self, image):
@@ -159,41 +159,41 @@
Add the bible import specific wizard pages.
"""
# Backup Page
- self.backupPage = QtGui.QWizardPage()
- self.backupPage.setObjectName(u'BackupPage')
- self.backupLayout = QtGui.QVBoxLayout(self.backupPage)
+ self.backup_page = QtGui.QWizardPage()
+ self.backup_page.setObjectName(u'BackupPage')
+ self.backupLayout = QtGui.QVBoxLayout(self.backup_page)
self.backupLayout.setObjectName(u'BackupLayout')
- self.backupInfoLabel = QtGui.QLabel(self.backupPage)
+ self.backupInfoLabel = QtGui.QLabel(self.backup_page)
self.backupInfoLabel.setOpenExternalLinks(True)
self.backupInfoLabel.setTextFormat(QtCore.Qt.RichText)
self.backupInfoLabel.setWordWrap(True)
self.backupInfoLabel.setObjectName(u'backupInfoLabel')
self.backupLayout.addWidget(self.backupInfoLabel)
- self.selectLabel = QtGui.QLabel(self.backupPage)
+ self.selectLabel = QtGui.QLabel(self.backup_page)
self.selectLabel.setObjectName(u'select_label')
self.backupLayout.addWidget(self.selectLabel)
self.formLayout = QtGui.QFormLayout()
self.formLayout.setMargin(0)
self.formLayout.setObjectName(u'FormLayout')
- self.backupDirectoryLabel = QtGui.QLabel(self.backupPage)
+ self.backupDirectoryLabel = QtGui.QLabel(self.backup_page)
self.backupDirectoryLabel.setObjectName(u'backupDirectoryLabel')
self.backupDirectoryLayout = QtGui.QHBoxLayout()
self.backupDirectoryLayout.setObjectName(u'BackupDirectoryLayout')
- self.backupDirectoryEdit = QtGui.QLineEdit(self.backupPage)
+ self.backupDirectoryEdit = QtGui.QLineEdit(self.backup_page)
self.backupDirectoryEdit.setObjectName(u'BackupFolderEdit')
self.backupDirectoryLayout.addWidget(self.backupDirectoryEdit)
- self.backupBrowseButton = QtGui.QToolButton(self.backupPage)
+ self.backupBrowseButton = QtGui.QToolButton(self.backup_page)
self.backupBrowseButton.setIcon(self.open_icon)
self.backupBrowseButton.setObjectName(u'BackupBrowseButton')
self.backupDirectoryLayout.addWidget(self.backupBrowseButton)
self.formLayout.addRow(self.backupDirectoryLabel, self.backupDirectoryLayout)
self.backupLayout.addLayout(self.formLayout)
- self.noBackupCheckBox = QtGui.QCheckBox(self.backupPage)
+ self.noBackupCheckBox = QtGui.QCheckBox(self.backup_page)
self.noBackupCheckBox.setObjectName('NoBackupCheckBox')
self.backupLayout.addWidget(self.noBackupCheckBox)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.backupLayout.addItem(self.spacer)
- self.addPage(self.backupPage)
+ self.addPage(self.backup_page)
# Select Page
self.selectPage = QtGui.QWizardPage()
self.selectPage.setObjectName(u'SelectPage')
@@ -247,8 +247,8 @@
self.information_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'This wizard will help you to upgrade your existing Bibles from a prior version of OpenLP 2. '
'Click the next button below to start the upgrade process.'))
- self.backupPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
- self.backupPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
+ self.backup_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
+ self.backup_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please select a backup directory for your Bibles'))
self.backupInfoLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
@@ -277,7 +277,7 @@
"""
if self.currentPage() == self.welcome_page:
return True
- elif self.currentPage() == self.backupPage:
+ elif self.currentPage() == self.backup_page:
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
backup_path = self.backupDirectoryEdit.text()
if not backup_path:
@@ -316,7 +316,7 @@
settings.beginGroup(self.plugin.settings_section)
self.stop_import_flag = False
self.success.clear()
- self.newbibles.clear()
+ self.new_bibles.clear()
self.clearScrollArea()
self.files = self.manager.old_bible_databases
self.addScrollArea()
@@ -372,8 +372,8 @@
name = filename[1]
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') % (number + 1, max_bibles, name))
- self.newbibles[number] = BibleDB(self.media_item, path=self.path, name=name, file=filename[0])
- self.newbibles[number].register(self.plugin.upgrade_wizard)
+ self.new_bibles[number] = BibleDB(self.media_item, path=self.path, name=name, file=filename[0])
+ self.new_bibles[number].register(self.plugin.upgrade_wizard)
metadata = old_bible.get_metadata()
web_bible = False
meta_data = {}
@@ -387,7 +387,7 @@
# Copy the metadata
meta_data[meta[u'key']] = meta[u'value']
if meta[u'key'] != u'name' and meta[u'key'] != u'dbversion':
- self.newbibles[number].save_meta(meta[u'key'], meta[u'value'])
+ self.new_bibles[number].save_meta(meta[u'key'], meta[u'value'])
if meta[u'key'] == u'download_source':
web_bible = True
self.includeWebBible = True
@@ -403,8 +403,8 @@
if not books:
log.error(u'Upgrading books from %s - download name: "%s" failed' % (
meta_data[u'download_source'], meta_data[u'download_name']))
- self.newbibles[number].session.close()
- del self.newbibles[number]
+ self.new_bibles[number].session.close()
+ del self.new_bibles[number]
critical_error_message_box(
translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'),
translate('BiblesPlugin.UpgradeWizardForm',
@@ -419,14 +419,14 @@
meta_data[u'download_source'].lower())
if bible and bible[u'language_id']:
language_id = bible[u'language_id']
- self.newbibles[number].save_meta(u'language_id',
+ self.new_bibles[number].save_meta(u'language_id',
language_id)
else:
- language_id = self.newbibles[number].get_language(name)
+ language_id = self.new_bibles[number].get_language(name)
if not language_id:
log.warn(u'Upgrading from "%s" failed' % filename[0])
- self.newbibles[number].session.close()
- del self.newbibles[number]
+ self.new_bibles[number].session.close()
+ del self.new_bibles[number]
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
@@ -439,17 +439,17 @@
break
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') % (number + 1, max_bibles, name, book))
- book_ref_id = self.newbibles[number].\
+ book_ref_id = self.new_bibles[number].\
get_book_ref_id_by_name(book, len(books), language_id)
if not book_ref_id:
log.warn(u'Upgrading books from %s - download name: "%s" aborted by user' % (
meta_data[u'download_source'], meta_data[u'download_name']))
- self.newbibles[number].session.close()
- del self.newbibles[number]
+ self.new_bibles[number].session.close()
+ del self.new_bibles[number]
self.success[number] = False
break
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
- db_book = self.newbibles[number].create_book(book,
+ db_book = self.new_bibles[number].create_book(book,
book_ref_id, book_details[u'testament_id'])
# Try to import already downloaded verses.
oldbook = old_bible.get_book(book)
@@ -462,19 +462,19 @@
if self.stop_import_flag:
self.success[number] = False
break
- self.newbibles[number].create_verse(db_book.id,
+ self.new_bibles[number].create_verse(db_book.id,
int(verse[u'chapter']),
int(verse[u'verse']), unicode(verse[u'text']))
self.application.process_events()
- self.newbibles[number].session.commit()
+ self.new_bibles[number].session.commit()
else:
- language_id = self.newbibles[number].get_object(BibleMeta, u'language_id')
+ language_id = self.new_bibles[number].get_object(BibleMeta, u'language_id')
if not language_id:
- language_id = self.newbibles[number].get_language(name)
+ language_id = self.new_bibles[number].get_language(name)
if not language_id:
log.warn(u'Upgrading books from "%s" failed' % name)
- self.newbibles[number].session.close()
- del self.newbibles[number]
+ self.new_bibles[number].session.close()
+ del self.new_bibles[number]
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
@@ -489,41 +489,41 @@
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
(number + 1, max_bibles, name, book[u'name']))
- book_ref_id = self.newbibles[number].get_book_ref_id_by_name(book[u'name'], len(books), language_id)
+ book_ref_id = self.new_bibles[number].get_book_ref_id_by_name(book[u'name'], len(books), language_id)
if not book_ref_id:
log.warn(u'Upgrading books from %s " failed - aborted by user' % name)
- self.newbibles[number].session.close()
- del self.newbibles[number]
+ self.new_bibles[number].session.close()
+ del self.new_bibles[number]
self.success[number] = False
break
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
- db_book = self.newbibles[number].create_book(book[u'name'],
+ db_book = self.new_bibles[number].create_book(book[u'name'],
book_ref_id, book_details[u'testament_id'])
verses = old_bible.get_verses(book[u'id'])
if not verses:
log.warn(u'No verses found to import for book "%s"', book[u'name'])
- self.newbibles[number].delete_book(db_book)
+ self.new_bibles[number].delete_book(db_book)
continue
for verse in verses:
if self.stop_import_flag:
self.success[number] = False
break
- self.newbibles[number].create_verse(db_book.id,
+ self.new_bibles[number].create_verse(db_book.id,
int(verse[u'chapter']),
int(verse[u'verse']), unicode(verse[u'text']))
self.application.process_events()
- self.newbibles[number].session.commit()
+ self.new_bibles[number].session.commit()
if not self.success.get(number, True):
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
else:
self.success[number] = True
- self.newbibles[number].save_meta(u'name', name)
+ self.new_bibles[number].save_meta(u'name', name)
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
- if number in self.newbibles:
- self.newbibles[number].session.close()
+ if number in self.new_bibles:
+ self.new_bibles[number].session.close()
# Close the last bible's connection if possible.
if old_bible is not None:
old_bible.close_connection()
=== modified file 'openlp/plugins/bibles/forms/booknamedialog.py'
--- openlp/plugins/bibles/forms/booknamedialog.py 2013-01-27 20:36:18 +0000
+++ openlp/plugins/bibles/forms/booknamedialog.py 2013-04-20 20:36:31 +0000
@@ -33,66 +33,66 @@
from openlp.core.lib.ui import create_button_box
class Ui_BookNameDialog(object):
- def setupUi(self, bookNameDialog):
- bookNameDialog.setObjectName(u'bookNameDialog')
- bookNameDialog.resize(400, 271)
- self.bookNameLayout = QtGui.QVBoxLayout(bookNameDialog)
- self.bookNameLayout.setSpacing(8)
- self.bookNameLayout.setMargin(8)
- self.bookNameLayout.setObjectName(u'bookNameLayout')
- self.infoLabel = QtGui.QLabel(bookNameDialog)
- self.infoLabel.setWordWrap(True)
- self.infoLabel.setObjectName(u'infoLabel')
- self.bookNameLayout.addWidget(self.infoLabel)
- self.correspondingLayout = QtGui.QGridLayout()
- self.correspondingLayout.setColumnStretch(1, 1)
- self.correspondingLayout.setSpacing(8)
- self.correspondingLayout.setObjectName(u'correspondingLayout')
- self.currentLabel = QtGui.QLabel(bookNameDialog)
+ def setupUi(self, book_name_dialog):
+ book_name_dialog.setObjectName(u'book_name_dialog')
+ book_name_dialog.resize(400, 271)
+ self.book_name_layout = QtGui.QVBoxLayout(book_name_dialog)
+ self.book_name_layout.setSpacing(8)
+ self.book_name_layout.setMargin(8)
+ self.book_name_layout.setObjectName(u'book_name_layout')
+ self.info_label = QtGui.QLabel(book_name_dialog)
+ self.info_label.setWordWrap(True)
+ self.info_label.setObjectName(u'info_label')
+ self.book_name_layout.addWidget(self.info_label)
+ self.corresponding_layout = QtGui.QGridLayout()
+ self.corresponding_layout.setColumnStretch(1, 1)
+ self.corresponding_layout.setSpacing(8)
+ self.corresponding_layout.setObjectName(u'corresponding_layout')
+ self.currentLabel = QtGui.QLabel(book_name_dialog)
self.currentLabel.setObjectName(u'currentLabel')
- self.correspondingLayout.addWidget(self.currentLabel, 0, 0, 1, 1)
- self.currentBookLabel = QtGui.QLabel(bookNameDialog)
- self.currentBookLabel.setObjectName(u'currentBookLabel')
- self.correspondingLayout.addWidget(self.currentBookLabel, 0, 1, 1, 1)
- self.correspondingLabel = QtGui.QLabel(bookNameDialog)
+ self.corresponding_layout.addWidget(self.currentLabel, 0, 0, 1, 1)
+ self.current_book_label = QtGui.QLabel(book_name_dialog)
+ self.current_book_label.setObjectName(u'current_book_label')
+ self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1)
+ self.correspondingLabel = QtGui.QLabel(book_name_dialog)
self.correspondingLabel.setObjectName(u'correspondingLabel')
- self.correspondingLayout.addWidget(self.correspondingLabel, 1, 0, 1, 1)
- self.correspondingComboBox = QtGui.QComboBox(bookNameDialog)
- self.correspondingComboBox.setObjectName(u'correspondingComboBox')
- self.correspondingLayout.addWidget(self.correspondingComboBox, 1, 1, 1, 1)
- self.bookNameLayout.addLayout(self.correspondingLayout)
- self.optionsGroupBox = QtGui.QGroupBox(bookNameDialog)
- self.optionsGroupBox.setObjectName(u'optionsGroupBox')
- self.optionsLayout = QtGui.QVBoxLayout(self.optionsGroupBox)
- self.optionsLayout.setSpacing(8)
- self.optionsLayout.setMargin(8)
- self.optionsLayout.setObjectName(u'optionsLayout')
- self.oldTestamentCheckBox = QtGui.QCheckBox(self.optionsGroupBox)
- self.oldTestamentCheckBox.setObjectName(u'oldTestamentCheckBox')
- self.oldTestamentCheckBox.setCheckState(QtCore.Qt.Checked)
- self.optionsLayout.addWidget(self.oldTestamentCheckBox)
- self.newTestamentCheckBox = QtGui.QCheckBox(self.optionsGroupBox)
- self.newTestamentCheckBox.setObjectName(u'newTestamentCheckBox')
- self.newTestamentCheckBox.setCheckState(QtCore.Qt.Checked)
- self.optionsLayout.addWidget(self.newTestamentCheckBox)
- self.apocryphaCheckBox = QtGui.QCheckBox(self.optionsGroupBox)
- self.apocryphaCheckBox.setObjectName(u'apocryphaCheckBox')
- self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
- self.optionsLayout.addWidget(self.apocryphaCheckBox)
- self.bookNameLayout.addWidget(self.optionsGroupBox)
- self.button_box = create_button_box(bookNameDialog, u'button_box', [u'cancel', u'ok'])
- self.bookNameLayout.addWidget(self.button_box)
-
- self.retranslateUi(bookNameDialog)
-
- def retranslateUi(self, bookNameDialog):
- bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
- self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog',
+ self.corresponding_layout.addWidget(self.correspondingLabel, 1, 0, 1, 1)
+ self.corresponding_combo_box = QtGui.QComboBox(book_name_dialog)
+ self.corresponding_combo_box.setObjectName(u'corresponding_combo_box')
+ self.corresponding_layout.addWidget(self.corresponding_combo_box, 1, 1, 1, 1)
+ self.book_name_layout.addLayout(self.corresponding_layout)
+ self.options_group_box = QtGui.QGroupBox(book_name_dialog)
+ self.options_group_box.setObjectName(u'options_group_box')
+ self.options_layout = QtGui.QVBoxLayout(self.options_group_box)
+ self.options_layout.setSpacing(8)
+ self.options_layout.setMargin(8)
+ self.options_layout.setObjectName(u'options_layout')
+ self.old_testament_check_box = QtGui.QCheckBox(self.options_group_box)
+ self.old_testament_check_box.setObjectName(u'old_testament_check_box')
+ self.old_testament_check_box.setCheckState(QtCore.Qt.Checked)
+ self.options_layout.addWidget(self.old_testament_check_box)
+ self.new_testament_check_box = QtGui.QCheckBox(self.options_group_box)
+ self.new_testament_check_box.setObjectName(u'new_testament_check_box')
+ self.new_testament_check_box.setCheckState(QtCore.Qt.Checked)
+ self.options_layout.addWidget(self.new_testament_check_box)
+ self.apocrypha_check_box = QtGui.QCheckBox(self.options_group_box)
+ self.apocrypha_check_box.setObjectName(u'apocrypha_check_box')
+ self.apocrypha_check_box.setCheckState(QtCore.Qt.Checked)
+ self.options_layout.addWidget(self.apocrypha_check_box)
+ self.book_name_layout.addWidget(self.options_group_box)
+ self.button_box = create_button_box(book_name_dialog, u'button_box', [u'cancel', u'ok'])
+ self.book_name_layout.addWidget(self.button_box)
+
+ self.retranslateUi(book_name_dialog)
+
+ def retranslateUi(self, book_name_dialog):
+ book_name_dialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
+ self.info_label.setText(translate('BiblesPlugin.BookNameDialog',
'The following book name cannot be matched up internally. '
'Please select the corresponding name from the list.'))
self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
self.correspondingLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
- self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
- self.oldTestamentCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
- self.newTestamentCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))
- self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Apocrypha'))
+ self.options_group_box.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
+ self.old_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
+ self.new_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))
+ self.apocrypha_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'Apocrypha'))
=== modified file 'openlp/plugins/bibles/forms/booknameform.py'
--- openlp/plugins/bibles/forms/booknameform.py 2013-03-14 22:22:18 +0000
+++ openlp/plugins/bibles/forms/booknameform.py 2013-04-20 20:36:31 +0000
@@ -66,61 +66,61 @@
"""
Set up the signals used in the booknameform.
"""
- self.oldTestamentCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
- self.newTestamentCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
- self.apocryphaCheckBox.stateChanged.connect(self.onCheckBoxIndexChanged)
+ self.old_testament_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
+ self.new_testament_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
+ self.apocrypha_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
def onCheckBoxIndexChanged(self, index):
"""
Reload Combobox if CheckBox state has changed
"""
- self.reloadComboBox()
+ self.reload_combo_box()
- def reloadComboBox(self):
+ def reload_combo_box(self):
"""
Reload the Combobox items
"""
- self.correspondingComboBox.clear()
+ self.corresponding_combo_box.clear()
items = BiblesResourcesDB.get_books()
for item in items:
- addBook = True
+ add_book = True
for book in self.books:
if book.book_reference_id == item[u'id']:
- addBook = False
+ add_book = False
break
- if self.oldTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 1:
- addBook = False
- elif self.newTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 2:
- addBook = False
- elif self.apocryphaCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 3:
- addBook = False
- if addBook:
- self.correspondingComboBox.addItem(self.book_names[item[u'abbreviation']])
+ if self.old_testament_check_box.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 1:
+ add_book = False
+ elif self.new_testament_check_box.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 2:
+ add_book = False
+ elif self.apocrypha_check_box.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 3:
+ add_book = False
+ if add_book:
+ self.corresponding_combo_box.addItem(self.book_names[item[u'abbreviation']])
- def exec_(self, name, books, maxbooks):
+ def exec_(self, name, books, max_books):
self.books = books
- log.debug(maxbooks)
- if maxbooks <= 27:
- self.oldTestamentCheckBox.setCheckState(QtCore.Qt.Unchecked)
- self.apocryphaCheckBox.setCheckState(QtCore.Qt.Unchecked)
- elif maxbooks <= 66:
- self.apocryphaCheckBox.setCheckState(QtCore.Qt.Unchecked)
- self.reloadComboBox()
- self.currentBookLabel.setText(unicode(name))
- self.correspondingComboBox.setFocus()
+ log.debug(max_books)
+ if max_books <= 27:
+ self.old_testament_check_box.setCheckState(QtCore.Qt.Unchecked)
+ self.apocrypha_check_box.setCheckState(QtCore.Qt.Unchecked)
+ elif max_books <= 66:
+ self.apocrypha_check_box.setCheckState(QtCore.Qt.Unchecked)
+ self.reload_combo_box()
+ self.current_book_label.setText(unicode(name))
+ self.corresponding_combo_box.setFocus()
return QDialog.exec_(self)
def accept(self):
- if self.correspondingComboBox.currentText() == u'':
+ if not self.corresponding_combo_box.currentText():
critical_error_message_box(message=translate('BiblesPlugin.BookNameForm', 'You need to select a book.'))
- self.correspondingComboBox.setFocus()
+ self.corresponding_combo_box.setFocus()
return False
else:
- cor_book = self.correspondingComboBox.currentText()
+ cor_book = self.corresponding_combo_box.currentText()
for character in u'\\.^$*+?{}[]()':
cor_book = cor_book.replace(character, u'\\' + character)
- books = filter(lambda key:
- re.match(cor_book, unicode(self.book_names[key]), re.UNICODE), self.book_names.keys())
+ books = filter(
+ lambda key: re.match(cor_book, unicode(self.book_names[key]), re.UNICODE), self.book_names.keys())
books = filter(None, map(BiblesResourcesDB.get_book, books))
if books:
self.book_id = books[0][u'id']
=== modified file 'openlp/plugins/bibles/forms/editbibledialog.py'
--- openlp/plugins/bibles/forms/editbibledialog.py 2013-02-10 10:39:28 +0000
+++ openlp/plugins/bibles/forms/editbibledialog.py 2013-04-20 20:36:31 +0000
@@ -36,118 +36,118 @@
class Ui_EditBibleDialog(object):
- def setupUi(self, editBibleDialog):
- editBibleDialog.setObjectName(u'editBibleDialog')
- editBibleDialog.resize(520, 400)
- editBibleDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
- editBibleDialog.setModal(True)
- self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
- self.dialogLayout.setSpacing(8)
- self.dialogLayout.setContentsMargins(8, 8, 8, 8)
- self.dialogLayout.setObjectName(u'dialog_layout')
- self.bibleTabWidget = QtGui.QTabWidget(editBibleDialog)
- self.bibleTabWidget.setObjectName(u'BibleTabWidget')
+ def setupUi(self, edit_bible_dialog):
+ edit_bible_dialog.setObjectName(u'edit_bible_dialog')
+ edit_bible_dialog.resize(520, 400)
+ edit_bible_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
+ edit_bible_dialog.setModal(True)
+ self.dialog_layout = QtGui.QVBoxLayout(edit_bible_dialog)
+ self.dialog_layout.setSpacing(8)
+ self.dialog_layout.setContentsMargins(8, 8, 8, 8)
+ self.dialog_layout.setObjectName(u'dialog_layout')
+ self.bible_tab_widget = QtGui.QTabWidget(edit_bible_dialog)
+ self.bible_tab_widget.setObjectName(u'BibleTabWidget')
# Meta tab
- self.metaTab = QtGui.QWidget()
- self.metaTab.setObjectName(u'metaTab')
- self.metaTabLayout = QtGui.QVBoxLayout(self.metaTab)
- self.metaTabLayout.setObjectName(u'metaTabLayout')
- self.licenseDetailsGroupBox = QtGui.QGroupBox(self.metaTab)
- self.licenseDetailsGroupBox.setObjectName(u'licenseDetailsGroupBox')
- self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsGroupBox)
- self.licenseDetailsLayout.setObjectName(u'licenseDetailsLayout')
- self.versionNameLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
- self.versionNameLabel.setObjectName(u'versionNameLabel')
- self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
- self.versionNameEdit.setObjectName(u'versionNameEdit')
- self.versionNameLabel.setBuddy(self.versionNameEdit)
- self.licenseDetailsLayout.addRow(self.versionNameLabel, self.versionNameEdit)
- self.copyrightLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
- self.copyrightLabel.setObjectName(u'copyrightLabel')
- self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
- self.copyrightEdit.setObjectName(u'copyright_edit')
- self.copyrightLabel.setBuddy(self.copyrightEdit)
- self.licenseDetailsLayout.addRow(self.copyrightLabel, self.copyrightEdit)
- self.permissionsLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
- self.permissionsLabel.setObjectName(u'permissionsLabel')
- self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
- self.permissionsEdit.setObjectName(u'permissionsEdit')
- self.permissionsLabel.setBuddy(self.permissionsEdit)
- self.licenseDetailsLayout.addRow(self.permissionsLabel, self.permissionsEdit)
- self.metaTabLayout.addWidget(self.licenseDetailsGroupBox)
- self.languageSelectionGroupBox = QtGui.QGroupBox(self.metaTab)
- self.languageSelectionGroupBox.setObjectName(u'languageSelectionGroupBox')
- self.languageSelectionLayout = QtGui.QVBoxLayout(self.languageSelectionGroupBox)
- self.languageSelectionLabel = QtGui.QLabel(self.languageSelectionGroupBox)
- self.languageSelectionLabel.setObjectName(u'languageSelectionLabel')
- self.languageSelectionComboBox = QtGui.QComboBox(self.languageSelectionGroupBox)
- self.languageSelectionComboBox.setObjectName(u'languageSelectionComboBox')
- self.languageSelectionComboBox.addItems([u'', u'', u'', u''])
- self.languageSelectionLayout.addWidget(self.languageSelectionLabel)
- self.languageSelectionLayout.addWidget(self.languageSelectionComboBox)
- self.metaTabLayout.addWidget(self.languageSelectionGroupBox)
- self.metaTabLayout.addStretch()
- self.bibleTabWidget.addTab(self.metaTab, u'')
+ self.meta_tab = QtGui.QWidget()
+ self.meta_tab.setObjectName(u'meta_tab')
+ self.meta_tab_layout = QtGui.QVBoxLayout(self.meta_tab)
+ self.meta_tab_layout.setObjectName(u'meta_tab_layout')
+ self.license_details_group_box = QtGui.QGroupBox(self.meta_tab)
+ self.license_details_group_box.setObjectName(u'license_details_group_box')
+ self.license_details_layout = QtGui.QFormLayout(self.license_details_group_box)
+ self.license_details_layout.setObjectName(u'license_details_layout')
+ self.version_name_label = QtGui.QLabel(self.license_details_group_box)
+ self.version_name_label.setObjectName(u'version_name_label')
+ self.version_name_edit = QtGui.QLineEdit(self.license_details_group_box)
+ self.version_name_edit.setObjectName(u'version_name_edit')
+ self.version_name_label.setBuddy(self.version_name_edit)
+ self.license_details_layout.addRow(self.version_name_label, self.version_name_edit)
+ self.copyright_label = QtGui.QLabel(self.license_details_group_box)
+ self.copyright_label.setObjectName(u'copyright_label')
+ self.copyright_edit = QtGui.QLineEdit(self.license_details_group_box)
+ self.copyright_edit.setObjectName(u'copyright_edit')
+ self.copyright_label.setBuddy(self.copyright_edit)
+ self.license_details_layout.addRow(self.copyright_label, self.copyright_edit)
+ self.permissions_label = QtGui.QLabel(self.license_details_group_box)
+ self.permissions_label.setObjectName(u'permissions_label')
+ self.permissions_edit = QtGui.QLineEdit(self.license_details_group_box)
+ self.permissions_edit.setObjectName(u'permissions_edit')
+ self.permissions_label.setBuddy(self.permissions_edit)
+ self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)
+ self.meta_tab_layout.addWidget(self.license_details_group_box)
+ self.language_selection_group_box = QtGui.QGroupBox(self.meta_tab)
+ self.language_selection_group_box.setObjectName(u'language_selection_group_box')
+ self.language_selection_layout = QtGui.QVBoxLayout(self.language_selection_group_box)
+ self.language_selection_label = QtGui.QLabel(self.language_selection_group_box)
+ self.language_selection_label.setObjectName(u'language_selection_label')
+ self.language_selection_combo_box = QtGui.QComboBox(self.language_selection_group_box)
+ self.language_selection_combo_box.setObjectName(u'language_selection_combo_box')
+ self.language_selection_combo_box.addItems([u'', u'', u'', u''])
+ self.language_selection_layout.addWidget(self.language_selection_label)
+ self.language_selection_layout.addWidget(self.language_selection_combo_box)
+ self.meta_tab_layout.addWidget(self.language_selection_group_box)
+ self.meta_tab_layout.addStretch()
+ self.bible_tab_widget.addTab(self.meta_tab, u'')
# Book name tab
- self.bookNameTab = QtGui.QWidget()
- self.bookNameTab.setObjectName(u'bookNameTab')
- self.bookNameTabLayout = QtGui.QVBoxLayout(self.bookNameTab)
- self.bookNameTabLayout.setObjectName(u'bookNameTabLayout')
- self.bookNameNotice = QtGui.QLabel(self.bookNameTab)
- self.bookNameNotice.setObjectName(u'bookNameNotice')
- self.bookNameNotice.setWordWrap(True)
- self.bookNameTabLayout.addWidget(self.bookNameNotice)
- self.scrollArea = QtGui.QScrollArea(self.bookNameTab)
- self.scrollArea.setWidgetResizable(True)
- self.scrollArea.setObjectName(u'scrollArea')
- self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
- self.bookNameWidget = QtGui.QWidget(self.scrollArea)
- self.bookNameWidget.setObjectName(u'bookNameWidget')
- self.bookNameWidgetLayout = QtGui.QFormLayout(self.bookNameWidget)
- self.bookNameWidgetLayout.setObjectName(u'bookNameWidgetLayout')
- self.bookNameLabel = {}
- self.bookNameEdit= {}
+ self.book_name_tab = QtGui.QWidget()
+ self.book_name_tab.setObjectName(u'book_name_tab')
+ self.book_name_tab_layout = QtGui.QVBoxLayout(self.book_name_tab)
+ self.book_name_tab_layout.setObjectName(u'book_name_tab_layout')
+ self.book_name_notice = QtGui.QLabel(self.book_name_tab)
+ self.book_name_notice.setObjectName(u'book_name_notice')
+ self.book_name_notice.setWordWrap(True)
+ self.book_name_tab_layout.addWidget(self.book_name_notice)
+ self.scroll_area = QtGui.QScrollArea(self.book_name_tab)
+ self.scroll_area.setWidgetResizable(True)
+ self.scroll_area.setObjectName(u'scroll_area')
+ self.scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.book_name_widget = QtGui.QWidget(self.scroll_area)
+ self.book_name_widget.setObjectName(u'book_name_widget')
+ self.book_name_widget_layout = QtGui.QFormLayout(self.book_name_widget)
+ self.book_name_widget_layout.setObjectName(u'book_name_widget_layout')
+ self.book_name_label = {}
+ self.book_name_edit= {}
for book in BiblesResourcesDB.get_books():
- self.bookNameLabel[book[u'abbreviation']] = QtGui.QLabel(self.bookNameWidget)
- self.bookNameLabel[book[u'abbreviation']].setObjectName(u'bookNameLabel[%s]' % book[u'abbreviation'])
- self.bookNameEdit[book[u'abbreviation']] = QtGui.QLineEdit(self.bookNameWidget)
- self.bookNameEdit[book[u'abbreviation']].setObjectName(u'bookNameEdit[%s]' % book[u'abbreviation'])
- self.bookNameWidgetLayout.addRow(
- self.bookNameLabel[book[u'abbreviation']],
- self.bookNameEdit[book[u'abbreviation']])
- self.scrollArea.setWidget(self.bookNameWidget)
- self.bookNameTabLayout.addWidget(self.scrollArea)
- self.bookNameTabLayout.addStretch()
- self.bibleTabWidget.addTab(self.bookNameTab, u'')
+ self.book_name_label[book[u'abbreviation']] = QtGui.QLabel(self.book_name_widget)
+ self.book_name_label[book[u'abbreviation']].setObjectName(u'book_name_label[%s]' % book[u'abbreviation'])
+ self.book_name_edit[book[u'abbreviation']] = QtGui.QLineEdit(self.book_name_widget)
+ self.book_name_edit[book[u'abbreviation']].setObjectName(u'book_name_edit[%s]' % book[u'abbreviation'])
+ self.book_name_widget_layout.addRow(
+ self.book_name_label[book[u'abbreviation']],
+ self.book_name_edit[book[u'abbreviation']])
+ self.scroll_area.setWidget(self.book_name_widget)
+ self.book_name_tab_layout.addWidget(self.scroll_area)
+ self.book_name_tab_layout.addStretch()
+ self.bible_tab_widget.addTab(self.book_name_tab, u'')
# Last few bits
- self.dialogLayout.addWidget(self.bibleTabWidget)
- self.button_box = create_button_box(editBibleDialog, u'button_box', [u'cancel', u'save'])
- self.dialogLayout.addWidget(self.button_box)
- self.retranslateUi(editBibleDialog)
- QtCore.QMetaObject.connectSlotsByName(editBibleDialog)
+ self.dialog_layout.addWidget(self.bible_tab_widget)
+ self.button_box = create_button_box(edit_bible_dialog, u'button_box', [u'cancel', u'save'])
+ self.dialog_layout.addWidget(self.button_box)
+ self.retranslateUi(edit_bible_dialog)
+ QtCore.QMetaObject.connectSlotsByName(edit_bible_dialog)
- def retranslateUi(self, editBibleDialog):
+ def retranslateUi(self, edit_bible_dialog):
self.book_names = BibleStrings().BookNames
- editBibleDialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
+ edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
# Meta tab
- self.bibleTabWidget.setTabText( self.bibleTabWidget.indexOf(self.metaTab),
+ self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.meta_tab),
translate('SongsPlugin.EditBibleForm', 'Meta Data'))
- self.licenseDetailsGroupBox.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details'))
- self.versionNameLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
- self.copyrightLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
- self.permissionsLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
- self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
- self.languageSelectionLabel.setText(translate('BiblesPlugin.EditBibleForm',
+ self.license_details_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details'))
+ self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
+ self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
+ self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
+ self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
+ self.language_selection_label.setText(translate('BiblesPlugin.EditBibleForm',
'Book name language in search field, search results and on display:'))
- self.languageSelectionComboBox.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings'))
- self.languageSelectionComboBox.setItemText(LanguageSelection.Bible + 1,
+ self.language_selection_combo_box.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings'))
+ self.language_selection_combo_box.setItemText(LanguageSelection.Bible + 1,
translate('BiblesPlugin.EditBibleForm', 'Bible Language'))
- self.languageSelectionComboBox.setItemText(LanguageSelection.Application + 1,
+ self.language_selection_combo_box.setItemText(LanguageSelection.Application + 1,
translate('BiblesPlugin.EditBibleForm', 'Application Language'))
- self.languageSelectionComboBox.setItemText(LanguageSelection.English + 1,
+ self.language_selection_combo_box.setItemText(LanguageSelection.English + 1,
translate('BiblesPlugin.EditBibleForm', 'English'))
# Book name tab
- self.bibleTabWidget.setTabText(self.bibleTabWidget.indexOf(self.bookNameTab),
+ self.bible_tab_widget.setTabText(self.bible_tab_widget.indexOf(self.book_name_tab),
translate('SongsPlugin.EditBibleForm', 'Custom Book Names'))
for book in BiblesResourcesDB.get_books():
- self.bookNameLabel[book[u'abbreviation']].setText(u'%s:' % unicode(self.book_names[book[u'abbreviation']]))
+ self.book_name_label[book[u'abbreviation']].setText(u'%s:' % unicode(self.book_names[book[u'abbreviation']]))
=== modified file 'openlp/plugins/bibles/forms/editbibleform.py'
--- openlp/plugins/bibles/forms/editbibleform.py 2013-03-19 20:05:13 +0000
+++ openlp/plugins/bibles/forms/editbibleform.py 2013-04-20 20:36:31 +0000
@@ -65,33 +65,33 @@
"""
log.debug(u'Load Bible')
self.bible = bible
- self.versionNameEdit.setText(self.manager.get_meta_data(self.bible, u'name').value)
- self.copyrightEdit.setText(self.manager.get_meta_data(self.bible, u'copyright').value)
- self.permissionsEdit.setText(self.manager.get_meta_data(self.bible, u'permissions').value)
+ self.version_name_edit.setText(self.manager.get_meta_data(self.bible, u'name').value)
+ self.copyright_edit.setText(self.manager.get_meta_data(self.bible, u'copyright').value)
+ self.permissions_edit.setText(self.manager.get_meta_data(self.bible, u'permissions').value)
book_name_language = self.manager.get_meta_data(self.bible, u'book_name_language')
if book_name_language and book_name_language.value != u'None':
- self.languageSelectionComboBox.setCurrentIndex(int(book_name_language.value) + 1)
+ self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
self.books = {}
self.webbible = self.manager.get_meta_data(self.bible, u'download_source')
if self.webbible:
- self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
+ self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm',
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.'))
- self.scrollArea.hide()
+ self.scroll_area.hide()
else:
- self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
+ self.book_name_notice.setText(translate('BiblesPlugin.EditBibleForm',
'To use the customized book names, "Bible language" must be selected on the Meta Data tab or, '
'if "Global settings" is selected, on the Bible page in Configure OpenLP.'))
for book in BiblesResourcesDB.get_books():
self.books[book[u'abbreviation']] = self.manager.get_book_by_id(self.bible, book[u'id'])
if self.books[book[u'abbreviation']] and not self.webbible:
- self.bookNameEdit[book[u'abbreviation']].setText(self.books[book[u'abbreviation']].name)
+ self.book_name_edit[book[u'abbreviation']].setText(self.books[book[u'abbreviation']].name)
else:
# It is necessary to remove the Widget otherwise there still
# exists the vertical spacing in QFormLayout
- self.bookNameWidgetLayout.removeWidget(self.bookNameLabel[book[u'abbreviation']])
- self.bookNameLabel[book[u'abbreviation']].hide()
- self.bookNameWidgetLayout.removeWidget(self.bookNameEdit[book[u'abbreviation']])
- self.bookNameEdit[book[u'abbreviation']].hide()
+ self.book_name_widget_layout.removeWidget(self.book_name_label[book[u'abbreviation']])
+ self.book_name_label[book[u'abbreviation']].hide()
+ self.book_name_widget_layout.removeWidget(self.book_name_edit[book[u'abbreviation']])
+ self.book_name_edit[book[u'abbreviation']].hide()
def reject(self):
"""
@@ -106,10 +106,10 @@
Exit Dialog and save data
"""
log.debug(u'BibleEditForm.accept')
- version = self.versionNameEdit.text()
- copyright = self.copyrightEdit.text()
- permissions = self.permissionsEdit.text()
- book_name_language = self.languageSelectionComboBox.currentIndex() - 1
+ version = self.version_name_edit.text()
+ copyright = self.copyright_edit.text()
+ permissions = self.permissions_edit.text()
+ book_name_language = self.language_selection_combo_box.currentIndex() - 1
if book_name_language == -1:
book_name_language = None
if not self.validateMeta(version, copyright):
@@ -118,7 +118,7 @@
custom_names = {}
for abbr, book in self.books.iteritems():
if book:
- custom_names[abbr] = self.bookNameEdit[abbr].text()
+ custom_names[abbr] = self.book_name_edit[abbr].text()
if book.name != custom_names[abbr]:
if not self.validateBook(custom_names[abbr], abbr):
return
@@ -139,19 +139,19 @@
Validate the Meta before saving.
"""
if not name:
- self.versionNameEdit.setFocus()
+ self.version_name_edit.setFocus()
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', 'You need to specify a version name for your Bible.'))
return False
elif not copyright:
- self.copyrightEdit.setFocus()
+ self.copyright_edit.setFocus()
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm',
'You need to set a copyright for your Bible. Bibles in the Public Domain need to be marked as such.'))
return False
elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, u'name').value != \
name:
- self.versionNameEdit.setFocus()
+ self.version_name_edit.setFocus()
critical_error_message_box(translate('BiblesPlugin.BibleEditForm', 'Bible Exists'),
translate('BiblesPlugin.BibleEditForm', 'This Bible already exists. Please import '
'a different Bible or first delete the existing one.'))
@@ -164,13 +164,13 @@
"""
book_regex = re.compile(u'[\d]*[^\d]+$')
if not new_book_name:
- self.bookNameEdit[abbreviation].setFocus()
+ self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') %
self.book_names[abbreviation])
return False
elif not book_regex.match(new_book_name):
- self.bookNameEdit[abbreviation].setFocus()
+ self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.BibleEditForm',
'The book name "%s" is not correct.\nNumbers can only be used at the beginning and must\nbe '
@@ -180,8 +180,8 @@
if book:
if abbr == abbreviation:
continue
- if self.bookNameEdit[abbr].text() == new_book_name:
- self.bookNameEdit[abbreviation].setFocus()
+ if self.book_name_edit[abbr].text() == new_book_name:
+ self.book_name_edit[abbreviation].setFocus()
critical_error_message_box(
translate('BiblesPlugin.BibleEditForm', 'Duplicate Book Name'),
translate('BiblesPlugin.BibleEditForm', 'The Book Name "%s" has been entered more than once.')
=== modified file 'openlp/plugins/bibles/forms/languagedialog.py'
--- openlp/plugins/bibles/forms/languagedialog.py 2013-01-27 20:36:18 +0000
+++ openlp/plugins/bibles/forms/languagedialog.py 2013-04-20 20:36:31 +0000
@@ -33,44 +33,44 @@
from openlp.core.lib.ui import create_button_box
class Ui_LanguageDialog(object):
- def setupUi(self, languageDialog):
- languageDialog.setObjectName(u'languageDialog')
- languageDialog.resize(400, 165)
- self.languageLayout = QtGui.QVBoxLayout(languageDialog)
- self.languageLayout.setSpacing(8)
- self.languageLayout.setMargin(8)
- self.languageLayout.setObjectName(u'languageLayout')
- self.bibleLabel = QtGui.QLabel(languageDialog)
- self.bibleLabel.setObjectName(u'bibleLabel')
- self.languageLayout.addWidget(self.bibleLabel)
- self.infoLabel = QtGui.QLabel(languageDialog)
- self.infoLabel.setWordWrap(True)
- self.infoLabel.setObjectName(u'infoLabel')
- self.languageLayout.addWidget(self.infoLabel)
- self.languageHBoxLayout = QtGui.QHBoxLayout()
- self.languageHBoxLayout.setSpacing(8)
- self.languageHBoxLayout.setObjectName(u'languageHBoxLayout')
- self.languageLabel = QtGui.QLabel(languageDialog)
- self.languageLabel.setObjectName(u'languageLabel')
- self.languageHBoxLayout.addWidget(self.languageLabel)
- self.languageComboBox = QtGui.QComboBox(languageDialog)
+ def setupUi(self, language_dialog):
+ language_dialog.setObjectName(u'language_dialog')
+ language_dialog.resize(400, 165)
+ self.language_layout = QtGui.QVBoxLayout(language_dialog)
+ self.language_layout.setSpacing(8)
+ self.language_layout.setMargin(8)
+ self.language_layout.setObjectName(u'language_layout')
+ self.bible_label = QtGui.QLabel(language_dialog)
+ self.bible_label.setObjectName(u'bible_label')
+ self.language_layout.addWidget(self.bible_label)
+ self.info_label = QtGui.QLabel(language_dialog)
+ self.info_label.setWordWrap(True)
+ self.info_label.setObjectName(u'info_label')
+ self.language_layout.addWidget(self.info_label)
+ self.language_h_box_layout = QtGui.QHBoxLayout()
+ self.language_h_box_layout.setSpacing(8)
+ self.language_h_box_layout.setObjectName(u'language_h_box_layout')
+ self.language_label = QtGui.QLabel(language_dialog)
+ self.language_label.setObjectName(u'language_label')
+ self.language_h_box_layout.addWidget(self.language_label)
+ self.language_combo_box = QtGui.QComboBox(language_dialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.languageComboBox.sizePolicy().hasHeightForWidth())
- self.languageComboBox.setSizePolicy(sizePolicy)
- self.languageComboBox.setObjectName(u'languageComboBox')
- self.languageHBoxLayout.addWidget(self.languageComboBox)
- self.languageLayout.addLayout(self.languageHBoxLayout)
- self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
- self.languageLayout.addWidget(self.button_box)
-
- self.retranslateUi(languageDialog)
-
- def retranslateUi(self, languageDialog):
- languageDialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
- self.bibleLabel.setText(translate('BiblesPlugin.LanguageDialog', ''))
- self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog',
+ sizePolicy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())
+ self.language_combo_box.setSizePolicy(sizePolicy)
+ self.language_combo_box.setObjectName(u'language_combo_box')
+ self.language_h_box_layout.addWidget(self.language_combo_box)
+ self.language_layout.addLayout(self.language_h_box_layout)
+ self.button_box = create_button_box(language_dialog, u'button_box', [u'cancel', u'ok'])
+ self.language_layout.addWidget(self.button_box)
+
+ self.retranslateUi(language_dialog)
+
+ def retranslateUi(self, language_dialog):
+ language_dialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
+ self.bible_label.setText(translate('BiblesPlugin.LanguageDialog', ''))
+ self.info_label.setText(translate('BiblesPlugin.LanguageDialog',
'OpenLP is unable to determine the language of this translation of the Bible. Please select the language '
'from the list below.'))
- self.languageLabel.setText(translate('BiblesPlugin.LanguageDialog', 'Language:'))
+ self.language_label.setText(translate('BiblesPlugin.LanguageDialog', 'Language:'))
=== modified file 'openlp/plugins/bibles/forms/languageform.py'
--- openlp/plugins/bibles/forms/languageform.py 2012-12-29 20:56:56 +0000
+++ openlp/plugins/bibles/forms/languageform.py 2013-04-20 20:36:31 +0000
@@ -40,8 +40,10 @@
Ui_LanguageDialog
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
+
log = logging.getLogger(__name__)
+
class LanguageForm(QDialog, Ui_LanguageDialog):
"""
Class to manage a dialog which ask the user for a language.
@@ -56,19 +58,17 @@
self.setupUi(self)
def exec_(self, bible_name):
- self.languageComboBox.addItem(u'')
+ self.language_combo_box.addItem(u'')
if bible_name:
- self.bibleLabel.setText(unicode(bible_name))
+ self.bible_label.setText(unicode(bible_name))
items = BiblesResourcesDB.get_languages()
- self.languageComboBox.addItems([item[u'name'] for item in items])
+ self.language_combo_box.addItems([item[u'name'] for item in items])
return QDialog.exec_(self)
def accept(self):
- if not self.languageComboBox.currentText():
- critical_error_message_box(
- message=translate('BiblesPlugin.LanguageForm',
- 'You need to choose a language.'))
- self.languageComboBox.setFocus()
+ if not self.language_combo_box.currentText():
+ critical_error_message_box(message=translate('BiblesPlugin.LanguageForm', 'You need to choose a language.'))
+ self.language_combo_box.setFocus()
return False
else:
return QDialog.accept(self)
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2013-02-05 08:05:28 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2013-04-20 20:36:31 +0000
@@ -38,9 +38,11 @@
log = logging.getLogger(__name__)
+
REFERENCE_MATCHES = {}
REFERENCE_SEPARATORS = {}
+
class LayoutStyle(object):
"""
An enumeration for bible screen layout styles.
@@ -62,8 +64,7 @@
class LanguageSelection(object):
"""
- An enumeration for bible bookname language.
- And standard strings for use throughout the bibles plugin.
+ An enumeration for bible bookname language. And standard strings for use throughout the bibles plugin.
"""
Bible = 0
Application = 1
@@ -178,8 +179,7 @@
def update_reference_separators():
"""
- Updates separators and matches for parsing and formating scripture
- references.
+ Updates separators and matches for parsing and formating scripture references.
"""
default_separators = translate('BiblesPlugin',
':|v|V|verse|verses;;-|to;;,|and;;end Double-semicolon delimited separators for parsing references. '
@@ -245,9 +245,8 @@
def parse_reference(reference, bible, language_selection, book_ref_id=False):
"""
- This is the next generation über-awesome function that takes a person's
- typed in string and converts it to a list of references to be queried from
- the Bible database files.
+ This is the next generation über-awesome function that takes a person's typed in string and converts it to a list
+ of references to be queried from the Bible database files.
``reference``
A string. The Bible reference to parse.
@@ -256,16 +255,14 @@
A object. The Bible database object.
``language_selection``
- An int. The language selection the user has choosen in settings
- section.
+ An int. The language selection the user has choosen in settings section.
``book_ref_id``
A string. The book reference id.
Returns ``None`` or a reference list.
- The reference list is a list of tuples, with each tuple structured like
- this::
+ The reference list is a list of tuples, with each tuple structured like this::
(book, chapter, from_verse, to_verse)
@@ -275,8 +272,7 @@
**Reference string details:**
- Each reference starts with the book name and a chapter number. These are
- both mandatory.
+ Each reference starts with the book name and a chapter number. These are both mandatory.
* ``John 3`` refers to Gospel of John chapter 3
@@ -289,38 +285,31 @@
* ``John 3:16`` refers to John chapter 3 verse 16
* ``John 3:16-4:3`` refers to John chapter 3 verse 16 to chapter 4 verse 3
- After a verse reference all further single values are treat as verse in
- the last selected chapter.
+ After a verse reference all further single values are treat as verse in the last selected chapter.
* ``John 3:16-18`` refers to John chapter 3 verses 16 to 18
- After a list separator it is possible to refer to additional verses. They
- are build analog to the first ones. This way it is possible to define each
- number of verse references. It is not possible to refer to verses in
- additional books.
+ After a list separator it is possible to refer to additional verses. They are build analog to the first ones. This
+ way it is possible to define each number of verse references. It is not possible to refer to verses in additional
+ books.
* ``John 3:16,18`` refers to John chapter 3 verses 16 and 18
* ``John 3:16-18,20`` refers to John chapter 3 verses 16 to 18 and 20
- * ``John 3:16-18,4:1`` refers to John chapter 3 verses 16 to 18 and
- chapter 4 verse 1
-
- If there is a range separator without further verse declaration the last
- refered chapter is addressed until the end.
-
- ``range_regex`` is a regular expression which matches for verse range
- declarations:
+ * ``John 3:16-18,4:1`` refers to John chapter 3 verses 16 to 18 and chapter 4 verse 1
+
+ If there is a range separator without further verse declaration the last refered chapter is addressed until the end.
+
+ ``range_regex`` is a regular expression which matches for verse range declarations:
``(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?``
- It starts with a optional chapter reference ``from_chapter`` followed by
- a verse separator.
+ It starts with a optional chapter reference ``from_chapter`` followed by a verse separator.
``(?P<from_verse>[0-9]+)``
The verse reference ``from_verse`` is manditory
``(?P<range_to>%(sep_r)s(?:`` ... ``|%(sep_e)s)?)?``
- A ``range_to`` declaration is optional. It starts with a range separator
- and contains optional a chapter and verse declaration or a end
- separator.
+ A ``range_to`` declaration is optional. It starts with a range separator and contains optional a chapter and
+ verse declaration or a end separator.
``(?:(?P<to_chapter>[0-9]+)%(sep_v)s)?``
The ``to_chapter`` reference with separator is equivalent to group 1.
@@ -328,17 +317,15 @@
``(?P<to_verse>[0-9]+)``
The ``to_verse`` reference is equivalent to group 2.
- The full reference is matched against get_reference_match(u'full'). This
- regular expression looks like this:
+ The full reference is matched against get_reference_match(u'full'). This regular expression looks like this:
``^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*``
- The ``book`` group starts with the first non-whitespace character. There
- are optional leading digits followed by non-digits. The group ends
- before the whitspace in front of the next digit.
+ The ``book`` group starts with the first non-whitespace character. There are optional leading digits followed by
+ non-digits. The group ends before the whitspace in front of the next digit.
``(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$``
- The second group contains all ``ranges``. This can be multiple
- declarations of range_regex separated by a list separator.
+ The second group contains all ``ranges``. This can be multiple declarations of range_regex separated by a list
+ separator.
"""
log.debug(u'parse_reference("%s")', reference)
=== modified file 'openlp/plugins/bibles/lib/csvbible.py'
--- openlp/plugins/bibles/lib/csvbible.py 2013-03-08 08:14:39 +0000
+++ openlp/plugins/bibles/lib/csvbible.py 2013-04-20 20:36:31 +0000
@@ -27,8 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`cvsbible` modules provides a facility to import bibles from a set of
-CSV files.
+The :mod:`cvsbible` modules provides a facility to import bibles from a set of CSV files.
The module expects two mandatory files containing the books and the verses.
@@ -55,8 +54,7 @@
or
"Genesis",1,2,"And the earth was without form, and void; and...."
-All CSV files are expected to use a comma (',') as the delimiter and double
-quotes ('"') as the quote symbol.
+All CSV files are expected to use a comma (',') as the delimiter and double quotes ('"') as the quote symbol.
"""
import logging
import chardet
@@ -65,8 +63,10 @@
from openlp.core.lib import translate
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
+
log = logging.getLogger(__name__)
+
class CSVBible(BibleDB):
"""
This class provides a specialisation for importing of CSV Bibles.
@@ -75,9 +75,8 @@
def __init__(self, parent, **kwargs):
"""
- Loads a Bible from a set of CSV files.
- This class assumes the files contain all the information and
- a clean bible is being loaded.
+ Loads a Bible from a set of CSV files. This class assumes the files contain all the information and a clean
+ bible is being loaded.
"""
log.info(self.__class__.__name__)
BibleDB.__init__(self, parent, **kwargs)
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2013-03-16 16:59:10 +0000
+++ openlp/plugins/bibles/lib/db.py 2013-04-20 20:36:31 +0000
@@ -511,7 +511,7 @@
language = None
language_form = LanguageForm(self.wizard)
if language_form.exec_(bible_name):
- language = unicode(language_form.languageComboBox.currentText())
+ language = unicode(language_form.language_combo_box.currentText())
if not language:
return False
language = BiblesResourcesDB.get_language(language)
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2013-03-30 06:56:28 +0000
+++ openlp/plugins/bibles/lib/http.py 2013-04-20 20:36:31 +0000
@@ -27,8 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`http` module enables OpenLP to retrieve scripture from bible
-websites.
+The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
"""
import logging
import re
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2013-04-16 16:37:26 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2013-04-20 20:36:31 +0000
@@ -61,8 +61,8 @@
def __init__(self, parent, plugin):
self.icon_path = u'songs/song'
- self.lockIcon = build_icon(u':/bibles/bibles_search_lock.png')
- self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png')
+ self.lock_icon = build_icon(u':/bibles/bibles_search_lock.png')
+ self.unlock_icon = build_icon(u':/bibles/bibles_search_unlock.png')
MediaManagerItem.__init__(self, parent, plugin)
# Place to store the search results for both bibles.
self.settings = self.plugin.settings_tab
@@ -73,7 +73,7 @@
self.check_search_result()
Registry().register_function(u'bibles_load_list', self.reload_bibles)
- def __checkSecondBible(self, bible, second_bible):
+ def __check_second_bible(self, bible, second_bible):
"""
Check if the first item is a second bible item or not.
"""
@@ -84,7 +84,7 @@
self.displayResults(bible, second_bible)
return
else:
- item_second_bible = self._decodeQtObject(bitem, 'second_bible')
+ item_second_bible = self._decode_qt_object(bitem, 'second_bible')
if item_second_bible and second_bible or not item_second_bible and not second_bible:
self.displayResults(bible, second_bible)
elif critical_error_message_box(
@@ -95,7 +95,7 @@
self.list_view.clear()
self.displayResults(bible, second_bible)
- def _decodeQtObject(self, bitem, key):
+ def _decode_qt_object(self, bitem, key):
reference = bitem.data(QtCore.Qt.UserRole)
obj = reference[unicode(key)]
return unicode(obj).strip()
@@ -159,7 +159,7 @@
search_button_layout.setObjectName(prefix + u'search_button_layout')
search_button_layout.addStretch()
lockButton = QtGui.QToolButton(tab)
- lockButton.setIcon(self.unlockIcon)
+ lockButton.setIcon(self.unlock_icon)
lockButton.setCheckable(True)
lockButton.setObjectName(prefix + u'LockButton')
search_button_layout.addWidget(lockButton)
@@ -250,7 +250,7 @@
self.quickSearchEdit.returnPressed.connect(self.onQuickSearchButton)
self.searchTabBar.currentChanged.connect(self.onSearchTabBarCurrentChanged)
- def onFocus(self):
+ def on_focus(self):
if self.quickTab.isVisible():
self.quickSearchEdit.setFocus()
else:
@@ -509,9 +509,9 @@
def onLockButtonToggled(self, checked):
if checked:
- self.sender().setIcon(self.lockIcon)
+ self.sender().setIcon(self.lock_icon)
else:
- self.sender().setIcon(self.unlockIcon)
+ self.sender().setIcon(self.unlock_icon)
def onQuickStyleComboBoxChanged(self):
self.settings.layout_style = self.quickStyleComboBox.currentIndex()
@@ -633,7 +633,7 @@
if not self.advancedLockButton.isChecked():
self.list_view.clear()
if self.list_view.count() != 0:
- self.__checkSecondBible(bible, second_bible)
+ self.__check_second_bible(bible, second_bible)
elif self.search_results:
self.displayResults(bible, second_bible)
self.advancedSearchButton.setEnabled(True)
@@ -689,7 +689,7 @@
if not self.quickLockButton.isChecked():
self.list_view.clear()
if self.list_view.count() != 0 and self.search_results:
- self.__checkSecondBible(bible, second_bible)
+ self.__check_second_bible(bible, second_bible)
elif self.search_results:
self.displayResults(bible, second_bible)
self.quickSearchButton.setEnabled(True)
@@ -787,19 +787,19 @@
raw_title = []
verses = VerseReferenceList()
for bitem in items:
- book = self._decodeQtObject(bitem, 'book')
- chapter = int(self._decodeQtObject(bitem, 'chapter'))
- verse = int(self._decodeQtObject(bitem, 'verse'))
- bible = self._decodeQtObject(bitem, 'bible')
- version = self._decodeQtObject(bitem, 'version')
- copyright = self._decodeQtObject(bitem, 'copyright')
- permissions = self._decodeQtObject(bitem, 'permissions')
- text = self._decodeQtObject(bitem, 'text')
- second_bible = self._decodeQtObject(bitem, 'second_bible')
- second_version = self._decodeQtObject(bitem, 'second_version')
- second_copyright = self._decodeQtObject(bitem, 'second_copyright')
- second_permissions = self._decodeQtObject(bitem, 'second_permissions')
- second_text = self._decodeQtObject(bitem, 'second_text')
+ book = self._decode_qt_object(bitem, 'book')
+ chapter = int(self._decode_qt_object(bitem, 'chapter'))
+ verse = int(self._decode_qt_object(bitem, 'verse'))
+ bible = self._decode_qt_object(bitem, 'bible')
+ version = self._decode_qt_object(bitem, 'version')
+ copyright = self._decode_qt_object(bitem, 'copyright')
+ permissions = self._decode_qt_object(bitem, 'permissions')
+ text = self._decode_qt_object(bitem, 'text')
+ second_bible = self._decode_qt_object(bitem, 'second_bible')
+ second_version = self._decode_qt_object(bitem, 'second_version')
+ second_copyright = self._decode_qt_object(bitem, 'second_copyright')
+ second_permissions = self._decode_qt_object(bitem, 'second_permissions')
+ second_text = self._decode_qt_object(bitem, 'second_text')
verses.add(book, chapter, verse, version, copyright, permissions)
verse_text = self.formatVerse(old_chapter, chapter, verse)
if second_bible:
@@ -867,13 +867,13 @@
"""
verse_separator = get_reference_separator(u'sep_v_display')
range_separator = get_reference_separator(u'sep_r_display')
- old_chapter = self._decodeQtObject(old_bitem, 'chapter')
- old_verse = self._decodeQtObject(old_bitem, 'verse')
- start_book = self._decodeQtObject(start_bitem, 'book')
- start_chapter = self._decodeQtObject(start_bitem, 'chapter')
- start_verse = self._decodeQtObject(start_bitem, 'verse')
- start_bible = self._decodeQtObject(start_bitem, 'bible')
- start_second_bible = self._decodeQtObject(start_bitem, 'second_bible')
+ old_chapter = self._decode_qt_object(old_bitem, 'chapter')
+ old_verse = self._decode_qt_object(old_bitem, 'verse')
+ start_book = self._decode_qt_object(start_bitem, 'book')
+ start_chapter = self._decode_qt_object(start_bitem, 'chapter')
+ start_verse = self._decode_qt_object(start_bitem, 'verse')
+ start_bible = self._decode_qt_object(start_bitem, 'bible')
+ start_second_bible = self._decode_qt_object(start_bitem, 'second_bible')
if start_second_bible:
bibles = u'%s, %s' % (start_bible, start_second_bible)
else:
@@ -901,16 +901,16 @@
The item we were previously dealing with.
"""
# Get all the necessary meta data.
- book = self._decodeQtObject(bitem, 'book')
- chapter = int(self._decodeQtObject(bitem, 'chapter'))
- verse = int(self._decodeQtObject(bitem, 'verse'))
- bible = self._decodeQtObject(bitem, 'bible')
- second_bible = self._decodeQtObject(bitem, 'second_bible')
- old_book = self._decodeQtObject(old_bitem, 'book')
- old_chapter = int(self._decodeQtObject(old_bitem, 'chapter'))
- old_verse = int(self._decodeQtObject(old_bitem, 'verse'))
- old_bible = self._decodeQtObject(old_bitem, 'bible')
- old_second_bible = self._decodeQtObject(old_bitem, 'second_bible')
+ book = self._decode_qt_object(bitem, 'book')
+ chapter = int(self._decode_qt_object(bitem, 'chapter'))
+ verse = int(self._decode_qt_object(bitem, 'verse'))
+ bible = self._decode_qt_object(bitem, 'bible')
+ second_bible = self._decode_qt_object(bitem, 'second_bible')
+ old_book = self._decode_qt_object(old_bitem, 'book')
+ old_chapter = int(self._decode_qt_object(old_bitem, 'chapter'))
+ old_verse = int(self._decode_qt_object(old_bitem, 'verse'))
+ old_bible = self._decode_qt_object(old_bitem, 'bible')
+ old_second_bible = self._decode_qt_object(old_bitem, 'second_bible')
if old_bible != bible or old_second_bible != second_bible or old_book != book:
# The bible, second bible or book has changed.
return True
=== modified file 'openlp/plugins/bibles/lib/opensong.py'
--- openlp/plugins/bibles/lib/opensong.py 2013-03-07 08:05:43 +0000
+++ openlp/plugins/bibles/lib/opensong.py 2013-04-20 20:36:31 +0000
@@ -34,16 +34,18 @@
from openlp.core.lib.ui import critical_error_message_box
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
+
log = logging.getLogger(__name__)
+
class OpenSongBible(BibleDB):
"""
OpenSong Bible format importer class.
"""
def __init__(self, parent, **kwargs):
"""
- Constructor to create and set up an instance of the OpenSongBible
- class. This class is used to import Bibles from OpenSong's XML format.
+ Constructor to create and set up an instance of the OpenSongBible class. This class is used to import Bibles
+ from OpenSong's XML format.
"""
log.debug(self.__class__.__name__)
BibleDB.__init__(self, parent, **kwargs)
@@ -75,9 +77,8 @@
file = None
success = True
try:
- # NOTE: We don't need to do any of the normal encoding detection
- # here, because lxml does it's own encoding detection, and the two
- # mechanisms together interfere with each other.
+ # NOTE: We don't need to do any of the normal encoding detection here, because lxml does it's own encoding
+ # detection, and the two mechanisms together interfere with each other.
file = open(self.filename, u'r')
opensong = objectify.parse(file)
bible = opensong.getroot()
@@ -116,16 +117,11 @@
if len(verse_parts) > 1:
number = int(verse_parts[0])
except TypeError:
- log.warn(u'Illegal verse number: %s',
- unicode(verse.attrib[u'n']))
+ log.warn(u'Illegal verse number: %s', unicode(verse.attrib[u'n']))
verse_number = number
else:
verse_number += 1
- self.create_verse(
- db_book.id,
- chapter_number,
- verse_number,
- self.get_text(verse))
+ self.create_verse(db_book.id, chapter_number, verse_number, self.get_text(verse))
self.wizard.increment_progress_bar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
self.session.commit()
=== modified file 'openlp/plugins/bibles/lib/osis.py'
--- openlp/plugins/bibles/lib/osis.py 2013-03-07 08:05:43 +0000
+++ openlp/plugins/bibles/lib/osis.py 2013-04-20 20:36:31 +0000
@@ -39,9 +39,11 @@
log = logging.getLogger(__name__)
+
def replacement(match):
return match.group(2).upper()
+
class OSISBible(BibleDB):
"""
`OSIS <http://www.bibletechnologies.net/>`_ Bible format importer class.
@@ -53,8 +55,7 @@
BibleDB.__init__(self, parent, **kwargs)
self.filename = kwargs[u'filename']
self.language_regex = re.compile(r'<language.*>(.*?)</language>')
- self.verse_regex = re.compile(
- r'<verse osisID="([a-zA-Z0-9 ]*).([0-9]*).([0-9]*)">(.*?)</verse>')
+ self.verse_regex = re.compile(r'<verse osisID="([a-zA-Z0-9 ]*).([0-9]*).([0-9]*)">(.*?)</verse>')
self.note_regex = re.compile(r'<note(.*?)>(.*?)</note>')
self.title_regex = re.compile(r'<title(.*?)>(.*?)</title>')
self.milestone_regex = re.compile(r'<milestone(.*?)/>')
@@ -68,8 +69,7 @@
self.q1_regex = re.compile(r'<q(.*?)level="1"(.*?)>')
self.q2_regex = re.compile(r'<q(.*?)level="2"(.*?)>')
self.trans_regex = re.compile(r'<transChange(.*?)>(.*?)</transChange>')
- self.divine_name_regex = re.compile(
- r'<divineName(.*?)>(.*?)</divineName>')
+ self.divine_name_regex = re.compile(r'<divineName(.*?)>(.*?)</divineName>')
self.spaces_regex = re.compile(r'([ ]{2,})')
filepath = os.path.join(
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', u'resources', u'osisbooks.csv')
@@ -158,10 +158,8 @@
self.wizard.increment_progress_bar(translate('BiblesPlugin.OsisImport', 'Importing %s %s...',
'Importing <book name> <chapter>...') % (book_details[u'name'], chapter))
last_chapter = chapter
- # All of this rigmarol below is because the mod2osis
- # tool from the Sword library embeds XML in the OSIS
- # but neglects to enclose the verse text (with XML) in
- # <[CDATA[ ]]> tags.
+ # All of this rigmarol below is because the mod2osis tool from the Sword library embeds XML in the
+ # OSIS but neglects to enclose the verse text (with XML) in <[CDATA[ ]]> tags.
verse_text = self.note_regex.sub(u'', verse_text)
verse_text = self.title_regex.sub(u'', verse_text)
verse_text = self.milestone_regex.sub(u'', verse_text)
=== modified file 'openlp/plugins/bibles/lib/upgrade.py'
--- openlp/plugins/bibles/lib/upgrade.py 2013-03-16 16:59:10 +0000
+++ openlp/plugins/bibles/lib/upgrade.py 2013-04-20 20:36:31 +0000
@@ -27,8 +27,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
-The :mod:`upgrade` module provides a way for the database and schema that is the
-backend for the Bibles plugin
+The :mod:`upgrade` module provides a way for the database and schema that is the backend for the Bibles plugin.
"""
import logging
=== modified file 'openlp/plugins/bibles/lib/versereferencelist.py'
--- openlp/plugins/bibles/lib/versereferencelist.py 2013-02-04 21:26:27 +0000
+++ openlp/plugins/bibles/lib/versereferencelist.py 2013-04-20 20:36:31 +0000
@@ -29,8 +29,8 @@
class VerseReferenceList(object):
"""
- The VerseReferenceList class encapsulates a list of verse references, but
- maintains the order in which they were added.
+ The VerseReferenceList class encapsulates a list of verse references, but maintains the order in which they were
+ added.
"""
def __init__(self):
=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py 2013-03-29 08:25:33 +0000
+++ openlp/plugins/custom/lib/mediaitem.py 2013-04-20 20:36:31 +0000
@@ -63,14 +63,14 @@
self.has_search = True
# Holds information about whether the edit is remotely triggered and
# which Custom is required.
- self.remoteCustom = -1
+ self.remote_custom = -1
self.manager = plugin.manager
def add_end_header_bar(self):
self.toolbar.addSeparator()
self.add_search_to_toolbar()
# Signals and slots
- QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
+ QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'cleared()'), self.on_clear_text_button_click)
QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.on_search_text_button_clicked)
Registry().register_function(u'custom_load_list', self.load_list)
@@ -119,14 +119,13 @@
def on_new_click(self):
self.edit_custom_form.load_custom(0)
self.edit_custom_form.exec_()
- self.onClearTextButtonClick()
+ self.on_clear_text_button_click()
self.on_selection_change()
- def onRemoteEdit(self, custom_id, preview=False):
+ def on_remote_edit(self, custom_id, preview=False):
"""
- Called by ServiceManager or SlideController by event passing
- the custom Id in the payload along with an indicator to say which
- type of display is required.
+ Called by ServiceManager or SlideController by event passing the custom Id in the payload along with an
+ indicator to say which type of display is required.
"""
custom_id = int(custom_id)
valid = self.manager.get_object(CustomSlide, custom_id)
@@ -134,12 +133,12 @@
self.edit_custom_form.load_custom(custom_id, preview)
if self.edit_custom_form.exec_() == QtGui.QDialog.Accepted:
self.remote_triggered = True
- self.remoteCustom = custom_id
+ self.remote_custom = custom_id
self.auto_select_id = -1
self.on_search_text_button_clicked()
item = self.build_service_item(remote=True)
self.remote_triggered = None
- self.remoteCustom = 1
+ self.remote_custom = 1
if item:
return item
return None
@@ -163,22 +162,21 @@
if check_item_selected(self.list_view, UiStrings().SelectDelete):
items = self.list_view.selectedIndexes()
if QtGui.QMessageBox.question(self,
- UiStrings().ConfirmDelete,
- translate('CustomPlugin.MediaItem',
- 'Are you sure you want to delete the %n selected custom slide(s)?', '',
- QtCore.QCoreApplication.CodecForTr, len(items)),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
- QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
+ UiStrings().ConfirmDelete,
+ translate('CustomPlugin.MediaItem',
+ 'Are you sure you want to delete the %n selected custom slide(s)?', '',
+ QtCore.QCoreApplication.CodecForTr, len(items)),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
+ QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
row_list = [item.row() for item in self.list_view.selectedIndexes()]
row_list.sort(reverse=True)
- id_list = [(item.data(QtCore.Qt.UserRole))
- for item in self.list_view.selectedIndexes()]
+ id_list = [(item.data(QtCore.Qt.UserRole)) for item in self.list_view.selectedIndexes()]
for id in id_list:
self.plugin.manager.delete_object(CustomSlide, id)
self.on_search_text_button_clicked()
- def onFocus(self):
+ def on_focus(self):
self.search_text_edit.setFocus()
def generate_slide_data(self, service_item, item=None, xmlVersion=False,
@@ -186,20 +184,20 @@
"""
Generate the slide data. Needs to be implemented by the plugin.
"""
- item_id = self._get_id_of_item_to_generate(item, self.remoteCustom)
+ item_id = self._get_id_of_item_to_generate(item, self.remote_custom)
service_item.add_capability(ItemCapabilities.CanEdit)
service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop)
service_item.add_capability(ItemCapabilities.CanSoftBreak)
service_item.add_capability(ItemCapabilities.OnLoadUpdate)
- customSlide = self.plugin.manager.get_object(CustomSlide, item_id)
- title = customSlide.title
- credit = customSlide.credits
+ custom_slide = self.plugin.manager.get_object(CustomSlide, item_id)
+ title = custom_slide.title
+ credit = custom_slide.credits
service_item.edit_id = item_id
- theme = customSlide.theme_name
+ theme = custom_slide.theme_name
if theme:
service_item.theme = theme
- custom_xml = CustomXMLParser(customSlide.text)
+ custom_xml = CustomXMLParser(custom_slide.text)
verse_list = custom_xml.get_verses()
raw_slides = [verse[1] for verse in verse_list]
service_item.title = title
@@ -234,15 +232,14 @@
def on_search_text_edit_changed(self, text):
"""
- If search as type enabled invoke the search on each key press.
- If the Title is being searched do not start until 2 characters
- have been entered.
+ If search as type enabled invoke the search on each key press. If the Title is being searched do not start until
+ 2 characters have been entered.
"""
search_length = 2
if len(text) > search_length:
self.on_search_text_button_clicked()
elif not text:
- self.onClearTextButtonClick()
+ self.on_clear_text_button_click()
def service_load(self, item):
"""
@@ -287,7 +284,7 @@
if item.name.lower() == u'custom':
Registry().execute(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
- def onClearTextButtonClick(self):
+ def on_clear_text_button_click(self):
"""
Clear the search text.
"""
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2013-04-19 19:15:12 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-04-20 20:36:31 +0000
@@ -714,7 +714,7 @@
text = self.song_book_combo_box.currentText()
if item == 0 and text:
temp_song_book = text
- self.media_item.songMaintenanceForm.exec_(True)
+ self.media_item.song_maintenance_form.exec_(True)
self.load_authors()
self.load_books()
self.load_topics()
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2013-04-20 20:19:53 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2013-04-20 20:36:31 +0000
@@ -72,27 +72,24 @@
def __init__(self, parent, plugin):
self.icon_path = u'songs/song'
MediaManagerItem.__init__(self, parent, plugin)
- self.editSongForm = EditSongForm(self, self.main_window, self.plugin.manager)
+ self.edit_song_form = EditSongForm(self, self.main_window, self.plugin.manager)
self.openLyrics = OpenLyrics(self.plugin.manager)
self.single_service_item = False
- self.songMaintenanceForm = SongMaintenanceForm(self.plugin.manager, self)
- # Holds information about whether the edit is remotely triggered and
- # which Song is required.
- self.remoteSong = -1
- self.editItem = None
+ self.song_maintenance_form = SongMaintenanceForm(self.plugin.manager, self)
+ # Holds information about whether the edit is remotely triggered and which Song is required.
+ self.remote_song = -1
+ self.edit_item = None
self.quick_preview_allowed = True
self.has_search = True
- def _updateBackgroundAudio(self, song, item):
+ def _update_background_audio(self, song, item):
song.media_files = []
for i, bga in enumerate(item.background_audio):
dest_file = os.path.join(
AppLocation.get_section_data_path(self.plugin.name), u'audio', str(song.id), os.path.split(bga)[1])
check_directory_exists(os.path.split(dest_file)[0])
- shutil.copyfile(os.path.join(AppLocation.get_section_data_path(u'servicemanager'), bga),
- dest_file)
- song.media_files.append(MediaFile.populate(
- weight=i, file_name=dest_file))
+ shutil.copyfile(os.path.join(AppLocation.get_section_data_path(u'servicemanager'), bga), dest_file)
+ song.media_files.append(MediaFile.populate(weight=i, file_name=dest_file))
self.plugin.manager.save_object(song, True)
def add_end_header_bar(self):
@@ -100,12 +97,12 @@
## Song Maintenance Button ##
self.maintenanceAction = self.toolbar.add_toolbar_action('maintenanceAction',
icon=':/songs/song_maintenance.png',
- triggers=self.onSongMaintenanceClick)
+ triggers=self.on_song_maintenance_click)
self.add_search_to_toolbar()
# Signals and slots
Registry().register_function(u'songs_load_list', self.on_song_list_load)
Registry().register_function(u'songs_preview', self.on_preview_click)
- QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
+ QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'cleared()'), self.on_clear_text_button_click)
QtCore.QObject.connect(self.search_text_edit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.on_search_text_button_clicked)
@@ -113,17 +110,17 @@
create_widget_action(self.list_view, separator=True)
create_widget_action(self.list_view,
text=translate('OpenLP.MediaManagerItem', '&Clone'), icon=u':/general/general_clone.png',
- triggers=self.onCloneClick)
+ triggers=self.on_clone_click)
- def onFocus(self):
+ def on_focus(self):
self.search_text_edit.setFocus()
def config_update(self):
"""
- IS triggered when the songs config is updated
+ Is triggered when the songs config is updated
"""
log.debug(u'config_updated')
- self.searchAsYouType = Settings().value(self.settings_section + u'/search as type')
+ self.search_as_you_type = Settings().value(self.settings_section + u'/search as type')
self.updateServiceOnEdit = Settings().value(self.settings_section + u'/update service on edit')
self.addSongFromService = Settings().value(self.settings_section + u'/add song from service',)
@@ -164,23 +161,23 @@
search_type = self.search_text_edit.current_search_type()
if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
- search_results = self.searchEntire(search_keywords)
- self.displayResultsSong(search_results)
+ search_results = self.search_entire(search_keywords)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Titles:
log.debug(u'Titles Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title.like(u'%' + clean_string(search_keywords) + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Lyrics:
log.debug(u'Lyrics Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_lyrics.like(u'%' + clean_string(search_keywords) + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
elif search_type == SongSearch.Authors:
log.debug(u'Authors Search')
search_results = self.plugin.manager.get_all_objects(Author,
Author.display_name.like(u'%' + search_keywords + u'%'), Author.display_name.asc())
- self.displayResultsAuthor(search_results)
+ self.display_results_author(search_results)
elif search_type == SongSearch.Books:
log.debug(u'Books Search')
search_results = self.plugin.manager.get_all_objects(Book,
@@ -191,15 +188,15 @@
search_results = self.plugin.manager.get_all_objects(Book,
Book.name.like(u'%' + search_keywords[0] + u'%'), Book.name.asc())
song_number = re.sub(r'[^0-9]', u'', search_keywords[2])
- self.displayResultsBook(search_results, song_number)
+ self.display_results_book(search_results, song_number)
elif search_type == SongSearch.Themes:
log.debug(u'Theme Search')
search_results = self.plugin.manager.get_all_objects(Song,
Song.theme_name.like(u'%' + search_keywords + u'%'))
- self.displayResultsSong(search_results)
+ self.display_results_song(search_results)
self.check_search_result()
- def searchEntire(self, search_keywords):
+ def search_entire(self, search_keywords):
return self.plugin.manager.get_all_objects(Song,
or_(Song.search_title.like(u'%' + clean_string(search_keywords) + u'%'),
Song.search_lyrics.like(u'%' + clean_string(search_keywords) + u'%'),
@@ -211,17 +208,16 @@
of songs
"""
log.debug(u'on_song_list_load - start')
- # Called to redisplay the song list screen edit from a search
- # or from the exit of the Song edit dialog. If remote editing is active
- # Trigger it and clean up so it will not update again.
- # Push edits to the service manager to update items
- if self.editItem and self.updateServiceOnEdit and not self.remote_triggered:
- item = self.build_service_item(self.editItem)
+ # Called to redisplay the song list screen edit from a search or from the exit of the Song edit dialog. If
+ # remote editing is active Trigger it and clean up so it will not update again. Push edits to the service
+ # manager to update items
+ if self.edit_item and self.updateServiceOnEdit and not self.remote_triggered:
+ item = self.build_service_item(self.edit_item)
self.service_manager.replace_service_item(item)
self.on_search_text_button_clicked()
log.debug(u'on_song_list_load - finished')
- def displayResultsSong(self, searchresults):
+ def display_results_song(self, searchresults):
log.debug(u'display results Song')
self.save_auto_select_id()
self.list_view.clear()
@@ -241,7 +237,7 @@
self.list_view.setCurrentItem(song_name)
self.auto_select_id = -1
- def displayResultsAuthor(self, searchresults):
+ def display_results_author(self, searchresults):
log.debug(u'display results Author')
self.list_view.clear()
for author in searchresults:
@@ -254,7 +250,7 @@
song_name.setData(QtCore.Qt.UserRole, song.id)
self.list_view.addItem(song_name)
- def displayResultsBook(self, searchresults, song_number=False):
+ def display_results_book(self, searchresults, song_number=False):
log.debug(u'display results Book')
self.list_view.clear()
for book in searchresults:
@@ -271,7 +267,7 @@
song_name.setData(QtCore.Qt.UserRole, song.id)
self.list_view.addItem(song_name)
- def onClearTextButtonClick(self):
+ def on_clear_text_button_click(self):
"""
Clear the search text.
"""
@@ -280,11 +276,10 @@
def on_search_text_edit_changed(self, text):
"""
- If search as type enabled invoke the search on each key press.
- If the Lyrics are being searched do not start till 7 characters
- have been entered.
+ If search as type enabled invoke the search on each key press. If the Lyrics are being searched do not start
+ till 7 characters have been entered.
"""
- if self.searchAsYouType:
+ if self.search_as_you_type:
search_length = 1
if self.search_text_edit.current_search_type() == SongSearch.Entire:
search_length = 4
@@ -293,7 +288,7 @@
if len(text) > search_length:
self.on_search_text_button_clicked()
elif not text:
- self.onClearTextButtonClick()
+ self.on_clear_text_button_click()
def on_import_click(self):
if not hasattr(self, u'import_wizard'):
@@ -309,33 +304,32 @@
def on_new_click(self):
log.debug(u'on_new_click')
- self.editSongForm.new_song()
- self.editSongForm.exec_()
- self.onClearTextButtonClick()
+ self.edit_song_form.new_song()
+ self.edit_song_form.exec_()
+ self.on_clear_text_button_click()
self.on_selection_change()
self.auto_select_id = -1
- def onSongMaintenanceClick(self):
- self.songMaintenanceForm.exec_()
+ def on_song_maintenance_click(self):
+ self.song_maintenance_form.exec_()
- def onRemoteEdit(self, song_id, preview=False):
- """
- Called by ServiceManager or SlideController by event passing
- the Song Id in the payload along with an indicator to say which
- type of display is required.
- """
- log.debug(u'onRemoteEdit for song %s' % song_id)
+ def on_remote_edit(self, song_id, preview=False):
+ """
+ Called by ServiceManager or SlideController by event passing the Song Id in the payload along with an indicator
+ to say which type of display is required.
+ """
+ log.debug(u'on_remote_edit for song %s' % song_id)
song_id = int(song_id)
valid = self.plugin.manager.get_object(Song, song_id)
if valid:
- self.editSongForm.load_song(song_id, preview)
- if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
+ self.edit_song_form.load_song(song_id, preview)
+ if self.edit_song_form.exec_() == QtGui.QDialog.Accepted:
self.auto_select_id = -1
self.on_song_list_load()
- self.remoteSong = song_id
+ self.remote_song = song_id
self.remote_triggered = True
item = self.build_service_item(remote=True)
- self.remoteSong = -1
+ self.remote_song = -1
self.remote_triggered = None
if item:
return item
@@ -347,13 +341,13 @@
"""
log.debug(u'on_edit_click')
if check_item_selected(self.list_view, UiStrings().SelectEdit):
- self.editItem = self.list_view.currentItem()
- item_id = self.editItem.data(QtCore.Qt.UserRole)
- self.editSongForm.load_song(item_id, False)
- self.editSongForm.exec_()
+ self.edit_item = self.list_view.currentItem()
+ item_id = self.edit_item.data(QtCore.Qt.UserRole)
+ self.edit_song_form.load_song(item_id, False)
+ self.edit_song_form.exec_()
self.auto_select_id = -1
self.on_song_list_load()
- self.editItem = None
+ self.edit_item = None
def on_delete_click(self):
"""
@@ -362,11 +356,11 @@
if check_item_selected(self.list_view, UiStrings().SelectDelete):
items = self.list_view.selectedIndexes()
if QtGui.QMessageBox.question(self,
- UiStrings().ConfirmDelete,
- translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '',
- QtCore.QCoreApplication.CodecForTr, len(items)),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
- QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
+ UiStrings().ConfirmDelete,
+ translate('SongsPlugin.MediaItem', 'Are you sure you want to delete the %n selected song(s)?', '',
+ QtCore.QCoreApplication.CodecForTr, len(items)),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
+ QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
self.application.set_busy_cursor()
self.main_window.display_progress_bar(len(items))
@@ -390,14 +384,14 @@
self.application.set_normal_cursor()
self.on_search_text_button_clicked()
- def onCloneClick(self):
+ def on_clone_click(self):
"""
Clone a Song
"""
- log.debug(u'onCloneClick')
+ log.debug(u'on_clone_click')
if check_item_selected(self.list_view, UiStrings().SelectEdit):
- self.editItem = self.list_view.currentItem()
- item_id = self.editItem.data(QtCore.Qt.UserRole)
+ self.edit_item = self.list_view.currentItem()
+ item_id = self.edit_item.data(QtCore.Qt.UserRole)
old_song = self.plugin.manager.get_object(Song, item_id)
song_xml = self.openLyrics.song_to_xml(old_song)
new_song = self.openLyrics.xml_to_song(song_xml)
@@ -411,8 +405,8 @@
"""
Generate the slide data. Needs to be implemented by the plugin.
"""
- log.debug(u'generate_slide_data: %s, %s, %s' % (service_item, item, self.remoteSong))
- item_id = self._get_id_of_item_to_generate(item, self.remoteSong)
+ log.debug(u'generate_slide_data: %s, %s, %s' % (service_item, item, self.remote_song))
+ item_id = self._get_id_of_item_to_generate(item, self.remote_song)
service_item.add_capability(ItemCapabilities.CanEdit)
service_item.add_capability(ItemCapabilities.CanPreview)
service_item.add_capability(ItemCapabilities.CanLoop)
@@ -430,8 +424,8 @@
verse_tags_translated = True
if not song.verse_order.strip():
for verse in verse_list:
- # We cannot use from_loose_input() here, because database
- # is supposed to contain English lowercase singlechar tags.
+ # We cannot use from_loose_input() here, because database is supposed to contain English lowercase
+ # singlechar tags.
verse_tag = verse[0][u'type']
verse_index = None
if len(verse_tag) > 1:
@@ -470,9 +464,7 @@
if Settings().value(u'core/ccli number'):
service_item.raw_footer.append(translate('SongsPlugin.MediaItem', 'CCLI License: ') +
Settings().value(u'core/ccli number'))
- service_item.audit = [
- song.title, author_list, song.copyright, unicode(song.ccli_number)
- ]
+ service_item.audit = [song.title, author_list, song.copyright, unicode(song.ccli_number)]
service_item.data_string = {u'title': song.search_title, u'authors': u', '.join(author_list)}
service_item.xml_version = self.openLyrics.song_to_xml(song)
# Add the audio file to the service item.
@@ -489,9 +481,8 @@
if self.plugin.status != PluginStatus.Active or not item.data_string:
return
if item.data_string[u'title'].find(u'@') == -1:
- # This file seems to be an old one (prior to 1.9.5), which means,
- # that the search title (data_string[u'title']) is probably wrong.
- # We add "@" to search title and hope that we do not add any
+ # FIXME: This file seems to be an old one (prior to 1.9.5), which means, that the search title
+ # (data_string[u'title']) is probably wrong. We add "@" to search title and hope that we do not add any
# duplicate. This should work for songs without alternate title.
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(u' ',
@@ -518,12 +509,12 @@
break
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
if add_song and self.addSongFromService:
song = self.openLyrics.xml_to_song(item.xml_version)
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
editId = song.id
self.on_search_text_button_clicked()
elif add_song and not self.addSongFromService:
@@ -531,7 +522,7 @@
song = self.openLyrics.xml_to_song(item.xml_version, True)
# If there's any backing tracks, copy them over.
if item.background_audio:
- self._updateBackgroundAudio(song, item)
+ self._update_background_audio(song, item)
editId = song.id
temporary = True
# Update service with correct song id.
@@ -542,5 +533,5 @@
"""
Search for some songs
"""
- search_results = self.searchEntire(string)
+ search_results = self.search_entire(string)
return [[song.id, song.title] for song in search_results]
Follow ups