forked from openlp/openlp
Plugin cleanups
bzr-revno: 2135
This commit is contained in:
commit
941b427fa6
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -31,8 +31,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
|
||||||
Settings
|
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.core.lib.ui import create_action, UiStrings
|
from openlp.core.lib.ui import create_action, UiStrings
|
||||||
from openlp.core.lib.theme import VerticalType
|
from openlp.core.lib.theme import VerticalType
|
||||||
@ -118,8 +117,7 @@ class AlertsPlugin(Plugin):
|
|||||||
log.info(u'Alerts Plugin loaded')
|
log.info(u'Alerts Plugin loaded')
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
Plugin.__init__(self, u'alerts', plugin_helpers,
|
Plugin.__init__(self, u'alerts', plugin_helpers, settings_tab_class=AlertsTab)
|
||||||
settings_tab_class=AlertsTab)
|
|
||||||
self.weight = -3
|
self.weight = -3
|
||||||
self.iconPath = u':/plugins/plugin_alerts.png'
|
self.iconPath = u':/plugins/plugin_alerts.png'
|
||||||
self.icon = build_icon(self.iconPath)
|
self.icon = build_icon(self.iconPath)
|
||||||
@ -138,8 +136,7 @@ class AlertsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
log.info(u'add tools menu')
|
log.info(u'add tools menu')
|
||||||
self.toolsAlertItem = create_action(tools_menu, u'toolsAlertItem',
|
self.toolsAlertItem = create_action(tools_menu, u'toolsAlertItem',
|
||||||
text=translate('AlertsPlugin', '&Alert'),
|
text=translate('AlertsPlugin', '&Alert'), icon=u':/plugins/plugin_alerts.png',
|
||||||
icon=u':/plugins/plugin_alerts.png',
|
|
||||||
statustip=translate('AlertsPlugin', 'Show an alert message.'),
|
statustip=translate('AlertsPlugin', 'Show an alert message.'),
|
||||||
visible=False, shortcuts=[u'F7'], triggers=self.onAlertsTrigger)
|
visible=False, shortcuts=[u'F7'], triggers=self.onAlertsTrigger)
|
||||||
self.serviceManager.mainwindow.toolsMenu.addAction(self.toolsAlertItem)
|
self.serviceManager.mainwindow.toolsMenu.addAction(self.toolsAlertItem)
|
||||||
@ -164,8 +161,7 @@ class AlertsPlugin(Plugin):
|
|||||||
|
|
||||||
def toggleAlertsState(self):
|
def toggleAlertsState(self):
|
||||||
self.alertsActive = not self.alertsActive
|
self.alertsActive = not self.alertsActive
|
||||||
Settings().setValue(self.settingsSection + u'/active',
|
Settings().setValue(self.settingsSection + u'/active', self.alertsActive)
|
||||||
self.alertsActive)
|
|
||||||
|
|
||||||
def onAlertsTrigger(self):
|
def onAlertsTrigger(self):
|
||||||
self.alertForm.loadList()
|
self.alertForm.loadList()
|
||||||
@ -173,8 +169,7 @@ class AlertsPlugin(Plugin):
|
|||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
|
about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
|
||||||
'<br />The alert plugin controls the displaying of nursery alerts '
|
'<br />The alert plugin controls the displaying of nursery alerts on the display screen.')
|
||||||
'on the display screen.')
|
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
def setPluginTextStrings(self):
|
def setPluginTextStrings(self):
|
||||||
@ -182,13 +177,11 @@ class AlertsPlugin(Plugin):
|
|||||||
Called to define all translatable texts of the plugin
|
Called to define all translatable texts of the plugin
|
||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {u'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
|
||||||
u'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
|
|
||||||
u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
|
u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {u'title': translate('AlertsPlugin', 'Alerts', 'container title')
|
||||||
u'title': translate('AlertsPlugin', 'Alerts', 'container title')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getDisplayJavaScript(self):
|
def getDisplayJavaScript(self):
|
||||||
@ -202,8 +195,7 @@ class AlertsPlugin(Plugin):
|
|||||||
Add CSS to the main display.
|
Add CSS to the main display.
|
||||||
"""
|
"""
|
||||||
align = VerticalType.Names[self.settingsTab.location]
|
align = VerticalType.Names[self.settingsTab.location]
|
||||||
return CSS % (align, self.settingsTab.font_face,
|
return CSS % (align, self.settingsTab.font_face, self.settingsTab.font_size, self.settingsTab.font_color,
|
||||||
self.settingsTab.font_size, self.settingsTab.font_color,
|
|
||||||
self.settingsTab.bg_color)
|
self.settingsTab.bg_color)
|
||||||
|
|
||||||
def getDisplayHtml(self):
|
def getDisplayHtml(self):
|
||||||
@ -222,4 +214,4 @@ class AlertsPlugin(Plugin):
|
|||||||
align = VerticalType.Names[self.settingsTab.location]
|
align = VerticalType.Names[self.settingsTab.location]
|
||||||
frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
|
frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
|
||||||
(align, self.settingsTab.font_face, self.settingsTab.font_size,
|
(align, self.settingsTab.font_face, self.settingsTab.font_size,
|
||||||
self.settingsTab.font_color, self.settingsTab.bg_color))
|
self.settingsTab.font_color, self.settingsTab.bg_color))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -69,34 +69,24 @@ class Ui_AlertDialog(object):
|
|||||||
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
|
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
|
||||||
self.saveButton.setObjectName(u'saveButton')
|
self.saveButton.setObjectName(u'saveButton')
|
||||||
self.manageButtonLayout.addWidget(self.saveButton)
|
self.manageButtonLayout.addWidget(self.saveButton)
|
||||||
self.deleteButton = create_button(alertDialog, u'deleteButton',
|
self.deleteButton = create_button(alertDialog, u'deleteButton', role=u'delete', enabled=False,
|
||||||
role=u'delete', enabled=False,
|
|
||||||
click=alertDialog.onDeleteButtonClicked)
|
click=alertDialog.onDeleteButtonClicked)
|
||||||
self.manageButtonLayout.addWidget(self.deleteButton)
|
self.manageButtonLayout.addWidget(self.deleteButton)
|
||||||
self.manageButtonLayout.addStretch()
|
self.manageButtonLayout.addStretch()
|
||||||
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
|
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
|
||||||
displayIcon = build_icon(u':/general/general_live.png')
|
displayIcon = build_icon(u':/general/general_live.png')
|
||||||
self.displayButton = create_button(alertDialog, u'displayButton',
|
self.displayButton = create_button(alertDialog, u'displayButton', icon=displayIcon, enabled=False)
|
||||||
icon=displayIcon, enabled=False)
|
self.displayCloseButton = create_button(alertDialog, u'displayCloseButton', icon=displayIcon, enabled=False)
|
||||||
self.displayCloseButton = create_button(alertDialog,
|
self.buttonBox = create_button_box(alertDialog, u'buttonBox', [u'close'],
|
||||||
u'displayCloseButton', icon=displayIcon, enabled=False)
|
[self.displayButton, self.displayCloseButton])
|
||||||
self.buttonBox = create_button_box(alertDialog, u'buttonBox',
|
|
||||||
[u'close'], [self.displayButton, self.displayCloseButton])
|
|
||||||
self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
|
self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
|
||||||
self.retranslateUi(alertDialog)
|
self.retranslateUi(alertDialog)
|
||||||
|
|
||||||
def retranslateUi(self, alertDialog):
|
def retranslateUi(self, alertDialog):
|
||||||
alertDialog.setWindowTitle(
|
alertDialog.setWindowTitle(translate('AlertsPlugin.AlertForm', 'Alert Message'))
|
||||||
translate('AlertsPlugin.AlertForm', 'Alert Message'))
|
self.alertEntryLabel.setText(translate('AlertsPlugin.AlertForm', 'Alert &text:'))
|
||||||
self.alertEntryLabel.setText(
|
self.alertParameter.setText(translate('AlertsPlugin.AlertForm', '&Parameter:'))
|
||||||
translate('AlertsPlugin.AlertForm', 'Alert &text:'))
|
self.newButton.setText(translate('AlertsPlugin.AlertForm', '&New'))
|
||||||
self.alertParameter.setText(
|
self.saveButton.setText(translate('AlertsPlugin.AlertForm', '&Save'))
|
||||||
translate('AlertsPlugin.AlertForm', '&Parameter:'))
|
self.displayButton.setText(translate('AlertsPlugin.AlertForm', 'Displ&ay'))
|
||||||
self.newButton.setText(
|
self.displayCloseButton.setText(translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
|
||||||
translate('AlertsPlugin.AlertForm', '&New'))
|
|
||||||
self.saveButton.setText(
|
|
||||||
translate('AlertsPlugin.AlertForm', '&Save'))
|
|
||||||
self.displayButton.setText(
|
|
||||||
translate('AlertsPlugin.AlertForm', 'Displ&ay'))
|
|
||||||
self.displayCloseButton.setText(
|
|
||||||
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -47,22 +47,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
self.item_id = None
|
self.item_id = None
|
||||||
QtGui.QDialog.__init__(self, plugin.formParent)
|
QtGui.QDialog.__init__(self, plugin.formParent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QtCore.QObject.connect(self.displayButton,
|
QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayClicked)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onDisplayClicked)
|
QtCore.QObject.connect(self.displayCloseButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
|
||||||
QtCore.QObject.connect(self.displayCloseButton,
|
QtCore.QObject.connect(self.alertTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
|
QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'), self.onNewClick)
|
||||||
QtCore.QObject.connect(self.alertTextEdit,
|
QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'), self.onSaveClick)
|
||||||
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
|
QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
|
||||||
QtCore.QObject.connect(self.newButton,
|
QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onNewClick)
|
QtCore.QObject.connect(self.alertListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
||||||
QtCore.QObject.connect(self.saveButton,
|
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onSaveClick)
|
|
||||||
QtCore.QObject.connect(self.alertListWidget,
|
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
|
|
||||||
QtCore.QObject.connect(self.alertListWidget,
|
|
||||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
|
|
||||||
QtCore.QObject.connect(self.alertListWidget,
|
|
||||||
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
self.displayButton.setEnabled(False)
|
self.displayButton.setEnabled(False)
|
||||||
@ -75,16 +67,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
Loads the list with alerts.
|
Loads the list with alerts.
|
||||||
"""
|
"""
|
||||||
self.alertListWidget.clear()
|
self.alertListWidget.clear()
|
||||||
alerts = self.manager.get_all_objects(AlertItem,
|
alerts = self.manager.get_all_objects(AlertItem, order_by_ref=AlertItem.text)
|
||||||
order_by_ref=AlertItem.text)
|
|
||||||
for alert in alerts:
|
for alert in alerts:
|
||||||
item_name = QtGui.QListWidgetItem(alert.text)
|
item_name = QtGui.QListWidgetItem(alert.text)
|
||||||
item_name.setData(QtCore.Qt.UserRole, alert.id)
|
item_name.setData(QtCore.Qt.UserRole, alert.id)
|
||||||
self.alertListWidget.addItem(item_name)
|
self.alertListWidget.addItem(item_name)
|
||||||
if alert.text == unicode(self.alertTextEdit.text()):
|
if alert.text == unicode(self.alertTextEdit.text()):
|
||||||
self.item_id = alert.id
|
self.item_id = alert.id
|
||||||
self.alertListWidget.setCurrentRow(
|
self.alertListWidget.setCurrentRow(self.alertListWidget.row(item_name))
|
||||||
self.alertListWidget.row(item_name))
|
|
||||||
|
|
||||||
def onDisplayClicked(self):
|
def onDisplayClicked(self):
|
||||||
self.triggerAlert(self.alertTextEdit.text())
|
self.triggerAlert(self.alertTextEdit.text())
|
||||||
@ -110,9 +100,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
if not self.alertTextEdit.text():
|
if not self.alertTextEdit.text():
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self,
|
||||||
translate('AlertsPlugin.AlertForm', 'New Alert'),
|
translate('AlertsPlugin.AlertForm', 'New Alert'),
|
||||||
translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
|
translate('AlertsPlugin.AlertForm', 'You haven\'t specified any text for your alert. \n'
|
||||||
'any text for your alert. Please type in some text before '
|
'Please type in some text before clicking New.'))
|
||||||
'clicking New.'))
|
|
||||||
else:
|
else:
|
||||||
alert = AlertItem()
|
alert = AlertItem()
|
||||||
alert.text = self.alertTextEdit.text()
|
alert.text = self.alertTextEdit.text()
|
||||||
@ -180,24 +169,20 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
if not text:
|
if not text:
|
||||||
return False
|
return False
|
||||||
# We found '<>' in the alert text, but the ParameterEdit field is empty.
|
# We found '<>' in the alert text, but the ParameterEdit field is empty.
|
||||||
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
|
if text.find(u'<>') != -1 and not self.parameterEdit.text() and QtGui.QMessageBox.question(self,
|
||||||
QtGui.QMessageBox.question(self,
|
translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
|
||||||
translate('AlertsPlugin.AlertForm', 'No Parameter Found'),
|
translate('AlertsPlugin.AlertForm', 'You have not entered a parameter to be replaced.\n'
|
||||||
translate('AlertsPlugin.AlertForm', 'You have not entered a '
|
'Do you want to continue anyway?'),
|
||||||
'parameter to be replaced.\nDo 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.parameterEdit.setFocus()
|
self.parameterEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
# The ParameterEdit field is not empty, but we have not found '<>'
|
# The ParameterEdit field is not empty, but we have not found '<>'
|
||||||
# in the alert text.
|
# in the alert text.
|
||||||
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
|
elif text.find(u'<>') == -1 and self.parameterEdit.text() and QtGui.QMessageBox.question(self,
|
||||||
QtGui.QMessageBox.question(self,
|
translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
|
||||||
translate('AlertsPlugin.AlertForm', 'No Placeholder Found'),
|
translate('AlertsPlugin.AlertForm', 'The alert text does not contain \'<>\'.\n'
|
||||||
translate('AlertsPlugin.AlertForm', 'The alert text does not'
|
'Do you want to continue anyway?'),
|
||||||
' contain \'<>\'.\nDo 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.parameterEdit.setFocus()
|
self.parameterEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
text = text.replace(u'<>', self.parameterEdit.text())
|
text = text.replace(u'<>', self.parameterEdit.text())
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -46,10 +46,8 @@ class AlertsManager(QtCore.QObject):
|
|||||||
self.screen = None
|
self.screen = None
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.alertList = []
|
self.alertList = []
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_active'), self.generateAlert)
|
||||||
QtCore.SIGNAL(u'live_display_active'), self.generateAlert)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'alerts_text'), self.onAlertText)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'alerts_text'), self.onAlertText)
|
|
||||||
|
|
||||||
def onAlertText(self, message):
|
def onAlertText(self, message):
|
||||||
"""
|
"""
|
||||||
@ -71,8 +69,7 @@ class AlertsManager(QtCore.QObject):
|
|||||||
self.alertList.append(text)
|
self.alertList.append(text)
|
||||||
if self.timer_id != 0:
|
if self.timer_id != 0:
|
||||||
Receiver.send_message(u'mainwindow_status_text',
|
Receiver.send_message(u'mainwindow_status_text',
|
||||||
translate('AlertsPlugin.AlertsManager',
|
translate('AlertsPlugin.AlertsManager', 'Alert message created and displayed.'))
|
||||||
'Alert message created and displayed.'))
|
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'mainwindow_status_text', u'')
|
Receiver.send_message(u'mainwindow_status_text', u'')
|
||||||
self.generateAlert()
|
self.generateAlert()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -78,8 +78,7 @@ class AlertsTab(SettingsTab):
|
|||||||
self.timeoutSpinBox.setMaximum(180)
|
self.timeoutSpinBox.setMaximum(180)
|
||||||
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
|
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
|
||||||
self.fontLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
|
self.fontLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
|
||||||
self.verticalLabel, self.verticalComboBox = \
|
self.verticalLabel, self.verticalComboBox = create_valign_selection_widgets(self.fontGroupBox)
|
||||||
create_valign_selection_widgets(self.fontGroupBox)
|
|
||||||
self.verticalLabel.setObjectName(u'verticalLabel')
|
self.verticalLabel.setObjectName(u'verticalLabel')
|
||||||
self.verticalComboBox.setObjectName(u'verticalComboBox')
|
self.verticalComboBox.setObjectName(u'verticalComboBox')
|
||||||
self.fontLayout.addRow(self.verticalLabel, self.verticalComboBox)
|
self.fontLayout.addRow(self.verticalLabel, self.verticalComboBox)
|
||||||
@ -95,54 +94,40 @@ class AlertsTab(SettingsTab):
|
|||||||
self.rightLayout.addWidget(self.previewGroupBox)
|
self.rightLayout.addWidget(self.previewGroupBox)
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.backgroundColorButton,
|
QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onBackgroundColorButtonClicked)
|
self.onBackgroundColorButtonClicked)
|
||||||
QtCore.QObject.connect(self.fontColorButton,
|
QtCore.QObject.connect(self.fontColorButton, QtCore.SIGNAL(u'clicked()'), self.onFontColorButtonClicked)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onFontColorButtonClicked)
|
QtCore.QObject.connect(self.fontComboBox, QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
|
||||||
QtCore.QObject.connect(self.fontComboBox,
|
QtCore.QObject.connect(self.timeoutSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
|
QtCore.QObject.connect(self.fontSizeSpinBox, QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
|
||||||
QtCore.QObject.connect(self.timeoutSpinBox,
|
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged)
|
|
||||||
QtCore.QObject.connect(self.fontSizeSpinBox,
|
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontSizeSpinBoxChanged)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.fontGroupBox.setTitle(
|
self.fontGroupBox.setTitle(translate('AlertsPlugin.AlertsTab', 'Font'))
|
||||||
translate('AlertsPlugin.AlertsTab', 'Font'))
|
self.fontLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font name:'))
|
||||||
self.fontLabel.setText(
|
self.fontColorLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font color:'))
|
||||||
translate('AlertsPlugin.AlertsTab', 'Font name:'))
|
self.backgroundColorLabel.setText(translate('AlertsPlugin.AlertsTab', 'Background color:'))
|
||||||
self.fontColorLabel.setText(
|
self.fontSizeLabel.setText(translate('AlertsPlugin.AlertsTab', 'Font size:'))
|
||||||
translate('AlertsPlugin.AlertsTab', 'Font color:'))
|
|
||||||
self.backgroundColorLabel.setText(
|
|
||||||
translate('AlertsPlugin.AlertsTab', 'Background color:'))
|
|
||||||
self.fontSizeLabel.setText(
|
|
||||||
translate('AlertsPlugin.AlertsTab', 'Font size:'))
|
|
||||||
self.fontSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
self.fontSizeSpinBox.setSuffix(UiStrings().FontSizePtUnit)
|
||||||
self.timeoutLabel.setText(
|
self.timeoutLabel.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
|
||||||
translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
|
|
||||||
self.timeoutSpinBox.setSuffix(UiStrings().Seconds)
|
self.timeoutSpinBox.setSuffix(UiStrings().Seconds)
|
||||||
self.previewGroupBox.setTitle(UiStrings().Preview)
|
self.previewGroupBox.setTitle(UiStrings().Preview)
|
||||||
self.fontPreview.setText(UiStrings().OLPV2x)
|
self.fontPreview.setText(UiStrings().OLPV2x)
|
||||||
|
|
||||||
def onBackgroundColorButtonClicked(self):
|
def onBackgroundColorButtonClicked(self):
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self)
|
||||||
QtGui.QColor(self.bg_color), self)
|
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
self.bg_color = new_color.name()
|
self.bg_color = new_color.name()
|
||||||
self.backgroundColorButton.setStyleSheet(
|
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||||
u'background-color: %s' % self.bg_color)
|
|
||||||
self.updateDisplay()
|
self.updateDisplay()
|
||||||
|
|
||||||
def onFontComboBoxClicked(self):
|
def onFontComboBoxClicked(self):
|
||||||
self.updateDisplay()
|
self.updateDisplay()
|
||||||
|
|
||||||
def onFontColorButtonClicked(self):
|
def onFontColorButtonClicked(self):
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.font_color), self)
|
||||||
QtGui.QColor(self.font_color), self)
|
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
self.font_color = new_color.name()
|
self.font_color = new_color.name()
|
||||||
self.fontColorButton.setStyleSheet(
|
self.fontColorButton.setStyleSheet(u'background-color: %s' % self.font_color)
|
||||||
u'background-color: %s' % self.font_color)
|
|
||||||
self.updateDisplay()
|
self.updateDisplay()
|
||||||
|
|
||||||
def onTimeoutSpinBoxChanged(self):
|
def onTimeoutSpinBoxChanged(self):
|
||||||
@ -165,10 +150,8 @@ class AlertsTab(SettingsTab):
|
|||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.fontSizeSpinBox.setValue(self.font_size)
|
self.fontSizeSpinBox.setValue(self.font_size)
|
||||||
self.timeoutSpinBox.setValue(self.timeout)
|
self.timeoutSpinBox.setValue(self.timeout)
|
||||||
self.fontColorButton.setStyleSheet(
|
self.fontColorButton.setStyleSheet(u'background-color: %s' % self.font_color)
|
||||||
u'background-color: %s' % self.font_color)
|
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||||
self.backgroundColorButton.setStyleSheet(
|
|
||||||
u'background-color: %s' % self.bg_color)
|
|
||||||
self.verticalComboBox.setCurrentIndex(self.location)
|
self.verticalComboBox.setCurrentIndex(self.location)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(self.font_face)
|
font.setFamily(self.font_face)
|
||||||
@ -180,8 +163,7 @@ class AlertsTab(SettingsTab):
|
|||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
# Check value has changed as no event handles this field
|
# Check value has changed as no event handles this field
|
||||||
if settings.value(u'location', 1) != \
|
if settings.value(u'location', 1) != self.verticalComboBox.currentIndex():
|
||||||
self.verticalComboBox.currentIndex():
|
|
||||||
self.changed = True
|
self.changed = True
|
||||||
settings.setValue(u'background color', self.bg_color)
|
settings.setValue(u'background color', self.bg_color)
|
||||||
settings.setValue(u'font color', self.font_color)
|
settings.setValue(u'font color', self.font_color)
|
||||||
@ -202,7 +184,6 @@ class AlertsTab(SettingsTab):
|
|||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
font.setPointSize(self.font_size)
|
font.setPointSize(self.font_size)
|
||||||
self.fontPreview.setFont(font)
|
self.fontPreview.setFont(font)
|
||||||
self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' %
|
self.fontPreview.setStyleSheet(u'background-color: %s; color: %s' % (self.bg_color, self.font_color))
|
||||||
(self.bg_color, self.font_color))
|
|
||||||
self.changed = True
|
self.changed = True
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -31,8 +31,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
|
||||||
Settings
|
|
||||||
from openlp.core.lib.ui import create_action, UiStrings
|
from openlp.core.lib.ui import create_action, UiStrings
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||||
@ -44,8 +43,7 @@ class BiblePlugin(Plugin):
|
|||||||
log.info(u'Bible Plugin loaded')
|
log.info(u'Bible Plugin loaded')
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
Plugin.__init__(self, u'bibles', plugin_helpers,
|
Plugin.__init__(self, u'bibles', plugin_helpers, BibleMediaItem, BiblesTab)
|
||||||
BibleMediaItem, BiblesTab)
|
|
||||||
self.weight = -9
|
self.weight = -9
|
||||||
self.iconPath = u':/plugins/plugin_bibles.png'
|
self.iconPath = u':/plugins/plugin_bibles.png'
|
||||||
self.icon = build_icon(self.iconPath)
|
self.icon = build_icon(self.iconPath)
|
||||||
@ -84,17 +82,16 @@ class BiblePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
if self.manager.old_bible_databases:
|
if self.manager.old_bible_databases:
|
||||||
if QtGui.QMessageBox.information(self.formParent,
|
if QtGui.QMessageBox.information(self.formParent,
|
||||||
translate('OpenLP', 'Information'), translate('OpenLP',
|
translate('OpenLP', 'Information'),
|
||||||
'Bible format has changed.\nYou have to upgrade your '
|
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n'
|
||||||
'existing Bibles.\nShould OpenLP upgrade now?'),
|
'Should OpenLP upgrade now?'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
|
||||||
QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes:
|
||||||
self.onToolsUpgradeItemTriggered()
|
self.onToolsUpgradeItemTriggered()
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
if settings.contains(u'bookname language'):
|
if settings.contains(u'bookname language'):
|
||||||
settings.setValue(u'book name language', settings.value(
|
settings.setValue(u'book name language', settings.value(u'bookname language', 0))
|
||||||
u'bookname language', 0))
|
|
||||||
settings.remove(u'bookname language')
|
settings.remove(u'bookname language')
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
@ -122,8 +119,7 @@ class BiblePlugin(Plugin):
|
|||||||
log.debug(u'add tools menu')
|
log.debug(u'add tools menu')
|
||||||
self.toolsUpgradeItem = create_action(tools_menu, u'toolsUpgradeItem',
|
self.toolsUpgradeItem = create_action(tools_menu, u'toolsUpgradeItem',
|
||||||
text=translate('BiblesPlugin', '&Upgrade older Bibles'),
|
text=translate('BiblesPlugin', '&Upgrade older Bibles'),
|
||||||
statustip=translate('BiblesPlugin',
|
statustip=translate('BiblesPlugin', 'Upgrade the Bible databases to the latest format.'),
|
||||||
'Upgrade the Bible databases to the latest format.'),
|
|
||||||
visible=False, triggers=self.onToolsUpgradeItemTriggered)
|
visible=False, triggers=self.onToolsUpgradeItemTriggered)
|
||||||
tools_menu.addAction(self.toolsUpgradeItem)
|
tools_menu.addAction(self.toolsUpgradeItem)
|
||||||
|
|
||||||
@ -132,8 +128,7 @@ class BiblePlugin(Plugin):
|
|||||||
Upgrade older bible databases.
|
Upgrade older bible databases.
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, u'upgrade_wizard'):
|
if not hasattr(self, u'upgrade_wizard'):
|
||||||
self.upgrade_wizard = BibleUpgradeForm(self.formParent,
|
self.upgrade_wizard = BibleUpgradeForm(self.formParent, self.manager, self)
|
||||||
self.manager, self)
|
|
||||||
# If the import was not cancelled then reload.
|
# If the import was not cancelled then reload.
|
||||||
if self.upgrade_wizard.exec_():
|
if self.upgrade_wizard.exec_():
|
||||||
self.mediaItem.reloadBibles()
|
self.mediaItem.reloadBibles()
|
||||||
@ -194,7 +189,6 @@ class BiblePlugin(Plugin):
|
|||||||
u'preview': translate('BiblesPlugin',
|
u'preview': translate('BiblesPlugin',
|
||||||
'Preview the selected Bible.'),
|
'Preview the selected Bible.'),
|
||||||
u'live': translate('BiblesPlugin', 'Send the selected Bible live.'),
|
u'live': translate('BiblesPlugin', 'Send the selected Bible live.'),
|
||||||
u'service': translate('BiblesPlugin',
|
u'service': translate('BiblesPlugin', 'Add the selected Bible to the service.')
|
||||||
'Add the selected Bible to the service.')
|
|
||||||
}
|
}
|
||||||
self.setPluginUiTextStrings(tooltips)
|
self.setPluginUiTextStrings(tooltips)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -78,16 +78,14 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.web_bible_list = {}
|
self.web_bible_list = {}
|
||||||
OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleImportWizard',
|
OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp')
|
||||||
u':/wizards/wizard_importbible.bmp')
|
|
||||||
|
|
||||||
def setupUi(self, image):
|
def setupUi(self, image):
|
||||||
"""
|
"""
|
||||||
Set up the UI for the bible wizard.
|
Set up the UI for the bible wizard.
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.setupUi(self, image)
|
OpenLPWizard.setupUi(self, image)
|
||||||
QtCore.QObject.connect(self.formatComboBox,
|
QtCore.QObject.connect(self.formatComboBox,QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
|
||||||
self.onCurrentIndexChanged)
|
self.onCurrentIndexChanged)
|
||||||
|
|
||||||
def onCurrentIndexChanged(self, index):
|
def onCurrentIndexChanged(self, index):
|
||||||
@ -119,23 +117,17 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Set up the signals used in the bible importer.
|
Set up the signals used in the bible importer.
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.connect(self.webSourceComboBox,
|
QtCore.QObject.connect(self.webSourceComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
||||||
QtCore.SIGNAL(u'currentIndexChanged(int)'),
|
|
||||||
self.onWebSourceComboBoxIndexChanged)
|
self.onWebSourceComboBoxIndexChanged)
|
||||||
QtCore.QObject.connect(self.osisBrowseButton,
|
QtCore.QObject.connect(self.osisBrowseButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onOsisBrowseButtonClicked)
|
self.onOsisBrowseButtonClicked)
|
||||||
QtCore.QObject.connect(self.csvBooksButton,
|
QtCore.QObject.connect(self.csvBooksButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onCsvBooksBrowseButtonClicked)
|
self.onCsvBooksBrowseButtonClicked)
|
||||||
QtCore.QObject.connect(self.csvVersesButton,
|
QtCore.QObject.connect(self.csvVersesButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onCsvVersesBrowseButtonClicked)
|
self.onCsvVersesBrowseButtonClicked)
|
||||||
QtCore.QObject.connect(self.openSongBrowseButton,
|
QtCore.QObject.connect(self.openSongBrowseButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onOpenSongBrowseButtonClicked)
|
self.onOpenSongBrowseButtonClicked)
|
||||||
QtCore.QObject.connect(self.openlp1BrowseButton,
|
QtCore.QObject.connect(self.openlp1BrowseButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
self.onOpenlp1BrowseButtonClicked)
|
self.onOpenlp1BrowseButtonClicked)
|
||||||
|
|
||||||
def addCustomPages(self):
|
def addCustomPages(self):
|
||||||
@ -155,8 +147,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.formatComboBox.addItems([u'', u'', u'', u'', u''])
|
self.formatComboBox.addItems([u'', u'', u'', u'', u''])
|
||||||
self.formatComboBox.setObjectName(u'FormatComboBox')
|
self.formatComboBox.setObjectName(u'FormatComboBox')
|
||||||
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
|
||||||
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||||
QtGui.QSizePolicy.Minimum)
|
|
||||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectPageLayout.addLayout(self.formatLayout)
|
self.selectPageLayout.addLayout(self.formatLayout)
|
||||||
self.selectStack = QtGui.QStackedLayout()
|
self.selectStack = QtGui.QStackedLayout()
|
||||||
@ -227,8 +218,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.openSongBrowseButton.setIcon(self.openIcon)
|
self.openSongBrowseButton.setIcon(self.openIcon)
|
||||||
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
|
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
|
||||||
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
|
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
|
||||||
self.openSongLayout.addRow(self.openSongFileLabel,
|
self.openSongLayout.addRow(self.openSongFileLabel, self.openSongFileLayout)
|
||||||
self.openSongFileLayout)
|
|
||||||
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectStack.addWidget(self.openSongWidget)
|
self.selectStack.addWidget(self.openSongWidget)
|
||||||
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
|
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
|
||||||
@ -239,23 +229,18 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.webBibleLayout.setObjectName(u'WebBibleLayout')
|
self.webBibleLayout.setObjectName(u'WebBibleLayout')
|
||||||
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
|
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
|
||||||
self.webSourceLabel.setObjectName(u'WebSourceLabel')
|
self.webSourceLabel.setObjectName(u'WebSourceLabel')
|
||||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webSourceLabel)
|
||||||
self.webSourceLabel)
|
|
||||||
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
|
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||||
self.webSourceComboBox.setObjectName(u'WebSourceComboBox')
|
self.webSourceComboBox.setObjectName(u'WebSourceComboBox')
|
||||||
self.webSourceComboBox.addItems([u'', u'', u''])
|
self.webSourceComboBox.addItems([u'', u'', u''])
|
||||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webSourceComboBox)
|
||||||
self.webSourceComboBox)
|
|
||||||
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
|
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
|
||||||
self.webTranslationLabel.setObjectName(u'webTranslationLabel')
|
self.webTranslationLabel.setObjectName(u'webTranslationLabel')
|
||||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webTranslationLabel)
|
||||||
self.webTranslationLabel)
|
|
||||||
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
|
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
|
||||||
self.webTranslationComboBox.setSizeAdjustPolicy(
|
self.webTranslationComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||||
QtGui.QComboBox.AdjustToContents)
|
|
||||||
self.webTranslationComboBox.setObjectName(u'WebTranslationComboBox')
|
self.webTranslationComboBox.setObjectName(u'WebTranslationComboBox')
|
||||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webTranslationComboBox)
|
||||||
self.webTranslationComboBox)
|
|
||||||
self.webTabWidget.addTab(self.webBibleTab, u'')
|
self.webTabWidget.addTab(self.webBibleTab, u'')
|
||||||
self.webProxyTab = QtGui.QWidget()
|
self.webProxyTab = QtGui.QWidget()
|
||||||
self.webProxyTab.setObjectName(u'WebProxyTab')
|
self.webProxyTab.setObjectName(u'WebProxyTab')
|
||||||
@ -263,28 +248,22 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.webProxyLayout.setObjectName(u'WebProxyLayout')
|
self.webProxyLayout.setObjectName(u'WebProxyLayout')
|
||||||
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
|
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
|
||||||
self.webServerLabel.setObjectName(u'WebServerLabel')
|
self.webServerLabel.setObjectName(u'WebServerLabel')
|
||||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webServerLabel)
|
||||||
self.webServerLabel)
|
|
||||||
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||||
self.webServerEdit.setObjectName(u'WebServerEdit')
|
self.webServerEdit.setObjectName(u'WebServerEdit')
|
||||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webServerEdit)
|
||||||
self.webServerEdit)
|
|
||||||
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
|
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
|
||||||
self.webUserLabel.setObjectName(u'WebUserLabel')
|
self.webUserLabel.setObjectName(u'WebUserLabel')
|
||||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webUserLabel)
|
||||||
self.webUserLabel)
|
|
||||||
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||||
self.webUserEdit.setObjectName(u'WebUserEdit')
|
self.webUserEdit.setObjectName(u'WebUserEdit')
|
||||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webUserEdit)
|
||||||
self.webUserEdit)
|
|
||||||
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
|
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
|
||||||
self.webPasswordLabel.setObjectName(u'WebPasswordLabel')
|
self.webPasswordLabel.setObjectName(u'WebPasswordLabel')
|
||||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.webPasswordLabel)
|
||||||
self.webPasswordLabel)
|
|
||||||
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
|
||||||
self.webPasswordEdit.setObjectName(u'WebPasswordEdit')
|
self.webPasswordEdit.setObjectName(u'WebPasswordEdit')
|
||||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.webPasswordEdit)
|
||||||
self.webPasswordEdit)
|
|
||||||
self.webTabWidget.addTab(self.webProxyTab, u'')
|
self.webTabWidget.addTab(self.webProxyTab, u'')
|
||||||
self.selectStack.addWidget(self.webTabWidget)
|
self.selectStack.addWidget(self.webTabWidget)
|
||||||
self.openlp1Widget = QtGui.QWidget(self.selectPage)
|
self.openlp1Widget = QtGui.QWidget(self.selectPage)
|
||||||
@ -319,36 +298,30 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
|
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
|
||||||
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||||
self.versionNameLabel.setObjectName(u'VersionNameLabel')
|
self.versionNameLabel.setObjectName(u'VersionNameLabel')
|
||||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
|
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.versionNameLabel)
|
||||||
self.versionNameLabel)
|
|
||||||
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||||
self.versionNameEdit.setObjectName(u'VersionNameEdit')
|
self.versionNameEdit.setObjectName(u'VersionNameEdit')
|
||||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
|
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.versionNameEdit)
|
||||||
self.versionNameEdit)
|
|
||||||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||||
self.copyrightLabel.setObjectName(u'CopyrightLabel')
|
self.copyrightLabel.setObjectName(u'CopyrightLabel')
|
||||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
|
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyrightLabel)
|
||||||
self.copyrightLabel)
|
|
||||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||||
self.copyrightEdit.setObjectName(u'CopyrightEdit')
|
self.copyrightEdit.setObjectName(u'CopyrightEdit')
|
||||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyrightEdit)
|
||||||
self.copyrightEdit)
|
|
||||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
|
||||||
self.permissionsLabel.setObjectName(u'PermissionsLabel')
|
self.permissionsLabel.setObjectName(u'PermissionsLabel')
|
||||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||||
self.permissionsLabel)
|
self.permissionsLabel)
|
||||||
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
||||||
self.permissionsEdit.setObjectName(u'PermissionsEdit')
|
self.permissionsEdit.setObjectName(u'PermissionsEdit')
|
||||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissionsEdit)
|
||||||
self.permissionsEdit)
|
|
||||||
self.addPage(self.licenseDetailsPage)
|
self.addPage(self.licenseDetailsPage)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
Allow for localisation of the bible import wizard.
|
Allow for localisation of the bible import wizard.
|
||||||
"""
|
"""
|
||||||
self.setWindowTitle(
|
self.setWindowTitle(translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
|
||||||
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
||||||
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
|
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
@ -365,53 +338,36 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.formatComboBox.setItemText(BibleFormat.WebDownload,
|
self.formatComboBox.setItemText(BibleFormat.WebDownload,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
||||||
self.formatComboBox.setItemText(BibleFormat.OpenLP1, UiStrings().OLPV1)
|
self.formatComboBox.setItemText(BibleFormat.OpenLP1, UiStrings().OLPV1)
|
||||||
self.openlp1FileLabel.setText(
|
self.openlp1FileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
self.osisFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.osisFileLabel.setText(
|
self.csvBooksLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
self.csvVersesLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Verses file:'))
|
||||||
self.csvBooksLabel.setText(
|
self.openSongFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
self.webSourceLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
||||||
self.csvVersesLabel.setText(
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Verses file:'))
|
|
||||||
self.openSongFileLabel.setText(
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
|
||||||
self.webSourceLabel.setText(
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
|
||||||
self.webSourceComboBox.setItemText(WebDownload.Crosswalk,
|
self.webSourceComboBox.setItemText(WebDownload.Crosswalk,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
||||||
self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
|
self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
||||||
self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
|
self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
||||||
self.webTranslationLabel.setText(
|
self.webTranslationLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webBibleTab),
|
||||||
self.webTabWidget.setTabText(
|
|
||||||
self.webTabWidget.indexOf(self.webBibleTab),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
||||||
self.webServerLabel.setText(
|
self.webServerLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
self.webUserLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
||||||
self.webUserLabel.setText(
|
self.webPasswordLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webProxyTab),
|
||||||
self.webPasswordLabel.setText(
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
|
||||||
self.webTabWidget.setTabText(
|
|
||||||
self.webTabWidget.indexOf(self.webProxyTab),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Proxy Server (Optional)'))
|
'Proxy Server (Optional)'))
|
||||||
self.licenseDetailsPage.setTitle(
|
self.licenseDetailsPage.setTitle(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
|
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
|
||||||
self.licenseDetailsPage.setSubTitle(
|
self.licenseDetailsPage.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Set up the Bible\'s license details.'))
|
'Set up the Bible\'s license details.'))
|
||||||
self.versionNameLabel.setText(
|
self.versionNameLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
self.copyrightLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||||
self.copyrightLabel.setText(
|
self.permissionsLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
|
||||||
self.permissionsLabel.setText(
|
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
|
||||||
self.progressPage.setTitle(WizardStrings.Importing)
|
self.progressPage.setTitle(WizardStrings.Importing)
|
||||||
self.progressPage.setSubTitle(
|
self.progressPage.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'Please wait while your Bible is imported.'))
|
'Please wait while your Bible is imported.'))
|
||||||
self.progressLabel.setText(WizardStrings.Ready)
|
self.progressLabel.setText(WizardStrings.Ready)
|
||||||
self.progressBar.setFormat(u'%p%')
|
self.progressBar.setFormat(u'%p%')
|
||||||
@ -423,8 +379,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.csvVersesLabel.minimumSizeHint().width(),
|
self.csvVersesLabel.minimumSizeHint().width(),
|
||||||
self.openSongFileLabel.minimumSizeHint().width(),
|
self.openSongFileLabel.minimumSizeHint().width(),
|
||||||
self.openlp1FileLabel.minimumSizeHint().width())
|
self.openlp1FileLabel.minimumSizeHint().width())
|
||||||
self.spacer.changeSize(labelWidth, 0,
|
self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
"""
|
"""
|
||||||
@ -435,41 +390,32 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
if self.field(u'source_format') == BibleFormat.OSIS:
|
if self.field(u'source_format') == BibleFormat.OSIS:
|
||||||
if not self.field(u'osis_location'):
|
if not self.field(u'osis_location'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
|
||||||
self.osisFileEdit.setFocus()
|
self.osisFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format') == BibleFormat.CSV:
|
elif self.field(u'source_format') == BibleFormat.CSV:
|
||||||
if not self.field(u'csv_booksfile'):
|
if not self.field(u'csv_booksfile'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs, translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
'You need to specify a file with books of the Bible to use in the import.'))
|
||||||
'You need to specify a file with books of '
|
|
||||||
'the Bible to use in the import.'))
|
|
||||||
self.csvBooksEdit.setFocus()
|
self.csvBooksEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field(u'csv_versefile'):
|
elif not self.field(u'csv_versefile'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'You need to specify a file of Bible '
|
'You need to specify a file of Bible verses to import.'))
|
||||||
'verses to import.'))
|
|
||||||
self.csvVersesEdit.setFocus()
|
self.csvVersesEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format') == \
|
elif self.field(u'source_format') == BibleFormat.OpenSong:
|
||||||
BibleFormat.OpenSong:
|
|
||||||
if not self.field(u'opensong_file'):
|
if not self.field(u'opensong_file'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
|
||||||
self.openSongFileEdit.setFocus()
|
self.openSongFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format') == \
|
elif self.field(u'source_format') == BibleFormat.WebDownload:
|
||||||
BibleFormat.WebDownload:
|
self.versionNameEdit.setText(self.webTranslationComboBox.currentText())
|
||||||
self.versionNameEdit.setText(
|
|
||||||
self.webTranslationComboBox.currentText())
|
|
||||||
return True
|
return True
|
||||||
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
||||||
if not self.field(u'openlp1_location'):
|
if not self.field(u'openlp1_location'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
||||||
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
|
||||||
self.openlp1FileEdit.setFocus()
|
self.openlp1FileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -479,32 +425,27 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
path = AppLocation.get_section_data_path(u'bibles')
|
path = AppLocation.get_section_data_path(u'bibles')
|
||||||
if not license_version:
|
if not license_version:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm', 'You need to specify a version name for your Bible.'))
|
||||||
'You need to specify a version name for your Bible.'))
|
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not license_copyright:
|
elif not license_copyright:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible. '
|
||||||
'You need to set a copyright for your Bible. '
|
'Bibles in the Public Domain need to be marked as such.'))
|
||||||
'Bibles in the Public Domain need to be marked as such.'))
|
|
||||||
self.copyrightEdit.setFocus()
|
self.copyrightEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.manager.exists(license_version):
|
elif self.manager.exists(license_version):
|
||||||
critical_error_message_box(
|
critical_error_message_box(translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'This Bible already exists. Please import '
|
'This Bible already exists. Please import a different Bible or first delete the existing one.'))
|
||||||
'a different Bible or first delete the existing one.'))
|
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif os.path.exists(os.path.join(path, clean_filename(
|
elif os.path.exists(os.path.join(path, clean_filename(
|
||||||
license_version))):
|
license_version))):
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists. Please import '
|
||||||
'This Bible already exists. Please import '
|
'a different Bible or first delete the existing one.'))
|
||||||
'a different Bible or first delete the existing one.'))
|
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -528,40 +469,34 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Show the file open dialog for the OSIS file.
|
Show the file open dialog for the OSIS file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OSIS, self.osisFileEdit)
|
||||||
self.osisFileEdit)
|
|
||||||
|
|
||||||
def onCsvBooksBrowseButtonClicked(self):
|
def onCsvBooksBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the books CSV file.
|
Show the file open dialog for the books CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvBooksEdit, u'%s (*.csv)'
|
||||||
self.csvBooksEdit, u'%s (*.csv)'
|
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onCsvVersesBrowseButtonClicked(self):
|
def onCsvVersesBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the verses CSV file.
|
Show the file open dialog for the verses CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvVersesEdit, u'%s (*.csv)'
|
||||||
self.csvVersesEdit, u'%s (*.csv)'
|
|
||||||
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onOpenSongBrowseButtonClicked(self):
|
def onOpenSongBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the OpenSong file.
|
Show the file open dialog for the OpenSong file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OS,
|
self.getFileName(WizardStrings.OpenTypeFile % WizardStrings.OS, self.openSongFileEdit)
|
||||||
self.openSongFileEdit)
|
|
||||||
|
|
||||||
def onOpenlp1BrowseButtonClicked(self):
|
def onOpenlp1BrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the openlp.org 1.x file.
|
Show the file open dialog for the openlp.org 1.x file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(WizardStrings.OpenTypeFile % UiStrings().OLPV1,
|
self.getFileName(WizardStrings.OpenTypeFile % UiStrings().OLPV1, self.openlp1FileEdit, u'%s (*.bible)' %
|
||||||
self.openlp1FileEdit, u'%s (*.bible)' %
|
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x Bible Files'))
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
|
||||||
'openlp.org 1.x Bible Files'))
|
|
||||||
|
|
||||||
def registerFields(self):
|
def registerFields(self):
|
||||||
"""
|
"""
|
||||||
@ -573,18 +508,14 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
|
self.selectPage.registerField(u'csv_versefile', self.csvVersesEdit)
|
||||||
self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
|
self.selectPage.registerField(u'opensong_file', self.openSongFileEdit)
|
||||||
self.selectPage.registerField(u'web_location', self.webSourceComboBox)
|
self.selectPage.registerField(u'web_location', self.webSourceComboBox)
|
||||||
self.selectPage.registerField(
|
self.selectPage.registerField(u'web_biblename', self.webTranslationComboBox)
|
||||||
u'web_biblename', self.webTranslationComboBox)
|
|
||||||
self.selectPage.registerField(u'proxy_server', self.webServerEdit)
|
self.selectPage.registerField(u'proxy_server', self.webServerEdit)
|
||||||
self.selectPage.registerField(u'proxy_username', self.webUserEdit)
|
self.selectPage.registerField(u'proxy_username', self.webUserEdit)
|
||||||
self.selectPage.registerField(u'proxy_password', self.webPasswordEdit)
|
self.selectPage.registerField(u'proxy_password', self.webPasswordEdit)
|
||||||
self.selectPage.registerField(u'openlp1_location', self.openlp1FileEdit)
|
self.selectPage.registerField(u'openlp1_location', self.openlp1FileEdit)
|
||||||
self.licenseDetailsPage.registerField(
|
self.licenseDetailsPage.registerField(u'license_version', self.versionNameEdit)
|
||||||
u'license_version', self.versionNameEdit)
|
self.licenseDetailsPage.registerField(u'license_copyright', self.copyrightEdit)
|
||||||
self.licenseDetailsPage.registerField(
|
self.licenseDetailsPage.registerField(u'license_permissions', self.permissionsEdit)
|
||||||
u'license_copyright', self.copyrightEdit)
|
|
||||||
self.licenseDetailsPage.registerField(
|
|
||||||
u'license_permissions', self.permissionsEdit)
|
|
||||||
|
|
||||||
def setDefaults(self):
|
def setDefaults(self):
|
||||||
"""
|
"""
|
||||||
@ -601,8 +532,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.setField(u'csv_versefile', '')
|
self.setField(u'csv_versefile', '')
|
||||||
self.setField(u'opensong_file', '')
|
self.setField(u'opensong_file', '')
|
||||||
self.setField(u'web_location', WebDownload.Crosswalk)
|
self.setField(u'web_location', WebDownload.Crosswalk)
|
||||||
self.setField(u'web_biblename',
|
self.setField(u'web_biblename', self.webTranslationComboBox.currentIndex())
|
||||||
self.webTranslationComboBox.currentIndex())
|
|
||||||
self.setField(u'proxy_server', settings.value(u'proxy address', u''))
|
self.setField(u'proxy_server', settings.value(u'proxy address', u''))
|
||||||
self.setField(u'proxy_username', settings.value(u'proxy username', u''))
|
self.setField(u'proxy_username', settings.value(u'proxy username', u''))
|
||||||
self.setField(u'proxy_password', settings.value(u'proxy password', u''))
|
self.setField(u'proxy_password', settings.value(u'proxy password', u''))
|
||||||
@ -632,8 +562,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
The WebDownload type e.g. bibleserver.
|
The WebDownload type e.g. bibleserver.
|
||||||
"""
|
"""
|
||||||
self.web_bible_list[download_type] = {}
|
self.web_bible_list[download_type] = {}
|
||||||
bibles = BiblesResourcesDB.get_webbibles(
|
bibles = BiblesResourcesDB.get_webbibles(WebDownload.Names[download_type])
|
||||||
WebDownload.Names[download_type])
|
|
||||||
for bible in bibles:
|
for bible in bibles:
|
||||||
version = bible[u'name']
|
version = bible[u'name']
|
||||||
name = bible[u'abbreviation']
|
name = bible[u'abbreviation']
|
||||||
@ -646,9 +575,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
bible_type = self.field(u'source_format')
|
bible_type = self.field(u'source_format')
|
||||||
if bible_type == BibleFormat.WebDownload:
|
if bible_type == BibleFormat.WebDownload:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
|
||||||
'BiblesPlugin.ImportWizardForm',
|
|
||||||
'Registering Bible...'))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(WizardStrings.StartingImport)
|
self.progressLabel.setText(WizardStrings.StartingImport)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
@ -707,13 +634,11 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.manager.reload_bibles()
|
self.manager.reload_bibles()
|
||||||
if bible_type == BibleFormat.WebDownload:
|
if bible_type == BibleFormat.WebDownload:
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Registered '
|
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
|
||||||
'Bible. Please note, that verses will be downloaded on\n'
|
'downloaded on\ndemand and thus an internet connection is required.'))
|
||||||
'demand and thus an internet connection is required.'))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(WizardStrings.FinishedImport)
|
self.progressLabel.setText(WizardStrings.FinishedImport)
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
||||||
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
|
||||||
del self.manager.db_cache[importer.name]
|
del self.manager.db_cache[importer.name]
|
||||||
delete_database(self.plugin.settingsSection, importer.file)
|
delete_database(self.plugin.settingsSection, importer.file)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -36,13 +36,11 @@ from tempfile import gettempdir
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate, \
|
from openlp.core.lib import Receiver, SettingsManager, translate, check_directory_exists, Settings
|
||||||
check_directory_exists, Settings
|
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \
|
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, BiblesResourcesDB
|
||||||
BiblesResourcesDB
|
|
||||||
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
|
from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -73,21 +71,18 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.suffix = u'.sqlite'
|
self.suffix = u'.sqlite'
|
||||||
self.settingsSection = u'bibles'
|
self.settingsSection = u'bibles'
|
||||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||||
self.temp_dir = os.path.join(
|
self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
||||||
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
|
||||||
self.files = self.manager.old_bible_databases
|
self.files = self.manager.old_bible_databases
|
||||||
self.success = {}
|
self.success = {}
|
||||||
self.newbibles = {}
|
self.newbibles = {}
|
||||||
OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleUpgradeWizard',
|
OpenLPWizard.__init__(self, parent, bibleplugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp')
|
||||||
u':/wizards/wizard_importbible.bmp')
|
|
||||||
|
|
||||||
def setupUi(self, image):
|
def setupUi(self, image):
|
||||||
"""
|
"""
|
||||||
Set up the UI for the bible wizard.
|
Set up the UI for the bible wizard.
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.setupUi(self, image)
|
OpenLPWizard.setupUi(self, image)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
@ -120,14 +115,12 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Show the file open dialog for the OSIS file.
|
Show the file open dialog for the OSIS file.
|
||||||
"""
|
"""
|
||||||
filename = QtGui.QFileDialog.getExistingDirectory(self, translate(
|
filename = QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
'BiblesPlugin.UpgradeWizardForm', 'Select a Backup Directory'),
|
translate('BiblesPlugin.UpgradeWizardForm', 'Select a Backup Directory'),
|
||||||
os.path.dirname(SettingsManager.get_last_dir(
|
os.path.dirname(SettingsManager.get_last_dir(self.plugin.settingsSection, 1)))
|
||||||
self.plugin.settingsSection, 1)))
|
|
||||||
if filename:
|
if filename:
|
||||||
self.backupDirectoryEdit.setText(filename)
|
self.backupDirectoryEdit.setText(filename)
|
||||||
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
SettingsManager.set_last_dir(self.plugin.settingsSection, filename, 1)
|
||||||
filename, 1)
|
|
||||||
|
|
||||||
def onNoBackupCheckBoxToggled(self, checked):
|
def onNoBackupCheckBoxToggled(self, checked):
|
||||||
"""
|
"""
|
||||||
@ -144,8 +137,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
success = True
|
success = True
|
||||||
for filename in self.files:
|
for filename in self.files:
|
||||||
try:
|
try:
|
||||||
shutil.copy(os.path.join(self.path, filename[0]),
|
shutil.copy(os.path.join(self.path, filename[0]), backup_directory)
|
||||||
backup_directory)
|
|
||||||
except:
|
except:
|
||||||
success = False
|
success = False
|
||||||
return success
|
return success
|
||||||
@ -161,10 +153,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Set up the signals used in the bible importer.
|
Set up the signals used in the bible importer.
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.connect(self.backupBrowseButton,
|
QtCore.QObject.connect(self.backupBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onBackupBrowseButtonClicked)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onBackupBrowseButtonClicked)
|
QtCore.QObject.connect(self.noBackupCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onNoBackupCheckBoxToggled)
|
||||||
QtCore.QObject.connect(self.noBackupCheckBox,
|
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.onNoBackupCheckBoxToggled)
|
|
||||||
|
|
||||||
def addCustomPages(self):
|
def addCustomPages(self):
|
||||||
"""
|
"""
|
||||||
@ -198,14 +188,12 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.backupBrowseButton.setIcon(self.openIcon)
|
self.backupBrowseButton.setIcon(self.openIcon)
|
||||||
self.backupBrowseButton.setObjectName(u'BackupBrowseButton')
|
self.backupBrowseButton.setObjectName(u'BackupBrowseButton')
|
||||||
self.backupDirectoryLayout.addWidget(self.backupBrowseButton)
|
self.backupDirectoryLayout.addWidget(self.backupBrowseButton)
|
||||||
self.formLayout.addRow(self.backupDirectoryLabel,
|
self.formLayout.addRow(self.backupDirectoryLabel, self.backupDirectoryLayout)
|
||||||
self.backupDirectoryLayout)
|
|
||||||
self.backupLayout.addLayout(self.formLayout)
|
self.backupLayout.addLayout(self.formLayout)
|
||||||
self.noBackupCheckBox = QtGui.QCheckBox(self.backupPage)
|
self.noBackupCheckBox = QtGui.QCheckBox(self.backupPage)
|
||||||
self.noBackupCheckBox.setObjectName('NoBackupCheckBox')
|
self.noBackupCheckBox.setObjectName('NoBackupCheckBox')
|
||||||
self.backupLayout.addWidget(self.noBackupCheckBox)
|
self.backupLayout.addWidget(self.noBackupCheckBox)
|
||||||
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||||
QtGui.QSizePolicy.Minimum)
|
|
||||||
self.backupLayout.addItem(self.spacer)
|
self.backupLayout.addItem(self.spacer)
|
||||||
self.addPage(self.backupPage)
|
self.addPage(self.backupPage)
|
||||||
# Select Page
|
# Select Page
|
||||||
@ -216,8 +204,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.scrollArea = QtGui.QScrollArea(self.selectPage)
|
self.scrollArea = QtGui.QScrollArea(self.selectPage)
|
||||||
self.scrollArea.setWidgetResizable(True)
|
self.scrollArea.setWidgetResizable(True)
|
||||||
self.scrollArea.setObjectName(u'scrollArea')
|
self.scrollArea.setObjectName(u'scrollArea')
|
||||||
self.scrollArea.setHorizontalScrollBarPolicy(
|
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
|
||||||
self.scrollAreaContents = QtGui.QWidget(self.scrollArea)
|
self.scrollAreaContents = QtGui.QWidget(self.scrollArea)
|
||||||
self.scrollAreaContents.setObjectName(u'scrollAreaContents')
|
self.scrollAreaContents.setObjectName(u'scrollAreaContents')
|
||||||
self.formLayout = QtGui.QVBoxLayout(self.scrollAreaContents)
|
self.formLayout = QtGui.QVBoxLayout(self.scrollAreaContents)
|
||||||
@ -239,8 +226,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.checkBox[number].setText(bible.get_name())
|
self.checkBox[number].setText(bible.get_name())
|
||||||
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
|
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
|
||||||
self.formLayout.addWidget(self.checkBox[number])
|
self.formLayout.addWidget(self.checkBox[number])
|
||||||
self.spacerItem = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum,
|
self.spacerItem = QtGui.QSpacerItem(20, 5, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
QtGui.QSizePolicy.Expanding)
|
|
||||||
self.formLayout.addItem(self.spacerItem)
|
self.formLayout.addItem(self.spacerItem)
|
||||||
self.scrollArea.setWidget(self.scrollAreaContents)
|
self.scrollArea.setWidget(self.scrollAreaContents)
|
||||||
|
|
||||||
@ -257,20 +243,14 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Allow for localisation of the bible import wizard.
|
Allow for localisation of the bible import wizard.
|
||||||
"""
|
"""
|
||||||
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard'))
|
||||||
'Bible Upgrade Wizard'))
|
|
||||||
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
self.titleLabel.setText(WizardStrings.HeaderStyle %
|
||||||
translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard'))
|
translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard'))
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
'This wizard will help you to upgrade your existing Bibles from a prior version of OpenLP 2. '
|
||||||
'This wizard will help you to upgrade your existing Bibles from a '
|
'Click the next button below to start the upgrade process.'))
|
||||||
'prior version of OpenLP 2. Click the next button below to start '
|
self.backupPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
|
||||||
'the upgrade process.'))
|
self.backupPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
self.backupPage.setTitle(
|
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'Select Backup Directory'))
|
|
||||||
self.backupPage.setSubTitle(
|
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'Please select a backup directory for your Bibles'))
|
'Please select a backup directory for your Bibles'))
|
||||||
self.backupInfoLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.backupInfoLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
|
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
|
||||||
@ -281,21 +261,14 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
'http://wiki.openlp.org/faq">Frequently Asked Questions</a>.'))
|
'http://wiki.openlp.org/faq">Frequently Asked Questions</a>.'))
|
||||||
self.selectLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.selectLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'Please select a backup location for your Bibles.'))
|
'Please select a backup location for your Bibles.'))
|
||||||
self.backupDirectoryLabel.setText(
|
self.backupDirectoryLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Backup Directory:'))
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Backup Directory:'))
|
|
||||||
self.noBackupCheckBox.setText(
|
self.noBackupCheckBox.setText(
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm', 'There is no need to backup my Bibles'))
|
||||||
'There is no need to backup my Bibles'))
|
self.selectPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Bibles'))
|
||||||
self.selectPage.setTitle(
|
self.selectPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'Select Bibles'))
|
|
||||||
self.selectPage.setSubTitle(
|
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'Please select the Bibles to upgrade'))
|
'Please select the Bibles to upgrade'))
|
||||||
self.progressPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progressPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
|
||||||
'Upgrading'))
|
self.progressPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
self.progressPage.setSubTitle(
|
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'Please wait while your Bibles are upgraded.'))
|
'Please wait while your Bibles are upgraded.'))
|
||||||
self.progressLabel.setText(WizardStrings.Ready)
|
self.progressLabel.setText(WizardStrings.Ready)
|
||||||
self.progressBar.setFormat(u'%p%')
|
self.progressBar.setFormat(u'%p%')
|
||||||
@ -312,17 +285,14 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if not backup_path:
|
if not backup_path:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'You need to specify a backup directory for your '
|
'You need to specify a backup directory for your Bibles.'))
|
||||||
'Bibles.'))
|
|
||||||
self.backupDirectoryEdit.setFocus()
|
self.backupDirectoryEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if not self.backupOldBibles(backup_path):
|
if not self.backupOldBibles(backup_path):
|
||||||
critical_error_message_box(UiStrings().Error,
|
critical_error_message_box(UiStrings().Error,
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup your '
|
||||||
'The backup was not successful.\nTo backup your '
|
'Bibles you need permission to write to the given directory.'))
|
||||||
'Bibles you need permission to write to the given '
|
|
||||||
'directory.'))
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
@ -332,8 +302,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
continue
|
continue
|
||||||
# Move bibles to temp dir.
|
# Move bibles to temp dir.
|
||||||
if not os.path.exists(os.path.join(self.temp_dir, filename[0])):
|
if not os.path.exists(os.path.join(self.temp_dir, filename[0])):
|
||||||
shutil.move(
|
shutil.move(os.path.join(self.path, filename[0]), self.temp_dir)
|
||||||
os.path.join(self.path, filename[0]), self.temp_dir)
|
|
||||||
else:
|
else:
|
||||||
delete_file(os.path.join(self.path, filename[0]))
|
delete_file(os.path.join(self.path, filename[0]))
|
||||||
return True
|
return True
|
||||||
@ -367,8 +336,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
Prepare the UI for the upgrade.
|
Prepare the UI for the upgrade.
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
@ -378,9 +346,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.includeWebBible = False
|
self.includeWebBible = False
|
||||||
proxy_server = None
|
proxy_server = None
|
||||||
if not self.files:
|
if not self.files:
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'There are no '
|
'There are no Bibles that need to be upgraded.'))
|
||||||
'Bibles that need to be upgraded.'))
|
|
||||||
self.progressBar.hide()
|
self.progressBar.hide()
|
||||||
return
|
return
|
||||||
max_bibles = 0
|
max_bibles = 0
|
||||||
@ -405,12 +372,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
|
old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir,
|
||||||
file=filename[0])
|
file=filename[0])
|
||||||
name = filename[1]
|
name = filename[1]
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') % (number + 1, max_bibles, name))
|
||||||
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') %
|
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path, name=name, file=filename[0])
|
||||||
(number + 1, max_bibles, name))
|
|
||||||
self.newbibles[number] = BibleDB(self.mediaItem, path=self.path,
|
|
||||||
name=name, file=filename[0])
|
|
||||||
self.newbibles[number].register(self.plugin.upgrade_wizard)
|
self.newbibles[number].register(self.plugin.upgrade_wizard)
|
||||||
metadata = old_bible.get_metadata()
|
metadata = old_bible.get_metadata()
|
||||||
web_bible = False
|
web_bible = False
|
||||||
@ -425,8 +389,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
# Copy the metadata
|
# Copy the metadata
|
||||||
meta_data[meta[u'key']] = meta[u'value']
|
meta_data[meta[u'key']] = meta[u'value']
|
||||||
if meta[u'key'] != u'name' and meta[u'key'] != u'dbversion':
|
if meta[u'key'] != u'name' and meta[u'key'] != u'dbversion':
|
||||||
self.newbibles[number].save_meta(meta[u'key'],
|
self.newbibles[number].save_meta(meta[u'key'], meta[u'value'])
|
||||||
meta[u'value'])
|
|
||||||
if meta[u'key'] == u'download_source':
|
if meta[u'key'] == u'download_source':
|
||||||
web_bible = True
|
web_bible = True
|
||||||
self.includeWebBible = True
|
self.includeWebBible = True
|
||||||
@ -440,23 +403,17 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
handler = BSExtract(proxy_server)
|
handler = BSExtract(proxy_server)
|
||||||
books = handler.get_books_from_http(meta_data[u'download_name'])
|
books = handler.get_books_from_http(meta_data[u'download_name'])
|
||||||
if not books:
|
if not books:
|
||||||
log.error(u'Upgrading books from %s - download '\
|
log.error(u'Upgrading books from %s - download name: "%s" failed' % (
|
||||||
u'name: "%s" failed' % (
|
meta_data[u'download_source'], meta_data[u'download_name']))
|
||||||
meta_data[u'download_source'],
|
|
||||||
meta_data[u'download_name']))
|
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
|
translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'),
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'Download Error'),
|
'To upgrade your Web Bibles an Internet connection is required.'))
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
|
||||||
'To upgrade your Web Bibles an Internet connection is '
|
|
||||||
'required.'))
|
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
(number + 1, max_bibles, name), self.progressBar.maximum() - self.progressBar.value())
|
||||||
(number + 1, max_bibles, name),
|
|
||||||
self.progressBar.maximum() - self.progressBar.value())
|
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
bible = BiblesResourcesDB.get_webbible(
|
bible = BiblesResourcesDB.get_webbible(
|
||||||
@ -472,10 +429,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
log.warn(u'Upgrading from "%s" failed' % filename[0])
|
log.warn(u'Upgrading from "%s" failed' % filename[0])
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
|
||||||
(number + 1, max_bibles, name),
|
|
||||||
self.progressBar.maximum() - self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
@ -484,18 +439,13 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') % (number + 1, max_bibles, name, book))
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
|
||||||
'Upgrading %s ...') %
|
|
||||||
(number + 1, max_bibles, name, book))
|
|
||||||
book_ref_id = self.newbibles[number].\
|
book_ref_id = self.newbibles[number].\
|
||||||
get_book_ref_id_by_name(book, len(books), language_id)
|
get_book_ref_id_by_name(book, len(books), language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.warn(u'Upgrading books from %s - download '\
|
log.warn(u'Upgrading books from %s - download name: "%s" aborted by user' % (
|
||||||
u'name: "%s" aborted by user' % (
|
meta_data[u'download_source'], meta_data[u'download_name']))
|
||||||
meta_data[u'download_source'],
|
|
||||||
meta_data[u'download_name']))
|
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
@ -508,8 +458,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if oldbook:
|
if oldbook:
|
||||||
verses = old_bible.get_verses(oldbook[u'id'])
|
verses = old_bible.get_verses(oldbook[u'id'])
|
||||||
if not verses:
|
if not verses:
|
||||||
log.warn(u'No verses found to import for book '
|
log.warn(u'No verses found to import for book "%s"', book)
|
||||||
u'"%s"', book)
|
|
||||||
continue
|
continue
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
@ -521,18 +470,15 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.newbibles[number].session.commit()
|
self.newbibles[number].session.commit()
|
||||||
else:
|
else:
|
||||||
language_id = self.newbibles[number].get_object(BibleMeta,
|
language_id = self.newbibles[number].get_object(BibleMeta, u'language_id')
|
||||||
u'language_id')
|
|
||||||
if not language_id:
|
if not language_id:
|
||||||
language_id = self.newbibles[number].get_language(name)
|
language_id = self.newbibles[number].get_language(name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.warn(u'Upgrading books from "%s" failed' % name)
|
log.warn(u'Upgrading books from "%s" failed' % name)
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
|
||||||
(number + 1, max_bibles, name),
|
|
||||||
self.progressBar.maximum() - self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
@ -542,17 +488,12 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
|
||||||
'Upgrading %s ...') %
|
|
||||||
(number + 1, max_bibles, name, book[u'name']))
|
(number + 1, max_bibles, name, book[u'name']))
|
||||||
book_ref_id = self.newbibles[number].\
|
book_ref_id = self.newbibles[number].get_book_ref_id_by_name(book[u'name'], len(books), language_id)
|
||||||
get_book_ref_id_by_name(book[u'name'], len(books),
|
|
||||||
language_id)
|
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.warn(u'Upgrading books from %s " '\
|
log.warn(u'Upgrading books from %s " failed - aborted by user' % name)
|
||||||
'failed - aborted by user' % name)
|
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
@ -562,8 +503,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
book_ref_id, book_details[u'testament_id'])
|
book_ref_id, book_details[u'testament_id'])
|
||||||
verses = old_bible.get_verses(book[u'id'])
|
verses = old_bible.get_verses(book[u'id'])
|
||||||
if not verses:
|
if not verses:
|
||||||
log.warn(u'No verses found to import for book '
|
log.warn(u'No verses found to import for book "%s"', book[u'name'])
|
||||||
u'"%s"', book[u'name'])
|
|
||||||
self.newbibles[number].delete_book(db_book)
|
self.newbibles[number].delete_book(db_book)
|
||||||
continue
|
continue
|
||||||
for verse in verses:
|
for verse in verses:
|
||||||
@ -576,19 +516,14 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.newbibles[number].session.commit()
|
self.newbibles[number].session.commit()
|
||||||
if not self.success.get(number, True):
|
if not self.success.get(number, True):
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') %
|
|
||||||
(number + 1, max_bibles, name),
|
|
||||||
self.progressBar.maximum() - self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
else:
|
else:
|
||||||
self.success[number] = True
|
self.success[number] = True
|
||||||
self.newbibles[number].save_meta(u'name', name)
|
self.newbibles[number].save_meta(u'name', name)
|
||||||
self.incrementProgressBar(translate(
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
|
||||||
'Complete') %
|
|
||||||
(number + 1, max_bibles, name))
|
|
||||||
if number in self.newbibles:
|
if number in self.newbibles:
|
||||||
self.newbibles[number].session.close()
|
self.newbibles[number].session.close()
|
||||||
# Close the last bible's connection if possible.
|
# Close the last bible's connection if possible.
|
||||||
@ -611,26 +546,19 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
# Copy not upgraded bible back.
|
# Copy not upgraded bible back.
|
||||||
shutil.move(os.path.join(self.temp_dir, filename[0]), self.path)
|
shutil.move(os.path.join(self.temp_dir, filename[0]), self.path)
|
||||||
if failed_import > 0:
|
if failed_import > 0:
|
||||||
failed_import_text = translate('BiblesPlugin.UpgradeWizardForm',
|
failed_import_text = translate('BiblesPlugin.UpgradeWizardForm', ', %s failed') % failed_import
|
||||||
', %s failed') % failed_import
|
|
||||||
else:
|
else:
|
||||||
failed_import_text = u''
|
failed_import_text = u''
|
||||||
if successful_import > 0:
|
if successful_import > 0:
|
||||||
if self.includeWebBible:
|
if self.includeWebBible:
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
|
'Upgrading Bible(s): %s successful%s\nPlease note that verses from Web Bibles will be downloaded '
|
||||||
'Bible(s): %s successful%s\nPlease note that verses from '
|
'on demand and so an Internet connection is required.') % (successful_import, failed_import_text))
|
||||||
'Web Bibles will be downloaded on demand and so an '
|
|
||||||
'Internet connection is required.') %
|
|
||||||
(successful_import, failed_import_text))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading '
|
'Upgrading Bible(s): %s successful%s') % (successful_import, failed_import_text))
|
||||||
'Bible(s): %s successful%s') % (successful_import,
|
|
||||||
failed_import_text))
|
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
|
||||||
'BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
|
|
||||||
# Remove temp directory.
|
# Remove temp directory.
|
||||||
shutil.rmtree(self.temp_dir, True)
|
shutil.rmtree(self.temp_dir, True)
|
||||||
OpenLPWizard.postWizard(self)
|
OpenLPWizard.postWizard(self)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -56,12 +56,10 @@ class Ui_BookNameDialog(object):
|
|||||||
self.correspondingLayout.addWidget(self.currentBookLabel, 0, 1, 1, 1)
|
self.correspondingLayout.addWidget(self.currentBookLabel, 0, 1, 1, 1)
|
||||||
self.correspondingLabel = QtGui.QLabel(bookNameDialog)
|
self.correspondingLabel = QtGui.QLabel(bookNameDialog)
|
||||||
self.correspondingLabel.setObjectName(u'correspondingLabel')
|
self.correspondingLabel.setObjectName(u'correspondingLabel')
|
||||||
self.correspondingLayout.addWidget(
|
self.correspondingLayout.addWidget(self.correspondingLabel, 1, 0, 1, 1)
|
||||||
self.correspondingLabel, 1, 0, 1, 1)
|
|
||||||
self.correspondingComboBox = QtGui.QComboBox(bookNameDialog)
|
self.correspondingComboBox = QtGui.QComboBox(bookNameDialog)
|
||||||
self.correspondingComboBox.setObjectName(u'correspondingComboBox')
|
self.correspondingComboBox.setObjectName(u'correspondingComboBox')
|
||||||
self.correspondingLayout.addWidget(
|
self.correspondingLayout.addWidget(self.correspondingComboBox, 1, 1, 1, 1)
|
||||||
self.correspondingComboBox, 1, 1, 1, 1)
|
|
||||||
self.bookNameLayout.addLayout(self.correspondingLayout)
|
self.bookNameLayout.addLayout(self.correspondingLayout)
|
||||||
self.optionsGroupBox = QtGui.QGroupBox(bookNameDialog)
|
self.optionsGroupBox = QtGui.QGroupBox(bookNameDialog)
|
||||||
self.optionsGroupBox.setObjectName(u'optionsGroupBox')
|
self.optionsGroupBox.setObjectName(u'optionsGroupBox')
|
||||||
@ -82,27 +80,19 @@ class Ui_BookNameDialog(object):
|
|||||||
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
|
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
|
||||||
self.optionsLayout.addWidget(self.apocryphaCheckBox)
|
self.optionsLayout.addWidget(self.apocryphaCheckBox)
|
||||||
self.bookNameLayout.addWidget(self.optionsGroupBox)
|
self.bookNameLayout.addWidget(self.optionsGroupBox)
|
||||||
self.buttonBox = create_button_box(bookNameDialog, u'buttonBox',
|
self.buttonBox = create_button_box(bookNameDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||||
[u'cancel', u'ok'])
|
|
||||||
self.bookNameLayout.addWidget(self.buttonBox)
|
self.bookNameLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self.retranslateUi(bookNameDialog)
|
self.retranslateUi(bookNameDialog)
|
||||||
|
|
||||||
def retranslateUi(self, bookNameDialog):
|
def retranslateUi(self, bookNameDialog):
|
||||||
bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog',
|
bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
|
||||||
'Select Book Name'))
|
|
||||||
self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog',
|
self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog',
|
||||||
'The following book name cannot be matched up internally. Please '
|
'The following book name cannot be matched up internally. '
|
||||||
'select the corresponding name from the list.'))
|
'Please select the corresponding name from the list.'))
|
||||||
self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog',
|
self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
|
||||||
'Current name:'))
|
self.correspondingLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
|
||||||
self.correspondingLabel.setText(translate(
|
self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
|
||||||
'BiblesPlugin.BookNameDialog', 'Corresponding name:'))
|
self.oldTestamentCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
|
||||||
self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog',
|
self.newTestamentCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))
|
||||||
'Show Books From'))
|
self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Apocrypha'))
|
||||||
self.oldTestamentCheckBox.setText(translate(
|
|
||||||
'BiblesPlugin.BookNameDialog', 'Old Testament'))
|
|
||||||
self.newTestamentCheckBox.setText(translate(
|
|
||||||
'BiblesPlugin.BookNameDialog', 'New Testament'))
|
|
||||||
self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog',
|
|
||||||
'Apocrypha'))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -38,8 +38,7 @@ from PyQt4 import QtCore
|
|||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.plugins.bibles.forms.booknamedialog import \
|
from openlp.plugins.bibles.forms.booknamedialog import Ui_BookNameDialog
|
||||||
Ui_BookNameDialog
|
|
||||||
from openlp.plugins.bibles.lib import BibleStrings
|
from openlp.plugins.bibles.lib import BibleStrings
|
||||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||||
|
|
||||||
@ -66,14 +65,11 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
"""
|
"""
|
||||||
Set up the signals used in the booknameform.
|
Set up the signals used in the booknameform.
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.connect(self.oldTestamentCheckBox,
|
QtCore.QObject.connect(self.oldTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onCheckBoxIndexChanged)
|
self.onCheckBoxIndexChanged)
|
||||||
QtCore.QObject.connect(self.newTestamentCheckBox,
|
QtCore.QObject.connect(self.newTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onCheckBoxIndexChanged)
|
self.onCheckBoxIndexChanged)
|
||||||
QtCore.QObject.connect(self.apocryphaCheckBox,
|
QtCore.QObject.connect(self.apocryphaCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onCheckBoxIndexChanged)
|
self.onCheckBoxIndexChanged)
|
||||||
|
|
||||||
def onCheckBoxIndexChanged(self, index):
|
def onCheckBoxIndexChanged(self, index):
|
||||||
@ -94,18 +90,14 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
if book.book_reference_id == item[u'id']:
|
if book.book_reference_id == item[u'id']:
|
||||||
addBook = False
|
addBook = False
|
||||||
break
|
break
|
||||||
if self.oldTestamentCheckBox.checkState() == QtCore.Qt.Unchecked \
|
if self.oldTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 1:
|
||||||
and item[u'testament_id'] == 1:
|
|
||||||
addBook = False
|
addBook = False
|
||||||
elif self.newTestamentCheckBox.checkState() == QtCore.Qt.Unchecked \
|
elif self.newTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 2:
|
||||||
and item[u'testament_id'] == 2:
|
|
||||||
addBook = False
|
addBook = False
|
||||||
elif self.apocryphaCheckBox.checkState() == QtCore.Qt.Unchecked \
|
elif self.apocryphaCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 3:
|
||||||
and item[u'testament_id'] == 3:
|
|
||||||
addBook = False
|
addBook = False
|
||||||
if addBook:
|
if addBook:
|
||||||
self.correspondingComboBox.addItem(
|
self.correspondingComboBox.addItem(self.book_names[item[u'abbreviation']])
|
||||||
self.book_names[item[u'abbreviation']])
|
|
||||||
|
|
||||||
def exec_(self, name, books, maxbooks):
|
def exec_(self, name, books, maxbooks):
|
||||||
self.books = books
|
self.books = books
|
||||||
@ -122,9 +114,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.correspondingComboBox.currentText() == u'':
|
if self.correspondingComboBox.currentText() == u'':
|
||||||
critical_error_message_box(
|
critical_error_message_box(message=translate('BiblesPlugin.BookNameForm', 'You need to select a book.'))
|
||||||
message=translate('BiblesPlugin.BookNameForm',
|
|
||||||
'You need to select a book.'))
|
|
||||||
self.correspondingComboBox.setFocus()
|
self.correspondingComboBox.setFocus()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@ -132,8 +122,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
for character in u'\\.^$*+?{}[]()':
|
for character in u'\\.^$*+?{}[]()':
|
||||||
cor_book = cor_book.replace(character, u'\\' + character)
|
cor_book = cor_book.replace(character, u'\\' + character)
|
||||||
books = filter(lambda key:
|
books = filter(lambda key:
|
||||||
re.match(cor_book, unicode(self.book_names[key]), re.UNICODE),
|
re.match(cor_book, unicode(self.book_names[key]), re.UNICODE), self.book_names.keys())
|
||||||
self.book_names.keys())
|
|
||||||
books = filter(None, map(BiblesResourcesDB.get_book, books))
|
books = filter(None, map(BiblesResourcesDB.get_book, books))
|
||||||
if books:
|
if books:
|
||||||
self.book_id = books[0][u'id']
|
self.book_id = books[0][u'id']
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -39,8 +39,7 @@ class Ui_EditBibleDialog(object):
|
|||||||
def setupUi(self, editBibleDialog):
|
def setupUi(self, editBibleDialog):
|
||||||
editBibleDialog.setObjectName(u'editBibleDialog')
|
editBibleDialog.setObjectName(u'editBibleDialog')
|
||||||
editBibleDialog.resize(520, 400)
|
editBibleDialog.resize(520, 400)
|
||||||
editBibleDialog.setWindowIcon(
|
editBibleDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||||
build_icon(u':/icon/openlp-logo-16x16.png'))
|
|
||||||
editBibleDialog.setModal(True)
|
editBibleDialog.setModal(True)
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialogLayout.setSpacing(8)
|
||||||
@ -55,43 +54,34 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.metaTabLayout.setObjectName(u'metaTabLayout')
|
self.metaTabLayout.setObjectName(u'metaTabLayout')
|
||||||
self.licenseDetailsGroupBox = QtGui.QGroupBox(self.metaTab)
|
self.licenseDetailsGroupBox = QtGui.QGroupBox(self.metaTab)
|
||||||
self.licenseDetailsGroupBox.setObjectName(u'licenseDetailsGroupBox')
|
self.licenseDetailsGroupBox.setObjectName(u'licenseDetailsGroupBox')
|
||||||
self.licenseDetailsLayout = QtGui.QFormLayout(
|
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsGroupBox)
|
||||||
self.licenseDetailsGroupBox)
|
|
||||||
self.licenseDetailsLayout.setObjectName(u'licenseDetailsLayout')
|
self.licenseDetailsLayout.setObjectName(u'licenseDetailsLayout')
|
||||||
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
||||||
self.versionNameLabel.setObjectName(u'versionNameLabel')
|
self.versionNameLabel.setObjectName(u'versionNameLabel')
|
||||||
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
||||||
self.versionNameEdit.setObjectName(u'versionNameEdit')
|
self.versionNameEdit.setObjectName(u'versionNameEdit')
|
||||||
self.versionNameLabel.setBuddy(self.versionNameEdit)
|
self.versionNameLabel.setBuddy(self.versionNameEdit)
|
||||||
self.licenseDetailsLayout.addRow(self.versionNameLabel,
|
self.licenseDetailsLayout.addRow(self.versionNameLabel, self.versionNameEdit)
|
||||||
self.versionNameEdit)
|
|
||||||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
||||||
self.copyrightLabel.setObjectName(u'copyrightLabel')
|
self.copyrightLabel.setObjectName(u'copyrightLabel')
|
||||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
||||||
self.copyrightEdit.setObjectName(u'copyrightEdit')
|
self.copyrightEdit.setObjectName(u'copyrightEdit')
|
||||||
self.copyrightLabel.setBuddy(self.copyrightEdit)
|
self.copyrightLabel.setBuddy(self.copyrightEdit)
|
||||||
self.licenseDetailsLayout.addRow(self.copyrightLabel,
|
self.licenseDetailsLayout.addRow(self.copyrightLabel, self.copyrightEdit)
|
||||||
self.copyrightEdit)
|
|
||||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
||||||
self.permissionsLabel.setObjectName(u'permissionsLabel')
|
self.permissionsLabel.setObjectName(u'permissionsLabel')
|
||||||
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
||||||
self.permissionsEdit.setObjectName(u'permissionsEdit')
|
self.permissionsEdit.setObjectName(u'permissionsEdit')
|
||||||
self.permissionsLabel.setBuddy(self.permissionsEdit)
|
self.permissionsLabel.setBuddy(self.permissionsEdit)
|
||||||
self.licenseDetailsLayout.addRow(self.permissionsLabel,
|
self.licenseDetailsLayout.addRow(self.permissionsLabel, self.permissionsEdit)
|
||||||
self.permissionsEdit)
|
|
||||||
self.metaTabLayout.addWidget(self.licenseDetailsGroupBox)
|
self.metaTabLayout.addWidget(self.licenseDetailsGroupBox)
|
||||||
self.languageSelectionGroupBox = QtGui.QGroupBox(self.metaTab)
|
self.languageSelectionGroupBox = QtGui.QGroupBox(self.metaTab)
|
||||||
self.languageSelectionGroupBox.setObjectName(
|
self.languageSelectionGroupBox.setObjectName(u'languageSelectionGroupBox')
|
||||||
u'languageSelectionGroupBox')
|
self.languageSelectionLayout = QtGui.QVBoxLayout(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionLayout = QtGui.QVBoxLayout(
|
self.languageSelectionLabel = QtGui.QLabel(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionGroupBox)
|
|
||||||
self.languageSelectionLabel = QtGui.QLabel(
|
|
||||||
self.languageSelectionGroupBox)
|
|
||||||
self.languageSelectionLabel.setObjectName(u'languageSelectionLabel')
|
self.languageSelectionLabel.setObjectName(u'languageSelectionLabel')
|
||||||
self.languageSelectionComboBox = QtGui.QComboBox(
|
self.languageSelectionComboBox = QtGui.QComboBox(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionGroupBox)
|
self.languageSelectionComboBox.setObjectName(u'languageSelectionComboBox')
|
||||||
self.languageSelectionComboBox.setObjectName(
|
|
||||||
u'languageSelectionComboBox')
|
|
||||||
self.languageSelectionComboBox.addItems([u'', u'', u'', u''])
|
self.languageSelectionComboBox.addItems([u'', u'', u'', u''])
|
||||||
self.languageSelectionLayout.addWidget(self.languageSelectionLabel)
|
self.languageSelectionLayout.addWidget(self.languageSelectionLabel)
|
||||||
self.languageSelectionLayout.addWidget(self.languageSelectionComboBox)
|
self.languageSelectionLayout.addWidget(self.languageSelectionComboBox)
|
||||||
@ -110,8 +100,7 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.scrollArea = QtGui.QScrollArea(self.bookNameTab)
|
self.scrollArea = QtGui.QScrollArea(self.bookNameTab)
|
||||||
self.scrollArea.setWidgetResizable(True)
|
self.scrollArea.setWidgetResizable(True)
|
||||||
self.scrollArea.setObjectName(u'scrollArea')
|
self.scrollArea.setObjectName(u'scrollArea')
|
||||||
self.scrollArea.setHorizontalScrollBarPolicy(
|
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
|
||||||
self.bookNameWidget = QtGui.QWidget(self.scrollArea)
|
self.bookNameWidget = QtGui.QWidget(self.scrollArea)
|
||||||
self.bookNameWidget.setObjectName(u'bookNameWidget')
|
self.bookNameWidget.setObjectName(u'bookNameWidget')
|
||||||
self.bookNameWidgetLayout = QtGui.QFormLayout(self.bookNameWidget)
|
self.bookNameWidgetLayout = QtGui.QFormLayout(self.bookNameWidget)
|
||||||
@ -119,14 +108,10 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.bookNameLabel = {}
|
self.bookNameLabel = {}
|
||||||
self.bookNameEdit= {}
|
self.bookNameEdit= {}
|
||||||
for book in BiblesResourcesDB.get_books():
|
for book in BiblesResourcesDB.get_books():
|
||||||
self.bookNameLabel[book[u'abbreviation']] = QtGui.QLabel(
|
self.bookNameLabel[book[u'abbreviation']] = QtGui.QLabel(self.bookNameWidget)
|
||||||
self.bookNameWidget)
|
self.bookNameLabel[book[u'abbreviation']].setObjectName(u'bookNameLabel[%s]' % book[u'abbreviation'])
|
||||||
self.bookNameLabel[book[u'abbreviation']].setObjectName(
|
self.bookNameEdit[book[u'abbreviation']] = QtGui.QLineEdit(self.bookNameWidget)
|
||||||
u'bookNameLabel[%s]' % book[u'abbreviation'])
|
self.bookNameEdit[book[u'abbreviation']].setObjectName(u'bookNameEdit[%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.bookNameWidgetLayout.addRow(
|
||||||
self.bookNameLabel[book[u'abbreviation']],
|
self.bookNameLabel[book[u'abbreviation']],
|
||||||
self.bookNameEdit[book[u'abbreviation']])
|
self.bookNameEdit[book[u'abbreviation']])
|
||||||
@ -136,48 +121,33 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.bibleTabWidget.addTab(self.bookNameTab, u'')
|
self.bibleTabWidget.addTab(self.bookNameTab, u'')
|
||||||
# Last few bits
|
# Last few bits
|
||||||
self.dialogLayout.addWidget(self.bibleTabWidget)
|
self.dialogLayout.addWidget(self.bibleTabWidget)
|
||||||
self.buttonBox = create_button_box(editBibleDialog, u'buttonBox',
|
self.buttonBox = create_button_box(editBibleDialog, u'buttonBox', [u'cancel', u'save'])
|
||||||
[u'cancel', u'save'])
|
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.buttonBox)
|
||||||
self.retranslateUi(editBibleDialog)
|
self.retranslateUi(editBibleDialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(editBibleDialog)
|
QtCore.QMetaObject.connectSlotsByName(editBibleDialog)
|
||||||
|
|
||||||
def retranslateUi(self, editBibleDialog):
|
def retranslateUi(self, editBibleDialog):
|
||||||
self.book_names = BibleStrings().BookNames
|
self.book_names = BibleStrings().BookNames
|
||||||
editBibleDialog.setWindowTitle(
|
editBibleDialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
|
|
||||||
# Meta tab
|
# Meta tab
|
||||||
self.bibleTabWidget.setTabText(
|
self.bibleTabWidget.setTabText( self.bibleTabWidget.indexOf(self.metaTab),
|
||||||
self.bibleTabWidget.indexOf(self.metaTab),
|
|
||||||
translate('SongsPlugin.EditBibleForm', 'Meta Data'))
|
translate('SongsPlugin.EditBibleForm', 'Meta Data'))
|
||||||
self.licenseDetailsGroupBox.setTitle(
|
self.licenseDetailsGroupBox.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details'))
|
||||||
translate('BiblesPlugin.EditBibleForm', 'License Details'))
|
self.versionNameLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
||||||
self.versionNameLabel.setText(
|
self.copyrightLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
self.permissionsLabel.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
||||||
self.copyrightLabel.setText(
|
self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
self.languageSelectionLabel.setText(translate('BiblesPlugin.EditBibleForm',
|
||||||
self.permissionsLabel.setText(
|
'Book name language in search field, search results and on display:'))
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
self.languageSelectionComboBox.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings'))
|
||||||
self.languageSelectionGroupBox.setTitle(translate(
|
|
||||||
'BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
|
||||||
self.languageSelectionLabel.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.languageSelectionComboBox.setItemText(LanguageSelection.Bible + 1,
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Bible Language'))
|
translate('BiblesPlugin.EditBibleForm', 'Bible Language'))
|
||||||
self.languageSelectionComboBox.setItemText(
|
self.languageSelectionComboBox.setItemText(LanguageSelection.Application + 1,
|
||||||
LanguageSelection.Application + 1,
|
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Application Language'))
|
translate('BiblesPlugin.EditBibleForm', 'Application Language'))
|
||||||
self.languageSelectionComboBox.setItemText(
|
self.languageSelectionComboBox.setItemText(LanguageSelection.English + 1,
|
||||||
LanguageSelection.English + 1,
|
|
||||||
translate('BiblesPlugin.EditBibleForm', 'English'))
|
translate('BiblesPlugin.EditBibleForm', 'English'))
|
||||||
# Book name tab
|
# Book name tab
|
||||||
self.bibleTabWidget.setTabText(
|
self.bibleTabWidget.setTabText(self.bibleTabWidget.indexOf(self.bookNameTab),
|
||||||
self.bibleTabWidget.indexOf(self.bookNameTab),
|
|
||||||
translate('SongsPlugin.EditBibleForm', 'Custom Book Names'))
|
translate('SongsPlugin.EditBibleForm', 'Custom Book Names'))
|
||||||
for book in BiblesResourcesDB.get_books():
|
for book in BiblesResourcesDB.get_books():
|
||||||
self.bookNameLabel[book[u'abbreviation']].setText(
|
self.bookNameLabel[book[u'abbreviation']].setText(u'%s:' % unicode(self.book_names[book[u'abbreviation']]))
|
||||||
u'%s:' % unicode(self.book_names[book[u'abbreviation']]))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -65,44 +65,32 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Load Bible')
|
log.debug(u'Load Bible')
|
||||||
self.bible = bible
|
self.bible = bible
|
||||||
self.versionNameEdit.setText(
|
self.versionNameEdit.setText(self.manager.get_meta_data(self.bible, u'name').value)
|
||||||
self.manager.get_meta_data(self.bible, u'name').value)
|
self.copyrightEdit.setText(self.manager.get_meta_data(self.bible, u'copyright').value)
|
||||||
self.copyrightEdit.setText(
|
self.permissionsEdit.setText(self.manager.get_meta_data(self.bible, u'permissions').value)
|
||||||
self.manager.get_meta_data(self.bible, u'copyright').value)
|
book_name_language = self.manager.get_meta_data(self.bible, u'book_name_language')
|
||||||
self.permissionsEdit.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':
|
if book_name_language and book_name_language.value != u'None':
|
||||||
self.languageSelectionComboBox.setCurrentIndex(
|
self.languageSelectionComboBox.setCurrentIndex(int(book_name_language.value) + 1)
|
||||||
int(book_name_language.value) + 1)
|
|
||||||
self.books = {}
|
self.books = {}
|
||||||
self.webbible = self.manager.get_meta_data(self.bible,
|
self.webbible = self.manager.get_meta_data(self.bible, u'download_source')
|
||||||
u'download_source')
|
|
||||||
if self.webbible:
|
if self.webbible:
|
||||||
self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
|
self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
|
||||||
'This is a Web Download Bible.\nIt is not possible to '
|
'This is a Web Download Bible.\nIt is not possible to customize the Book Names.'))
|
||||||
'customize the Book Names.'))
|
|
||||||
self.scrollArea.hide()
|
self.scrollArea.hide()
|
||||||
else:
|
else:
|
||||||
self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
|
self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm',
|
||||||
'To use the customized book names, "Bible language" must be '
|
'To use the customized book names, "Bible language" must be selected on the Meta Data tab or, '
|
||||||
'selected on the Meta Data tab or, if "Global settings" is '
|
'if "Global settings" is selected, on the Bible page in Configure OpenLP.'))
|
||||||
'selected, on the Bible page in Configure OpenLP.'))
|
|
||||||
for book in BiblesResourcesDB.get_books():
|
for book in BiblesResourcesDB.get_books():
|
||||||
self.books[book[u'abbreviation']] = self.manager.get_book_by_id(
|
self.books[book[u'abbreviation']] = self.manager.get_book_by_id(self.bible, book[u'id'])
|
||||||
self.bible, book[u'id'])
|
|
||||||
if self.books[book[u'abbreviation']] and not self.webbible:
|
if self.books[book[u'abbreviation']] and not self.webbible:
|
||||||
self.bookNameEdit[book[u'abbreviation']].setText(
|
self.bookNameEdit[book[u'abbreviation']].setText(self.books[book[u'abbreviation']].name)
|
||||||
self.books[book[u'abbreviation']].name)
|
|
||||||
else:
|
else:
|
||||||
# It is nessecary to remove the Widget otherwise there still
|
# It is necessary to remove the Widget otherwise there still
|
||||||
# exists the vertical spacing in QFormLayout
|
# exists the vertical spacing in QFormLayout
|
||||||
self.bookNameWidgetLayout.removeWidget(
|
self.bookNameWidgetLayout.removeWidget(self.bookNameLabel[book[u'abbreviation']])
|
||||||
self.bookNameLabel[book[u'abbreviation']])
|
|
||||||
self.bookNameLabel[book[u'abbreviation']].hide()
|
self.bookNameLabel[book[u'abbreviation']].hide()
|
||||||
self.bookNameWidgetLayout.removeWidget(
|
self.bookNameWidgetLayout.removeWidget(self.bookNameEdit[book[u'abbreviation']])
|
||||||
self.bookNameEdit[book[u'abbreviation']])
|
|
||||||
self.bookNameEdit[book[u'abbreviation']].hide()
|
self.bookNameEdit[book[u'abbreviation']].hide()
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
@ -136,8 +124,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||||||
return
|
return
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
self.manager.save_meta_data(self.bible, version, copyright, permissions,
|
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
|
||||||
book_name_language)
|
|
||||||
if not self.webbible:
|
if not self.webbible:
|
||||||
for abbr, book in self.books.iteritems():
|
for abbr, book in self.books.iteritems():
|
||||||
if book:
|
if book:
|
||||||
@ -155,24 +142,19 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||||||
if not name:
|
if not name:
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
translate('BiblesPlugin.BibleEditForm', 'You need to specify a version name for your Bible.'))
|
||||||
'You need to specify a version name for your Bible.'))
|
|
||||||
return False
|
return False
|
||||||
elif not copyright:
|
elif not copyright:
|
||||||
self.copyrightEdit.setFocus()
|
self.copyrightEdit.setFocus()
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
translate('BiblesPlugin.BibleEditForm',
|
||||||
'You need to set a copyright for your Bible. '
|
'You need to set a copyright for your Bible. Bibles in the Public Domain need to be marked as such.'))
|
||||||
'Bibles in the Public Domain need to be marked as such.'))
|
|
||||||
return False
|
return False
|
||||||
elif self.manager.exists(name) and \
|
elif self.manager.exists(name) and self.manager.get_meta_data(self.bible, u'name').value != \
|
||||||
self.manager.get_meta_data(self.bible, u'name').value != \
|
|
||||||
name:
|
name:
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
critical_error_message_box(
|
critical_error_message_box(translate('BiblesPlugin.BibleEditForm', 'Bible Exists'),
|
||||||
translate('BiblesPlugin.BibleEditForm', 'Bible Exists'),
|
translate('BiblesPlugin.BibleEditForm', 'This Bible already exists. Please import '
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
|
||||||
'This Bible already exists. Please import '
|
|
||||||
'a different Bible or first delete the existing one.'))
|
'a different Bible or first delete the existing one.'))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -185,17 +167,15 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||||||
if not new_book_name:
|
if not new_book_name:
|
||||||
self.bookNameEdit[abbreviation].setFocus()
|
self.bookNameEdit[abbreviation].setFocus()
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') %
|
||||||
'You need to specify a book name for "%s".') %
|
self.book_names[abbreviation])
|
||||||
self.book_names[abbreviation])
|
|
||||||
return False
|
return False
|
||||||
elif not book_regex.match(new_book_name):
|
elif not book_regex.match(new_book_name):
|
||||||
self.bookNameEdit[abbreviation].setFocus()
|
self.bookNameEdit[abbreviation].setFocus()
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
translate('BiblesPlugin.BibleEditForm',
|
||||||
'The book name "%s" is not correct.\nNumbers can only be used '
|
'The book name "%s" is not correct.\nNumbers can only be used at the beginning and must\nbe '
|
||||||
'at the beginning and must\nbe followed by one or more '
|
'followed by one or more non-numeric characters.') % new_book_name)
|
||||||
'non-numeric characters.') % new_book_name)
|
|
||||||
return False
|
return False
|
||||||
for abbr, book in self.books.iteritems():
|
for abbr, book in self.books.iteritems():
|
||||||
if book:
|
if book:
|
||||||
@ -204,10 +184,8 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
|||||||
if self.bookNameEdit[abbr].text() == new_book_name:
|
if self.bookNameEdit[abbr].text() == new_book_name:
|
||||||
self.bookNameEdit[abbreviation].setFocus()
|
self.bookNameEdit[abbreviation].setFocus()
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
translate('BiblesPlugin.BibleEditForm', 'Duplicate Book Name'),
|
||||||
'Duplicate Book Name'),
|
translate('BiblesPlugin.BibleEditForm', 'The Book Name "%s" has been entered more than once.')
|
||||||
translate('BiblesPlugin.BibleEditForm',
|
% new_book_name)
|
||||||
'The Book Name "%s" has been entered more than once.')
|
|
||||||
% new_book_name)
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -54,28 +54,23 @@ class Ui_LanguageDialog(object):
|
|||||||
self.languageLabel.setObjectName(u'languageLabel')
|
self.languageLabel.setObjectName(u'languageLabel')
|
||||||
self.languageHBoxLayout.addWidget(self.languageLabel)
|
self.languageHBoxLayout.addWidget(self.languageLabel)
|
||||||
self.languageComboBox = QtGui.QComboBox(languageDialog)
|
self.languageComboBox = QtGui.QComboBox(languageDialog)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(
|
sizePolicy.setHeightForWidth(self.languageComboBox.sizePolicy().hasHeightForWidth())
|
||||||
self.languageComboBox.sizePolicy().hasHeightForWidth())
|
|
||||||
self.languageComboBox.setSizePolicy(sizePolicy)
|
self.languageComboBox.setSizePolicy(sizePolicy)
|
||||||
self.languageComboBox.setObjectName(u'languageComboBox')
|
self.languageComboBox.setObjectName(u'languageComboBox')
|
||||||
self.languageHBoxLayout.addWidget(self.languageComboBox)
|
self.languageHBoxLayout.addWidget(self.languageComboBox)
|
||||||
self.languageLayout.addLayout(self.languageHBoxLayout)
|
self.languageLayout.addLayout(self.languageHBoxLayout)
|
||||||
self.buttonBox = create_button_box(languageDialog, u'buttonBox',
|
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||||
[u'cancel', u'ok'])
|
|
||||||
self.languageLayout.addWidget(self.buttonBox)
|
self.languageLayout.addWidget(self.buttonBox)
|
||||||
|
|
||||||
self.retranslateUi(languageDialog)
|
self.retranslateUi(languageDialog)
|
||||||
|
|
||||||
def retranslateUi(self, languageDialog):
|
def retranslateUi(self, languageDialog):
|
||||||
languageDialog.setWindowTitle(
|
languageDialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
|
||||||
translate('BiblesPlugin.LanguageDialog', 'Select Language'))
|
|
||||||
self.bibleLabel.setText(translate('BiblesPlugin.LanguageDialog', ''))
|
self.bibleLabel.setText(translate('BiblesPlugin.LanguageDialog', ''))
|
||||||
self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog',
|
self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog',
|
||||||
'OpenLP is unable to determine the language of this translation '
|
'OpenLP is unable to determine the language of this translation of the Bible. Please select the language '
|
||||||
'of the Bible. Please select the language from the list below.'))
|
'from the list below.'))
|
||||||
self.languageLabel.setText(translate('BiblesPlugin.LanguageDialog',
|
self.languageLabel.setText(translate('BiblesPlugin.LanguageDialog', 'Language:'))
|
||||||
'Language:'))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -182,8 +182,7 @@ def update_reference_separators():
|
|||||||
references.
|
references.
|
||||||
"""
|
"""
|
||||||
default_separators = translate('BiblesPlugin',
|
default_separators = translate('BiblesPlugin',
|
||||||
':|v|V|verse|verses;;-|to;;,|and;;end',
|
':|v|V|verse|verses;;-|to;;,|and;;end Double-semicolon delimited separators for parsing references. '
|
||||||
'Double-semicolon delimited separators for parsing references. '
|
|
||||||
'Consult the developers for further information.').split(u';;')
|
'Consult the developers for further information.').split(u';;')
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.beginGroup(u'bibles')
|
settings.beginGroup(u'bibles')
|
||||||
@ -201,8 +200,7 @@ def update_reference_separators():
|
|||||||
while u'||' in source_string:
|
while u'||' in source_string:
|
||||||
source_string = source_string.replace(u'||', u'|')
|
source_string = source_string.replace(u'||', u'|')
|
||||||
if role != u'e':
|
if role != u'e':
|
||||||
REFERENCE_SEPARATORS[u'sep_%s_display' % role] = \
|
REFERENCE_SEPARATORS[u'sep_%s_display' % role] = source_string.split(u'|')[0]
|
||||||
source_string.split(u'|')[0]
|
|
||||||
# escape reserved characters
|
# escape reserved characters
|
||||||
for character in u'\\.^$*+?{}[]()':
|
for character in u'\\.^$*+?{}[]()':
|
||||||
source_string = source_string.replace(character, u'\\' + character)
|
source_string = source_string.replace(character, u'\\' + character)
|
||||||
@ -211,23 +209,17 @@ def update_reference_separators():
|
|||||||
u'(?:[-\u00AD\u2010\u2011\u2012\u2013\u2014\u2212\uFE63\uFF0D])')
|
u'(?:[-\u00AD\u2010\u2011\u2012\u2013\u2014\u2212\uFE63\uFF0D])')
|
||||||
source_string = source_string.replace(u',', u'(?:[,\u201A])')
|
source_string = source_string.replace(u',', u'(?:[,\u201A])')
|
||||||
REFERENCE_SEPARATORS[u'sep_%s' % role] = u'\s*(?:%s)\s*' % source_string
|
REFERENCE_SEPARATORS[u'sep_%s' % role] = u'\s*(?:%s)\s*' % source_string
|
||||||
REFERENCE_SEPARATORS[u'sep_%s_default' % role] = \
|
REFERENCE_SEPARATORS[u'sep_%s_default' % role] = default_separators[index]
|
||||||
default_separators[index]
|
|
||||||
# verse range match: (<chapter>:)?<verse>(-((<chapter>:)?<verse>|end)?)?
|
# verse range match: (<chapter>:)?<verse>(-((<chapter>:)?<verse>|end)?)?
|
||||||
range_regex = u'(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?' \
|
range_regex = u'(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?' \
|
||||||
u'(?P<from_verse>[0-9]+)(?P<range_to>%(sep_r)s(?:(?:(?P<to_chapter>' \
|
u'(?P<from_verse>[0-9]+)(?P<range_to>%(sep_r)s(?:(?:(?P<to_chapter>' \
|
||||||
u'[0-9]+)%(sep_v)s)?(?P<to_verse>[0-9]+)|%(sep_e)s)?)?' % \
|
u'[0-9]+)%(sep_v)s)?(?P<to_verse>[0-9]+)|%(sep_e)s)?)?' % REFERENCE_SEPARATORS
|
||||||
REFERENCE_SEPARATORS
|
REFERENCE_MATCHES[u'range'] = re.compile(u'^\s*%s\s*$' % range_regex, re.UNICODE)
|
||||||
REFERENCE_MATCHES[u'range'] = re.compile(u'^\s*%s\s*$' % range_regex,
|
REFERENCE_MATCHES[u'range_separator'] = re.compile(REFERENCE_SEPARATORS[u'sep_l'], re.UNICODE)
|
||||||
re.UNICODE)
|
|
||||||
REFERENCE_MATCHES[u'range_separator'] = re.compile(
|
|
||||||
REFERENCE_SEPARATORS[u'sep_l'], re.UNICODE)
|
|
||||||
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
|
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
|
||||||
REFERENCE_MATCHES[u'full'] = re.compile(
|
REFERENCE_MATCHES[u'full'] = re.compile(u'^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
|
||||||
u'^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
|
|
||||||
u'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$' \
|
u'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$' \
|
||||||
% dict(REFERENCE_SEPARATORS.items() + [(u'range_regex', range_regex)]),
|
% dict(REFERENCE_SEPARATORS.items() + [(u'range_regex', range_regex)]), re.UNICODE)
|
||||||
re.UNICODE)
|
|
||||||
|
|
||||||
def get_reference_separator(separator_type):
|
def get_reference_separator(separator_type):
|
||||||
"""
|
"""
|
||||||
@ -355,8 +347,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False):
|
|||||||
log.debug(u'Matched reference %s' % reference)
|
log.debug(u'Matched reference %s' % reference)
|
||||||
book = match.group(u'book')
|
book = match.group(u'book')
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
book_ref_id = bible.get_book_ref_id_by_localised_name(
|
book_ref_id = bible.get_book_ref_id_by_localised_name(book, language_selection)
|
||||||
book, language_selection)
|
|
||||||
elif not bible.get_book_by_book_ref_id(book_ref_id):
|
elif not bible.get_book_by_book_ref_id(book_ref_id):
|
||||||
book_ref_id = False
|
book_ref_id = False
|
||||||
ranges = match.group(u'ranges')
|
ranges = match.group(u'ranges')
|
||||||
@ -409,11 +400,9 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False):
|
|||||||
ref_list.append((book_ref_id, i, 1, -1))
|
ref_list.append((book_ref_id, i, 1, -1))
|
||||||
ref_list.append((book_ref_id, to_chapter, 1, to_verse))
|
ref_list.append((book_ref_id, to_chapter, 1, to_verse))
|
||||||
elif to_verse >= from_verse or to_verse == -1:
|
elif to_verse >= from_verse or to_verse == -1:
|
||||||
ref_list.append((book_ref_id, from_chapter,
|
ref_list.append((book_ref_id, from_chapter, from_verse, to_verse))
|
||||||
from_verse, to_verse))
|
|
||||||
elif from_verse:
|
elif from_verse:
|
||||||
ref_list.append((book_ref_id, from_chapter,
|
ref_list.append((book_ref_id, from_chapter, from_verse, from_verse))
|
||||||
from_verse, from_verse))
|
|
||||||
else:
|
else:
|
||||||
ref_list.append((book_ref_id, from_chapter, 1, -1))
|
ref_list.append((book_ref_id, from_chapter, 1, -1))
|
||||||
return ref_list
|
return ref_list
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -33,8 +33,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsTab, translate, Settings
|
from openlp.core.lib import Receiver, SettingsTab, translate, Settings
|
||||||
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
from openlp.core.lib.ui import UiStrings, find_and_set_in_combo_box
|
||||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \
|
||||||
update_reference_separators, get_reference_separator, LanguageSelection
|
get_reference_separator, LanguageSelection
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -65,97 +65,68 @@ class BiblesTab(SettingsTab):
|
|||||||
self.displayStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
self.displayStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
||||||
self.displayStyleComboBox.addItems([u'', u'', u'', u''])
|
self.displayStyleComboBox.addItems([u'', u'', u'', u''])
|
||||||
self.displayStyleComboBox.setObjectName(u'displayStyleComboBox')
|
self.displayStyleComboBox.setObjectName(u'displayStyleComboBox')
|
||||||
self.verseDisplayLayout.addRow(self.displayStyleLabel,
|
self.verseDisplayLayout.addRow(self.displayStyleLabel, self.displayStyleComboBox)
|
||||||
self.displayStyleComboBox)
|
|
||||||
self.layoutStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
self.layoutStyleLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
||||||
self.layoutStyleLabel.setObjectName(u'layoutStyleLabel')
|
self.layoutStyleLabel.setObjectName(u'layoutStyleLabel')
|
||||||
self.layoutStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
self.layoutStyleComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
||||||
self.layoutStyleComboBox.setObjectName(u'layoutStyleComboBox')
|
self.layoutStyleComboBox.setObjectName(u'layoutStyleComboBox')
|
||||||
self.layoutStyleComboBox.addItems([u'', u'', u''])
|
self.layoutStyleComboBox.addItems([u'', u'', u''])
|
||||||
self.verseDisplayLayout.addRow(self.layoutStyleLabel,
|
self.verseDisplayLayout.addRow(self.layoutStyleLabel, self.layoutStyleComboBox)
|
||||||
self.layoutStyleComboBox)
|
|
||||||
self.bibleSecondCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox)
|
self.bibleSecondCheckBox = QtGui.QCheckBox(self.verseDisplayGroupBox)
|
||||||
self.bibleSecondCheckBox.setObjectName(u'bibleSecondCheckBox')
|
self.bibleSecondCheckBox.setObjectName(u'bibleSecondCheckBox')
|
||||||
self.verseDisplayLayout.addRow(self.bibleSecondCheckBox)
|
self.verseDisplayLayout.addRow(self.bibleSecondCheckBox)
|
||||||
self.bibleThemeLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
self.bibleThemeLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
||||||
self.bibleThemeLabel.setObjectName(u'BibleThemeLabel')
|
self.bibleThemeLabel.setObjectName(u'BibleThemeLabel')
|
||||||
self.bibleThemeComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
self.bibleThemeComboBox = QtGui.QComboBox(self.verseDisplayGroupBox)
|
||||||
self.bibleThemeComboBox.setSizeAdjustPolicy(
|
self.bibleThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||||
QtGui.QComboBox.AdjustToMinimumContentsLength)
|
self.bibleThemeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||||
self.bibleThemeComboBox.setSizePolicy(
|
|
||||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
|
||||||
self.bibleThemeComboBox.addItem(u'')
|
self.bibleThemeComboBox.addItem(u'')
|
||||||
self.bibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
|
self.bibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
|
||||||
self.verseDisplayLayout.addRow(self.bibleThemeLabel,
|
self.verseDisplayLayout.addRow(self.bibleThemeLabel, self.bibleThemeComboBox)
|
||||||
self.bibleThemeComboBox)
|
|
||||||
self.changeNoteLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
self.changeNoteLabel = QtGui.QLabel(self.verseDisplayGroupBox)
|
||||||
self.changeNoteLabel.setWordWrap(True)
|
self.changeNoteLabel.setWordWrap(True)
|
||||||
self.changeNoteLabel.setObjectName(u'changeNoteLabel')
|
self.changeNoteLabel.setObjectName(u'changeNoteLabel')
|
||||||
self.verseDisplayLayout.addRow(self.changeNoteLabel)
|
self.verseDisplayLayout.addRow(self.changeNoteLabel)
|
||||||
self.leftLayout.addWidget(self.verseDisplayGroupBox)
|
self.leftLayout.addWidget(self.verseDisplayGroupBox)
|
||||||
self.scriptureReferenceGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.scriptureReferenceGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.scriptureReferenceGroupBox.setObjectName(
|
self.scriptureReferenceGroupBox.setObjectName(u'scriptureReferenceGroupBox')
|
||||||
u'scriptureReferenceGroupBox')
|
self.scriptureReferenceLayout = QtGui.QGridLayout(self.scriptureReferenceGroupBox)
|
||||||
self.scriptureReferenceLayout = QtGui.QGridLayout(
|
self.verseSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox)
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.verseSeparatorCheckBox = QtGui.QCheckBox(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.verseSeparatorCheckBox.setObjectName(u'verseSeparatorCheckBox')
|
self.verseSeparatorCheckBox.setObjectName(u'verseSeparatorCheckBox')
|
||||||
self.scriptureReferenceLayout.addWidget(self.verseSeparatorCheckBox, 0,
|
self.scriptureReferenceLayout.addWidget(self.verseSeparatorCheckBox, 0, 0)
|
||||||
0)
|
self.verseSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox)
|
||||||
self.verseSeparatorLineEdit = QtGui.QLineEdit(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
# self.verseSeparatorLineEdit.setPalette
|
# self.verseSeparatorLineEdit.setPalette
|
||||||
self.verseSeparatorLineEdit.setObjectName(u'verseSeparatorLineEdit')
|
self.verseSeparatorLineEdit.setObjectName(u'verseSeparatorLineEdit')
|
||||||
self.scriptureReferenceLayout.addWidget(self.verseSeparatorLineEdit, 0,
|
self.scriptureReferenceLayout.addWidget(self.verseSeparatorLineEdit, 0, 1)
|
||||||
1)
|
self.rangeSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox)
|
||||||
self.rangeSeparatorCheckBox = QtGui.QCheckBox(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.rangeSeparatorCheckBox.setObjectName(u'rangeSeparatorCheckBox')
|
self.rangeSeparatorCheckBox.setObjectName(u'rangeSeparatorCheckBox')
|
||||||
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorCheckBox, 1,
|
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorCheckBox, 1, 0)
|
||||||
0)
|
self.rangeSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox)
|
||||||
self.rangeSeparatorLineEdit = QtGui.QLineEdit(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.rangeSeparatorLineEdit.setObjectName(u'rangeSeparatorLineEdit')
|
self.rangeSeparatorLineEdit.setObjectName(u'rangeSeparatorLineEdit')
|
||||||
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorLineEdit, 1,
|
self.scriptureReferenceLayout.addWidget(self.rangeSeparatorLineEdit, 1, 1)
|
||||||
1)
|
self.listSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox)
|
||||||
self.listSeparatorCheckBox = QtGui.QCheckBox(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.listSeparatorCheckBox.setObjectName(u'listSeparatorCheckBox')
|
self.listSeparatorCheckBox.setObjectName(u'listSeparatorCheckBox')
|
||||||
self.scriptureReferenceLayout.addWidget(self.listSeparatorCheckBox, 2,
|
self.scriptureReferenceLayout.addWidget(self.listSeparatorCheckBox, 2, 0)
|
||||||
0)
|
self.listSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox)
|
||||||
self.listSeparatorLineEdit = QtGui.QLineEdit(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.listSeparatorLineEdit.setObjectName(u'listSeparatorLineEdit')
|
self.listSeparatorLineEdit.setObjectName(u'listSeparatorLineEdit')
|
||||||
self.scriptureReferenceLayout.addWidget(self.listSeparatorLineEdit, 2,
|
self.scriptureReferenceLayout.addWidget(self.listSeparatorLineEdit, 2, 1)
|
||||||
1)
|
self.endSeparatorCheckBox = QtGui.QCheckBox(self.scriptureReferenceGroupBox)
|
||||||
self.endSeparatorCheckBox = QtGui.QCheckBox(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.endSeparatorCheckBox.setObjectName(u'endSeparatorCheckBox')
|
self.endSeparatorCheckBox.setObjectName(u'endSeparatorCheckBox')
|
||||||
self.scriptureReferenceLayout.addWidget(self.endSeparatorCheckBox, 3,
|
self.scriptureReferenceLayout.addWidget(self.endSeparatorCheckBox, 3, 0)
|
||||||
0)
|
self.endSeparatorLineEdit = QtGui.QLineEdit(self.scriptureReferenceGroupBox)
|
||||||
self.endSeparatorLineEdit = QtGui.QLineEdit(
|
|
||||||
self.scriptureReferenceGroupBox)
|
|
||||||
self.endSeparatorLineEdit.setObjectName(u'endSeparatorLineEdit')
|
self.endSeparatorLineEdit.setObjectName(u'endSeparatorLineEdit')
|
||||||
self.endSeparatorLineEdit.setValidator(QtGui.QRegExpValidator(
|
self.endSeparatorLineEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^0-9]*'),
|
||||||
QtCore.QRegExp(r'[^0-9]*'), self.endSeparatorLineEdit))
|
self.endSeparatorLineEdit))
|
||||||
self.scriptureReferenceLayout.addWidget(self.endSeparatorLineEdit, 3,
|
self.scriptureReferenceLayout.addWidget(self.endSeparatorLineEdit, 3, 1)
|
||||||
1)
|
|
||||||
self.leftLayout.addWidget(self.scriptureReferenceGroupBox)
|
self.leftLayout.addWidget(self.scriptureReferenceGroupBox)
|
||||||
self.rightColumn.setSizePolicy(
|
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
|
||||||
self.languageSelectionGroupBox = QtGui.QGroupBox(self.rightColumn)
|
self.languageSelectionGroupBox = QtGui.QGroupBox(self.rightColumn)
|
||||||
self.languageSelectionGroupBox.setObjectName(
|
self.languageSelectionGroupBox.setObjectName(u'languageSelectionGroupBox')
|
||||||
u'languageSelectionGroupBox')
|
self.languageSelectionLayout = QtGui.QVBoxLayout(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionLayout = QtGui.QVBoxLayout(
|
self.languageSelectionLabel = QtGui.QLabel(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionGroupBox)
|
|
||||||
self.languageSelectionLabel = QtGui.QLabel(
|
|
||||||
self.languageSelectionGroupBox)
|
|
||||||
self.languageSelectionLabel.setObjectName(u'languageSelectionLabel')
|
self.languageSelectionLabel.setObjectName(u'languageSelectionLabel')
|
||||||
self.languageSelectionComboBox = QtGui.QComboBox(
|
self.languageSelectionComboBox = QtGui.QComboBox(self.languageSelectionGroupBox)
|
||||||
self.languageSelectionGroupBox)
|
self.languageSelectionComboBox.setObjectName(u'languageSelectionComboBox')
|
||||||
self.languageSelectionComboBox.setObjectName(
|
|
||||||
u'languageSelectionComboBox')
|
|
||||||
self.languageSelectionComboBox.addItems([u'', u'', u''])
|
self.languageSelectionComboBox.addItems([u'', u'', u''])
|
||||||
self.languageSelectionLayout.addWidget(self.languageSelectionLabel)
|
self.languageSelectionLayout.addWidget(self.languageSelectionLabel)
|
||||||
self.languageSelectionLayout.addWidget(self.languageSelectionComboBox)
|
self.languageSelectionLayout.addWidget(self.languageSelectionComboBox)
|
||||||
@ -163,79 +134,53 @@ class BiblesTab(SettingsTab):
|
|||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.newChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
self.newChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onNewChaptersCheckBoxChanged)
|
self.onNewChaptersCheckBoxChanged)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.displayStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
self.displayStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onDisplayStyleComboBoxChanged)
|
self.onDisplayStyleComboBoxChanged)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.bibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
self.bibleThemeComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onBibleThemeComboBoxChanged)
|
self.onBibleThemeComboBoxChanged)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.layoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
self.layoutStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onLayoutStyleComboBoxChanged)
|
self.onLayoutStyleComboBoxChanged)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.bibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
self.bibleSecondCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onBibleSecondCheckBox)
|
self.onBibleSecondCheckBox)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.verseSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.verseSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
|
||||||
self.onVerseSeparatorCheckBoxClicked)
|
self.onVerseSeparatorCheckBoxClicked)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.verseSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
||||||
self.verseSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
|
||||||
self.onVerseSeparatorLineEditEdited)
|
self.onVerseSeparatorLineEditEdited)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.verseSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
||||||
self.verseSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
|
||||||
self.onVerseSeparatorLineEditFinished)
|
self.onVerseSeparatorLineEditFinished)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.rangeSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.rangeSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
|
||||||
self.onRangeSeparatorCheckBoxClicked)
|
self.onRangeSeparatorCheckBoxClicked)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
||||||
self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
|
||||||
self.onRangeSeparatorLineEditEdited)
|
self.onRangeSeparatorLineEditEdited)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
||||||
self.rangeSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
|
||||||
self.onRangeSeparatorLineEditFinished)
|
self.onRangeSeparatorLineEditFinished)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.listSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.listSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
|
||||||
self.onListSeparatorCheckBoxClicked)
|
self.onListSeparatorCheckBoxClicked)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.listSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
||||||
self.listSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
|
||||||
self.onListSeparatorLineEditEdited)
|
self.onListSeparatorLineEditEdited)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.listSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
||||||
self.listSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
|
||||||
self.onListSeparatorLineEditFinished)
|
self.onListSeparatorLineEditFinished)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.endSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.endSeparatorCheckBox, QtCore.SIGNAL(u'clicked(bool)'),
|
|
||||||
self.onEndSeparatorCheckBoxClicked)
|
self.onEndSeparatorCheckBoxClicked)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.endSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
||||||
self.endSeparatorLineEdit, QtCore.SIGNAL(u'textEdited(QString)'),
|
|
||||||
self.onEndSeparatorLineEditEdited)
|
self.onEndSeparatorLineEditEdited)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.endSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
||||||
self.endSeparatorLineEdit, QtCore.SIGNAL(u'editingFinished()'),
|
|
||||||
self.onEndSeparatorLineEditFinished)
|
self.onEndSeparatorLineEditFinished)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
|
||||||
QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList)
|
QtCore.QObject.connect(self.languageSelectionComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
QtCore.QObject.connect(
|
|
||||||
self.languageSelectionComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onLanguageSelectionComboBoxChanged)
|
self.onLanguageSelectionComboBoxChanged)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.verseDisplayGroupBox.setTitle(
|
self.verseDisplayGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Verse Display'))
|
||||||
translate('BiblesPlugin.BiblesTab', 'Verse Display'))
|
self.newChaptersCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Only show new chapter numbers'))
|
||||||
self.newChaptersCheckBox.setText(
|
|
||||||
translate('BiblesPlugin.BiblesTab',
|
|
||||||
'Only show new chapter numbers'))
|
|
||||||
self.layoutStyleLabel.setText(UiStrings().LayoutStyle)
|
self.layoutStyleLabel.setText(UiStrings().LayoutStyle)
|
||||||
self.displayStyleLabel.setText(UiStrings().DisplayStyle)
|
self.displayStyleLabel.setText(UiStrings().DisplayStyle)
|
||||||
self.bibleThemeLabel.setText(
|
self.bibleThemeLabel.setText(translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
|
||||||
translate('BiblesPlugin.BiblesTab', 'Bible theme:'))
|
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide)
|
||||||
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
|
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine)
|
||||||
UiStrings().VersePerSlide)
|
self.layoutStyleComboBox.setItemText(LayoutStyle.Continuous, UiStrings().Continuous)
|
||||||
self.layoutStyleComboBox.setItemText(LayoutStyle.VersePerLine,
|
|
||||||
UiStrings().VersePerLine)
|
|
||||||
self.layoutStyleComboBox.setItemText(LayoutStyle.Continuous,
|
|
||||||
UiStrings().Continuous)
|
|
||||||
self.displayStyleComboBox.setItemText(DisplayStyle.NoBrackets,
|
self.displayStyleComboBox.setItemText(DisplayStyle.NoBrackets,
|
||||||
translate('BiblesPlugin.BiblesTab', 'No Brackets'))
|
translate('BiblesPlugin.BiblesTab', 'No Brackets'))
|
||||||
self.displayStyleComboBox.setItemText(DisplayStyle.Round,
|
self.displayStyleComboBox.setItemText(DisplayStyle.Round,
|
||||||
@ -246,18 +191,13 @@ class BiblesTab(SettingsTab):
|
|||||||
translate('BiblesPlugin.BiblesTab', '[ And ]'))
|
translate('BiblesPlugin.BiblesTab', '[ And ]'))
|
||||||
self.changeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
|
self.changeNoteLabel.setText(translate('BiblesPlugin.BiblesTab',
|
||||||
'Note:\nChanges do not affect verses already in the service.'))
|
'Note:\nChanges do not affect verses already in the service.'))
|
||||||
self.bibleSecondCheckBox.setText(
|
self.bibleSecondCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Display second Bible verses'))
|
||||||
translate('BiblesPlugin.BiblesTab', 'Display second Bible verses'))
|
self.scriptureReferenceGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Custom Scripture References'))
|
||||||
self.scriptureReferenceGroupBox.setTitle(
|
self.verseSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Verse Separator:'))
|
||||||
translate('BiblesPlugin.BiblesTab', 'Custom Scripture References'))
|
self.rangeSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'Range Separator:'))
|
||||||
self.verseSeparatorCheckBox.setText(
|
self.listSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'List Separator:'))
|
||||||
translate('BiblesPlugin.BiblesTab', 'Verse Separator:'))
|
self.endSeparatorCheckBox.setText(translate('BiblesPlugin.BiblesTab', 'End Mark:'))
|
||||||
self.rangeSeparatorCheckBox.setText(
|
#@todo these are common so move to StringsUI and reuse.
|
||||||
translate('BiblesPlugin.BiblesTab', 'Range Separator:'))
|
|
||||||
self.listSeparatorCheckBox.setText(
|
|
||||||
translate('BiblesPlugin.BiblesTab', 'List Separator:'))
|
|
||||||
self.endSeparatorCheckBox.setText(
|
|
||||||
translate('BiblesPlugin.BiblesTab', 'End Mark:'))
|
|
||||||
self.verseSeparatorLineEdit.setToolTip(
|
self.verseSeparatorLineEdit.setToolTip(
|
||||||
translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
|
translate('BiblesPlugin.BiblesTab', 'Multiple alternative '
|
||||||
'verse separators may be defined.\nThey have to be separated '
|
'verse separators may be defined.\nThey have to be separated '
|
||||||
@ -278,15 +218,12 @@ class BiblesTab(SettingsTab):
|
|||||||
'end marks may be defined.\nThey have to be separated by a '
|
'end marks may be defined.\nThey have to be separated by a '
|
||||||
'vertical bar "|".\nPlease clear this edit line to use the '
|
'vertical bar "|".\nPlease clear this edit line to use the '
|
||||||
'default value.'))
|
'default value.'))
|
||||||
self.languageSelectionGroupBox.setTitle(translate(
|
self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', 'Default Bible Language'))
|
||||||
'BiblesPlugin.BiblesTab', 'Default Bible Language'))
|
|
||||||
self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab',
|
self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab',
|
||||||
'Book name language in search field,\nsearch results and on '
|
'Book name language in search field,\nsearch results and on display:'))
|
||||||
'display:'))
|
|
||||||
self.languageSelectionComboBox.setItemText(LanguageSelection.Bible,
|
self.languageSelectionComboBox.setItemText(LanguageSelection.Bible,
|
||||||
translate('BiblesPlugin.BiblesTab', 'Bible Language'))
|
translate('BiblesPlugin.BiblesTab', 'Bible Language'))
|
||||||
self.languageSelectionComboBox.setItemText(
|
self.languageSelectionComboBox.setItemText(LanguageSelection.Application,
|
||||||
LanguageSelection.Application,
|
|
||||||
translate('BiblesPlugin.BiblesTab', 'Application Language'))
|
translate('BiblesPlugin.BiblesTab', 'Application Language'))
|
||||||
self.languageSelectionComboBox.setItemText(LanguageSelection.English,
|
self.languageSelectionComboBox.setItemText(LanguageSelection.English,
|
||||||
translate('BiblesPlugin.BiblesTab', 'English'))
|
translate('BiblesPlugin.BiblesTab', 'English'))
|
||||||
@ -319,101 +256,77 @@ class BiblesTab(SettingsTab):
|
|||||||
if checked:
|
if checked:
|
||||||
self.verseSeparatorLineEdit.setFocus()
|
self.verseSeparatorLineEdit.setFocus()
|
||||||
else:
|
else:
|
||||||
self.verseSeparatorLineEdit.setText(
|
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default'))
|
||||||
get_reference_separator(u'sep_v_default'))
|
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked))
|
||||||
self.verseSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(not checked))
|
|
||||||
|
|
||||||
def onVerseSeparatorLineEditEdited(self, text):
|
def onVerseSeparatorLineEditEdited(self, text):
|
||||||
self.verseSeparatorCheckBox.setChecked(True)
|
self.verseSeparatorCheckBox.setChecked(True)
|
||||||
self.verseSeparatorLineEdit.setPalette(
|
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
|
|
||||||
def onVerseSeparatorLineEditFinished(self):
|
def onVerseSeparatorLineEditFinished(self):
|
||||||
if self.verseSeparatorLineEdit.isModified():
|
if self.verseSeparatorLineEdit.isModified():
|
||||||
text = self.verseSeparatorLineEdit.text()
|
text = self.verseSeparatorLineEdit.text()
|
||||||
if text == get_reference_separator(u'sep_v_default') or \
|
if text == get_reference_separator(u'sep_v_default') or not text.replace(u'|', u''):
|
||||||
not text.replace(u'|', u''):
|
|
||||||
self.verseSeparatorCheckBox.setChecked(False)
|
self.verseSeparatorCheckBox.setChecked(False)
|
||||||
self.verseSeparatorLineEdit.setText(
|
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default'))
|
||||||
get_reference_separator(u'sep_v_default'))
|
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.verseSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
|
|
||||||
def onRangeSeparatorCheckBoxClicked(self, checked):
|
def onRangeSeparatorCheckBoxClicked(self, checked):
|
||||||
if checked:
|
if checked:
|
||||||
self.rangeSeparatorLineEdit.setFocus()
|
self.rangeSeparatorLineEdit.setFocus()
|
||||||
else:
|
else:
|
||||||
self.rangeSeparatorLineEdit.setText(
|
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default'))
|
||||||
get_reference_separator(u'sep_r_default'))
|
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked))
|
||||||
self.rangeSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(not checked))
|
|
||||||
|
|
||||||
def onRangeSeparatorLineEditEdited(self, text):
|
def onRangeSeparatorLineEditEdited(self, text):
|
||||||
self.rangeSeparatorCheckBox.setChecked(True)
|
self.rangeSeparatorCheckBox.setChecked(True)
|
||||||
self.rangeSeparatorLineEdit.setPalette(
|
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
|
|
||||||
def onRangeSeparatorLineEditFinished(self):
|
def onRangeSeparatorLineEditFinished(self):
|
||||||
if self.rangeSeparatorLineEdit.isModified():
|
if self.rangeSeparatorLineEdit.isModified():
|
||||||
text = self.rangeSeparatorLineEdit.text()
|
text = self.rangeSeparatorLineEdit.text()
|
||||||
if text == get_reference_separator(u'sep_r_default') or \
|
if text == get_reference_separator(u'sep_r_default') or not text.replace(u'|', u''):
|
||||||
not text.replace(u'|', u''):
|
|
||||||
self.rangeSeparatorCheckBox.setChecked(False)
|
self.rangeSeparatorCheckBox.setChecked(False)
|
||||||
self.rangeSeparatorLineEdit.setText(
|
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default'))
|
||||||
get_reference_separator(u'sep_r_default'))
|
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.rangeSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
|
|
||||||
def onListSeparatorCheckBoxClicked(self, checked):
|
def onListSeparatorCheckBoxClicked(self, checked):
|
||||||
if checked:
|
if checked:
|
||||||
self.listSeparatorLineEdit.setFocus()
|
self.listSeparatorLineEdit.setFocus()
|
||||||
else:
|
else:
|
||||||
self.listSeparatorLineEdit.setText(
|
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default'))
|
||||||
get_reference_separator(u'sep_l_default'))
|
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked))
|
||||||
self.listSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(not checked))
|
|
||||||
|
|
||||||
def onListSeparatorLineEditEdited(self, text):
|
def onListSeparatorLineEditEdited(self, text):
|
||||||
self.listSeparatorCheckBox.setChecked(True)
|
self.listSeparatorCheckBox.setChecked(True)
|
||||||
self.listSeparatorLineEdit.setPalette(
|
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
|
|
||||||
def onListSeparatorLineEditFinished(self):
|
def onListSeparatorLineEditFinished(self):
|
||||||
if self.listSeparatorLineEdit.isModified():
|
if self.listSeparatorLineEdit.isModified():
|
||||||
text = self.listSeparatorLineEdit.text()
|
text = self.listSeparatorLineEdit.text()
|
||||||
if text == get_reference_separator(u'sep_l_default') or \
|
if text == get_reference_separator(u'sep_l_default') or not text.replace(u'|', u''):
|
||||||
not text.replace(u'|', u''):
|
|
||||||
self.listSeparatorCheckBox.setChecked(False)
|
self.listSeparatorCheckBox.setChecked(False)
|
||||||
self.listSeparatorLineEdit.setText(
|
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default'))
|
||||||
get_reference_separator(u'sep_l_default'))
|
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.listSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
|
|
||||||
def onEndSeparatorCheckBoxClicked(self, checked):
|
def onEndSeparatorCheckBoxClicked(self, checked):
|
||||||
if checked:
|
if checked:
|
||||||
self.endSeparatorLineEdit.setFocus()
|
self.endSeparatorLineEdit.setFocus()
|
||||||
else:
|
else:
|
||||||
self.endSeparatorLineEdit.setText(
|
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default'))
|
||||||
get_reference_separator(u'sep_e_default'))
|
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(not checked))
|
||||||
self.endSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(not checked))
|
|
||||||
|
|
||||||
def onEndSeparatorLineEditEdited(self, text):
|
def onEndSeparatorLineEditEdited(self, text):
|
||||||
self.endSeparatorCheckBox.setChecked(True)
|
self.endSeparatorCheckBox.setChecked(True)
|
||||||
self.endSeparatorLineEdit.setPalette(
|
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
|
|
||||||
def onEndSeparatorLineEditFinished(self):
|
def onEndSeparatorLineEditFinished(self):
|
||||||
if self.endSeparatorLineEdit.isModified():
|
if self.endSeparatorLineEdit.isModified():
|
||||||
text = self.endSeparatorLineEdit.text()
|
text = self.endSeparatorLineEdit.text()
|
||||||
if text == get_reference_separator(u'sep_e_default') or \
|
if text == get_reference_separator(u'sep_e_default') or not text.replace(u'|', u''):
|
||||||
not text.replace(u'|', u''):
|
|
||||||
self.endSeparatorCheckBox.setChecked(False)
|
self.endSeparatorCheckBox.setChecked(False)
|
||||||
self.endSeparatorLineEdit.setText(
|
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default'))
|
||||||
get_reference_separator(u'sep_e_default'))
|
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.endSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
@ -428,48 +341,35 @@ class BiblesTab(SettingsTab):
|
|||||||
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
|
self.layoutStyleComboBox.setCurrentIndex(self.layout_style)
|
||||||
self.bibleSecondCheckBox.setChecked(self.second_bibles)
|
self.bibleSecondCheckBox.setChecked(self.second_bibles)
|
||||||
verse_separator = settings.value(u'verse separator', u'')
|
verse_separator = settings.value(u'verse separator', u'')
|
||||||
if (verse_separator.strip(u'|') == u'') or \
|
if (verse_separator.strip(u'|') == u'') or (verse_separator == get_reference_separator(u'sep_v_default')):
|
||||||
(verse_separator == get_reference_separator(u'sep_v_default')):
|
self.verseSeparatorLineEdit.setText(get_reference_separator(u'sep_v_default'))
|
||||||
self.verseSeparatorLineEdit.setText(
|
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
get_reference_separator(u'sep_v_default'))
|
|
||||||
self.verseSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
self.verseSeparatorCheckBox.setChecked(False)
|
self.verseSeparatorCheckBox.setChecked(False)
|
||||||
else:
|
else:
|
||||||
self.verseSeparatorLineEdit.setText(verse_separator)
|
self.verseSeparatorLineEdit.setText(verse_separator)
|
||||||
self.verseSeparatorLineEdit.setPalette(
|
self.verseSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
self.verseSeparatorCheckBox.setChecked(True)
|
self.verseSeparatorCheckBox.setChecked(True)
|
||||||
range_separator = settings.value(u'range separator', u'')
|
range_separator = settings.value(u'range separator', u'')
|
||||||
if (range_separator.strip(u'|') == u'') or \
|
if (range_separator.strip(u'|') == u'') or (range_separator == get_reference_separator(u'sep_r_default')):
|
||||||
(range_separator == get_reference_separator(u'sep_r_default')):
|
self.rangeSeparatorLineEdit.setText(get_reference_separator(u'sep_r_default'))
|
||||||
self.rangeSeparatorLineEdit.setText(
|
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
get_reference_separator(u'sep_r_default'))
|
|
||||||
self.rangeSeparatorLineEdit.setPalette(
|
|
||||||
self.getGreyTextPalette(True))
|
|
||||||
self.rangeSeparatorCheckBox.setChecked(False)
|
self.rangeSeparatorCheckBox.setChecked(False)
|
||||||
else:
|
else:
|
||||||
self.rangeSeparatorLineEdit.setText(range_separator)
|
self.rangeSeparatorLineEdit.setText(range_separator)
|
||||||
self.rangeSeparatorLineEdit.setPalette(
|
self.rangeSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
self.rangeSeparatorCheckBox.setChecked(True)
|
self.rangeSeparatorCheckBox.setChecked(True)
|
||||||
list_separator = settings.value(u'list separator', u'')
|
list_separator = settings.value(u'list separator', u'')
|
||||||
if (list_separator.strip(u'|') == u'') or \
|
if (list_separator.strip(u'|') == u'') or (list_separator == get_reference_separator(u'sep_l_default')):
|
||||||
(list_separator == get_reference_separator(u'sep_l_default')):
|
self.listSeparatorLineEdit.setText(get_reference_separator(u'sep_l_default'))
|
||||||
self.listSeparatorLineEdit.setText(
|
|
||||||
get_reference_separator(u'sep_l_default'))
|
|
||||||
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.listSeparatorCheckBox.setChecked(False)
|
self.listSeparatorCheckBox.setChecked(False)
|
||||||
else:
|
else:
|
||||||
self.listSeparatorLineEdit.setText(list_separator)
|
self.listSeparatorLineEdit.setText(list_separator)
|
||||||
self.listSeparatorLineEdit.setPalette(
|
self.listSeparatorLineEdit.setPalette(self.getGreyTextPalette(False))
|
||||||
self.getGreyTextPalette(False))
|
|
||||||
self.listSeparatorCheckBox.setChecked(True)
|
self.listSeparatorCheckBox.setChecked(True)
|
||||||
end_separator = settings.value(u'end separator', u'')
|
end_separator = settings.value(u'end separator', u'')
|
||||||
if (end_separator.strip(u'|') == u'') or \
|
if (end_separator.strip(u'|') == u'') or (end_separator == get_reference_separator(u'sep_e_default')):
|
||||||
(end_separator == get_reference_separator(u'sep_e_default')):
|
self.endSeparatorLineEdit.setText(get_reference_separator(u'sep_e_default'))
|
||||||
self.endSeparatorLineEdit.setText(
|
|
||||||
get_reference_separator(u'sep_e_default'))
|
|
||||||
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
self.endSeparatorLineEdit.setPalette(self.getGreyTextPalette(True))
|
||||||
self.endSeparatorCheckBox.setChecked(False)
|
self.endSeparatorCheckBox.setChecked(False)
|
||||||
else:
|
else:
|
||||||
@ -490,23 +390,19 @@ class BiblesTab(SettingsTab):
|
|||||||
settings.setValue(u'second bibles', self.second_bibles)
|
settings.setValue(u'second bibles', self.second_bibles)
|
||||||
settings.setValue(u'bible theme', self.bible_theme)
|
settings.setValue(u'bible theme', self.bible_theme)
|
||||||
if self.verseSeparatorCheckBox.isChecked():
|
if self.verseSeparatorCheckBox.isChecked():
|
||||||
settings.setValue(u'verse separator',
|
settings.setValue(u'verse separator', self.verseSeparatorLineEdit.text())
|
||||||
self.verseSeparatorLineEdit.text())
|
|
||||||
else:
|
else:
|
||||||
settings.remove(u'verse separator')
|
settings.remove(u'verse separator')
|
||||||
if self.rangeSeparatorCheckBox.isChecked():
|
if self.rangeSeparatorCheckBox.isChecked():
|
||||||
settings.setValue(u'range separator',
|
settings.setValue(u'range separator', self.rangeSeparatorLineEdit.text())
|
||||||
self.rangeSeparatorLineEdit.text())
|
|
||||||
else:
|
else:
|
||||||
settings.remove(u'range separator')
|
settings.remove(u'range separator')
|
||||||
if self.listSeparatorCheckBox.isChecked():
|
if self.listSeparatorCheckBox.isChecked():
|
||||||
settings.setValue(u'list separator',
|
settings.setValue(u'list separator', self.listSeparatorLineEdit.text())
|
||||||
self.listSeparatorLineEdit.text())
|
|
||||||
else:
|
else:
|
||||||
settings.remove(u'list separator')
|
settings.remove(u'list separator')
|
||||||
if self.endSeparatorCheckBox.isChecked():
|
if self.endSeparatorCheckBox.isChecked():
|
||||||
settings.setValue(u'end separator',
|
settings.setValue(u'end separator', self.endSeparatorLineEdit.text())
|
||||||
self.endSeparatorLineEdit.text())
|
|
||||||
else:
|
else:
|
||||||
settings.remove(u'end separator')
|
settings.remove(u'end separator')
|
||||||
update_reference_separators()
|
update_reference_separators()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -109,19 +109,14 @@ class CSVBible(BibleDB):
|
|||||||
for line in books_reader:
|
for line in books_reader:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
break
|
break
|
||||||
self.wizard.incrementProgressBar(
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing books... %s') %
|
||||||
translate('BiblesPlugin.CSVBible',
|
|
||||||
'Importing books... %s') %
|
|
||||||
unicode(line[2], details['encoding']))
|
unicode(line[2], details['encoding']))
|
||||||
book_ref_id = self.get_book_ref_id_by_name(
|
book_ref_id = self.get_book_ref_id_by_name(unicode(line[2], details['encoding']), 67, language_id)
|
||||||
unicode(line[2], details['encoding']), 67, language_id)
|
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.booksfile)
|
||||||
'failed' % self.booksfile)
|
|
||||||
return False
|
return False
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
self.create_book(unicode(line[2], details['encoding']),
|
self.create_book(unicode(line[2], details['encoding']), book_ref_id, book_details[u'testament_id'])
|
||||||
book_ref_id, book_details[u'testament_id'])
|
|
||||||
book_list[int(line[0])] = unicode(line[2], details['encoding'])
|
book_list[int(line[0])] = unicode(line[2], details['encoding'])
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
except (IOError, IndexError):
|
except (IOError, IndexError):
|
||||||
@ -153,17 +148,15 @@ class CSVBible(BibleDB):
|
|||||||
if book_ptr != line_book:
|
if book_ptr != line_book:
|
||||||
book = self.get_book(line_book)
|
book = self.get_book(line_book)
|
||||||
book_ptr = book.name
|
book_ptr = book.name
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible',
|
||||||
'BiblesPlugin.CSVBible', 'Importing verses from %s...',
|
'Importing verses from %s... Importing verses from <book name>...') % book.name)
|
||||||
'Importing verses from <book name>...') % book.name)
|
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
try:
|
try:
|
||||||
verse_text = unicode(line[3], details['encoding'])
|
verse_text = unicode(line[3], details['encoding'])
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
verse_text = unicode(line[3], u'cp1252')
|
verse_text = unicode(line[3], u'cp1252')
|
||||||
self.create_verse(book.id, line[1], line[2], verse_text)
|
self.create_verse(book.id, line[1], line[2], verse_text)
|
||||||
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible',
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
|
||||||
'Importing verses... done.'))
|
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -160,8 +160,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
if u'path' in kwargs:
|
if u'path' in kwargs:
|
||||||
self.path = kwargs[u'path']
|
self.path = kwargs[u'path']
|
||||||
self.wizard = None
|
self.wizard = None
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
||||||
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_import)
|
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
@ -206,8 +205,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
bibles_resources.sqlite of the testament this book belongs to.
|
bibles_resources.sqlite of the testament this book belongs to.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleDB.create_book("%s", "%s")', name, bk_ref_id)
|
log.debug(u'BibleDB.create_book("%s", "%s")', name, bk_ref_id)
|
||||||
book = Book.populate(name=name, book_reference_id=bk_ref_id,
|
book = Book.populate(name=name, book_reference_id=bk_ref_id, testament_reference_id=testament)
|
||||||
testament_reference_id=testament)
|
|
||||||
self.save_object(book)
|
self.save_object(book)
|
||||||
return book
|
return book
|
||||||
|
|
||||||
@ -336,8 +334,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
return self.get_object_filtered(Book, Book.book_reference_id.like(id))
|
return self.get_object_filtered(Book, Book.book_reference_id.like(id))
|
||||||
|
|
||||||
def get_book_ref_id_by_name(self, book, maxbooks, language_id=None):
|
def get_book_ref_id_by_name(self, book, maxbooks, language_id=None):
|
||||||
log.debug(u'BibleDB.get_book_ref_id_by_name:("%s", "%s")', book,
|
log.debug(u'BibleDB.get_book_ref_id_by_name:("%s", "%s")', book, language_id)
|
||||||
language_id)
|
|
||||||
book_id = None
|
book_id = None
|
||||||
if BiblesResourcesDB.get_book(book, True):
|
if BiblesResourcesDB.get_book(book, True):
|
||||||
book_temp = BiblesResourcesDB.get_book(book, True)
|
book_temp = BiblesResourcesDB.get_book(book, True)
|
||||||
@ -446,8 +443,7 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin', 'No Book Found'),
|
translate('BiblesPlugin', 'No Book Found'),
|
||||||
translate('BiblesPlugin', 'No matching book '
|
translate('BiblesPlugin', 'No matching book '
|
||||||
'could be found in this Bible. Check that you '
|
'could be found in this Bible. Check that you have spelled the name of the book correctly.'))
|
||||||
'have spelled the name of the book correctly.'))
|
|
||||||
return verse_list
|
return verse_list
|
||||||
|
|
||||||
def verse_search(self, text):
|
def verse_search(self, text):
|
||||||
@ -573,9 +569,8 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
Return the cursor object. Instantiate one if it doesn't exist yet.
|
Return the cursor object. Instantiate one if it doesn't exist yet.
|
||||||
"""
|
"""
|
||||||
if BiblesResourcesDB.cursor is None:
|
if BiblesResourcesDB.cursor is None:
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(AppLocation.get_directory(AppLocation.PluginsDir),
|
||||||
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
|
u'bibles', u'resources', u'bibles_resources.sqlite')
|
||||||
u'resources', u'bibles_resources.sqlite')
|
|
||||||
conn = sqlite3.connect(filepath)
|
conn = sqlite3.connect(filepath)
|
||||||
BiblesResourcesDB.cursor = conn.cursor()
|
BiblesResourcesDB.cursor = conn.cursor()
|
||||||
return BiblesResourcesDB.cursor
|
return BiblesResourcesDB.cursor
|
||||||
@ -683,8 +678,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
if not isinstance(id, int):
|
if not isinstance(id, int):
|
||||||
id = int(id)
|
id = int(id)
|
||||||
books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, '
|
books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, '
|
||||||
u'abbreviation, chapters FROM book_reference WHERE id = ?',
|
u'abbreviation, chapters FROM book_reference WHERE id = ?', (id, ))
|
||||||
(id, ))
|
|
||||||
if books:
|
if books:
|
||||||
return {
|
return {
|
||||||
u'id': books[0][0],
|
u'id': books[0][0],
|
||||||
@ -707,13 +701,11 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
``chapter``
|
``chapter``
|
||||||
The chapter number.
|
The chapter number.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_chapter("%s", "%s")', book_ref_id,
|
log.debug(u'BiblesResourcesDB.get_chapter("%s", "%s")', book_ref_id, chapter)
|
||||||
chapter)
|
|
||||||
if not isinstance(chapter, int):
|
if not isinstance(chapter, int):
|
||||||
chapter = int(chapter)
|
chapter = int(chapter)
|
||||||
chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, '
|
chapters = BiblesResourcesDB.run_sql(u'SELECT id, book_reference_id, '
|
||||||
u'chapter, verse_count FROM chapters WHERE book_reference_id = ?',
|
u'chapter, verse_count FROM chapters WHERE book_reference_id = ?', (book_ref_id,))
|
||||||
(book_ref_id,))
|
|
||||||
try:
|
try:
|
||||||
return {
|
return {
|
||||||
u'id': chapters[chapter-1][0],
|
u'id': chapters[chapter-1][0],
|
||||||
@ -749,8 +741,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
``chapter``
|
``chapter``
|
||||||
The number of the chapter.
|
The number of the chapter.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_verse_count("%s", "%s")', book_ref_id,
|
log.debug(u'BiblesResourcesDB.get_verse_count("%s", "%s")', book_ref_id, chapter)
|
||||||
chapter)
|
|
||||||
details = BiblesResourcesDB.get_chapter(book_ref_id, chapter)
|
details = BiblesResourcesDB.get_chapter(book_ref_id, chapter)
|
||||||
if details:
|
if details:
|
||||||
return details[u'verse_count']
|
return details[u'verse_count']
|
||||||
@ -791,8 +782,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
source = unicode(source)
|
source = unicode(source)
|
||||||
source = BiblesResourcesDB.get_download_source(source)
|
source = BiblesResourcesDB.get_download_source(source)
|
||||||
bibles = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
|
bibles = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
|
||||||
u'language_id, download_source_id FROM webbibles WHERE '
|
u'language_id, download_source_id FROM webbibles WHERE download_source_id = ?', (source[u'id'],))
|
||||||
u'download_source_id = ?', (source[u'id'],))
|
|
||||||
if bibles:
|
if bibles:
|
||||||
return [{
|
return [{
|
||||||
u'id': bible[0],
|
u'id': bible[0],
|
||||||
@ -815,8 +805,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
``source``
|
``source``
|
||||||
The source of the webbible.
|
The source of the webbible.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation,
|
log.debug(u'BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, source)
|
||||||
source)
|
|
||||||
if not isinstance(abbreviation, unicode):
|
if not isinstance(abbreviation, unicode):
|
||||||
abbreviation = unicode(abbreviation)
|
abbreviation = unicode(abbreviation)
|
||||||
if not isinstance(source, unicode):
|
if not isinstance(source, unicode):
|
||||||
@ -824,8 +813,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
source = BiblesResourcesDB.get_download_source(source)
|
source = BiblesResourcesDB.get_download_source(source)
|
||||||
bible = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
|
bible = BiblesResourcesDB.run_sql(u'SELECT id, name, abbreviation, '
|
||||||
u'language_id, download_source_id FROM webbibles WHERE '
|
u'language_id, download_source_id FROM webbibles WHERE '
|
||||||
u'download_source_id = ? AND abbreviation = ?', (source[u'id'],
|
u'download_source_id = ? AND abbreviation = ?', (source[u'id'], abbreviation))
|
||||||
abbreviation))
|
|
||||||
try:
|
try:
|
||||||
return {
|
return {
|
||||||
u'id': bible[0][0],
|
u'id': bible[0][0],
|
||||||
@ -848,15 +836,12 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
``language_id``
|
``language_id``
|
||||||
The language_id for which language should be searched
|
The language_id for which language should be searched
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_alternative_book_name("%s", "%s")',
|
log.debug(u'BiblesResourcesDB.get_alternative_book_name("%s", "%s")', name, language_id)
|
||||||
name, language_id)
|
|
||||||
if language_id:
|
if language_id:
|
||||||
books = BiblesResourcesDB.run_sql(u'SELECT book_reference_id, name '
|
books = BiblesResourcesDB.run_sql(u'SELECT book_reference_id, name '
|
||||||
u'FROM alternative_book_names WHERE language_id = ? ORDER BY '
|
u'FROM alternative_book_names WHERE language_id = ? ORDER BY id', (language_id, ))
|
||||||
u'id', (language_id, ))
|
|
||||||
else:
|
else:
|
||||||
books = BiblesResourcesDB.run_sql(u'SELECT book_reference_id, name '
|
books = BiblesResourcesDB.run_sql(u'SELECT book_reference_id, name FROM alternative_book_names ORDER BY id')
|
||||||
u'FROM alternative_book_names ORDER BY id')
|
|
||||||
for book in books:
|
for book in books:
|
||||||
if book[1].lower() == name.lower():
|
if book[1].lower() == name.lower():
|
||||||
return book[0]
|
return book[0]
|
||||||
@ -891,8 +876,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
Return a dict containing all languages with id, name and code.
|
Return a dict containing all languages with id, name and code.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_languages()')
|
log.debug(u'BiblesResourcesDB.get_languages()')
|
||||||
languages = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM '
|
languages = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM language ORDER by name')
|
||||||
u'language ORDER by name')
|
|
||||||
if languages:
|
if languages:
|
||||||
return [{
|
return [{
|
||||||
u'id': language[0],
|
u'id': language[0],
|
||||||
@ -908,8 +892,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
Return a list of all testaments and their id of the Bible.
|
Return a list of all testaments and their id of the Bible.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BiblesResourcesDB.get_testament_reference()')
|
log.debug(u'BiblesResourcesDB.get_testament_reference()')
|
||||||
testaments = BiblesResourcesDB.run_sql(u'SELECT id, name FROM '
|
testaments = BiblesResourcesDB.run_sql(u'SELECT id, name FROM testament_reference ORDER BY id')
|
||||||
u'testament_reference ORDER BY id')
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
u'id': testament[0],
|
u'id': testament[0],
|
||||||
@ -935,8 +918,7 @@ class AlternativeBookNamesDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
if AlternativeBookNamesDB.cursor is None:
|
if AlternativeBookNamesDB.cursor is None:
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(
|
||||||
AppLocation.get_directory(AppLocation.DataDir), u'bibles',
|
AppLocation.get_directory(AppLocation.DataDir), u'bibles', u'alternative_book_names.sqlite')
|
||||||
u'alternative_book_names.sqlite')
|
|
||||||
if not os.path.exists(filepath):
|
if not os.path.exists(filepath):
|
||||||
#create new DB, create table alternative_book_names
|
#create new DB, create table alternative_book_names
|
||||||
AlternativeBookNamesDB.conn = sqlite3.connect(filepath)
|
AlternativeBookNamesDB.conn = sqlite3.connect(filepath)
|
||||||
@ -981,12 +963,10 @@ class AlternativeBookNamesDB(QtCore.QObject, Manager):
|
|||||||
``language_id``
|
``language_id``
|
||||||
The language_id for which language should be searched
|
The language_id for which language should be searched
|
||||||
"""
|
"""
|
||||||
log.debug(u'AlternativeBookNamesDB.get_book_reference_id("%s", "%s")',
|
log.debug(u'AlternativeBookNamesDB.get_book_reference_id("%s", "%s")', name, language_id)
|
||||||
name, language_id)
|
|
||||||
if language_id:
|
if language_id:
|
||||||
books = AlternativeBookNamesDB.run_sql(u'SELECT book_reference_id, '
|
books = AlternativeBookNamesDB.run_sql(u'SELECT book_reference_id, '
|
||||||
u'name FROM alternative_book_names WHERE language_id = ?',
|
u'name FROM alternative_book_names WHERE language_id = ?', (language_id, ))
|
||||||
(language_id, ))
|
|
||||||
else:
|
else:
|
||||||
books = AlternativeBookNamesDB.run_sql(u'SELECT book_reference_id, '
|
books = AlternativeBookNamesDB.run_sql(u'SELECT book_reference_id, '
|
||||||
u'name FROM alternative_book_names')
|
u'name FROM alternative_book_names')
|
||||||
@ -1018,7 +998,7 @@ class AlternativeBookNamesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
class OldBibleDB(QtCore.QObject, Manager):
|
class OldBibleDB(QtCore.QObject, Manager):
|
||||||
"""
|
"""
|
||||||
This class conects to the old bible databases to reimport them to the new
|
This class connects to the old bible databases to reimport them to the new
|
||||||
database scheme.
|
database scheme.
|
||||||
"""
|
"""
|
||||||
cursor = None
|
cursor = None
|
||||||
@ -1076,8 +1056,7 @@ class OldBibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
Returns the version name of the Bible.
|
Returns the version name of the Bible.
|
||||||
"""
|
"""
|
||||||
version_name = self.run_sql(u'SELECT value FROM '
|
version_name = self.run_sql(u'SELECT value FROM metadata WHERE key = "name"')
|
||||||
u'metadata WHERE key = "name"')
|
|
||||||
if version_name:
|
if version_name:
|
||||||
self.name = version_name[0][0]
|
self.name = version_name[0][0]
|
||||||
else:
|
else:
|
||||||
@ -1088,8 +1067,7 @@ class OldBibleDB(QtCore.QObject, Manager):
|
|||||||
"""
|
"""
|
||||||
Returns the metadata of the Bible.
|
Returns the metadata of the Bible.
|
||||||
"""
|
"""
|
||||||
metadata = self.run_sql(u'SELECT key, value FROM metadata '
|
metadata = self.run_sql(u'SELECT key, value FROM metadata ORDER BY rowid')
|
||||||
u'ORDER BY rowid')
|
|
||||||
if metadata:
|
if metadata:
|
||||||
return [{
|
return [{
|
||||||
u'key': unicode(meta[0]),
|
u'key': unicode(meta[0]),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -42,8 +42,7 @@ from openlp.core.lib import Receiver, translate
|
|||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.utils import get_web_page
|
from openlp.core.utils import get_web_page
|
||||||
from openlp.plugins.bibles.lib import SearchResults
|
from openlp.plugins.bibles.lib import SearchResults
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, \
|
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB, Book
|
||||||
Book
|
|
||||||
|
|
||||||
UGLY_CHARS = {
|
UGLY_CHARS = {
|
||||||
u'\u2014': u' - ',
|
u'\u2014': u' - ',
|
||||||
@ -94,10 +93,8 @@ class BGExtract(object):
|
|||||||
"""
|
"""
|
||||||
if isinstance(tag, NavigableString):
|
if isinstance(tag, NavigableString):
|
||||||
return None, unicode(tag)
|
return None, unicode(tag)
|
||||||
elif tag.get('class') == 'versenum' or \
|
elif tag.get('class') == 'versenum' or tag.get('class') == 'versenum mid-line':
|
||||||
tag.get('class') == 'versenum mid-line':
|
verse = unicode(tag.string).replace('[', '').replace(']', '').strip()
|
||||||
verse = unicode(tag.string)\
|
|
||||||
.replace('[', '').replace(']', '').strip()
|
|
||||||
return verse, None
|
return verse, None
|
||||||
elif tag.get('class') == 'chapternum':
|
elif tag.get('class') == 'chapternum':
|
||||||
verse = '1'
|
verse = '1'
|
||||||
@ -231,16 +228,13 @@ class BGExtract(object):
|
|||||||
``chapter``
|
``chapter``
|
||||||
Chapter number.
|
Chapter number.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version,
|
log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, book_name, chapter)
|
||||||
book_name, chapter)
|
|
||||||
url_book_name = urllib.quote(book_name.encode("utf-8"))
|
url_book_name = urllib.quote(book_name.encode("utf-8"))
|
||||||
url_params = u'search=%s+%s&version=%s' % (url_book_name, chapter,
|
url_params = u'search=%s+%s&version=%s' % (url_book_name, chapter, version)
|
||||||
version)
|
|
||||||
cleaner = [(re.compile(' |<br />|\'\+\''), lambda match: '')]
|
cleaner = [(re.compile(' |<br />|\'\+\''), lambda match: '')]
|
||||||
soup = get_soup_for_bible_ref(
|
soup = get_soup_for_bible_ref(
|
||||||
u'http://www.biblegateway.com/passage/?%s' % url_params,
|
u'http://www.biblegateway.com/passage/?%s' % url_params,
|
||||||
pre_parse_regex=r'<meta name.*?/>', pre_parse_substitute='',
|
pre_parse_regex=r'<meta name.*?/>', pre_parse_substitute='', cleaner=cleaner)
|
||||||
cleaner=cleaner)
|
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
@ -267,10 +261,8 @@ class BGExtract(object):
|
|||||||
The version of the Bible like NIV for New International Version
|
The version of the Bible like NIV for New International Version
|
||||||
"""
|
"""
|
||||||
log.debug(u'BGExtract.get_books_from_http("%s")', version)
|
log.debug(u'BGExtract.get_books_from_http("%s")', version)
|
||||||
url_params = urllib.urlencode(
|
url_params = urllib.urlencode({u'action': 'getVersionInfo', u'vid': u'%s' % version})
|
||||||
{u'action': 'getVersionInfo', u'vid': u'%s' % version})
|
reference_url = u'http://www.biblegateway.com/versions/?%s#books' % url_params
|
||||||
reference_url = u'http://www.biblegateway.com/versions/?%s#books' % \
|
|
||||||
url_params
|
|
||||||
page = get_web_page(reference_url)
|
page = get_web_page(reference_url)
|
||||||
if not page:
|
if not page:
|
||||||
send_error_message(u'download')
|
send_error_message(u'download')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -34,8 +34,7 @@ from PyQt4 import QtCore
|
|||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate, Settings
|
from openlp.core.lib import Receiver, SettingsManager, translate, Settings
|
||||||
from openlp.core.utils import AppLocation, delete_file
|
from openlp.core.utils import AppLocation, delete_file
|
||||||
from openlp.plugins.bibles.lib import parse_reference, \
|
from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
|
||||||
get_reference_separator, LanguageSelection
|
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||||
from csvbible import CSVBible
|
from csvbible import CSVBible
|
||||||
from http import HTTPBible
|
from http import HTTPBible
|
||||||
@ -127,8 +126,7 @@ class BibleManager(object):
|
|||||||
self.web = u'Web'
|
self.web = u'Web'
|
||||||
self.db_cache = None
|
self.db_cache = None
|
||||||
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
self.path = AppLocation.get_section_data_path(self.settingsSection)
|
||||||
self.proxy_name = Settings().value(
|
self.proxy_name = Settings().value(self.settingsSection + u'/proxy name', u'')
|
||||||
self.settingsSection + u'/proxy name', u'')
|
|
||||||
self.suffix = u'.sqlite'
|
self.suffix = u'.sqlite'
|
||||||
self.import_wizard = None
|
self.import_wizard = None
|
||||||
self.reload_bibles()
|
self.reload_bibles()
|
||||||
@ -141,8 +139,7 @@ class BibleManager(object):
|
|||||||
BibleDB class.
|
BibleDB class.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Reload bibles')
|
log.debug(u'Reload bibles')
|
||||||
files = SettingsManager.get_files(self.settingsSection,
|
files = SettingsManager.get_files(self.settingsSection, self.suffix)
|
||||||
self.suffix)
|
|
||||||
if u'alternative_book_names.sqlite' in files:
|
if u'alternative_book_names.sqlite' in files:
|
||||||
files.remove(u'alternative_book_names.sqlite')
|
files.remove(u'alternative_book_names.sqlite')
|
||||||
log.debug(u'Bible Files %s', files)
|
log.debug(u'Bible Files %s', files)
|
||||||
@ -164,15 +161,11 @@ class BibleManager(object):
|
|||||||
log.debug(u'Bible Name: "%s"', name)
|
log.debug(u'Bible Name: "%s"', name)
|
||||||
self.db_cache[name] = bible
|
self.db_cache[name] = bible
|
||||||
# Look to see if lazy load bible exists and get create getter.
|
# Look to see if lazy load bible exists and get create getter.
|
||||||
source = self.db_cache[name].get_object(BibleMeta,
|
source = self.db_cache[name].get_object(BibleMeta, u'download_source')
|
||||||
u'download_source')
|
|
||||||
if source:
|
if source:
|
||||||
download_name = self.db_cache[name].get_object(BibleMeta,
|
download_name = self.db_cache[name].get_object(BibleMeta, u'download_name').value
|
||||||
u'download_name').value
|
meta_proxy = self.db_cache[name].get_object(BibleMeta, u'proxy_server')
|
||||||
meta_proxy = self.db_cache[name].get_object(BibleMeta,
|
web_bible = HTTPBible(self.parent, path=self.path, file=filename, download_source=source.value,
|
||||||
u'proxy_server')
|
|
||||||
web_bible = HTTPBible(self.parent, path=self.path,
|
|
||||||
file=filename, download_source=source.value,
|
|
||||||
download_name=download_name)
|
download_name=download_name)
|
||||||
if meta_proxy:
|
if meta_proxy:
|
||||||
web_bible.proxy_server = meta_proxy.value
|
web_bible.proxy_server = meta_proxy.value
|
||||||
@ -265,8 +258,7 @@ class BibleManager(object):
|
|||||||
``book``
|
``book``
|
||||||
The book object to get the chapter count for.
|
The book object to get the chapter count for.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleManager.get_book_chapter_count ("%s", "%s")', bible,
|
log.debug(u'BibleManager.get_book_chapter_count ("%s", "%s")', bible, book.name)
|
||||||
book.name)
|
|
||||||
return self.db_cache[bible].get_chapter_count(book)
|
return self.db_cache[bible].get_chapter_count(book)
|
||||||
|
|
||||||
def get_verse_count(self, bible, book, chapter):
|
def get_verse_count(self, bible, book, chapter):
|
||||||
@ -277,8 +269,7 @@ class BibleManager(object):
|
|||||||
log.debug(u'BibleManager.get_verse_count("%s", "%s", %s)',
|
log.debug(u'BibleManager.get_verse_count("%s", "%s", %s)',
|
||||||
bible, book, chapter)
|
bible, book, chapter)
|
||||||
language_selection = self.get_language_selection(bible)
|
language_selection = self.get_language_selection(bible)
|
||||||
book_ref_id = self.db_cache[bible].get_book_ref_id_by_localised_name(
|
book_ref_id = self.db_cache[bible].get_book_ref_id_by_localised_name(book, language_selection)
|
||||||
book, language_selection)
|
|
||||||
return self.db_cache[bible].get_verse_count(book_ref_id, chapter)
|
return self.db_cache[bible].get_verse_count(book_ref_id, chapter)
|
||||||
|
|
||||||
def get_verse_count_by_book_ref_id(self, bible, book_ref_id, chapter):
|
def get_verse_count_by_book_ref_id(self, bible, book_ref_id, chapter):
|
||||||
@ -286,8 +277,7 @@ class BibleManager(object):
|
|||||||
Returns all the number of verses for a given
|
Returns all the number of verses for a given
|
||||||
book_ref_id and chapterMaxBibleBookVerses.
|
book_ref_id and chapterMaxBibleBookVerses.
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleManager.get_verse_count_by_book_ref_id("%s", "%s", '
|
log.debug(u'BibleManager.get_verse_count_by_book_ref_id("%s", "%s", "%s")', bible, book_ref_id, chapter)
|
||||||
u'"%s")', bible, book_ref_id, chapter)
|
|
||||||
return self.db_cache[bible].get_verse_count(book_ref_id, chapter)
|
return self.db_cache[bible].get_verse_count(book_ref_id, chapter)
|
||||||
|
|
||||||
def get_verses(self, bible, versetext, book_ref_id=False, show_error=True):
|
def get_verses(self, bible, versetext, book_ref_id=False, show_error=True):
|
||||||
@ -317,11 +307,10 @@ class BibleManager(object):
|
|||||||
if not bible:
|
if not bible:
|
||||||
if show_error:
|
if show_error:
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('BiblesPlugin.BibleManager',
|
u'title': translate('BiblesPlugin.BibleManager', 'No Bibles Available'),
|
||||||
'No Bibles Available'),
|
|
||||||
u'message': translate('BiblesPlugin.BibleManager',
|
u'message': translate('BiblesPlugin.BibleManager',
|
||||||
'There are no Bibles currently installed. Please use the '
|
'There are no Bibles currently installed. Please use the '
|
||||||
'Import Wizard to install one or more Bibles.')
|
'Import Wizard to install one or more Bibles.')
|
||||||
})
|
})
|
||||||
return None
|
return None
|
||||||
language_selection = self.get_language_selection(bible)
|
language_selection = self.get_language_selection(bible)
|
||||||
@ -366,13 +355,10 @@ class BibleManager(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'BibleManager.get_language_selection("%s")', bible)
|
log.debug(u'BibleManager.get_language_selection("%s")', bible)
|
||||||
language_selection = self.get_meta_data(bible, u'book_name_language')
|
language_selection = self.get_meta_data(bible, u'book_name_language')
|
||||||
if not language_selection or \
|
if not language_selection or language_selection.value == "None" or language_selection.value == "-1":
|
||||||
language_selection.value == "None" or \
|
|
||||||
language_selection.value == "-1":
|
|
||||||
# If None is returned, it's not the singleton object but a
|
# If None is returned, it's not the singleton object but a
|
||||||
# BibleMeta object with the value "None"
|
# BibleMeta object with the value "None"
|
||||||
language_selection = Settings().value(
|
language_selection = Settings().value(self.settingsSection + u'/book name language', 0)
|
||||||
self.settingsSection + u'/book name language', 0)
|
|
||||||
else:
|
else:
|
||||||
language_selection = language_selection.value
|
language_selection = language_selection.value
|
||||||
try:
|
try:
|
||||||
@ -397,11 +383,10 @@ class BibleManager(object):
|
|||||||
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
log.debug(u'BibleManager.verse_search("%s", "%s")', bible, text)
|
||||||
if not bible:
|
if not bible:
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('BiblesPlugin.BibleManager',
|
u'title': translate('BiblesPlugin.BibleManager', 'No Bibles Available'),
|
||||||
'No Bibles Available'),
|
|
||||||
u'message': translate('BiblesPlugin.BibleManager',
|
u'message': translate('BiblesPlugin.BibleManager',
|
||||||
'There are no Bibles currently installed. Please use the '
|
'There are no Bibles currently installed. Please use the '
|
||||||
'Import Wizard to install one or more Bibles.')
|
'Import Wizard to install one or more Bibles.')
|
||||||
})
|
})
|
||||||
return None
|
return None
|
||||||
# Check if the bible or second_bible is a web bible.
|
# Check if the bible or second_bible is a web bible.
|
||||||
@ -413,20 +398,16 @@ class BibleManager(object):
|
|||||||
u'download_source')
|
u'download_source')
|
||||||
if webbible or second_webbible:
|
if webbible or second_webbible:
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('BiblesPlugin.BibleManager',
|
u'title': translate('BiblesPlugin.BibleManager', 'Web Bible cannot be used'),
|
||||||
'Web Bible cannot be used'),
|
u'message': translate('BiblesPlugin.BibleManager', 'Text Search is not available with Web Bibles.')
|
||||||
u'message': translate('BiblesPlugin.BibleManager',
|
|
||||||
'Text Search is not available with Web Bibles.')
|
|
||||||
})
|
})
|
||||||
return None
|
return None
|
||||||
if text:
|
if text:
|
||||||
return self.db_cache[bible].verse_search(text)
|
return self.db_cache[bible].verse_search(text)
|
||||||
else:
|
else:
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('BiblesPlugin.BibleManager',
|
u'title': translate('BiblesPlugin.BibleManager', 'Scripture Reference Error'),
|
||||||
'Scripture Reference Error'),
|
u'message': translate('BiblesPlugin.BibleManager', 'You did not enter a search keyword.\n'
|
||||||
u'message': translate('BiblesPlugin.BibleManager',
|
|
||||||
'You did not enter a search keyword.\n'
|
|
||||||
'You can separate different keywords by a space to '
|
'You can separate different keywords by a space to '
|
||||||
'search for all of your keywords and you can separate '
|
'search for all of your keywords and you can separate '
|
||||||
'them by a comma to search for one of them.')
|
'them by a comma to search for one of them.')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -34,14 +34,12 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
translate, create_separated_list, ServiceItemContext, Settings
|
translate, create_separated_list, ServiceItemContext, Settings
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
|
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, create_horizontal_adjusting_combo_box, \
|
||||||
create_horizontal_adjusting_combo_box, critical_error_message_box, \
|
critical_error_message_box, find_and_set_in_combo_box, build_icon
|
||||||
find_and_set_in_combo_box, build_icon
|
|
||||||
from openlp.core.utils import locale_compare
|
from openlp.core.utils import locale_compare
|
||||||
from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm
|
from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm
|
||||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
|
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, VerseReferenceList, get_reference_separator, \
|
||||||
VerseReferenceList, get_reference_separator, LanguageSelection, \
|
LanguageSelection, BibleStrings
|
||||||
BibleStrings
|
|
||||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -72,8 +70,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.search_results = {}
|
self.search_results = {}
|
||||||
self.second_search_results = {}
|
self.second_search_results = {}
|
||||||
self.checkSearchResult()
|
self.checkSearchResult()
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
|
||||||
QtCore.SIGNAL(u'bibles_load_list'), self.reloadBibles)
|
|
||||||
|
|
||||||
def __checkSecondBible(self, bible, second_bible):
|
def __checkSecondBible(self, bible, second_bible):
|
||||||
"""
|
"""
|
||||||
@ -87,14 +84,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
item_second_bible = self._decodeQtObject(bitem, 'second_bible')
|
item_second_bible = self._decodeQtObject(bitem, 'second_bible')
|
||||||
if item_second_bible and second_bible or not item_second_bible and \
|
if item_second_bible and second_bible or not item_second_bible and not second_bible:
|
||||||
not second_bible:
|
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
elif critical_error_message_box(
|
elif critical_error_message_box(
|
||||||
message=translate('BiblesPlugin.MediaItem',
|
message=translate('BiblesPlugin.MediaItem',
|
||||||
'You cannot combine single and dual Bible verse search results. '
|
'You cannot combine single and dual Bible verse search results. '
|
||||||
'Do you want to delete your search results and start a new '
|
'Do you want to delete your search results and start a new search?'),
|
||||||
'search?'),
|
|
||||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
@ -141,22 +136,19 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
versionLabel = QtGui.QLabel(tab)
|
versionLabel = QtGui.QLabel(tab)
|
||||||
versionLabel.setObjectName(prefix + u'VersionLabel')
|
versionLabel.setObjectName(prefix + u'VersionLabel')
|
||||||
layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight)
|
layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight)
|
||||||
versionComboBox = create_horizontal_adjusting_combo_box(tab,
|
versionComboBox = create_horizontal_adjusting_combo_box(tab, prefix + u'VersionComboBox')
|
||||||
prefix + u'VersionComboBox')
|
|
||||||
versionLabel.setBuddy(versionComboBox)
|
versionLabel.setBuddy(versionComboBox)
|
||||||
layout.addWidget(versionComboBox, idx, 1, 1, 2)
|
layout.addWidget(versionComboBox, idx, 1, 1, 2)
|
||||||
secondLabel = QtGui.QLabel(tab)
|
secondLabel = QtGui.QLabel(tab)
|
||||||
secondLabel.setObjectName(prefix + u'SecondLabel')
|
secondLabel.setObjectName(prefix + u'SecondLabel')
|
||||||
layout.addWidget(secondLabel, idx + 1, 0, QtCore.Qt.AlignRight)
|
layout.addWidget(secondLabel, idx + 1, 0, QtCore.Qt.AlignRight)
|
||||||
secondComboBox = create_horizontal_adjusting_combo_box(
|
secondComboBox = create_horizontal_adjusting_combo_box(tab, prefix + u'SecondComboBox')
|
||||||
tab, prefix + u'SecondComboBox')
|
|
||||||
versionLabel.setBuddy(secondComboBox)
|
versionLabel.setBuddy(secondComboBox)
|
||||||
layout.addWidget(secondComboBox, idx + 1, 1, 1, 2)
|
layout.addWidget(secondComboBox, idx + 1, 1, 1, 2)
|
||||||
styleLabel = QtGui.QLabel(tab)
|
styleLabel = QtGui.QLabel(tab)
|
||||||
styleLabel.setObjectName(prefix + u'StyleLabel')
|
styleLabel.setObjectName(prefix + u'StyleLabel')
|
||||||
layout.addWidget(styleLabel, idx + 2, 0, QtCore.Qt.AlignRight)
|
layout.addWidget(styleLabel, idx + 2, 0, QtCore.Qt.AlignRight)
|
||||||
styleComboBox = create_horizontal_adjusting_combo_box(
|
styleComboBox = create_horizontal_adjusting_combo_box(tab, prefix + u'StyleComboBox')
|
||||||
tab, prefix + u'StyleComboBox')
|
|
||||||
styleComboBox.addItems([u'', u'', u''])
|
styleComboBox.addItems([u'', u'', u''])
|
||||||
layout.addWidget(styleComboBox, idx + 2, 1, 1, 2)
|
layout.addWidget(styleComboBox, idx + 2, 1, 1, 2)
|
||||||
searchButtonLayout = QtGui.QHBoxLayout()
|
searchButtonLayout = QtGui.QHBoxLayout()
|
||||||
@ -173,8 +165,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2)
|
layout.addLayout(searchButtonLayout, idx + 3, 1, 1, 2)
|
||||||
self.pageLayout.addWidget(tab)
|
self.pageLayout.addWidget(tab)
|
||||||
tab.setVisible(False)
|
tab.setVisible(False)
|
||||||
QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'),
|
QtCore.QObject.connect(lockButton, QtCore.SIGNAL(u'toggled(bool)'), self.onLockButtonToggled)
|
||||||
self.onLockButtonToggled)
|
|
||||||
setattr(self, prefix + u'VersionLabel', versionLabel)
|
setattr(self, prefix + u'VersionLabel', versionLabel)
|
||||||
setattr(self, prefix + u'VersionComboBox', versionComboBox)
|
setattr(self, prefix + u'VersionComboBox', versionComboBox)
|
||||||
setattr(self, prefix + u'SecondLabel', secondLabel)
|
setattr(self, prefix + u'SecondLabel', secondLabel)
|
||||||
@ -191,29 +182,23 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.searchTabBar.setObjectName(u'searchTabBar')
|
self.searchTabBar.setObjectName(u'searchTabBar')
|
||||||
self.pageLayout.addWidget(self.searchTabBar)
|
self.pageLayout.addWidget(self.searchTabBar)
|
||||||
# Add the Quick Search tab.
|
# Add the Quick Search tab.
|
||||||
self.addSearchTab(
|
self.addSearchTab(u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
||||||
u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
|
||||||
self.quickSearchLabel = QtGui.QLabel(self.quickTab)
|
self.quickSearchLabel = QtGui.QLabel(self.quickTab)
|
||||||
self.quickSearchLabel.setObjectName(u'quickSearchLabel')
|
self.quickSearchLabel.setObjectName(u'quickSearchLabel')
|
||||||
self.quickLayout.addWidget(
|
self.quickLayout.addWidget(self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight)
|
||||||
self.quickSearchLabel, 0, 0, QtCore.Qt.AlignRight)
|
|
||||||
self.quickSearchEdit = SearchEdit(self.quickTab)
|
self.quickSearchEdit = SearchEdit(self.quickTab)
|
||||||
self.quickSearchEdit.setSizePolicy(
|
self.quickSearchEdit.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
|
||||||
QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Fixed)
|
|
||||||
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
self.quickSearchEdit.setObjectName(u'quickSearchEdit')
|
||||||
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
self.quickSearchLabel.setBuddy(self.quickSearchEdit)
|
||||||
self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2)
|
self.quickLayout.addWidget(self.quickSearchEdit, 0, 1, 1, 2)
|
||||||
self.addSearchFields(
|
self.addSearchFields(u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
||||||
u'quick', translate('BiblesPlugin.MediaItem', 'Quick'))
|
|
||||||
self.quickTab.setVisible(True)
|
self.quickTab.setVisible(True)
|
||||||
# Add the Advanced Search tab.
|
# Add the Advanced Search tab.
|
||||||
self.addSearchTab(u'advanced', UiStrings().Advanced)
|
self.addSearchTab(u'advanced', UiStrings().Advanced)
|
||||||
self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
|
self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
|
||||||
self.advancedBookLabel.setObjectName(u'advancedBookLabel')
|
self.advancedBookLabel.setObjectName(u'advancedBookLabel')
|
||||||
self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0,
|
self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0, QtCore.Qt.AlignRight)
|
||||||
QtCore.Qt.AlignRight)
|
self.advancedBookComboBox = create_horizontal_adjusting_combo_box(self.advancedTab, u'advancedBookComboBox')
|
||||||
self.advancedBookComboBox = create_horizontal_adjusting_combo_box(
|
|
||||||
self.advancedTab, u'advancedBookComboBox')
|
|
||||||
self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
|
self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
|
||||||
self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2)
|
self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2)
|
||||||
self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
|
self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
|
||||||
@ -224,8 +209,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.advancedLayout.addWidget(self.advancedVerseLabel, 1, 2)
|
self.advancedLayout.addWidget(self.advancedVerseLabel, 1, 2)
|
||||||
self.advancedFromLabel = QtGui.QLabel(self.advancedTab)
|
self.advancedFromLabel = QtGui.QLabel(self.advancedTab)
|
||||||
self.advancedFromLabel.setObjectName(u'advancedFromLabel')
|
self.advancedFromLabel.setObjectName(u'advancedFromLabel')
|
||||||
self.advancedLayout.addWidget(self.advancedFromLabel, 3, 0,
|
self.advancedLayout.addWidget(self.advancedFromLabel, 3, 0, QtCore.Qt.AlignRight)
|
||||||
QtCore.Qt.AlignRight)
|
|
||||||
self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
|
self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
|
||||||
self.advancedFromChapter.setObjectName(u'advancedFromChapter')
|
self.advancedFromChapter.setObjectName(u'advancedFromChapter')
|
||||||
self.advancedLayout.addWidget(self.advancedFromChapter, 3, 1)
|
self.advancedLayout.addWidget(self.advancedFromChapter, 3, 1)
|
||||||
@ -234,8 +218,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.advancedLayout.addWidget(self.advancedFromVerse, 3, 2)
|
self.advancedLayout.addWidget(self.advancedFromVerse, 3, 2)
|
||||||
self.advancedToLabel = QtGui.QLabel(self.advancedTab)
|
self.advancedToLabel = QtGui.QLabel(self.advancedTab)
|
||||||
self.advancedToLabel.setObjectName(u'advancedToLabel')
|
self.advancedToLabel.setObjectName(u'advancedToLabel')
|
||||||
self.advancedLayout.addWidget(self.advancedToLabel, 4, 0,
|
self.advancedLayout.addWidget(self.advancedToLabel, 4, 0, QtCore.Qt.AlignRight)
|
||||||
QtCore.Qt.AlignRight)
|
|
||||||
self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
|
self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
|
||||||
self.advancedToChapter.setObjectName(u'advancedToChapter')
|
self.advancedToChapter.setObjectName(u'advancedToChapter')
|
||||||
self.advancedLayout.addWidget(self.advancedToChapter, 4, 1)
|
self.advancedLayout.addWidget(self.advancedToChapter, 4, 1)
|
||||||
@ -244,44 +227,29 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
|
self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
|
||||||
self.addSearchFields(u'advanced', UiStrings().Advanced)
|
self.addSearchFields(u'advanced', UiStrings().Advanced)
|
||||||
# Combo Boxes
|
# Combo Boxes
|
||||||
QtCore.QObject.connect(self.quickVersionComboBox,
|
QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
QtCore.QObject.connect(self.quickSecondComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
||||||
QtCore.QObject.connect(self.quickSecondComboBox,
|
QtCore.QObject.connect(self.advancedVersionComboBox,QtCore.SIGNAL(u'activated(int)'),
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
self.onAdvancedVersionComboBox)
|
||||||
QtCore.QObject.connect(self.advancedVersionComboBox,
|
QtCore.QObject.connect(self.advancedSecondComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
|
self.onAdvancedSecondComboBox)
|
||||||
QtCore.QObject.connect(self.advancedSecondComboBox,
|
QtCore.QObject.connect(self.advancedBookComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedSecondComboBox)
|
QtCore.QObject.connect(self.advancedFromChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
|
||||||
QtCore.QObject.connect(self.advancedBookComboBox,
|
QtCore.QObject.connect(self.advancedFromVerse, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
|
QtCore.QObject.connect(self.advancedToChapter, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
|
||||||
QtCore.QObject.connect(self.advancedFromChapter,
|
QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter)
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
|
QtCore.QObject.connect(self.quickVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
||||||
QtCore.QObject.connect(self.advancedFromVerse,
|
QtCore.QObject.connect(self.quickStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
|
|
||||||
QtCore.QObject.connect(self.advancedToChapter,
|
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
|
|
||||||
QtCore.QObject.connect(self.quickSearchEdit,
|
|
||||||
QtCore.SIGNAL(u'searchTypeChanged(int)'), self.updateAutoCompleter)
|
|
||||||
QtCore.QObject.connect(self.quickVersionComboBox,
|
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
|
|
||||||
QtCore.QObject.connect(
|
|
||||||
self.quickStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onQuickStyleComboBoxChanged)
|
self.onQuickStyleComboBoxChanged)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect( self.advancedStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
||||||
self.advancedStyleComboBox, QtCore.SIGNAL(u'activated(int)'),
|
|
||||||
self.onAdvancedStyleComboBoxChanged)
|
self.onAdvancedStyleComboBoxChanged)
|
||||||
# Buttons
|
# Buttons
|
||||||
QtCore.QObject.connect(self.advancedSearchButton,
|
QtCore.QObject.connect(self.advancedSearchButton, QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton)
|
QtCore.QObject.connect(self.quickSearchButton, QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton)
|
||||||
QtCore.QObject.connect(self.quickSearchButton,
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
|
||||||
# Other stuff
|
# Other stuff
|
||||||
QtCore.QObject.connect(self.quickSearchEdit,
|
QtCore.QObject.connect(self.quickSearchEdit, QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
|
||||||
QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
|
QtCore.QObject.connect(self.searchTabBar, QtCore.SIGNAL(u'currentChanged(int)'),
|
||||||
QtCore.QObject.connect(self.searchTabBar,
|
|
||||||
QtCore.SIGNAL(u'currentChanged(int)'),
|
|
||||||
self.onSearchTabBarCurrentChanged)
|
self.onSearchTabBarCurrentChanged)
|
||||||
|
|
||||||
def onFocus(self):
|
def onFocus(self):
|
||||||
@ -307,41 +275,27 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
log.debug(u'retranslateUi')
|
log.debug(u'retranslateUi')
|
||||||
self.quickSearchLabel.setText(
|
self.quickSearchLabel.setText(translate('BiblesPlugin.MediaItem', 'Find:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Find:'))
|
|
||||||
self.quickVersionLabel.setText(u'%s:' % UiStrings().Version)
|
self.quickVersionLabel.setText(u'%s:' % UiStrings().Version)
|
||||||
self.quickSecondLabel.setText(
|
self.quickSecondLabel.setText(translate('BiblesPlugin.MediaItem', 'Second:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
|
||||||
self.quickStyleLabel.setText(UiStrings().LayoutStyle)
|
self.quickStyleLabel.setText(UiStrings().LayoutStyle)
|
||||||
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
|
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide)
|
||||||
UiStrings().VersePerSlide)
|
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine)
|
||||||
self.quickStyleComboBox.setItemText(LayoutStyle.VersePerLine,
|
self.quickStyleComboBox.setItemText(LayoutStyle.Continuous, UiStrings().Continuous)
|
||||||
UiStrings().VersePerLine)
|
|
||||||
self.quickStyleComboBox.setItemText(LayoutStyle.Continuous,
|
|
||||||
UiStrings().Continuous)
|
|
||||||
self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
|
self.quickLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
|
||||||
'Toggle to keep or clear the previous results.'))
|
'Toggle to keep or clear the previous results.'))
|
||||||
self.quickSearchButton.setText(UiStrings().Search)
|
self.quickSearchButton.setText(UiStrings().Search)
|
||||||
self.advancedBookLabel.setText(
|
self.advancedBookLabel.setText(translate('BiblesPlugin.MediaItem', 'Book:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Book:'))
|
self.advancedChapterLabel.setText(translate('BiblesPlugin.MediaItem', 'Chapter:'))
|
||||||
self.advancedChapterLabel.setText(
|
self.advancedVerseLabel.setText(translate('BiblesPlugin.MediaItem', 'Verse:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Chapter:'))
|
self.advancedFromLabel.setText(translate('BiblesPlugin.MediaItem', 'From:'))
|
||||||
self.advancedVerseLabel.setText(
|
self.advancedToLabel.setText(translate('BiblesPlugin.MediaItem', 'To:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Verse:'))
|
|
||||||
self.advancedFromLabel.setText(
|
|
||||||
translate('BiblesPlugin.MediaItem', 'From:'))
|
|
||||||
self.advancedToLabel.setText(
|
|
||||||
translate('BiblesPlugin.MediaItem', 'To:'))
|
|
||||||
self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version)
|
self.advancedVersionLabel.setText(u'%s:' % UiStrings().Version)
|
||||||
self.advancedSecondLabel.setText(
|
self.advancedSecondLabel.setText(translate('BiblesPlugin.MediaItem', 'Second:'))
|
||||||
translate('BiblesPlugin.MediaItem', 'Second:'))
|
|
||||||
self.advancedStyleLabel.setText(UiStrings().LayoutStyle)
|
self.advancedStyleLabel.setText(UiStrings().LayoutStyle)
|
||||||
self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerSlide,
|
self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerSlide, UiStrings().VersePerSlide)
|
||||||
UiStrings().VersePerSlide)
|
self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerLine, UiStrings().VersePerLine)
|
||||||
self.advancedStyleComboBox.setItemText(LayoutStyle.VersePerLine,
|
self.advancedStyleComboBox.setItemText(LayoutStyle.Continuous, UiStrings().Continuous)
|
||||||
UiStrings().VersePerLine)
|
|
||||||
self.advancedStyleComboBox.setItemText(LayoutStyle.Continuous,
|
|
||||||
UiStrings().Continuous)
|
|
||||||
self.advancedLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
|
self.advancedLockButton.setToolTip(translate('BiblesPlugin.MediaItem',
|
||||||
'Toggle to keep or clear the previous results.'))
|
'Toggle to keep or clear the previous results.'))
|
||||||
self.advancedSearchButton.setText(UiStrings().Search)
|
self.advancedSearchButton.setText(UiStrings().Search)
|
||||||
@ -352,15 +306,13 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.loadBibles()
|
self.loadBibles()
|
||||||
self.quickSearchEdit.setSearchTypes([
|
self.quickSearchEdit.setSearchTypes([
|
||||||
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
(BibleSearch.Reference, u':/bibles/bibles_search_reference.png',
|
||||||
translate('BiblesPlugin.MediaItem', 'Scripture Reference'),
|
translate('BiblesPlugin.MediaItem', 'Scripture Reference'),
|
||||||
translate(
|
translate('BiblesPlugin.MediaItem', 'Search Scripture Reference...')),
|
||||||
'BiblesPlugin.MediaItem', 'Search Scripture Reference...')),
|
|
||||||
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
(BibleSearch.Text, u':/bibles/bibles_search_text.png',
|
||||||
translate('BiblesPlugin.MediaItem', 'Text Search'),
|
translate('BiblesPlugin.MediaItem', 'Text Search'),
|
||||||
translate('BiblesPlugin.MediaItem', 'Search Text...'))
|
translate('BiblesPlugin.MediaItem', 'Search Text...'))
|
||||||
])
|
])
|
||||||
self.quickSearchEdit.setCurrentSearchType(Settings().value(
|
self.quickSearchEdit.setCurrentSearchType(Settings().value(u'%s/last search type' % self.settingsSection,
|
||||||
u'%s/last search type' % self.settingsSection,
|
|
||||||
BibleSearch.Reference))
|
BibleSearch.Reference))
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
log.debug(u'bible manager initialise complete')
|
log.debug(u'bible manager initialise complete')
|
||||||
@ -389,9 +341,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.initialiseAdvancedBible(unicode(bible))
|
self.initialiseAdvancedBible(unicode(bible))
|
||||||
elif bibles:
|
elif bibles:
|
||||||
self.initialiseAdvancedBible(bibles[0])
|
self.initialiseAdvancedBible(bibles[0])
|
||||||
bible = Settings().value(
|
bible = Settings().value(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText())
|
||||||
self.settingsSection + u'/quick bible',
|
|
||||||
self.quickVersionComboBox.currentText())
|
|
||||||
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
|
||||||
|
|
||||||
def reloadBibles(self, process=False):
|
def reloadBibles(self, process=False):
|
||||||
@ -439,23 +389,18 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if language_selection == LanguageSelection.Bible:
|
if language_selection == LanguageSelection.Bible:
|
||||||
self.advancedBookComboBox.addItem(book[u'name'])
|
self.advancedBookComboBox.addItem(book[u'name'])
|
||||||
elif language_selection == LanguageSelection.Application:
|
elif language_selection == LanguageSelection.Application:
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(book[u'book_reference_id'])
|
||||||
book[u'book_reference_id'])
|
self.advancedBookComboBox.addItem(book_names[data[u'abbreviation']])
|
||||||
self.advancedBookComboBox.addItem(
|
|
||||||
book_names[data[u'abbreviation']])
|
|
||||||
elif language_selection == LanguageSelection.English:
|
elif language_selection == LanguageSelection.English:
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(book[u'book_reference_id'])
|
||||||
book[u'book_reference_id'])
|
|
||||||
self.advancedBookComboBox.addItem(data[u'name'])
|
self.advancedBookComboBox.addItem(data[u'name'])
|
||||||
self.advancedBookComboBox.setItemData(
|
self.advancedBookComboBox.setItemData(row, book[u'book_reference_id'])
|
||||||
row, book[u'book_reference_id'])
|
|
||||||
if first:
|
if first:
|
||||||
first = False
|
first = False
|
||||||
first_book = book
|
first_book = book
|
||||||
initialise_chapter_verse = True
|
initialise_chapter_verse = True
|
||||||
if last_book_id and last_book_id == int(book[u'book_reference_id']):
|
if last_book_id and last_book_id == int(book[u'book_reference_id']):
|
||||||
index = self.advancedBookComboBox.findData(
|
index = self.advancedBookComboBox.findData(book[u'book_reference_id'])
|
||||||
book[u'book_reference_id'])
|
|
||||||
if index == -1:
|
if index == -1:
|
||||||
# Not Found.
|
# Not Found.
|
||||||
index = 0
|
index = 0
|
||||||
@ -466,17 +411,13 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
first_book[u'book_reference_id'])
|
first_book[u'book_reference_id'])
|
||||||
|
|
||||||
def initialiseChapterVerse(self, bible, book, book_ref_id):
|
def initialiseChapterVerse(self, bible, book, book_ref_id):
|
||||||
log.debug(u'initialiseChapterVerse %s, %s, %s', bible, book,
|
log.debug(u'initialiseChapterVerse %s, %s, %s', bible, book, book_ref_id)
|
||||||
book_ref_id)
|
|
||||||
book = self.plugin.manager.get_book_by_id(bible, book_ref_id)
|
book = self.plugin.manager.get_book_by_id(bible, book_ref_id)
|
||||||
self.chapter_count = self.plugin.manager.get_chapter_count(bible, book)
|
self.chapter_count = self.plugin.manager.get_chapter_count(bible, book)
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, 1)
|
||||||
book_ref_id, 1)
|
|
||||||
if verse_count == 0:
|
if verse_count == 0:
|
||||||
self.advancedSearchButton.setEnabled(False)
|
self.advancedSearchButton.setEnabled(False)
|
||||||
critical_error_message_box(
|
critical_error_message_box(message=translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
|
||||||
message=translate('BiblesPlugin.MediaItem',
|
|
||||||
'Bible not fully loaded.'))
|
|
||||||
else:
|
else:
|
||||||
self.advancedSearchButton.setEnabled(True)
|
self.advancedSearchButton.setEnabled(True)
|
||||||
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
|
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
|
||||||
@ -492,11 +433,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'updateAutoCompleter')
|
log.debug(u'updateAutoCompleter')
|
||||||
# Save the current search type to the configuration.
|
# Save the current search type to the configuration.
|
||||||
Settings().setValue(u'%s/last search type' %
|
Settings().setValue(u'%s/last search type' % self.settingsSection, self.quickSearchEdit.currentSearchType())
|
||||||
self.settingsSection, self.quickSearchEdit.currentSearchType())
|
|
||||||
# Save the current bible to the configuration.
|
# Save the current bible to the configuration.
|
||||||
Settings().setValue(self.settingsSection + u'/quick bible',
|
Settings().setValue(self.settingsSection + u'/quick bible', self.quickVersionComboBox.currentText())
|
||||||
self.quickVersionComboBox.currentText())
|
|
||||||
books = []
|
books = []
|
||||||
# We have to do a 'Reference Search'.
|
# We have to do a 'Reference Search'.
|
||||||
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
|
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
|
||||||
@ -510,33 +449,27 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
book_data_temp = []
|
book_data_temp = []
|
||||||
for book in book_data:
|
for book in book_data:
|
||||||
for secondbook in secondbook_data:
|
for secondbook in secondbook_data:
|
||||||
if book.book_reference_id == \
|
if book.book_reference_id == secondbook.book_reference_id:
|
||||||
secondbook.book_reference_id:
|
|
||||||
book_data_temp.append(book)
|
book_data_temp.append(book)
|
||||||
book_data = book_data_temp
|
book_data = book_data_temp
|
||||||
language_selection = self.plugin.manager.get_language_selection(
|
language_selection = self.plugin.manager.get_language_selection(bible)
|
||||||
bible)
|
|
||||||
if language_selection == LanguageSelection.Bible:
|
if language_selection == LanguageSelection.Bible:
|
||||||
books = [book.name + u' ' for book in book_data]
|
books = [book.name + u' ' for book in book_data]
|
||||||
elif language_selection == LanguageSelection.Application:
|
elif language_selection == LanguageSelection.Application:
|
||||||
book_names = BibleStrings().BookNames
|
book_names = BibleStrings().BookNames
|
||||||
for book in book_data:
|
for book in book_data:
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(book.book_reference_id)
|
||||||
book.book_reference_id)
|
books.append(unicode(book_names[data[u'abbreviation']]) + u' ')
|
||||||
books.append(unicode(
|
|
||||||
book_names[data[u'abbreviation']]) + u' ')
|
|
||||||
elif language_selection == LanguageSelection.English:
|
elif language_selection == LanguageSelection.English:
|
||||||
for book in book_data:
|
for book in book_data:
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(book.book_reference_id)
|
||||||
book.book_reference_id)
|
|
||||||
books.append(data[u'name'] + u' ')
|
books.append(data[u'name'] + u' ')
|
||||||
books.sort(cmp=locale_compare)
|
books.sort(cmp=locale_compare)
|
||||||
set_case_insensitive_completer(books, self.quickSearchEdit)
|
set_case_insensitive_completer(books, self.quickSearchEdit)
|
||||||
|
|
||||||
def onImportClick(self):
|
def onImportClick(self):
|
||||||
if not hasattr(self, u'import_wizard'):
|
if not hasattr(self, u'import_wizard'):
|
||||||
self.import_wizard = BibleImportForm(self, self.plugin.manager,
|
self.import_wizard = BibleImportForm(self, self.plugin.manager, self.plugin)
|
||||||
self.plugin)
|
|
||||||
# If the import was not cancelled then reload.
|
# If the import was not cancelled then reload.
|
||||||
if self.import_wizard.exec_():
|
if self.import_wizard.exec_():
|
||||||
self.reloadBibles()
|
self.reloadBibles()
|
||||||
@ -547,8 +480,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
elif self.advancedTab.isVisible():
|
elif self.advancedTab.isVisible():
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
if bible:
|
if bible:
|
||||||
self.editBibleForm = EditBibleForm(self, self.plugin.formParent,
|
self.editBibleForm = EditBibleForm(self, self.plugin.formParent, self.plugin.manager)
|
||||||
self.plugin.manager)
|
|
||||||
self.editBibleForm.loadBible(bible)
|
self.editBibleForm.loadBible(bible)
|
||||||
if self.editBibleForm.exec_():
|
if self.editBibleForm.exec_():
|
||||||
self.reloadBibles()
|
self.reloadBibles()
|
||||||
@ -560,12 +492,9 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
if bible:
|
if bible:
|
||||||
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
|
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
|
||||||
translate('BiblesPlugin.MediaItem',
|
translate('BiblesPlugin.MediaItem', 'Are you sure you want to completely delete "%s" Bible from '
|
||||||
'Are you sure you want to completely delete "%s" Bible from '
|
'OpenLP?\n\nYou will need to re-import this Bible to use it again.') % bible,
|
||||||
'OpenLP?\n\nYou will need to re-import this Bible to use it '
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
'again.') % bible,
|
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
|
||||||
QtGui.QMessageBox.No),
|
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
self.plugin.manager.delete_bible(bible)
|
self.plugin.manager.delete_bible(bible)
|
||||||
@ -590,33 +519,23 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def onQuickStyleComboBoxChanged(self):
|
def onQuickStyleComboBoxChanged(self):
|
||||||
self.settings.layout_style = self.quickStyleComboBox.currentIndex()
|
self.settings.layout_style = self.quickStyleComboBox.currentIndex()
|
||||||
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
||||||
self.settings.layoutStyleComboBox.setCurrentIndex(
|
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
||||||
self.settings.layout_style)
|
Settings().setValue(self.settingsSection + u'/verse layout style', self.settings.layout_style)
|
||||||
Settings().setValue(
|
|
||||||
self.settingsSection + u'/verse layout style',
|
|
||||||
self.settings.layout_style)
|
|
||||||
|
|
||||||
def onAdvancedStyleComboBoxChanged(self):
|
def onAdvancedStyleComboBoxChanged(self):
|
||||||
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
|
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
|
||||||
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
||||||
self.settings.layoutStyleComboBox.setCurrentIndex(
|
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style)
|
||||||
self.settings.layout_style)
|
Settings().setValue(self.settingsSection + u'/verse layout style', self.settings.layout_style)
|
||||||
Settings().setValue(
|
|
||||||
self.settingsSection + u'/verse layout style',
|
|
||||||
self.settings.layout_style)
|
|
||||||
|
|
||||||
def onAdvancedVersionComboBox(self):
|
def onAdvancedVersionComboBox(self):
|
||||||
Settings().setValue(self.settingsSection + u'/advanced bible',
|
Settings().setValue(self.settingsSection + u'/advanced bible', self.advancedVersionComboBox.currentText())
|
||||||
self.advancedVersionComboBox.currentText())
|
|
||||||
self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
|
self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
|
||||||
self.advancedBookComboBox.itemData(
|
self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex())))
|
||||||
int(self.advancedBookComboBox.currentIndex())))
|
|
||||||
|
|
||||||
def onAdvancedSecondComboBox(self):
|
def onAdvancedSecondComboBox(self):
|
||||||
self.initialiseAdvancedBible(
|
self.initialiseAdvancedBible(self.advancedVersionComboBox.currentText(),
|
||||||
self.advancedVersionComboBox.currentText(),
|
self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex())))
|
||||||
self.advancedBookComboBox.itemData(
|
|
||||||
int(self.advancedBookComboBox.currentIndex())))
|
|
||||||
|
|
||||||
def onAdvancedBookComboBox(self):
|
def onAdvancedBookComboBox(self):
|
||||||
item = int(self.advancedBookComboBox.currentIndex())
|
item = int(self.advancedBookComboBox.currentIndex())
|
||||||
@ -630,24 +549,19 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
chapter_to = int(self.advancedToChapter.currentText())
|
chapter_to = int(self.advancedToChapter.currentText())
|
||||||
if chapter_from == chapter_to:
|
if chapter_from == chapter_to:
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex()))
|
||||||
int(self.advancedBookComboBox.currentIndex()))
|
|
||||||
verse_from = int(self.advancedFromVerse.currentText())
|
verse_from = int(self.advancedFromVerse.currentText())
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, chapter_to)
|
||||||
bible, book_ref_id, chapter_to)
|
self.adjustComboBox(verse_from, verse_count, self.advancedToVerse, True)
|
||||||
self.adjustComboBox(verse_from, verse_count,
|
|
||||||
self.advancedToVerse, True)
|
|
||||||
|
|
||||||
def onAdvancedToChapter(self):
|
def onAdvancedToChapter(self):
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex()))
|
||||||
int(self.advancedBookComboBox.currentIndex()))
|
|
||||||
chapter_from = int(self.advancedFromChapter.currentText())
|
chapter_from = int(self.advancedFromChapter.currentText())
|
||||||
chapter_to = int(self.advancedToChapter.currentText())
|
chapter_to = int(self.advancedToChapter.currentText())
|
||||||
verse_from = int(self.advancedFromVerse.currentText())
|
verse_from = int(self.advancedFromVerse.currentText())
|
||||||
verse_to = int(self.advancedToVerse.currentText())
|
verse_to = int(self.advancedToVerse.currentText())
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, chapter_to)
|
||||||
book_ref_id, chapter_to)
|
|
||||||
if chapter_from == chapter_to and verse_from > verse_to:
|
if chapter_from == chapter_to and verse_from > verse_to:
|
||||||
self.adjustComboBox(verse_from, verse_count, self.advancedToVerse)
|
self.adjustComboBox(verse_from, verse_count, self.advancedToVerse)
|
||||||
else:
|
else:
|
||||||
@ -659,20 +573,16 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
int(self.advancedBookComboBox.currentIndex()))
|
int(self.advancedBookComboBox.currentIndex()))
|
||||||
chapter_from = int(self.advancedFromChapter.currentText())
|
chapter_from = int(self.advancedFromChapter.currentText())
|
||||||
chapter_to = int(self.advancedToChapter.currentText())
|
chapter_to = int(self.advancedToChapter.currentText())
|
||||||
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible,
|
verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, chapter_from)
|
||||||
book_ref_id, chapter_from)
|
|
||||||
self.adjustComboBox(1, verse_count, self.advancedFromVerse)
|
self.adjustComboBox(1, verse_count, self.advancedFromVerse)
|
||||||
if chapter_from > chapter_to:
|
if chapter_from > chapter_to:
|
||||||
self.adjustComboBox(1, verse_count, self.advancedToVerse)
|
self.adjustComboBox(1, verse_count, self.advancedToVerse)
|
||||||
self.adjustComboBox(chapter_from, self.chapter_count,
|
self.adjustComboBox(chapter_from, self.chapter_count, self.advancedToChapter)
|
||||||
self.advancedToChapter)
|
|
||||||
elif chapter_from == chapter_to:
|
elif chapter_from == chapter_to:
|
||||||
self.adjustComboBox(chapter_from, self.chapter_count,
|
self.adjustComboBox(chapter_from, self.chapter_count, self.advancedToChapter)
|
||||||
self.advancedToChapter)
|
|
||||||
self.adjustComboBox(1, verse_count, self.advancedToVerse, True)
|
self.adjustComboBox(1, verse_count, self.advancedToVerse, True)
|
||||||
else:
|
else:
|
||||||
self.adjustComboBox(chapter_from, self.chapter_count,
|
self.adjustComboBox(chapter_from, self.chapter_count, self.advancedToChapter, True)
|
||||||
self.advancedToChapter, True)
|
|
||||||
|
|
||||||
def adjustComboBox(self, range_from, range_to, combo, restore=False):
|
def adjustComboBox(self, range_from, range_to, combo, restore=False):
|
||||||
"""
|
"""
|
||||||
@ -709,23 +619,20 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
second_bible = self.advancedSecondComboBox.currentText()
|
second_bible = self.advancedSecondComboBox.currentText()
|
||||||
book = self.advancedBookComboBox.currentText()
|
book = self.advancedBookComboBox.currentText()
|
||||||
book_ref_id = self.advancedBookComboBox.itemData(
|
book_ref_id = self.advancedBookComboBox.itemData(int(self.advancedBookComboBox.currentIndex()))
|
||||||
int(self.advancedBookComboBox.currentIndex()))
|
|
||||||
chapter_from = self.advancedFromChapter.currentText()
|
chapter_from = self.advancedFromChapter.currentText()
|
||||||
chapter_to = self.advancedToChapter.currentText()
|
chapter_to = self.advancedToChapter.currentText()
|
||||||
verse_from = self.advancedFromVerse.currentText()
|
verse_from = self.advancedFromVerse.currentText()
|
||||||
verse_to = self.advancedToVerse.currentText()
|
verse_to = self.advancedToVerse.currentText()
|
||||||
verse_separator = get_reference_separator(u'sep_v_display')
|
verse_separator = get_reference_separator(u'sep_v_display')
|
||||||
range_separator = get_reference_separator(u'sep_r_display')
|
range_separator = get_reference_separator(u'sep_r_display')
|
||||||
verse_range = chapter_from + verse_separator + verse_from + \
|
verse_range = chapter_from + verse_separator + verse_from + range_separator + chapter_to + \
|
||||||
range_separator + chapter_to + verse_separator + verse_to
|
verse_separator + verse_to
|
||||||
versetext = u'%s %s' % (book, verse_range)
|
versetext = u'%s %s' % (book, verse_range)
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
self.search_results = self.plugin.manager.get_verses(bible, versetext,
|
self.search_results = self.plugin.manager.get_verses(bible, versetext, book_ref_id)
|
||||||
book_ref_id)
|
|
||||||
if second_bible:
|
if second_bible:
|
||||||
self.second_search_results = self.plugin.manager.get_verses(
|
self.second_search_results = self.plugin.manager.get_verses(second_bible, versetext, book_ref_id)
|
||||||
second_bible, versetext, book_ref_id)
|
|
||||||
if not self.advancedLockButton.isChecked():
|
if not self.advancedLockButton.isChecked():
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
if self.listView.count() != 0:
|
if self.listView.count() != 0:
|
||||||
@ -752,27 +659,23 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
# We are doing a 'Reference Search'.
|
# We are doing a 'Reference Search'.
|
||||||
self.search_results = self.plugin.manager.get_verses(bible, text)
|
self.search_results = self.plugin.manager.get_verses(bible, text)
|
||||||
if second_bible and self.search_results:
|
if second_bible and self.search_results:
|
||||||
self.second_search_results = self.plugin.manager.get_verses(
|
self.second_search_results = self.plugin.manager.get_verses(second_bible, text,
|
||||||
second_bible, text,
|
|
||||||
self.search_results[0].book.book_reference_id)
|
self.search_results[0].book.book_reference_id)
|
||||||
else:
|
else:
|
||||||
# We are doing a 'Text Search'.
|
# We are doing a 'Text Search'.
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
bibles = self.plugin.manager.get_bibles()
|
bibles = self.plugin.manager.get_bibles()
|
||||||
self.search_results = self.plugin.manager.verse_search(bible,
|
self.search_results = self.plugin.manager.verse_search(bible, second_bible, text)
|
||||||
second_bible, text)
|
|
||||||
if second_bible and self.search_results:
|
if second_bible and self.search_results:
|
||||||
text = []
|
text = []
|
||||||
new_search_results = []
|
new_search_results = []
|
||||||
count = 0
|
count = 0
|
||||||
passage_not_found = False
|
passage_not_found = False
|
||||||
for verse in self.search_results:
|
for verse in self.search_results:
|
||||||
db_book = bibles[second_bible].get_book_by_book_ref_id(
|
db_book = bibles[second_bible].get_book_by_book_ref_id(verse.book.book_reference_id)
|
||||||
verse.book.book_reference_id)
|
|
||||||
if not db_book:
|
if not db_book:
|
||||||
log.debug(u'Passage "%s %d:%d" not found in Second '
|
log.debug(u'Passage "%s %d:%d" not found in Second Bible' %
|
||||||
u'Bible' % (verse.book.name, verse.chapter,
|
(verse.book.name, verse.chapter, verse.verse))
|
||||||
verse.verse))
|
|
||||||
passage_not_found = True
|
passage_not_found = True
|
||||||
count += 1
|
count += 1
|
||||||
continue
|
continue
|
||||||
@ -780,17 +683,13 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
text.append((verse.book.book_reference_id, verse.chapter,
|
text.append((verse.book.book_reference_id, verse.chapter,
|
||||||
verse.verse, verse.verse))
|
verse.verse, verse.verse))
|
||||||
if passage_not_found:
|
if passage_not_found:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self, translate('BiblesPlugin.MediaItem', 'Information'),
|
||||||
translate('BiblesPlugin.MediaItem', 'Information'),
|
translate('BiblesPlugin.MediaItem', 'The second Bible does not contain all the verses '
|
||||||
translate('BiblesPlugin.MediaItem',
|
'that are in the main Bible. Only verses found in both Bibles will be shown. %d verses '
|
||||||
'The second Bible does not contain all the verses '
|
'have not been included in the results.') % count,
|
||||||
'that are in the main Bible. Only verses found in both '
|
|
||||||
'Bibles will be shown. %d verses have not been '
|
|
||||||
'included in the results.') % count,
|
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
self.search_results = new_search_results
|
self.search_results = new_search_results
|
||||||
self.second_search_results = \
|
self.second_search_results = bibles[second_bible].get_verses(text)
|
||||||
bibles[second_bible].get_verses(text)
|
|
||||||
if not self.quickLockButton.isChecked():
|
if not self.quickLockButton.isChecked():
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
if self.listView.count() != 0 and self.search_results:
|
if self.listView.count() != 0 and self.search_results:
|
||||||
@ -807,8 +706,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
Displays the search results in the media manager. All data needed for
|
Displays the search results in the media manager. All data needed for
|
||||||
further action is saved for/in each row.
|
further action is saved for/in each row.
|
||||||
"""
|
"""
|
||||||
items = self.buildDisplayResults(bible, second_bible,
|
items = self.buildDisplayResults(bible, second_bible, self.search_results)
|
||||||
self.search_results)
|
|
||||||
for bible_verse in items:
|
for bible_verse in items:
|
||||||
self.listView.addItem(bible_verse)
|
self.listView.addItem(bible_verse)
|
||||||
self.listView.selectAll()
|
self.listView.selectAll()
|
||||||
@ -823,18 +721,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
verse_separator = get_reference_separator(u'sep_v_display')
|
verse_separator = get_reference_separator(u'sep_v_display')
|
||||||
version = self.plugin.manager.get_meta_data(bible, u'name').value
|
version = self.plugin.manager.get_meta_data(bible, u'name').value
|
||||||
copyright = self.plugin.manager.get_meta_data(bible, u'copyright').value
|
copyright = self.plugin.manager.get_meta_data(bible, u'copyright').value
|
||||||
permissions = \
|
permissions = self.plugin.manager.get_meta_data(bible, u'permissions').value
|
||||||
self.plugin.manager.get_meta_data(bible, u'permissions').value
|
|
||||||
second_version = u''
|
second_version = u''
|
||||||
second_copyright = u''
|
second_copyright = u''
|
||||||
second_permissions = u''
|
second_permissions = u''
|
||||||
if second_bible:
|
if second_bible:
|
||||||
second_version = self.plugin.manager.get_meta_data(
|
second_version = self.plugin.manager.get_meta_data(second_bible, u'name').value
|
||||||
second_bible, u'name').value
|
second_copyright = self.plugin.manager.get_meta_data(second_bible, u'copyright').value
|
||||||
second_copyright = self.plugin.manager.get_meta_data(
|
second_permissions = self.plugin.manager.get_meta_data(second_bible, u'permissions').value
|
||||||
second_bible, u'copyright').value
|
|
||||||
second_permissions = self.plugin.manager.get_meta_data(
|
|
||||||
second_bible, u'permissions').value
|
|
||||||
items = []
|
items = []
|
||||||
language_selection = self.plugin.manager.get_language_selection(bible)
|
language_selection = self.plugin.manager.get_language_selection(bible)
|
||||||
for count, verse in enumerate(search_results):
|
for count, verse in enumerate(search_results):
|
||||||
@ -843,12 +737,10 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
book = verse.book.name
|
book = verse.book.name
|
||||||
elif language_selection == LanguageSelection.Application:
|
elif language_selection == LanguageSelection.Application:
|
||||||
book_names = BibleStrings().BookNames
|
book_names = BibleStrings().BookNames
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(verse.book.book_reference_id)
|
||||||
verse.book.book_reference_id)
|
|
||||||
book = unicode(book_names[data[u'abbreviation']])
|
book = unicode(book_names[data[u'abbreviation']])
|
||||||
elif language_selection == LanguageSelection.English:
|
elif language_selection == LanguageSelection.English:
|
||||||
data = BiblesResourcesDB.get_book_by_id(
|
data = BiblesResourcesDB.get_book_by_id(verse.book.book_reference_id)
|
||||||
verse.book.book_reference_id)
|
|
||||||
book = data[u'name']
|
book = data[u'name']
|
||||||
data = {
|
data = {
|
||||||
'book': book,
|
'book': book,
|
||||||
@ -867,17 +759,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
}
|
}
|
||||||
if second_bible:
|
if second_bible:
|
||||||
try:
|
try:
|
||||||
data[u'second_text'] = \
|
data[u'second_text'] = self.second_search_results[count].text
|
||||||
self.second_search_results[count].text
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
log.exception(u'The second_search_results does not have as '
|
log.exception(u'The second_search_results does not have as many verses as the search_results.')
|
||||||
'many verses as the search_results.')
|
|
||||||
break
|
break
|
||||||
bible_text = u'%s %d%s%d (%s, %s)' % (book, verse.chapter,
|
bible_text = u'%s %d%s%d (%s, %s)' % (book, verse.chapter, verse_separator, verse.verse, version,
|
||||||
verse_separator, verse.verse, version, second_version)
|
second_version)
|
||||||
else:
|
else:
|
||||||
bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter,
|
bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter, verse_separator, verse.verse, version)
|
||||||
verse_separator, verse.verse, version)
|
|
||||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||||
bible_verse.setData(QtCore.Qt.UserRole, data)
|
bible_verse.setData(QtCore.Qt.UserRole, data)
|
||||||
items.append(bible_verse)
|
items.append(bible_verse)
|
||||||
@ -914,14 +803,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
second_bible = self._decodeQtObject(bitem, 'second_bible')
|
second_bible = self._decodeQtObject(bitem, 'second_bible')
|
||||||
second_version = self._decodeQtObject(bitem, 'second_version')
|
second_version = self._decodeQtObject(bitem, 'second_version')
|
||||||
second_copyright = self._decodeQtObject(bitem, 'second_copyright')
|
second_copyright = self._decodeQtObject(bitem, 'second_copyright')
|
||||||
second_permissions = \
|
second_permissions = self._decodeQtObject(bitem, 'second_permissions')
|
||||||
self._decodeQtObject(bitem, 'second_permissions')
|
|
||||||
second_text = self._decodeQtObject(bitem, 'second_text')
|
second_text = self._decodeQtObject(bitem, 'second_text')
|
||||||
verses.add(book, chapter, verse, version, copyright, permissions)
|
verses.add(book, chapter, verse, version, copyright, permissions)
|
||||||
verse_text = self.formatVerse(old_chapter, chapter, verse)
|
verse_text = self.formatVerse(old_chapter, chapter, verse)
|
||||||
if second_bible:
|
if second_bible:
|
||||||
bible_text = u'%s %s\n\n%s %s' % (verse_text, text,
|
bible_text = u'%s %s\n\n%s %s' % (verse_text, text, verse_text, second_text)
|
||||||
verse_text, second_text)
|
|
||||||
raw_slides.append(bible_text.rstrip())
|
raw_slides.append(bible_text.rstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Slide' then create a new slide.
|
# If we are 'Verse Per Slide' then create a new slide.
|
||||||
@ -946,8 +833,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
# Add footer
|
# Add footer
|
||||||
service_item.raw_footer.append(verses.format_verses())
|
service_item.raw_footer.append(verses.format_verses())
|
||||||
if second_bible:
|
if second_bible:
|
||||||
verses.add_version(second_version, second_copyright,
|
verses.add_version(second_version, second_copyright, second_permissions)
|
||||||
second_permissions)
|
|
||||||
service_item.raw_footer.append(verses.format_versions())
|
service_item.raw_footer.append(verses.format_versions())
|
||||||
raw_title.append(self.formatTitle(start_item, bitem))
|
raw_title.append(self.formatTitle(start_item, bitem))
|
||||||
# If there are no more items we check whether we have to add bible_text.
|
# If there are no more items we check whether we have to add bible_text.
|
||||||
@ -955,8 +841,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
raw_slides.append(bible_text.lstrip())
|
raw_slides.append(bible_text.lstrip())
|
||||||
bible_text = u''
|
bible_text = u''
|
||||||
# Service Item: Capabilities
|
# Service Item: Capabilities
|
||||||
if self.settings.layout_style == LayoutStyle.Continuous and \
|
if self.settings.layout_style == LayoutStyle.Continuous and not second_bible:
|
||||||
not second_bible:
|
|
||||||
# Split the line but do not replace line breaks in renderer.
|
# Split the line but do not replace line breaks in renderer.
|
||||||
service_item.add_capability(ItemCapabilities.NoLineBreaks)
|
service_item.add_capability(ItemCapabilities.NoLineBreaks)
|
||||||
service_item.add_capability(ItemCapabilities.CanPreview)
|
service_item.add_capability(ItemCapabilities.CanPreview)
|
||||||
@ -1002,8 +887,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
if start_verse == old_verse:
|
if start_verse == old_verse:
|
||||||
verse_range = start_chapter + verse_separator + start_verse
|
verse_range = start_chapter + verse_separator + start_verse
|
||||||
else:
|
else:
|
||||||
verse_range = start_chapter + verse_separator + start_verse + \
|
verse_range = start_chapter + verse_separator + start_verse + range_separator + old_verse
|
||||||
range_separator + old_verse
|
|
||||||
else:
|
else:
|
||||||
verse_range = start_chapter + verse_separator + start_verse + \
|
verse_range = start_chapter + verse_separator + start_verse + \
|
||||||
range_separator + old_chapter + verse_separator + old_verse
|
range_separator + old_chapter + verse_separator + old_verse
|
||||||
@ -1032,16 +916,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
old_verse = int(self._decodeQtObject(old_bitem, 'verse'))
|
old_verse = int(self._decodeQtObject(old_bitem, 'verse'))
|
||||||
old_bible = self._decodeQtObject(old_bitem, 'bible')
|
old_bible = self._decodeQtObject(old_bitem, 'bible')
|
||||||
old_second_bible = self._decodeQtObject(old_bitem, 'second_bible')
|
old_second_bible = self._decodeQtObject(old_bitem, 'second_bible')
|
||||||
if old_bible != bible or old_second_bible != second_bible or \
|
if old_bible != bible or old_second_bible != second_bible or old_book != book:
|
||||||
old_book != book:
|
|
||||||
# The bible, second bible or book has changed.
|
# The bible, second bible or book has changed.
|
||||||
return True
|
return True
|
||||||
elif old_verse + 1 != verse and old_chapter == chapter:
|
elif old_verse + 1 != verse and old_chapter == chapter:
|
||||||
# We are still in the same chapter, but a verse has been skipped.
|
# We are still in the same chapter, but a verse has been skipped.
|
||||||
return True
|
return True
|
||||||
elif old_chapter + 1 == chapter and (verse != 1 or
|
elif old_chapter + 1 == chapter and (verse != 1 or
|
||||||
old_verse != self.plugin.manager.get_verse_count(
|
old_verse != self.plugin.manager.get_verse_count(old_bible, old_book, old_chapter)):
|
||||||
old_bible, old_book, old_chapter)):
|
|
||||||
# We are in the following chapter, but the last verse was not the
|
# We are in the following chapter, but the last verse was not the
|
||||||
# last verse of the chapter or the current verse is not the
|
# last verse of the chapter or the current verse is not the
|
||||||
# first one of the chapter.
|
# first one of the chapter.
|
||||||
@ -1083,8 +965,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
Search for some Bible verses (by reference).
|
Search for some Bible verses (by reference).
|
||||||
"""
|
"""
|
||||||
bible = self.quickVersionComboBox.currentText()
|
bible = self.quickVersionComboBox.currentText()
|
||||||
search_results = self.plugin.manager.get_verses(bible, string, False,
|
search_results = self.plugin.manager.get_verses(bible, string, False, showError)
|
||||||
showError)
|
|
||||||
if search_results:
|
if search_results:
|
||||||
versetext = u' '.join([verse.text for verse in search_results])
|
versetext = u' '.join([verse.text for verse in search_results])
|
||||||
return [[string, versetext]]
|
return [[string, versetext]]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -56,12 +56,11 @@ class OpenLP1Bible(BibleDB):
|
|||||||
connection = None
|
connection = None
|
||||||
cursor = None
|
cursor = None
|
||||||
try:
|
try:
|
||||||
connection = sqlite.connect(
|
connection = sqlite.connect(self.filename.encode(sys.getfilesystemencoding()))
|
||||||
self.filename.encode(sys.getfilesystemencoding()))
|
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
except sqlite.DatabaseError:
|
except sqlite.DatabaseError:
|
||||||
log.exception(u'File "%s" is encrypted or not a sqlite database, '
|
log.exception(u'File "%s" is encrypted or not a sqlite database, '
|
||||||
'therefore not an openlp.org 1.x database either' % self.filename)
|
'therefore not an openlp.org 1.x database either' % self.filename)
|
||||||
# Please add an user error here!
|
# Please add an user error here!
|
||||||
# This file is not an openlp.org 1.x bible database.
|
# This file is not an openlp.org 1.x bible database.
|
||||||
return False
|
return False
|
||||||
@ -72,8 +71,7 @@ class OpenLP1Bible(BibleDB):
|
|||||||
return False
|
return False
|
||||||
# Create all books.
|
# Create all books.
|
||||||
try:
|
try:
|
||||||
cursor.execute(
|
cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
|
||||||
u'SELECT id, testament_id, name, abbreviation FROM book')
|
|
||||||
except sqlite.DatabaseError as error:
|
except sqlite.DatabaseError as error:
|
||||||
log.exception(u'DatabaseError: %s' % error)
|
log.exception(u'DatabaseError: %s' % error)
|
||||||
# Please add an user error here!
|
# Please add an user error here!
|
||||||
@ -92,12 +90,10 @@ class OpenLP1Bible(BibleDB):
|
|||||||
book_ref_id = self.get_book_ref_id_by_name(name, len(books),
|
book_ref_id = self.get_book_ref_id_by_name(name, len(books),
|
||||||
language_id)
|
language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
db_book = self.create_book(name, book_ref_id,
|
db_book = self.create_book(name, book_ref_id, book_details[u'testament_id'])
|
||||||
book_details[u'testament_id'])
|
|
||||||
# Update the progess bar.
|
# Update the progess bar.
|
||||||
self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
|
self.wizard.incrementProgressBar(WizardStrings.ImportingType % name)
|
||||||
# Import the verses for this book.
|
# Import the verses for this book.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -83,21 +83,17 @@ class OpenSongBible(BibleDB):
|
|||||||
bible = opensong.getroot()
|
bible = opensong.getroot()
|
||||||
language_id = self.get_language(bible_name)
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
for book in bible.b:
|
for book in bible.b:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
break
|
break
|
||||||
book_ref_id = self.get_book_ref_id_by_name(
|
book_ref_id = self.get_book_ref_id_by_name(unicode(book.attrib[u'n']), len(bible.b), language_id)
|
||||||
unicode(book.attrib[u'n']), len(bible.b), language_id)
|
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
db_book = self.create_book(unicode(book.attrib[u'n']),
|
db_book = self.create_book(unicode(book.attrib[u'n']), book_ref_id, book_details[u'testament_id'])
|
||||||
book_ref_id, book_details[u'testament_id'])
|
|
||||||
chapter_number = 0
|
chapter_number = 0
|
||||||
for chapter in book.c:
|
for chapter in book.c:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
@ -130,15 +126,12 @@ class OpenSongBible(BibleDB):
|
|||||||
chapter_number,
|
chapter_number,
|
||||||
verse_number,
|
verse_number,
|
||||||
self.get_text(verse))
|
self.get_text(verse))
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
|
||||||
'Importing <book name> <chapter>...')) % \
|
|
||||||
(db_book.name, chapter_number)
|
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
except etree.XMLSyntaxError as inst:
|
except etree.XMLSyntaxError as inst:
|
||||||
critical_error_message_box(
|
critical_error_message_box(message=translate('BiblesPlugin.OpenSongImport',
|
||||||
message=translate('BiblesPlugin.OpenSongImport',
|
|
||||||
'Incorrect Bible file type supplied. OpenSong Bibles may be '
|
'Incorrect Bible file type supplied. OpenSong Bibles may be '
|
||||||
'compressed. You must decompress them before import.'))
|
'compressed. You must decompress them before import.'))
|
||||||
log.exception(inst)
|
log.exception(inst)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -72,8 +72,7 @@ class OSISBible(BibleDB):
|
|||||||
r'<divineName(.*?)>(.*?)</divineName>')
|
r'<divineName(.*?)>(.*?)</divineName>')
|
||||||
self.spaces_regex = re.compile(r'([ ]{2,})')
|
self.spaces_regex = re.compile(r'([ ]{2,})')
|
||||||
filepath = os.path.join(
|
filepath = os.path.join(
|
||||||
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
|
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', u'resources', u'osisbooks.csv')
|
||||||
u'resources', u'osisbooks.csv')
|
|
||||||
|
|
||||||
def do_import(self, bible_name=None):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
@ -133,19 +132,16 @@ class OSISBible(BibleDB):
|
|||||||
if not language_id:
|
if not language_id:
|
||||||
language_id = self.get_language(bible_name)
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s" failed'
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
% self.filename)
|
|
||||||
return False
|
return False
|
||||||
match_count += 1
|
match_count += 1
|
||||||
book = unicode(match.group(1))
|
book = unicode(match.group(1))
|
||||||
chapter = int(match.group(2))
|
chapter = int(match.group(2))
|
||||||
verse = int(match.group(3))
|
verse = int(match.group(3))
|
||||||
verse_text = match.group(4)
|
verse_text = match.group(4)
|
||||||
book_ref_id = self.get_book_ref_id_by_name(book, book_count,
|
book_ref_id = self.get_book_ref_id_by_name(book, book_count, language_id)
|
||||||
language_id)
|
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.exception(u'Importing books from "%s" failed' %
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
self.filename)
|
|
||||||
return False
|
return False
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
if not db_book or db_book.name != book_details[u'name']:
|
if not db_book or db_book.name != book_details[u'name']:
|
||||||
@ -159,10 +155,8 @@ class OSISBible(BibleDB):
|
|||||||
if last_chapter != chapter:
|
if last_chapter != chapter:
|
||||||
if last_chapter != 0:
|
if last_chapter != 0:
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport', 'Importing %s %s...',
|
||||||
'BiblesPlugin.OsisImport', 'Importing %s %s...',
|
'Importing <book name> <chapter>...') % (book_details[u'name'], chapter))
|
||||||
'Importing <book name> <chapter>...') %
|
|
||||||
(book_details[u'name'], chapter))
|
|
||||||
last_chapter = chapter
|
last_chapter = chapter
|
||||||
# All of this rigmarol below is because the mod2osis
|
# All of this rigmarol below is because the mod2osis
|
||||||
# tool from the Sword library embeds XML in the OSIS
|
# tool from the Sword library embeds XML in the OSIS
|
||||||
@ -182,9 +176,9 @@ class OSISBible(BibleDB):
|
|||||||
verse_text = self.q_regex.sub(u'', verse_text)
|
verse_text = self.q_regex.sub(u'', verse_text)
|
||||||
verse_text = self.divine_name_regex.sub(repl, verse_text)
|
verse_text = self.divine_name_regex.sub(repl, verse_text)
|
||||||
verse_text = self.trans_regex.sub(u'', verse_text)
|
verse_text = self.trans_regex.sub(u'', verse_text)
|
||||||
verse_text = verse_text.replace(u'</lb>', u'')\
|
verse_text = verse_text.replace(u'</lb>', u'') \
|
||||||
.replace(u'</l>', u'').replace(u'<lg>', u'')\
|
.replace(u'</l>', u'').replace(u'<lg>', u'') \
|
||||||
.replace(u'</lg>', u'').replace(u'</q>', u'')\
|
.replace(u'</lg>', u'').replace(u'</q>', u'') \
|
||||||
.replace(u'</div>', u'').replace(u'</w>', u'')
|
.replace(u'</div>', u'').replace(u'</w>', u'')
|
||||||
verse_text = self.spaces_regex.sub(u' ', verse_text)
|
verse_text = self.spaces_regex.sub(u' ', verse_text)
|
||||||
self.create_verse(db_book.id, chapter, verse, verse_text)
|
self.create_verse(db_book.id, chapter, verse, verse_text)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -40,8 +40,7 @@ class VerseReferenceList(object):
|
|||||||
|
|
||||||
def add(self, book, chapter, verse, version, copyright, permission):
|
def add(self, book, chapter, verse, version, copyright, permission):
|
||||||
self.add_version(version, copyright, permission)
|
self.add_version(version, copyright, permission)
|
||||||
if not self.verse_list or \
|
if not self.verse_list or self.verse_list[self.current_index][u'book'] != book:
|
||||||
self.verse_list[self.current_index][u'book'] != book:
|
|
||||||
self.verse_list.append({u'version': version, u'book': book,
|
self.verse_list.append({u'version': version, u'book': book,
|
||||||
u'chapter': chapter, u'start': verse, u'end': verse})
|
u'chapter': chapter, u'start': verse, u'end': verse})
|
||||||
self.current_index += 1
|
self.current_index += 1
|
||||||
@ -60,26 +59,22 @@ class VerseReferenceList(object):
|
|||||||
for bible_version in self.version_list:
|
for bible_version in self.version_list:
|
||||||
if bible_version[u'version'] == version:
|
if bible_version[u'version'] == version:
|
||||||
return
|
return
|
||||||
self.version_list.append({u'version': version, u'copyright': copyright,
|
self.version_list.append({u'version': version, u'copyright': copyright, u'permission': permission})
|
||||||
u'permission': permission})
|
|
||||||
|
|
||||||
def format_verses(self):
|
def format_verses(self):
|
||||||
result = u''
|
result = u''
|
||||||
for index, verse in enumerate(self.verse_list):
|
for index, verse in enumerate(self.verse_list):
|
||||||
if index == 0:
|
if index == 0:
|
||||||
result = u'%s %s:%s' % (verse[u'book'], verse[u'chapter'],
|
result = u'%s %s:%s' % (verse[u'book'], verse[u'chapter'], verse[u'start'])
|
||||||
verse[u'start'])
|
|
||||||
if verse[u'start'] != verse[u'end']:
|
if verse[u'start'] != verse[u'end']:
|
||||||
result = u'%s-%s' % (result, verse[u'end'])
|
result = u'%s-%s' % (result, verse[u'end'])
|
||||||
continue
|
continue
|
||||||
prev = index - 1
|
prev = index - 1
|
||||||
if self.verse_list[prev][u'version'] != verse[u'version']:
|
if self.verse_list[prev][u'version'] != verse[u'version']:
|
||||||
result = u'%s (%s)' % (result,
|
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
|
||||||
self.verse_list[prev][u'version'])
|
|
||||||
result = result + u', '
|
result = result + u', '
|
||||||
if self.verse_list[prev][u'book'] != verse[u'book']:
|
if self.verse_list[prev][u'book'] != verse[u'book']:
|
||||||
result = u'%s%s %s:' % (result, verse[u'book'],
|
result = u'%s%s %s:' % (result, verse[u'book'], verse[u'chapter'])
|
||||||
verse[u'chapter'])
|
|
||||||
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
|
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
|
||||||
result = u'%s%s:' % (result, verse[u'chapter'])
|
result = u'%s%s:' % (result, verse[u'chapter'])
|
||||||
result = result + str(verse[u'start'])
|
result = result + str(verse[u'start'])
|
||||||
@ -96,8 +91,7 @@ class VerseReferenceList(object):
|
|||||||
if result[-1] not in [u';', u',', u'.']:
|
if result[-1] not in [u';', u',', u'.']:
|
||||||
result = result + u';'
|
result = result + u';'
|
||||||
result = result + u' '
|
result = result + u' '
|
||||||
result = u'%s%s, %s' % (result, version[u'version'],
|
result = u'%s%s, %s' % (result, version[u'version'], version[u'copyright'])
|
||||||
version[u'copyright'])
|
|
||||||
if version[u'permission'].strip():
|
if version[u'permission'].strip():
|
||||||
result = result + u', ' + version[u'permission']
|
result = result + u', ' + version[u'permission']
|
||||||
result = result.rstrip()
|
result = result.rstrip()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -31,8 +31,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, \
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, ImageSource, Settings
|
||||||
Receiver, ImageSource, Settings
|
|
||||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -41,13 +40,11 @@ class ImagePlugin(Plugin):
|
|||||||
log.info(u'Image Plugin loaded')
|
log.info(u'Image Plugin loaded')
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
Plugin.__init__(self, u'images', plugin_helpers, ImageMediaItem,
|
Plugin.__init__(self, u'images', plugin_helpers, ImageMediaItem, ImageTab)
|
||||||
ImageTab)
|
|
||||||
self.weight = -7
|
self.weight = -7
|
||||||
self.iconPath = u':/plugins/plugin_images.png'
|
self.iconPath = u':/plugins/plugin_images.png'
|
||||||
self.icon = build_icon(self.iconPath)
|
self.icon = build_icon(self.iconPath)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'image_updated'), self.image_updated)
|
||||||
QtCore.SIGNAL(u'image_updated'), self.image_updated)
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
|
about_text = translate('ImagePlugin', '<strong>Image Plugin</strong>'
|
||||||
@ -73,8 +70,7 @@ class ImagePlugin(Plugin):
|
|||||||
u'plural': translate('ImagePlugin', 'Images', 'name plural')
|
u'plural': translate('ImagePlugin', 'Images', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {u'title': translate('ImagePlugin', 'Images', 'container title')
|
||||||
u'title': translate('ImagePlugin', 'Images', 'container title')
|
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
tooltips = {
|
tooltips = {
|
||||||
@ -85,8 +81,7 @@ class ImagePlugin(Plugin):
|
|||||||
u'delete': translate('ImagePlugin', 'Delete the selected image.'),
|
u'delete': translate('ImagePlugin', 'Delete the selected image.'),
|
||||||
u'preview': translate('ImagePlugin', 'Preview the selected image.'),
|
u'preview': translate('ImagePlugin', 'Preview the selected image.'),
|
||||||
u'live': translate('ImagePlugin', 'Send the selected image live.'),
|
u'live': translate('ImagePlugin', 'Send the selected image live.'),
|
||||||
u'service': translate('ImagePlugin',
|
u'service': translate('ImagePlugin', 'Add the selected image to the service.')
|
||||||
'Add the selected image to the service.')
|
|
||||||
}
|
}
|
||||||
self.setPluginUiTextStrings(tooltips)
|
self.setPluginUiTextStrings(tooltips)
|
||||||
|
|
||||||
@ -96,7 +91,5 @@ class ImagePlugin(Plugin):
|
|||||||
image manager to require updates. Actual update is triggered by the
|
image manager to require updates. Actual update is triggered by the
|
||||||
last part of saving the config.
|
last part of saving the config.
|
||||||
"""
|
"""
|
||||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color', u'#000000'))
|
||||||
+ u'/background color', u'#000000'))
|
self.liveController.imageManager.updateImagesBorder(ImageSource.ImagePlugin, background)
|
||||||
self.liveController.imageManager.updateImagesBorder(
|
|
||||||
ImageSource.ImagePlugin, background)
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -60,27 +60,23 @@ class ImageTab(SettingsTab):
|
|||||||
self.formLayout.addRow(self.informationLabel)
|
self.formLayout.addRow(self.informationLabel)
|
||||||
self.leftLayout.addWidget(self.bgColorGroupBox)
|
self.leftLayout.addWidget(self.bgColorGroupBox)
|
||||||
self.leftLayout.addStretch()
|
self.leftLayout.addStretch()
|
||||||
self.rightColumn.setSizePolicy(
|
self.rightColumn.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
|
||||||
self.rightLayout.addStretch()
|
self.rightLayout.addStretch()
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.backgroundColorButton,
|
QtCore.QObject.connect(self.backgroundColorButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked)
|
self.onbackgroundColorButtonClicked)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
|
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
|
||||||
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
|
self.backgroundColorLabel.setText(UiStrings().DefaultColor)
|
||||||
self.informationLabel.setText(
|
self.informationLabel.setText(
|
||||||
translate('ImagesPlugin.ImageTab', 'Visible background for images '
|
translate('ImagesPlugin.ImageTab', 'Visible background for images with aspect ratio different to screen.'))
|
||||||
'with aspect ratio different to screen.'))
|
|
||||||
|
|
||||||
def onbackgroundColorButtonClicked(self):
|
def onbackgroundColorButtonClicked(self):
|
||||||
new_color = QtGui.QColorDialog.getColor(
|
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(self.bg_color), self)
|
||||||
QtGui.QColor(self.bg_color), self)
|
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
self.bg_color = new_color.name()
|
self.bg_color = new_color.name()
|
||||||
self.backgroundColorButton.setStyleSheet(
|
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||||
u'background-color: %s' % self.bg_color)
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
@ -88,8 +84,7 @@ class ImageTab(SettingsTab):
|
|||||||
self.bg_color = settings.value(u'background color', u'#000000')
|
self.bg_color = settings.value(u'background color', u'#000000')
|
||||||
self.initial_color = self.bg_color
|
self.initial_color = self.bg_color
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.backgroundColorButton.setStyleSheet(
|
self.backgroundColorButton.setStyleSheet(u'background-color: %s' % self.bg_color)
|
||||||
u'background-color: %s' % self.bg_color)
|
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -32,12 +32,10 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
|
||||||
SettingsManager, translate, check_item_selected, check_directory_exists, \
|
check_item_selected, check_directory_exists, Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings
|
||||||
Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings
|
|
||||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||||
from openlp.core.utils import AppLocation, delete_file, locale_compare, \
|
from openlp.core.utils import AppLocation, delete_file, locale_compare, get_images_filter
|
||||||
get_images_filter
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -52,8 +50,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
MediaManagerItem.__init__(self, parent, plugin, icon)
|
MediaManagerItem.__init__(self, parent, plugin, icon)
|
||||||
self.quickPreviewAllowed = True
|
self.quickPreviewAllowed = True
|
||||||
self.hasSearch = True
|
self.hasSearch = True
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
||||||
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
|
||||||
# Allow DnD from the desktop
|
# Allow DnD from the desktop
|
||||||
self.listView.activateDnD()
|
self.listView.activateDnD()
|
||||||
|
|
||||||
@ -61,8 +58,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.onNewPrompt = translate('ImagePlugin.MediaItem',
|
self.onNewPrompt = translate('ImagePlugin.MediaItem',
|
||||||
'Select Image(s)')
|
'Select Image(s)')
|
||||||
file_formats = get_images_filter()
|
file_formats = get_images_filter()
|
||||||
self.onNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
|
self.onNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats, UiStrings().AllFiles)
|
||||||
UiStrings().AllFiles)
|
|
||||||
self.replaceAction.setText(UiStrings().ReplaceBG)
|
self.replaceAction.setText(UiStrings().ReplaceBG)
|
||||||
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
|
self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG)
|
||||||
self.resetAction.setText(UiStrings().ResetBG)
|
self.resetAction.setText(UiStrings().ResetBG)
|
||||||
@ -79,12 +75,9 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
log.debug(u'initialise')
|
log.debug(u'initialise')
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
self.listView.setIconSize(QtCore.QSize(88, 50))
|
self.listView.setIconSize(QtCore.QSize(88, 50))
|
||||||
self.servicePath = os.path.join(
|
self.servicePath = os.path.join(AppLocation.get_section_data_path(self.settingsSection), u'thumbnails')
|
||||||
AppLocation.get_section_data_path(self.settingsSection),
|
|
||||||
u'thumbnails')
|
|
||||||
check_directory_exists(self.servicePath)
|
check_directory_exists(self.servicePath)
|
||||||
self.loadList(SettingsManager.load_list(
|
self.loadList(SettingsManager.load_list(self.settingsSection, u'images'), True)
|
||||||
self.settingsSection, u'images'), True)
|
|
||||||
|
|
||||||
def addListViewToToolBar(self):
|
def addListViewToToolBar(self):
|
||||||
MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
@ -94,8 +87,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction',
|
self.replaceAction = self.toolbar.addToolbarAction(u'replaceAction',
|
||||||
icon=u':/slides/slide_blank.png', triggers=self.onReplaceClick)
|
icon=u':/slides/slide_blank.png', triggers=self.onReplaceClick)
|
||||||
self.resetAction = self.toolbar.addToolbarAction(u'resetAction',
|
self.resetAction = self.toolbar.addToolbarAction(u'resetAction',
|
||||||
icon=u':/system/system_close.png', visible=False,
|
icon=u':/system/system_close.png', visible=False, triggers=self.onResetClick)
|
||||||
triggers=self.onResetClick)
|
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
"""
|
"""
|
||||||
@ -103,8 +95,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
# Turn off auto preview triggers.
|
# Turn off auto preview triggers.
|
||||||
self.listView.blockSignals(True)
|
self.listView.blockSignals(True)
|
||||||
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem',
|
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem','You must select an image to delete.')):
|
||||||
'You must select an image to delete.')):
|
|
||||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
@ -115,8 +106,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
delete_file(os.path.join(self.servicePath, text.text()))
|
delete_file(os.path.join(self.servicePath, text.text()))
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
self.plugin.formParent.incrementProgressBar()
|
self.plugin.formParent.incrementProgressBar()
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection, u'images', self.getFileList())
|
||||||
u'images', self.getFileList())
|
|
||||||
self.plugin.formParent.finishedProgressBar()
|
self.plugin.formParent.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
Receiver.send_message(u'cursor_normal')
|
||||||
self.listView.blockSignals(False)
|
self.listView.blockSignals(False)
|
||||||
@ -127,8 +117,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
self.plugin.formParent.displayProgressBar(len(images))
|
self.plugin.formParent.displayProgressBar(len(images))
|
||||||
# Sort the images by its filename considering language specific
|
# Sort the images by its filename considering language specific
|
||||||
# characters.
|
# characters.
|
||||||
images.sort(cmp=locale_compare,
|
images.sort(cmp=locale_compare, key=lambda filename: os.path.split(unicode(filename))[1])
|
||||||
key=lambda filename: os.path.split(unicode(filename))[1])
|
|
||||||
for imageFile in images:
|
for imageFile in images:
|
||||||
filename = os.path.split(unicode(imageFile))[1]
|
filename = os.path.split(unicode(imageFile))[1]
|
||||||
thumb = os.path.join(self.servicePath, filename)
|
thumb = os.path.join(self.servicePath, filename)
|
||||||
@ -152,8 +141,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||||
remote=False, context=ServiceItemContext.Service):
|
remote=False, context=ServiceItemContext.Service):
|
||||||
background = QtGui.QColor(Settings().value(self.settingsSection
|
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color', u'#000000'))
|
||||||
+ u'/background color', u'#000000'))
|
|
||||||
if item:
|
if item:
|
||||||
items = [item]
|
items = [item]
|
||||||
else:
|
else:
|
||||||
@ -181,18 +169,15 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
if not remote:
|
if not remote:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem', 'The following image(s) no longer exist: %s') %
|
||||||
'The following image(s) no longer exist: %s') %
|
u'\n'.join(missing_items_filenames))
|
||||||
u'\n'.join(missing_items_filenames))
|
|
||||||
return False
|
return False
|
||||||
# We have missing as well as existing images. We ask what to do.
|
# We have missing as well as existing images. We ask what to do.
|
||||||
elif missing_items and QtGui.QMessageBox.question(self,
|
elif missing_items and QtGui.QMessageBox.question(self,
|
||||||
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
translate('ImagePlugin.MediaItem', 'Missing Image(s)'),
|
||||||
translate('ImagePlugin.MediaItem', 'The following '
|
translate('ImagePlugin.MediaItem', 'The following image(s) no longer exist: %s\n'
|
||||||
'image(s) no longer exist: %s\nDo you want to add the other '
|
'Do you want to add the other images anyway?') % u'\n'.join(missing_items_filenames),
|
||||||
'images anyway?') % u'\n'.join(missing_items_filenames),
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
|
||||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
|
|
||||||
return False
|
return False
|
||||||
# Continue with the existing images.
|
# Continue with the existing images.
|
||||||
for bitem in items:
|
for bitem in items:
|
||||||
@ -219,26 +204,21 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
Called to replace Live backgound with the image selected.
|
Called to replace Live backgound with the image selected.
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView,
|
if check_item_selected(self.listView,
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem', 'You must select an image to replace the background with.')):
|
||||||
'You must select an image to replace the background with.')):
|
background = QtGui.QColor(Settings().value(self.settingsSection + u'/background color', u'#000000'))
|
||||||
background = QtGui.QColor(Settings().value(
|
|
||||||
self.settingsSection + u'/background color', u'#000000'))
|
|
||||||
item = self.listView.selectedIndexes()[0]
|
item = self.listView.selectedIndexes()[0]
|
||||||
bitem = self.listView.item(item.row())
|
bitem = self.listView.item(item.row())
|
||||||
filename = bitem.data(QtCore.Qt.UserRole)
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
if self.plugin.liveController.display.directImage(
|
if self.plugin.liveController.display.directImage(filename, background):
|
||||||
filename, background):
|
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem', 'There was no display item to amend.'))
|
||||||
'There was no display item to amend.'))
|
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem', 'There was a problem replacing your background, '
|
||||||
'There was a problem replacing your background, '
|
'the image file "%s" no longer exists.') % filename)
|
||||||
'the image file "%s" no longer exists.') % filename)
|
|
||||||
|
|
||||||
def search(self, string, showError):
|
def search(self, string, showError):
|
||||||
files = SettingsManager.load_list(self.settingsSection, u'images')
|
files = SettingsManager.load_list(self.settingsSection, u'images')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -46,21 +46,15 @@ class Ui_SongUsageDeleteDialog(object):
|
|||||||
self.deleteCalendar = QtGui.QCalendarWidget(songUsageDeleteDialog)
|
self.deleteCalendar = QtGui.QCalendarWidget(songUsageDeleteDialog)
|
||||||
self.deleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
|
self.deleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
|
||||||
self.deleteCalendar.setGridVisible(True)
|
self.deleteCalendar.setGridVisible(True)
|
||||||
self.deleteCalendar.setVerticalHeaderFormat(
|
self.deleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
|
||||||
QtGui.QCalendarWidget.NoVerticalHeader)
|
|
||||||
self.deleteCalendar.setObjectName(u'deleteCalendar')
|
self.deleteCalendar.setObjectName(u'deleteCalendar')
|
||||||
self.verticalLayout.addWidget(self.deleteCalendar)
|
self.verticalLayout.addWidget(self.deleteCalendar)
|
||||||
self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox',
|
self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||||
[u'cancel', u'ok'])
|
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
self.retranslateUi(songUsageDeleteDialog)
|
self.retranslateUi(songUsageDeleteDialog)
|
||||||
|
|
||||||
def retranslateUi(self, songUsageDeleteDialog):
|
def retranslateUi(self, songUsageDeleteDialog):
|
||||||
songUsageDeleteDialog.setWindowTitle(
|
songUsageDeleteDialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Song Usage Data'))
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm',
|
|
||||||
'Delete Song Usage Data'))
|
|
||||||
self.deleteLabel.setText(
|
self.deleteLabel.setText(
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm',
|
translate('SongUsagePlugin.SongUsageDeleteForm', 'Select the date up to which the song usage data '
|
||||||
'Select the date up to which the song usage data should be '
|
'should be deleted. All data recorded before this date will be permanently deleted.'))
|
||||||
'deleted. All data recorded before this date will be '
|
|
||||||
'permanently deleted.'))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -44,31 +44,23 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
|
|||||||
self.manager = manager
|
self.manager = manager
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QtCore.QObject.connect(
|
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
||||||
self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
|
||||||
self.onButtonBoxClicked)
|
self.onButtonBoxClicked)
|
||||||
|
|
||||||
def onButtonBoxClicked(self, button):
|
def onButtonBoxClicked(self, button):
|
||||||
if self.buttonBox.standardButton(button) == QtGui.QDialogButtonBox.Ok:
|
if self.buttonBox.standardButton(button) == QtGui.QDialogButtonBox.Ok:
|
||||||
ret = QtGui.QMessageBox.question(self,
|
ret = QtGui.QMessageBox.question(self,
|
||||||
|
translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm',
|
translate('SongUsagePlugin.SongUsageDeleteForm',
|
||||||
'Delete Selected Song Usage Events?'),
|
'Are you sure you want to delete selected Song Usage data?'),
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm',
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
||||||
'Are you sure you want to delete selected Song Usage '
|
|
||||||
'data?'),
|
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
|
||||||
QtGui.QMessageBox.No),
|
|
||||||
QtGui.QMessageBox.No)
|
|
||||||
if ret == QtGui.QMessageBox.Yes:
|
if ret == QtGui.QMessageBox.Yes:
|
||||||
deleteDate = self.deleteCalendar.selectedDate().toPyDate()
|
deleteDate = self.deleteCalendar.selectedDate().toPyDate()
|
||||||
self.manager.delete_all_objects(SongUsageItem,
|
self.manager.delete_all_objects(SongUsageItem, SongUsageItem.usagedate <= deleteDate)
|
||||||
SongUsageItem.usagedate <= deleteDate)
|
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('SongUsagePlugin.SongUsageDeleteForm',
|
u'title': translate('SongUsagePlugin.SongUsageDeleteForm', 'Deletion Successful'),
|
||||||
'Deletion Successful'),
|
|
||||||
u'message': translate(
|
u'message': translate(
|
||||||
'SongUsagePlugin.SongUsageDeleteForm',
|
'SongUsagePlugin.SongUsageDeleteForm', 'All requested data has been deleted successfully. ')}
|
||||||
'All requested data has been deleted successfully. ')}
|
|
||||||
)
|
)
|
||||||
self.accept()
|
self.accept()
|
||||||
else:
|
else:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -69,30 +69,19 @@ class Ui_SongUsageDetailDialog(object):
|
|||||||
self.fileLineEdit.setReadOnly(True)
|
self.fileLineEdit.setReadOnly(True)
|
||||||
self.fileHorizontalLayout.addWidget(self.fileLineEdit)
|
self.fileHorizontalLayout.addWidget(self.fileLineEdit)
|
||||||
self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
|
self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
|
||||||
self.saveFilePushButton.setMaximumWidth(
|
self.saveFilePushButton.setMaximumWidth(self.saveFilePushButton.size().height())
|
||||||
self.saveFilePushButton.size().height())
|
self.saveFilePushButton.setIcon(build_icon(u':/general/general_open.png'))
|
||||||
self.saveFilePushButton.setIcon(
|
|
||||||
build_icon(u':/general/general_open.png'))
|
|
||||||
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
|
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
|
||||||
self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
|
self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
|
||||||
self.verticalLayout.addWidget(self.fileGroupBox)
|
self.verticalLayout.addWidget(self.fileGroupBox)
|
||||||
self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox',
|
self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox', [u'cancel', u'ok'])
|
||||||
[u'cancel', u'ok'])
|
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
self.retranslateUi(songUsageDetailDialog)
|
self.retranslateUi(songUsageDetailDialog)
|
||||||
QtCore.QObject.connect(self.saveFilePushButton,
|
QtCore.QObject.connect(self.saveFilePushButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
|
||||||
songUsageDetailDialog.defineOutputLocation)
|
songUsageDetailDialog.defineOutputLocation)
|
||||||
|
|
||||||
def retranslateUi(self, songUsageDetailDialog):
|
def retranslateUi(self, songUsageDetailDialog):
|
||||||
songUsageDetailDialog.setWindowTitle(
|
songUsageDetailDialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Song Usage Extraction'))
|
||||||
translate('SongUsagePlugin.SongUsageDetailForm',
|
self.dateRangeGroupBox.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Select Date Range'))
|
||||||
'Song Usage Extraction'))
|
self.toLabel.setText(translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
|
||||||
self.dateRangeGroupBox.setTitle(
|
self.fileGroupBox.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Report Location'))
|
||||||
translate('SongUsagePlugin.SongUsageDetailForm',
|
|
||||||
'Select Date Range'))
|
|
||||||
self.toLabel.setText(
|
|
||||||
translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
|
|
||||||
self.fileGroupBox.setTitle(
|
|
||||||
translate('SongUsagePlugin.SongUsageDetailForm',
|
|
||||||
'Report Location'))
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -61,22 +61,18 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
year = QtCore.QDate().currentDate().year()
|
year = QtCore.QDate().currentDate().year()
|
||||||
if QtCore.QDate().currentDate().month() < 9:
|
if QtCore.QDate().currentDate().month() < 9:
|
||||||
year -= 1
|
year -= 1
|
||||||
toDate = Settings().value(self.plugin.settingsSection +
|
toDate = Settings().value(self.plugin.settingsSection + u'/to date', QtCore.QDate(year, 8, 31))
|
||||||
u'/to date', QtCore.QDate(year, 8, 31))
|
fromDate = Settings().value(self.plugin.settingsSection + u'/from date', QtCore.QDate(year - 1, 9, 1))
|
||||||
fromDate = Settings().value(self.plugin.settingsSection +
|
|
||||||
u'/from date', QtCore.QDate(year - 1, 9, 1))
|
|
||||||
self.fromDate.setSelectedDate(fromDate)
|
self.fromDate.setSelectedDate(fromDate)
|
||||||
self.toDate.setSelectedDate(toDate)
|
self.toDate.setSelectedDate(toDate)
|
||||||
self.fileLineEdit.setText(
|
self.fileLineEdit.setText(SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
|
||||||
|
|
||||||
def defineOutputLocation(self):
|
def defineOutputLocation(self):
|
||||||
"""
|
"""
|
||||||
Triggered when the Directory selection button is clicked
|
Triggered when the Directory selection button is clicked
|
||||||
"""
|
"""
|
||||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
translate('SongUsagePlugin.SongUsageDetailForm',
|
translate('SongUsagePlugin.SongUsageDetailForm', 'Output File Location'),
|
||||||
'Output File Location'),
|
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
||||||
path = unicode(path)
|
path = unicode(path)
|
||||||
if path:
|
if path:
|
||||||
@ -91,20 +87,16 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
path = self.fileLineEdit.text()
|
path = self.fileLineEdit.text()
|
||||||
if not path:
|
if not path:
|
||||||
Receiver.send_message(u'openlp_error_message', {
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
u'title': translate('SongUsagePlugin.SongUsageDetailForm',
|
u'title': translate('SongUsagePlugin.SongUsageDetailForm', 'Output Path Not Selected'),
|
||||||
'Output Path Not Selected'),
|
|
||||||
u'message': translate(
|
u'message': translate(
|
||||||
'SongUsagePlugin.SongUsageDetailForm', 'You have not set a '
|
'SongUsagePlugin.SongUsageDetailForm', 'You have not set a valid output location for your song usage '
|
||||||
'valid output location for your song usage report. Please '
|
'report. Please select an existing path on your computer.')})
|
||||||
'select an existing path on your computer.')})
|
|
||||||
return
|
return
|
||||||
check_directory_exists(path)
|
check_directory_exists(path)
|
||||||
filename = translate('SongUsagePlugin.SongUsageDetailForm',
|
filename = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
|
||||||
'usage_detail_%s_%s.txt') % (
|
|
||||||
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
|
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
|
||||||
self.toDate.selectedDate().toString(u'ddMMyyyy'))
|
self.toDate.selectedDate().toString(u'ddMMyyyy'))
|
||||||
Settings().setValue(u'songusage/from date',
|
Settings().setValue(u'songusage/from date', self.fromDate.selectedDate())
|
||||||
self.fromDate.selectedDate())
|
|
||||||
Settings().setValue(u'songusage/to date', self.toDate.selectedDate())
|
Settings().setValue(u'songusage/to date', self.toDate.selectedDate())
|
||||||
usage = self.plugin.manager.get_all_objects(
|
usage = self.plugin.manager.get_all_objects(
|
||||||
SongUsageItem, and_(
|
SongUsageItem, and_(
|
||||||
@ -119,15 +111,12 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
|
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
|
||||||
u'\"%s\",\"%s\"\n' % (instance.usagedate,
|
u'\"%s\",\"%s\"\n' % (instance.usagedate,
|
||||||
instance.usagetime, instance.title, instance.copyright,
|
instance.usagetime, instance.title, instance.copyright,
|
||||||
instance.ccl_number, instance.authors,
|
instance.ccl_number, instance.authors, instance.plugin_name, instance.source)
|
||||||
instance.plugin_name, instance.source)
|
|
||||||
fileHandle.write(record.encode(u'utf-8'))
|
fileHandle.write(record.encode(u'utf-8'))
|
||||||
Receiver.send_message(u'openlp_information_message', {
|
Receiver.send_message(u'openlp_information_message', {
|
||||||
u'title': translate('SongUsagePlugin.SongUsageDetailForm',
|
u'title': translate('SongUsagePlugin.SongUsageDetailForm', 'Report Creation'),
|
||||||
'Report Creation'),
|
u'message': translate('SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
|
||||||
u'message': translate(
|
'has been successfully created. ') % outname})
|
||||||
'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
|
|
||||||
'has been successfully created. ') % outname})
|
|
||||||
except IOError:
|
except IOError:
|
||||||
log.exception(u'Failed to write out song usage records')
|
log.exception(u'Failed to write out song usage records')
|
||||||
finally:
|
finally:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
# OpenLP - Open Source Lyrics Projection #
|
||||||
@ -32,13 +32,11 @@ from datetime import datetime
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, \
|
from openlp.core.lib import build_icon, Plugin, Receiver, Settings, StringContent, translate
|
||||||
StringContent, translate
|
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.core.lib.ui import create_action
|
from openlp.core.lib.ui import create_action
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
from openlp.plugins.songusage.forms import SongUsageDetailForm, \
|
from openlp.plugins.songusage.forms import SongUsageDetailForm, SongUsageDeleteForm
|
||||||
SongUsageDeleteForm
|
|
||||||
from openlp.plugins.songusage.lib import upgrade
|
from openlp.plugins.songusage.lib import upgrade
|
||||||
from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
|
from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem
|
||||||
|
|
||||||
@ -72,73 +70,56 @@ class SongUsagePlugin(Plugin):
|
|||||||
self.toolsMenu = tools_menu
|
self.toolsMenu = tools_menu
|
||||||
self.songUsageMenu = QtGui.QMenu(tools_menu)
|
self.songUsageMenu = QtGui.QMenu(tools_menu)
|
||||||
self.songUsageMenu.setObjectName(u'songUsageMenu')
|
self.songUsageMenu.setObjectName(u'songUsageMenu')
|
||||||
self.songUsageMenu.setTitle(translate(
|
self.songUsageMenu.setTitle(translate('SongUsagePlugin', '&Song Usage Tracking'))
|
||||||
'SongUsagePlugin', '&Song Usage Tracking'))
|
|
||||||
# SongUsage Delete
|
# SongUsage Delete
|
||||||
self.songUsageDelete = create_action(tools_menu, u'songUsageDelete',
|
self.songUsageDelete = create_action(tools_menu, u'songUsageDelete',
|
||||||
text=translate('SongUsagePlugin', '&Delete Tracking Data'),
|
text=translate('SongUsagePlugin', '&Delete Tracking Data'),
|
||||||
statustip=translate('SongUsagePlugin',
|
statustip=translate('SongUsagePlugin', 'Delete song usage data up to a specified date.'),
|
||||||
'Delete song usage data up to a specified date.'),
|
|
||||||
triggers=self.onSongUsageDelete)
|
triggers=self.onSongUsageDelete)
|
||||||
# SongUsage Report
|
# SongUsage Report
|
||||||
self.songUsageReport = create_action(tools_menu, u'songUsageReport',
|
self.songUsageReport = create_action(tools_menu, u'songUsageReport',
|
||||||
text=translate('SongUsagePlugin', '&Extract Tracking Data'),
|
text=translate('SongUsagePlugin', '&Extract Tracking Data'),
|
||||||
statustip=translate('SongUsagePlugin',
|
statustip=translate('SongUsagePlugin', 'Generate a report on song usage.'),
|
||||||
'Generate a report on song usage.'),
|
|
||||||
triggers=self.onSongUsageReport)
|
triggers=self.onSongUsageReport)
|
||||||
# SongUsage activation
|
# SongUsage activation
|
||||||
self.songUsageStatus = create_action(tools_menu, u'songUsageStatus',
|
self.songUsageStatus = create_action(tools_menu, u'songUsageStatus',
|
||||||
text=translate('SongUsagePlugin', 'Toggle Tracking'),
|
text=translate('SongUsagePlugin', 'Toggle Tracking'),
|
||||||
statustip=translate('SongUsagePlugin',
|
statustip=translate('SongUsagePlugin', 'Toggle the tracking of song usage.'), checked=False,
|
||||||
'Toggle the tracking of song usage.'), checked=False,
|
shortcuts=[QtCore.Qt.Key_F4], triggers=self.toggleSongUsageState)
|
||||||
shortcuts=[QtCore.Qt.Key_F4],
|
|
||||||
triggers=self.toggleSongUsageState)
|
|
||||||
# Add Menus together
|
# Add Menus together
|
||||||
self.toolsMenu.addAction(self.songUsageMenu.menuAction())
|
self.toolsMenu.addAction(self.songUsageMenu.menuAction())
|
||||||
self.songUsageMenu.addAction(self.songUsageStatus)
|
self.songUsageMenu.addAction(self.songUsageStatus)
|
||||||
self.songUsageMenu.addSeparator()
|
self.songUsageMenu.addSeparator()
|
||||||
self.songUsageMenu.addAction(self.songUsageReport)
|
self.songUsageMenu.addAction(self.songUsageReport)
|
||||||
self.songUsageMenu.addAction(self.songUsageDelete)
|
self.songUsageMenu.addAction(self.songUsageDelete)
|
||||||
self.songUsageActiveButton = QtGui.QToolButton(
|
self.songUsageActiveButton = QtGui.QToolButton(self.formParent.statusBar)
|
||||||
self.formParent.statusBar)
|
|
||||||
self.songUsageActiveButton.setCheckable(True)
|
self.songUsageActiveButton.setCheckable(True)
|
||||||
self.songUsageActiveButton.setAutoRaise(True)
|
self.songUsageActiveButton.setAutoRaise(True)
|
||||||
self.songUsageActiveButton.setStatusTip(translate('SongUsagePlugin',
|
self.songUsageActiveButton.setStatusTip(translate('SongUsagePlugin', 'Toggle the tracking of song usage.'))
|
||||||
'Toggle the tracking of song usage.'))
|
|
||||||
self.songUsageActiveButton.setObjectName(u'songUsageActiveButton')
|
self.songUsageActiveButton.setObjectName(u'songUsageActiveButton')
|
||||||
self.formParent.statusBar.insertPermanentWidget(1,
|
self.formParent.statusBar.insertPermanentWidget(1, self.songUsageActiveButton)
|
||||||
self.songUsageActiveButton)
|
|
||||||
self.songUsageActiveButton.hide()
|
self.songUsageActiveButton.hide()
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.songUsageStatus,
|
QtCore.QObject.connect(self.songUsageStatus, QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
||||||
QtCore.SIGNAL(u'visibilityChanged(bool)'),
|
|
||||||
self.songUsageStatus.setChecked)
|
self.songUsageStatus.setChecked)
|
||||||
QtCore.QObject.connect(self.songUsageActiveButton,
|
QtCore.QObject.connect(self.songUsageActiveButton, QtCore.SIGNAL(u'toggled(bool)'), self.toggleSongUsageState)
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.toggleSongUsageState)
|
|
||||||
self.songUsageMenu.menuAction().setVisible(False)
|
self.songUsageMenu.menuAction().setVisible(False)
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.info(u'SongUsage Initialising')
|
log.info(u'SongUsage Initialising')
|
||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_started'),
|
||||||
QtCore.SIGNAL(u'slidecontroller_live_started'),
|
|
||||||
self.displaySongUsage)
|
self.displaySongUsage)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'print_service_started'),
|
||||||
QtCore.SIGNAL(u'print_service_started'),
|
|
||||||
self.printSongUsage)
|
self.printSongUsage)
|
||||||
self.songUsageActive = Settings().value(
|
self.songUsageActive = Settings().value(self.settingsSection + u'/active', False)
|
||||||
self.settingsSection + u'/active', False)
|
|
||||||
# Set the button and checkbox state
|
# Set the button and checkbox state
|
||||||
self.setButtonState()
|
self.setButtonState()
|
||||||
action_list = ActionList.get_instance()
|
action_list = ActionList.get_instance()
|
||||||
action_list.add_action(self.songUsageStatus,
|
action_list.add_action(self.songUsageStatus, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
action_list.add_action(self.songUsageDelete, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
action_list.add_action(self.songUsageDelete,
|
action_list.add_action(self.songUsageReport, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
self.songUsageDeleteForm = SongUsageDeleteForm(self.manager, self.formParent)
|
||||||
action_list.add_action(self.songUsageReport,
|
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
|
||||||
self.songUsageDeleteForm = SongUsageDeleteForm(self.manager,
|
|
||||||
self.formParent)
|
|
||||||
self.songUsageDetailForm = SongUsageDetailForm(self, self.formParent)
|
self.songUsageDetailForm = SongUsageDetailForm(self, self.formParent)
|
||||||
self.songUsageMenu.menuAction().setVisible(True)
|
self.songUsageMenu.menuAction().setVisible(True)
|
||||||
self.songUsageActiveButton.show()
|
self.songUsageActiveButton.show()
|
||||||
@ -152,12 +133,9 @@ class SongUsagePlugin(Plugin):
|
|||||||
Plugin.finalise(self)
|
Plugin.finalise(self)
|
||||||
self.songUsageMenu.menuAction().setVisible(False)
|
self.songUsageMenu.menuAction().setVisible(False)
|
||||||
action_list = ActionList.get_instance()
|
action_list = ActionList.get_instance()
|
||||||
action_list.remove_action(self.songUsageStatus,
|
action_list.remove_action(self.songUsageStatus, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
action_list.remove_action(self.songUsageDelete, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
action_list.remove_action(self.songUsageDelete,
|
action_list.remove_action(self.songUsageReport, translate('SongUsagePlugin', 'Song Usage'))
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
|
||||||
action_list.remove_action(self.songUsageReport,
|
|
||||||
translate('SongUsagePlugin', 'Song Usage'))
|
|
||||||
self.songUsageActiveButton.hide()
|
self.songUsageActiveButton.hide()
|
||||||
# stop any events being processed
|
# stop any events being processed
|
||||||
self.songUsageActive = False
|
self.songUsageActive = False
|
||||||
@ -168,8 +146,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
the UI when necessary,
|
the UI when necessary,
|
||||||
"""
|
"""
|
||||||
self.songUsageActive = not self.songUsageActive
|
self.songUsageActive = not self.songUsageActive
|
||||||
Settings().setValue(self.settingsSection + u'/active',
|
Settings().setValue(self.settingsSection + u'/active', self.songUsageActive)
|
||||||
self.songUsageActive)
|
|
||||||
self.setButtonState()
|
self.setButtonState()
|
||||||
|
|
||||||
def setButtonState(self):
|
def setButtonState(self):
|
||||||
@ -183,14 +160,12 @@ class SongUsagePlugin(Plugin):
|
|||||||
self.songUsageActiveButton.setIcon(self.activeIcon)
|
self.songUsageActiveButton.setIcon(self.activeIcon)
|
||||||
self.songUsageStatus.setChecked(True)
|
self.songUsageStatus.setChecked(True)
|
||||||
self.songUsageActiveButton.setChecked(True)
|
self.songUsageActiveButton.setChecked(True)
|
||||||
self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin',
|
self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is active.'))
|
||||||
'Song usage tracking is active.'))
|
|
||||||
else:
|
else:
|
||||||
self.songUsageActiveButton.setIcon(self.inactiveIcon)
|
self.songUsageActiveButton.setIcon(self.inactiveIcon)
|
||||||
self.songUsageStatus.setChecked(False)
|
self.songUsageStatus.setChecked(False)
|
||||||
self.songUsageActiveButton.setChecked(False)
|
self.songUsageActiveButton.setChecked(False)
|
||||||
self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin',
|
self.songUsageActiveButton.setToolTip(translate('SongUsagePlugin', 'Song usage tracking is inactive.'))
|
||||||
'Song usage tracking is inactive.'))
|
|
||||||
self.songUsageActiveButton.blockSignals(False)
|
self.songUsageActiveButton.blockSignals(False)
|
||||||
self.songUsageStatus.blockSignals(False)
|
self.songUsageStatus.blockSignals(False)
|
||||||
|
|
||||||
@ -230,8 +205,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('SongUsagePlugin', '<strong>SongUsage Plugin'
|
about_text = translate('SongUsagePlugin', '<strong>SongUsage Plugin'
|
||||||
'</strong><br />This plugin tracks the usage of songs in '
|
'</strong><br />This plugin tracks the usage of songs in services.')
|
||||||
'services.')
|
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
def setPluginTextStrings(self):
|
def setPluginTextStrings(self):
|
||||||
@ -240,13 +214,10 @@ class SongUsagePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('SongUsagePlugin', 'SongUsage',
|
u'singular': translate('SongUsagePlugin', 'SongUsage', 'name singular'),
|
||||||
'name singular'),
|
u'plural': translate('SongUsagePlugin', 'SongUsage', 'name plural')
|
||||||
u'plural': translate('SongUsagePlugin', 'SongUsage',
|
|
||||||
'name plural')
|
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('SongUsagePlugin', 'SongUsage',
|
u'title': translate('SongUsagePlugin', 'SongUsage', 'container title')
|
||||||
'container title')
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user