This commit is contained in:
Andreas Preikschat 2014-03-28 21:38:38 +01:00
commit 7787e1a845
110 changed files with 1354 additions and 1456 deletions

View File

@ -74,7 +74,8 @@ class UiStrings(object):
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M',
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
'See http://docs.python.org/library/datetime.html#strftime-strptime-behavior for more information.')
'See http://docs.python.org/library/datetime'
'.html#strftime-strptime-behavior for more information.')
self.Delete = translate('OpenLP.Ui', '&Delete')
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')

View File

@ -117,7 +117,9 @@ is the function which has to be called from outside. The generated and returned
display: table-cell;
word-wrap: break-word;
-webkit-transition: opacity 0.4s ease;
white-space:pre-wrap; word-wrap: break-word; text-align: left; vertical-align: top; font-family: Nimbus Sans L; font-size: 40pt; color: #FFFFFF; line-height: 100%; margin: 0;padding: 0; padding-bottom: 0; padding-left: 4px; width: 1580px; height: 810px;
white-space:pre-wrap; word-wrap: break-word; text-align: left; vertical-align: top; font-family: Nimbus
Sans L; font-size: 40pt; color: #FFFFFF; line-height: 100%; margin: 0;padding: 0; padding-bottom: 0;
padding-left: 4px; width: 1580px; height: 810px;
}
.lyricsmain {
-webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px;

View File

@ -113,8 +113,8 @@ class Image(object):
:param path: The image's file path. This should be an existing file path.
:param source: The source describes the image's origin. Possible values are described in the
:class:`~openlp.core.lib.ImageSource` class.
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's ratio does not
match with the display ratio.
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's
ratio does not match with the display ratio.
"""
self.path = path

View File

@ -120,9 +120,8 @@ class SearchEdit(QtGui.QLineEdit):
A list of tuples to be used in the search type menu. The first item in the list will be preselected as the
default.
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or
string) and a title for the item in the menu. In short, they should look like this::
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon
instance or string) and a title for the item in the menu. In short, they should look like this::
(<identifier>, <icon>, <title>, <place holder text>)

View File

@ -92,9 +92,9 @@ class Ui_AboutDialog(object):
Dynamically translate the UI.
"""
about_dialog.setWindowTitle('%s OpenLP' % UiStrings().About)
self.about_text_edit.setPlainText(translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics '
'Projection\n'
self.about_text_edit.setPlainText(
translate('OpenLP.AboutForm',
'OpenLP <version><revision> - Open Source Lyrics Projection\n'
'\n'
'OpenLP is free church presentation software, or lyrics '
'projection software, used to display slides of songs, Bible '
@ -106,8 +106,7 @@ class Ui_AboutDialog(object):
'\n'
'OpenLP is written and maintained by volunteers. If you would '
'like to see more free Christian software being written, please '
'consider volunteering by using the button below.'
))
'consider volunteering by using the button below.'))
self.about_notebook.setTabText(self.about_notebook.indexOf(self.about_tab), UiStrings().About)
lead = 'Raoul "superfly" Snyman'
developers = ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin',
@ -138,35 +137,30 @@ class Ui_AboutDialog(object):
'af': ['Johan "nuvolari" Mynhardt'],
'cs': ['Martin "matysek" Zibricky'],
'da': ['Henrik "Hsonesson" Sonesson'],
'de': ['Patrick "madmuffin" Br\xfcckner',
'Meinert "m2j" Jordan', 'Andreas "googol" Preikschat',
'de': ['Patrick "madmuffin" Br\xfcckner', 'Meinert "m2j" Jordan', 'Andreas "googol" Preikschat',
'Christian "crichter" Richter'],
'en_GB': ['Tim "TRB143" Bentley', 'Jonathan "gushie" Corwin'],
'en_ZA': ['Raoul "superfly" Snyman',
'Johan "nuvolari" Mynhardt'],
'en_ZA': ['Raoul "superfly" Snyman', 'Johan "nuvolari" Mynhardt'],
'el': ['Alexander Siozos'],
'es': ['Josu\xe9 Z\xfa\xf1iga', 'Christian Gonzalez'],
'et': ['Mattias "mahfiaz" P\xf5ldaru'],
'fi': ['Jori "joribu" Brander', 'Tobbe "tobbeb" Bildo'],
'fr': ['Stephan\xe9 "stbrunner" Brunner', 'Jeremie "jnau05"',
'Carl "carl.fischer" Fischer'],
'fr': ['Stephan\xe9 "stbrunner" Brunner', 'Jeremie "jnau05"', 'Carl "carl.fischer" Fischer'],
'hu': ['Gyuris Gell\xe9rt'],
'id': ['Mico "bangmico" Siahaan', ' ign_christian'],
'ja': ['Kunio "Kunio" Nakamaru', 'Chris Haris'],
'nb': ['Atle "pendlaren" Weibell', 'Frode "frodus" Woldsund'],
'nl': ['Arjen "typovar" van Voorst'],
'pt_BR': ['David Mederiros', 'Rafael "rafaellerm" Lerm',
'Eduardo Levi Chaves',
'Gustavo Bim', 'Rog\xeanio Bel\xe9m', 'Samuel'
'Simon "samscudder" Scudder', 'Van Der Fran'],
'pt_BR': ['David Mederiros', 'Rafael "rafaellerm" Lerm', 'Eduardo Levi Chaves',
'Gustavo Bim', 'Rog\xeanio Bel\xe9m', 'Samuel Simon "samscudder" Scudder', 'Van Der Fran'],
'ru': ['Sergey "ratz" Ratz'],
'sv': ['Erik "luen" Lundin'],
'ta_LK': ['"Prasad"'],
'zh_CN': [' "executor" ']
}
documentors = ['Wesley "wrst" Stout',
'John "jseagull1" Cegalis (lead)']
self.credits_text_edit.setPlainText(translate('OpenLP.AboutForm',
documentors = ['Wesley "wrst" Stout', 'John "jseagull1" Cegalis (lead)']
self.credits_text_edit.setPlainText(
translate('OpenLP.AboutForm',
'Project Lead\n'
' %s\n'
'\n'
@ -245,7 +239,8 @@ class Ui_AboutDialog(object):
' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\n'
' bring this software to you for free because\n'
' He has set us free.') % (lead, '\n '.join(developers),
' He has set us free.') %
(lead, '\n '.join(developers),
'\n '.join(contributors), '\n '.join(testers),
'\n '.join(packagers), '\n '.join(translators['af']),
'\n '.join(translators['cs']),
@ -273,7 +268,8 @@ class Ui_AboutDialog(object):
translate('OpenLP.AboutForm', 'Credits'))
copyright_note = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2014 %s\n'
'Portions copyright \xa9 2004-2014 %s') % ('Raoul Snyman',
'Portions copyright \xa9 2004-2014 %s') % \
('Raoul Snyman',
'Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, '
'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, '

View File

@ -263,7 +263,7 @@ class AdvancedTab(SettingsTab):
"""
Setup the interface translation strings.
"""
self.tabTitleVisible = UiStrings().Advanced
self.tab_title_visible = UiStrings().Advanced
self.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
@ -375,7 +375,8 @@ class AdvancedTab(SettingsTab):
self.current_data_path = AppLocation.get_data_path()
if not os.path.exists(self.current_data_path):
log.error('Data path not found %s' % self.current_data_path)
answer = QtGui.QMessageBox.critical(self, translate('OpenLP.AdvancedTab', 'Data Directory Error'),
answer = QtGui.QMessageBox.critical(
self, translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
'This data directory was previously changed from the OpenLP '
'default location. If the new location was on removable '
@ -537,8 +538,9 @@ class AdvancedTab(SettingsTab):
# Make sure they want to change the data.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to:\n\n%s\n\nThe data directory '
'will be changed when OpenLP is closed.').replace('%s', new_data_path),
'location of the OpenLP data directory to:\n\n%s\n\nThe data '
'directory will be changed when OpenLP is closed.').
replace('%s', new_data_path),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
@ -561,8 +563,9 @@ class AdvancedTab(SettingsTab):
# default.
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
'location of the OpenLP data directory to the default location?\n\nThis'
' location will be used after OpenLP is closed.'),
'location of the OpenLP data directory to the default '
'location?\n\nThis location will be used after OpenLP is '
'closed.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
@ -602,8 +605,8 @@ class AdvancedTab(SettingsTab):
translate('OpenLP.AdvancedTab',
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
'appears to contain OpenLP data files. Do you wish to '
'replace these files with the current data files?').replace
('%s', os.path.abspath(data_path,)),
'replace these files with the current data files?').
replace('%s', os.path.abspath(data_path,)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)

View File

@ -83,9 +83,8 @@ class Ui_ExceptionDialog(object):
self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
icon=':/general/general_open.png',
click=self.on_attach_file_button_clicked)
self.button_box = create_button_box(exception_dialog, 'button_box',
['close'], [self.send_report_button,
self.save_report_button, self.attach_tile_button])
self.button_box = create_button_box(exception_dialog, 'button_box', ['close'],
[self.send_report_button, self.save_report_button, self.attach_tile_button])
self.exception_layout.addWidget(self.button_box)
self.retranslateUi(exception_dialog)

View File

@ -157,7 +157,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n')
filename = QtGui.QFileDialog.getSaveFileName(self,
filename = QtGui.QFileDialog.getSaveFileName(
self,
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
Settings().value(self.settings_section + '/last directory'),
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
@ -191,8 +192,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
'--- Exception Traceback ---\n%s\n'
'--- System information ---\n%s\n'
'--- Library Versions ---\n%s\n',
'Please add the information that bug reports are favoured written '
'in English.')
'Please add the information that bug reports are favoured written in English.')
content = self._create_report()
source = ''
exception = ''

View File

@ -102,8 +102,7 @@ class Ui_FormattingTagDialog(object):
self.edit_button_layout.addWidget(self.delete_button)
self.edit_button_layout.addStretch()
self.list_data_grid_layout.addLayout(self.edit_button_layout)
self.button_box = create_button_box(formatting_tag_dialog, 'button_box',
['cancel', 'save', 'defaults'])
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
self.save_button.setObjectName('save_button')
self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults)

View File

@ -204,4 +204,3 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
QtGui.QMessageBox.Ok)
#self.tag_table_widget.selectRow(pre_row - 1)
self.tag_table_widget.resizeRowsToContents()

View File

@ -223,7 +223,8 @@ class GeneralTab(SettingsTab):
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service'))
self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab',
'Automatically preview next item in service'))
self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))

View File

@ -601,4 +601,3 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
:param signal: The signal to be fired
"""
QtCore.QObject.connect(self.media_object, signal, slot)

View File

@ -1042,8 +1042,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Are you sure you want to close '
'OpenLP?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui
.QMessageBox.No),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
self.clean_up()
@ -1234,8 +1234,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.recent_files_menu.clear()
for file_id, filename in enumerate(recent_files_to_display):
log.debug('Recent file name: %s', filename)
action = create_action(self, '',
text='&%d %s' % (file_id + 1,
action = create_action(self, '', text='&%d %s' % (file_id + 1,
os.path.splitext(os.path.basename(str(filename)))[0]), data=filename,
triggers=self.service_manager_contents.on_recent_service_clicked)
self.recent_files_menu.addAction(action)
@ -1352,8 +1351,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
self.application.set_normal_cursor()
log.exception('Data copy failed %s' % str(why))
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow',
'OpenLP Data directory copy failed\n\n%s').replace('%s', str(why)),
translate('OpenLP.MainWindow', 'OpenLP Data directory copy failed\n\n%s').
replace('%s', str(why)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
return False
else:
@ -1365,5 +1364,3 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
if self.new_data_path == AppLocation.get_directory(AppLocation.DataDir):
settings.remove('advanced/data path')
self.application.set_normal_cursor()

View File

@ -689,8 +689,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
if self._file_name.endswith('oszl') or self.service_has_all_original_files:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite '
'(*.oszl)'))
'OpenLP Service Files (*.osz);; OpenLP Service '
'Files - lite (*.oszl)'))
else:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager',
@ -783,7 +783,8 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
self.log_exception('Service file is cannot be extracted as zip: %s' % file_name)
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager',
'This file is either corrupt or it is not an OpenLP 2 service file.'))
'This file is either corrupt or it is not an OpenLP 2 service '
'file.'))
self.application.set_normal_cursor()
return
finally:
@ -1253,8 +1254,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
tree_widget_item.setText(0, service_item_from_item.get_display_title())
tips = []
if service_item_from_item.temporary_edit:
tips.append('<strong>%s:</strong> <em>%s</em>' %
(translate('OpenLP.ServiceManager', 'Edit'),
tips.append('<strong>%s:</strong> <em>%s</em>' % (translate('OpenLP.ServiceManager', 'Edit'),
(translate('OpenLP.ServiceManager', 'Service copy only'))))
if service_item_from_item.theme and service_item_from_item.theme != -1:
tips.append('<strong>%s:</strong> <em>%s</em>' %
@ -1492,9 +1492,9 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
def find_service_item(self):
"""
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its selected
child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service
item is selected this will return::
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its
selected child item. For example, if the third child item (in the Slidecontroller known as slide) in the
second service item is selected this will return::
(1, 2)
"""

View File

@ -262,8 +262,9 @@ class SlideController(DisplayController, RegistryProperties):
triggers=self.on_preview_add_to_service)
self.toolbar.addSeparator()
self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png',
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.')
, triggers=self.on_edit_song)
tooltip=translate('OpenLP.SlideController',
'Edit and reload song preview.'),
triggers=self.on_edit_song)
self.controller_layout.addWidget(self.toolbar)
# Build the Media Toolbar
self.media_controller.register_controller(self)
@ -1325,7 +1326,7 @@ class SlideController(DisplayController, RegistryProperties):
"""
Update how much time is remaining
:param time: the time remainings
:param time: the time remaining
"""
seconds = self.display.audio_player.media_object.remainingTime() // 1000
minutes = seconds // 60

View File

@ -385,10 +385,10 @@ class Ui_ThemeWizard(object):
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_width_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_height_spin_box,
QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
self.footer_width_spin_box, QtCore.SLOT('setDisabled(bool)'))
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
self.footer_height_spin_box, QtCore.SLOT('setDisabled(bool)'))
def retranslateUi(self, themeWizard):
"""
@ -409,15 +409,18 @@ class Ui_ThemeWizard(object):
self.background_combo_box.setItemText(BackgroundType.Gradient,
translate('OpenLP.ThemeWizard', 'Gradient'))
self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)
self.background_combo_box.setItemText(BackgroundType.Transparent, translate('OpenLP.ThemeWizard', 'Transparent'))
self.background_combo_box.setItemText(BackgroundType.Transparent,
translate('OpenLP.ThemeWizard', 'Transparent'))
self.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal,
translate('OpenLP.ThemeWizard', 'Horizontal'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical, translate('OpenLP.ThemeWizard', 'Vertical'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular, translate('OpenLP.ThemeWizard', 'Circular'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical,
translate('OpenLP.ThemeWizard', 'Vertical'))
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular,
translate('OpenLP.ThemeWizard', 'Circular'))
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop,
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom,

View File

@ -72,13 +72,18 @@ USER_AGENTS = {
'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36'
],
'darwin': [
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) '
'Chrome/26.0.1410.43 Safari/537.31',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.11 (KHTML, like Gecko) '
'Chrome/20.0.1132.57 Safari/536.11',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) '
'Chrome/20.0.1132.47 Safari/536.11',
],
'linux2': [
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22',
'Mozilla/5.0 (X11; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 Safari/537.11',
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 '
'Chrome/25.0.1364.160 Safari/537.22',
'Mozilla/5.0 (X11; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 '
'Safari/537.11',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.27 (KHTML, like Gecko) Chrome/26.0.1389.0 Safari/537.27'
],
'default': [

View File

@ -127,7 +127,8 @@ class LanguageManager(object):
if message:
QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new language setting.'))
translate('OpenLP.LanguageManager', 'Please restart OpenLP to use your new '
'language setting.'))
@staticmethod
def init_qm_list():

View File

@ -113,8 +113,8 @@ class BiblePlugin(Plugin):
"""
super(BiblePlugin, self).app_startup()
if self.manager.old_bible_databases:
if QtGui.QMessageBox.information(self.main_window,
translate('OpenLP', 'Information'),
if QtGui.QMessageBox.information(
self.main_window, translate('OpenLP', 'Information'),
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n'
'Should OpenLP upgrade now?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \

View File

@ -44,6 +44,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename
log = logging.getLogger(__name__)
class WebDownload(object):
"""
Provides an enumeration for the web bible types available to OpenLP.
@ -81,258 +82,257 @@ class BibleImportForm(OpenLPWizard):
Set up the UI for the bible wizard.
"""
super(BibleImportForm, self).setupUi(image)
self.formatComboBox.currentIndexChanged.connect(self.onCurrentIndexChanged)
self.format_combo_box.currentIndexChanged.connect(self.on_current_index_changed)
def onCurrentIndexChanged(self, index):
def on_current_index_changed(self, index):
"""
Called when the format combo box's index changed. We have to check if
the import is available and accordingly to disable or enable the next
button.
"""
self.selectStack.setCurrentIndex(index)
self.select_stack.setCurrentIndex(index)
def custom_init(self):
"""
Perform any custom initialisation for bible importing.
"""
self.manager.set_process_dialog(self)
self.loadWebBibles()
self.load_Web_Bibles()
self.restart()
self.selectStack.setCurrentIndex(0)
self.select_stack.setCurrentIndex(0)
def custom_signals(self):
"""
Set up the signals used in the bible importer.
"""
self.webSourceComboBox.currentIndexChanged.connect(self.onWebSourceComboBoxIndexChanged)
self.osisBrowseButton.clicked.connect(self.onOsisBrowseButtonClicked)
self.csvBooksButton.clicked.connect(self.onCsvBooksBrowseButtonClicked)
self.csvVersesButton.clicked.connect(self.onCsvVersesBrowseButtonClicked)
self.openSongBrowseButton.clicked.connect(self.onOpenSongBrowseButtonClicked)
self.web_source_combo_box.currentIndexChanged.connect(self.on_web_source_combo_box_index_changed)
self.osis_browse_button.clicked.connect(self.on_osis_browse_button_clicked)
self.csv_books_button.clicked.connect(self.on_csv_books_browse_button_clicked)
self.csv_verses_button.clicked.connect(self.on_csv_verses_browse_button_clicked)
self.open_song_browse_button.clicked.connect(self.on_open_song_browse_button_clicked)
def add_custom_pages(self):
"""
Add the bible import specific wizard pages.
"""
# Select Page
self.selectPage = QtGui.QWizardPage()
self.selectPage.setObjectName('SelectPage')
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
self.selectPageLayout.setObjectName('SelectPageLayout')
self.formatLayout = QtGui.QFormLayout()
self.formatLayout.setObjectName('FormatLayout')
self.formatLabel = QtGui.QLabel(self.selectPage)
self.formatLabel.setObjectName('FormatLabel')
self.formatComboBox = QtGui.QComboBox(self.selectPage)
self.formatComboBox.addItems(['', '', '', ''])
self.formatComboBox.setObjectName('FormatComboBox')
self.formatLayout.addRow(self.formatLabel, self.formatComboBox)
self.select_page = QtGui.QWizardPage()
self.select_page.setObjectName('SelectPage')
self.select_page_layout = QtGui.QVBoxLayout(self.select_page)
self.select_page_layout.setObjectName('SelectPageLayout')
self.format_layout = QtGui.QFormLayout()
self.format_layout.setObjectName('FormatLayout')
self.format_label = QtGui.QLabel(self.select_page)
self.format_label.setObjectName('FormatLabel')
self.format_combo_box = QtGui.QComboBox(self.select_page)
self.format_combo_box.addItems(['', '', '', ''])
self.format_combo_box.setObjectName('FormatComboBox')
self.format_layout.addRow(self.format_label, self.format_combo_box)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.selectPageLayout.addLayout(self.formatLayout)
self.selectStack = QtGui.QStackedLayout()
self.selectStack.setObjectName('SelectStack')
self.osisWidget = QtGui.QWidget(self.selectPage)
self.osisWidget.setObjectName('OsisWidget')
self.osisLayout = QtGui.QFormLayout(self.osisWidget)
self.osisLayout.setMargin(0)
self.osisLayout.setObjectName('OsisLayout')
self.osisFileLabel = QtGui.QLabel(self.osisWidget)
self.osisFileLabel.setObjectName('OsisFileLabel')
self.osisFileLayout = QtGui.QHBoxLayout()
self.osisFileLayout.setObjectName('OsisFileLayout')
self.osisFileEdit = QtGui.QLineEdit(self.osisWidget)
self.osisFileEdit.setObjectName('OsisFileEdit')
self.osisFileLayout.addWidget(self.osisFileEdit)
self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
self.osisBrowseButton.setIcon(self.open_icon)
self.osisBrowseButton.setObjectName('OsisBrowseButton')
self.osisFileLayout.addWidget(self.osisBrowseButton)
self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
self.osisLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.selectStack.addWidget(self.osisWidget)
self.csvWidget = QtGui.QWidget(self.selectPage)
self.csvWidget.setObjectName('CsvWidget')
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
self.csvLayout.setMargin(0)
self.csvLayout.setObjectName('CsvLayout')
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
self.csvBooksLabel.setObjectName('CsvBooksLabel')
self.csvBooksLayout = QtGui.QHBoxLayout()
self.csvBooksLayout.setObjectName('CsvBooksLayout')
self.csvBooksEdit = QtGui.QLineEdit(self.csvWidget)
self.csvBooksEdit.setObjectName('CsvBooksEdit')
self.csvBooksLayout.addWidget(self.csvBooksEdit)
self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
self.csvBooksButton.setIcon(self.open_icon)
self.csvBooksButton.setObjectName('CsvBooksButton')
self.csvBooksLayout.addWidget(self.csvBooksButton)
self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
self.csvVersesLabel = QtGui.QLabel(self.csvWidget)
self.csvVersesLabel.setObjectName('CsvVersesLabel')
self.csvVersesLayout = QtGui.QHBoxLayout()
self.csvVersesLayout.setObjectName('CsvVersesLayout')
self.csvVersesEdit = QtGui.QLineEdit(self.csvWidget)
self.csvVersesEdit.setObjectName('CsvVersesEdit')
self.csvVersesLayout.addWidget(self.csvVersesEdit)
self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
self.csvVersesButton.setIcon(self.open_icon)
self.csvVersesButton.setObjectName('CsvVersesButton')
self.csvVersesLayout.addWidget(self.csvVersesButton)
self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
self.csvLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.selectStack.addWidget(self.csvWidget)
self.openSongWidget = QtGui.QWidget(self.selectPage)
self.openSongWidget.setObjectName('OpenSongWidget')
self.openSongLayout = QtGui.QFormLayout(self.openSongWidget)
self.openSongLayout.setMargin(0)
self.openSongLayout.setObjectName('OpenSongLayout')
self.openSongFileLabel = QtGui.QLabel(self.openSongWidget)
self.openSongFileLabel.setObjectName('OpenSongFileLabel')
self.openSongFileLayout = QtGui.QHBoxLayout()
self.openSongFileLayout.setObjectName('OpenSongFileLayout')
self.openSongFileEdit = QtGui.QLineEdit(self.openSongWidget)
self.openSongFileEdit.setObjectName('OpenSongFileEdit')
self.openSongFileLayout.addWidget(self.openSongFileEdit)
self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
self.openSongBrowseButton.setIcon(self.open_icon)
self.openSongBrowseButton.setObjectName('OpenSongBrowseButton')
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
self.openSongLayout.addRow(self.openSongFileLabel, self.openSongFileLayout)
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.selectStack.addWidget(self.openSongWidget)
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
self.webTabWidget.setObjectName('WebTabWidget')
self.webBibleTab = QtGui.QWidget()
self.webBibleTab.setObjectName('WebBibleTab')
self.webBibleLayout = QtGui.QFormLayout(self.webBibleTab)
self.webBibleLayout.setObjectName('WebBibleLayout')
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
self.webSourceLabel.setObjectName('WebSourceLabel')
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webSourceLabel)
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
self.webSourceComboBox.setObjectName('WebSourceComboBox')
self.webSourceComboBox.addItems(['', '', ''])
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webSourceComboBox)
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
self.webTranslationLabel.setObjectName('webTranslationLabel')
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webTranslationLabel)
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
self.webTranslationComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.webTranslationComboBox.setObjectName('WebTranslationComboBox')
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webTranslationComboBox)
self.webTabWidget.addTab(self.webBibleTab, '')
self.webProxyTab = QtGui.QWidget()
self.webProxyTab.setObjectName('WebProxyTab')
self.webProxyLayout = QtGui.QFormLayout(self.webProxyTab)
self.webProxyLayout.setObjectName('WebProxyLayout')
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
self.webServerLabel.setObjectName('WebServerLabel')
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webServerLabel)
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
self.webServerEdit.setObjectName('WebServerEdit')
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webServerEdit)
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
self.webUserLabel.setObjectName('WebUserLabel')
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webUserLabel)
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
self.webUserEdit.setObjectName('WebUserEdit')
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webUserEdit)
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
self.webPasswordLabel.setObjectName('WebPasswordLabel')
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.webPasswordLabel)
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
self.webPasswordEdit.setObjectName('WebPasswordEdit')
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.webPasswordEdit)
self.webTabWidget.addTab(self.webProxyTab, '')
self.selectStack.addWidget(self.webTabWidget)
self.selectPageLayout.addLayout(self.selectStack)
self.addPage(self.selectPage)
self.format_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.select_page_layout.addLayout(self.format_layout)
self.select_stack = QtGui.QStackedLayout()
self.select_stack.setObjectName('SelectStack')
self.osis_widget = QtGui.QWidget(self.select_page)
self.osis_widget.setObjectName('OsisWidget')
self.osis_layout = QtGui.QFormLayout(self.osis_widget)
self.osis_layout.setMargin(0)
self.osis_layout.setObjectName('OsisLayout')
self.osis_file_label = QtGui.QLabel(self.osis_widget)
self.osis_file_label.setObjectName('OsisFileLabel')
self.osis_file_layout = QtGui.QHBoxLayout()
self.osis_file_layout.setObjectName('OsisFileLayout')
self.osis_file_edit = QtGui.QLineEdit(self.osis_widget)
self.osis_file_edit.setObjectName('OsisFileEdit')
self.osis_file_layout.addWidget(self.osis_file_edit)
self.osis_browse_button = QtGui.QToolButton(self.osis_widget)
self.osis_browse_button.setIcon(self.open_icon)
self.osis_browse_button.setObjectName('OsisBrowseButton')
self.osis_file_layout.addWidget(self.osis_browse_button)
self.osis_layout.addRow(self.osis_file_label, self.osis_file_layout)
self.osis_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.osis_widget)
self.csv_widget = QtGui.QWidget(self.select_page)
self.csv_widget.setObjectName('CsvWidget')
self.csv_layout = QtGui.QFormLayout(self.csv_widget)
self.csv_layout.setMargin(0)
self.csv_layout.setObjectName('CsvLayout')
self.csv_books_label = QtGui.QLabel(self.csv_widget)
self.csv_books_label.setObjectName('CsvBooksLabel')
self.csv_books_layout = QtGui.QHBoxLayout()
self.csv_books_layout.setObjectName('CsvBooksLayout')
self.csv_books_edit = QtGui.QLineEdit(self.csv_widget)
self.csv_books_edit.setObjectName('CsvBooksEdit')
self.csv_books_layout.addWidget(self.csv_books_edit)
self.csv_books_button = QtGui.QToolButton(self.csv_widget)
self.csv_books_button.setIcon(self.open_icon)
self.csv_books_button.setObjectName('CsvBooksButton')
self.csv_books_layout.addWidget(self.csv_books_button)
self.csv_layout.addRow(self.csv_books_label, self.csv_books_layout)
self.csv_verses_label = QtGui.QLabel(self.csv_widget)
self.csv_verses_label.setObjectName('CsvVersesLabel')
self.csv_verses_layout = QtGui.QHBoxLayout()
self.csv_verses_layout.setObjectName('CsvVersesLayout')
self.csv_verses_edit = QtGui.QLineEdit(self.csv_widget)
self.csv_verses_edit.setObjectName('CsvVersesEdit')
self.csv_verses_layout.addWidget(self.csv_verses_edit)
self.csv_verses_button = QtGui.QToolButton(self.csv_widget)
self.csv_verses_button.setIcon(self.open_icon)
self.csv_verses_button.setObjectName('CsvVersesButton')
self.csv_verses_layout.addWidget(self.csv_verses_button)
self.csv_layout.addRow(self.csv_verses_label, self.csv_verses_layout)
self.csv_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.csv_widget)
self.open_song_widget = QtGui.QWidget(self.select_page)
self.open_song_widget.setObjectName('OpenSongWidget')
self.open_song_layout = QtGui.QFormLayout(self.open_song_widget)
self.open_song_layout.setMargin(0)
self.open_song_layout.setObjectName('OpenSongLayout')
self.open_song_file_label = QtGui.QLabel(self.open_song_widget)
self.open_song_file_label.setObjectName('OpenSongFileLabel')
self.open_song_file_layout = QtGui.QHBoxLayout()
self.open_song_file_layout.setObjectName('OpenSongFileLayout')
self.open_song_file_edit = QtGui.QLineEdit(self.open_song_widget)
self.open_song_file_edit.setObjectName('OpenSongFileEdit')
self.open_song_file_layout.addWidget(self.open_song_file_edit)
self.open_song_browse_button = QtGui.QToolButton(self.open_song_widget)
self.open_song_browse_button.setIcon(self.open_icon)
self.open_song_browse_button.setObjectName('OpenSongBrowseButton')
self.open_song_file_layout.addWidget(self.open_song_browse_button)
self.open_song_layout.addRow(self.open_song_file_label, self.open_song_file_layout)
self.open_song_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
self.select_stack.addWidget(self.open_song_widget)
self.web_tab_widget = QtGui.QTabWidget(self.select_page)
self.web_tab_widget.setObjectName('WebTabWidget')
self.web_bible_tab = QtGui.QWidget()
self.web_bible_tab.setObjectName('WebBibleTab')
self.web_bible_layout = QtGui.QFormLayout(self.web_bible_tab)
self.web_bible_layout.setObjectName('WebBibleLayout')
self.web_source_label = QtGui.QLabel(self.web_bible_tab)
self.web_source_label.setObjectName('WebSourceLabel')
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_source_label)
self.web_source_combo_box = QtGui.QComboBox(self.web_bible_tab)
self.web_source_combo_box.setObjectName('WebSourceComboBox')
self.web_source_combo_box.addItems(['', '', ''])
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_source_combo_box)
self.web_translation_label = QtGui.QLabel(self.web_bible_tab)
self.web_translation_label.setObjectName('web_translation_label')
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_translation_label)
self.web_translation_combo_box = QtGui.QComboBox(self.web_bible_tab)
self.web_translation_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.web_translation_combo_box.setObjectName('WebTranslationComboBox')
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_translation_combo_box)
self.web_tab_widget.addTab(self.web_bible_tab, '')
self.web_proxy_tab = QtGui.QWidget()
self.web_proxy_tab.setObjectName('WebProxyTab')
self.web_proxy_layout = QtGui.QFormLayout(self.web_proxy_tab)
self.web_proxy_layout.setObjectName('WebProxyLayout')
self.web_server_label = QtGui.QLabel(self.web_proxy_tab)
self.web_server_label.setObjectName('WebServerLabel')
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_server_label)
self.web_server_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_server_edit.setObjectName('WebServerEdit')
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_server_edit)
self.web_user_label = QtGui.QLabel(self.web_proxy_tab)
self.web_user_label.setObjectName('WebUserLabel')
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_user_label)
self.web_user_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_user_edit.setObjectName('WebUserEdit')
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_user_edit)
self.web_password_label = QtGui.QLabel(self.web_proxy_tab)
self.web_password_label.setObjectName('WebPasswordLabel')
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.web_password_label)
self.web_password_edit = QtGui.QLineEdit(self.web_proxy_tab)
self.web_password_edit.setObjectName('WebPasswordEdit')
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.web_password_edit)
self.web_tab_widget.addTab(self.web_proxy_tab, '')
self.select_stack.addWidget(self.web_tab_widget)
self.select_page_layout.addLayout(self.select_stack)
self.addPage(self.select_page)
# License Page
self.licenseDetailsPage = QtGui.QWizardPage()
self.licenseDetailsPage.setObjectName('LicenseDetailsPage')
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
self.licenseDetailsLayout.setObjectName('LicenseDetailsLayout')
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
self.versionNameLabel.setObjectName('VersionNameLabel')
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.versionNameLabel)
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.versionNameEdit.setObjectName('VersionNameEdit')
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.versionNameEdit)
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
self.copyrightLabel.setObjectName('CopyrightLabel')
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyrightLabel)
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.copyrightEdit.setObjectName('CopyrightEdit')
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyrightEdit)
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
self.permissionsLabel.setObjectName('PermissionsLabel')
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.permissionsLabel)
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.permissionsEdit.setObjectName('PermissionsEdit')
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissionsEdit)
self.addPage(self.licenseDetailsPage)
self.license_details_page = QtGui.QWizardPage()
self.license_details_page.setObjectName('LicenseDetailsPage')
self.license_details_layout = QtGui.QFormLayout(self.license_details_page)
self.license_details_layout.setObjectName('LicenseDetailsLayout')
self.version_name_label = QtGui.QLabel(self.license_details_page)
self.version_name_label.setObjectName('VersionNameLabel')
self.license_details_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.version_name_label)
self.version_name_edit = QtGui.QLineEdit(self.license_details_page)
self.version_name_edit.setObjectName('VersionNameEdit')
self.license_details_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.version_name_edit)
self.copyright_label = QtGui.QLabel(self.license_details_page)
self.copyright_label.setObjectName('CopyrightLabel')
self.license_details_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyright_label)
self.copyright_edit = QtGui.QLineEdit(self.license_details_page)
self.copyright_edit.setObjectName('CopyrightEdit')
self.license_details_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyright_edit)
self.permissions_label = QtGui.QLabel(self.license_details_page)
self.permissions_label.setObjectName('PermissionsLabel')
self.license_details_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.permissions_label)
self.permissions_edit = QtGui.QLineEdit(self.license_details_page)
self.permissions_edit.setObjectName('PermissionsEdit')
self.license_details_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissions_edit)
self.addPage(self.license_details_page)
def retranslateUi(self):
"""
Allow for localisation of the bible import wizard.
"""
self.setWindowTitle(translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
self.title_label.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui',
'Welcome to the Bible Import Wizard'))
self.information_label.setText(
translate('BiblesPlugin.ImportWizardForm',
'This wizard will help you to import Bibles from a variety of '
'formats. Click the next button below to start the process by '
'selecting a format to import from.'))
self.selectPage.setTitle(WizardStrings.ImportSelect)
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
self.formatLabel.setText(WizardStrings.FormatLabel)
self.formatComboBox.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
self.formatComboBox.setItemText(BibleFormat.CSV, WizardStrings.CSV)
self.formatComboBox.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
self.formatComboBox.setItemText(BibleFormat.WebDownload,
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
self.osisFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
self.csvBooksLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
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,
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
self.webTranslationLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webBibleTab),
self.select_page.setTitle(WizardStrings.ImportSelect)
self.select_page.setSubTitle(WizardStrings.ImportSelectLong)
self.format_label.setText(WizardStrings.FormatLabel)
self.format_combo_box.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
self.format_combo_box.setItemText(BibleFormat.CSV, WizardStrings.CSV)
self.format_combo_box.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
self.format_combo_box.setItemText(BibleFormat.WebDownload, translate('BiblesPlugin.ImportWizardForm',
'Web Download'))
self.osis_file_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
self.csv_books_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
self.csv_verses_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Verses file:'))
self.open_song_file_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
self.web_source_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Location:'))
self.web_source_combo_box.setItemText(WebDownload.Crosswalk, translate('BiblesPlugin.ImportWizardForm',
'Crosswalk'))
self.web_source_combo_box.setItemText(WebDownload.BibleGateway, translate('BiblesPlugin.ImportWizardForm',
'BibleGateway'))
self.web_source_combo_box.setItemText(WebDownload.Bibleserver, translate('BiblesPlugin.ImportWizardForm',
'Bibleserver'))
self.web_translation_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.web_tab_widget.setTabText(self.web_tab_widget.indexOf(self.web_bible_tab),
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
self.webServerLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Server:'))
self.webUserLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Username:'))
self.webPasswordLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Password:'))
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webProxyTab),
translate('BiblesPlugin.ImportWizardForm',
self.web_server_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Server:'))
self.web_user_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Username:'))
self.web_password_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Password:'))
self.web_tab_widget.setTabText(
self.web_tab_widget.indexOf(self.web_proxy_tab), translate('BiblesPlugin.ImportWizardForm',
'Proxy Server (Optional)'))
self.licenseDetailsPage.setTitle(
self.license_details_page.setTitle(
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
self.licenseDetailsPage.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
self.license_details_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
'Set up the Bible\'s license details.'))
self.versionNameLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
self.copyrightLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.permissionsLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
self.progress_page.setTitle(WizardStrings.Importing)
self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
'Please wait while your Bible is imported.'))
self.progress_label.setText(WizardStrings.Ready)
self.progress_bar.setFormat('%p%')
# Align all QFormLayouts towards each other.
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
self.osisFileLabel.minimumSizeHint().width(),
self.csvBooksLabel.minimumSizeHint().width(),
self.csvVersesLabel.minimumSizeHint().width(),
self.openSongFileLabel.minimumSizeHint().width())
self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
label_width = max(self.format_label.minimumSizeHint().width(),
self.osis_file_label.minimumSizeHint().width(),
self.csv_books_label.minimumSizeHint().width(),
self.csv_verses_label.minimumSizeHint().width(),
self.open_song_file_label.minimumSizeHint().width())
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
def validateCurrentPage(self):
"""
@ -340,122 +340,130 @@ class BibleImportForm(OpenLPWizard):
"""
if self.currentPage() == self.welcome_page:
return True
elif self.currentPage() == self.selectPage:
elif self.currentPage() == self.select_page:
if self.field('source_format') == BibleFormat.OSIS:
if not self.field('osis_location'):
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
self.osisFileEdit.setFocus()
self.osis_file_edit.setFocus()
return False
elif self.field('source_format') == BibleFormat.CSV:
if not self.field('csv_booksfile'):
critical_error_message_box(UiStrings().NFSs, translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of the Bible to use in the import.'))
self.csvBooksEdit.setFocus()
critical_error_message_box(
UiStrings().NFSs, translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of the Bible to use in the '
'import.'))
self.csv_books_edit.setFocus()
return False
elif not self.field('csv_versefile'):
critical_error_message_box(UiStrings().NFSs,
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible verses to import.'))
self.csvVersesEdit.setFocus()
critical_error_message_box(
UiStrings().NFSs,
translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file of Bible verses to '
'import.'))
self.csv_verses_edit.setFocus()
return False
elif self.field('source_format') == BibleFormat.OpenSong:
if not self.field('opensong_file'):
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OS)
self.openSongFileEdit.setFocus()
self.open_song_file_edit.setFocus()
return False
elif self.field('source_format') == BibleFormat.WebDownload:
self.versionNameEdit.setText(self.webTranslationComboBox.currentText())
self.version_name_edit.setText(self.web_translation_combo_box.currentText())
return True
return True
elif self.currentPage() == self.licenseDetailsPage:
elif self.currentPage() == self.license_details_page:
license_version = self.field('license_version')
license_copyright = self.field('license_copyright')
path = AppLocation.get_section_data_path('bibles')
if not license_version:
critical_error_message_box(UiStrings().EmptyField,
critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.ImportWizardForm', 'You need to specify a version name for your Bible.'))
self.versionNameEdit.setFocus()
self.version_name_edit.setFocus()
return False
elif not license_copyright:
critical_error_message_box(UiStrings().EmptyField,
critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as such.'))
self.copyrightEdit.setFocus()
self.copyright_edit.setFocus()
return False
elif self.manager.exists(license_version):
critical_error_message_box(translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
critical_error_message_box(
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists. Please import a different Bible or first delete the existing one.'))
self.versionNameEdit.setFocus()
'This Bible already exists. Please import a different Bible or first delete the '
'existing one.'))
self.version_name_edit.setFocus()
return False
elif os.path.exists(os.path.join(path, clean_filename(
license_version))):
elif os.path.exists(os.path.join(path, clean_filename(license_version))):
critical_error_message_box(
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists. Please import '
'a different Bible or first delete the existing one.'))
self.versionNameEdit.setFocus()
self.version_name_edit.setFocus()
return False
return True
if self.currentPage() == self.progress_page:
return True
def onWebSourceComboBoxIndexChanged(self, index):
def on_web_source_combo_box_index_changed(self, index):
"""
Setup the list of Bibles when you select a different source on the web
download page.
Setup the list of Bibles when you select a different source on the web download page.
``index``
The index of the combo box.
:param index: The index of the combo box.
"""
self.webTranslationComboBox.clear()
self.web_translation_combo_box.clear()
bibles = list(self.web_bible_list[index].keys())
bibles.sort(key=get_locale_key)
self.webTranslationComboBox.addItems(bibles)
self.web_translation_combo_box.addItems(bibles)
def onOsisBrowseButtonClicked(self):
def on_osis_browse_button_clicked(self):
"""
Show the file open dialog for the OSIS file.
"""
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OSIS, self.osisFileEdit, 'last directory import')
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OSIS, self.osis_file_edit,
'last directory import')
def onCsvBooksBrowseButtonClicked(self):
def on_csv_books_browse_button_clicked(self):
"""
Show the file open dialog for the books CSV file.
"""
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvBooksEdit, 'last directory import',
'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
self.get_file_name(
WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csv_books_edit, 'last directory import', '%s (*.csv)' %
translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onCsvVersesBrowseButtonClicked(self):
def on_csv_verses_browse_button_clicked(self):
"""
Show the file open dialog for the verses CSV file.
"""
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvVersesEdit, 'last directory import',
'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csv_verses_edit,
'last directory import', '%s (*.csv)' %
translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
def onOpenSongBrowseButtonClicked(self):
def on_open_song_browse_button_clicked(self):
"""
Show the file open dialog for the OpenSong file.
"""
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OS, self.openSongFileEdit, 'last directory import')
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.OS, self.open_song_file_edit,
'last directory import')
def register_fields(self):
"""
Register the bible import wizard fields.
"""
self.selectPage.registerField('source_format', self.formatComboBox)
self.selectPage.registerField('osis_location', self.osisFileEdit)
self.selectPage.registerField('csv_booksfile', self.csvBooksEdit)
self.selectPage.registerField('csv_versefile', self.csvVersesEdit)
self.selectPage.registerField('opensong_file', self.openSongFileEdit)
self.selectPage.registerField('web_location', self.webSourceComboBox)
self.selectPage.registerField('web_biblename', self.webTranslationComboBox)
self.selectPage.registerField('proxy_server', self.webServerEdit)
self.selectPage.registerField('proxy_username', self.webUserEdit)
self.selectPage.registerField('proxy_password', self.webPasswordEdit)
self.licenseDetailsPage.registerField('license_version', self.versionNameEdit)
self.licenseDetailsPage.registerField('license_copyright', self.copyrightEdit)
self.licenseDetailsPage.registerField('license_permissions', self.permissionsEdit)
self.select_page.registerField('source_format', self.format_combo_box)
self.select_page.registerField('osis_location', self.osis_file_edit)
self.select_page.registerField('csv_booksfile', self.csv_books_edit)
self.select_page.registerField('csv_versefile', self.csv_verses_edit)
self.select_page.registerField('opensong_file', self.open_song_file_edit)
self.select_page.registerField('web_location', self.web_source_combo_box)
self.select_page.registerField('web_biblename', self.web_translation_combo_box)
self.select_page.registerField('proxy_server', self.web_server_edit)
self.select_page.registerField('proxy_username', self.web_user_edit)
self.select_page.registerField('proxy_password', self.web_password_edit)
self.license_details_page.registerField('license_version', self.version_name_edit)
self.license_details_page.registerField('license_copyright', self.copyright_edit)
self.license_details_page.registerField('license_permissions', self.permissions_edit)
def setDefaults(self):
"""
@ -472,33 +480,32 @@ class BibleImportForm(OpenLPWizard):
self.setField('csv_versefile', '')
self.setField('opensong_file', '')
self.setField('web_location', WebDownload.Crosswalk)
self.setField('web_biblename', self.webTranslationComboBox.currentIndex())
self.setField('web_biblename', self.web_translation_combo_box.currentIndex())
self.setField('proxy_server', settings.value('proxy address'))
self.setField('proxy_username', settings.value('proxy username'))
self.setField('proxy_password', settings.value('proxy password'))
self.setField('license_version', self.versionNameEdit.text())
self.setField('license_copyright', self.copyrightEdit.text())
self.setField('license_permissions', self.permissionsEdit.text())
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
self.setField('license_version', self.version_name_edit.text())
self.setField('license_copyright', self.copyright_edit.text())
self.setField('license_permissions', self.permissions_edit.text())
self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
settings.endGroup()
def loadWebBibles(self):
def load_Web_Bibles(self):
"""
Load the lists of Crosswalk, BibleGateway and Bibleserver bibles.
"""
# Load Crosswalk Bibles.
self.loadBibleResource(WebDownload.Crosswalk)
self.load_Bible_Resource(WebDownload.Crosswalk)
# Load BibleGateway Bibles.
self.loadBibleResource(WebDownload.BibleGateway)
self.load_Bible_Resource(WebDownload.BibleGateway)
# Load and Bibleserver Bibles.
self.loadBibleResource(WebDownload.Bibleserver)
self.load_Bible_Resource(WebDownload.Bibleserver)
def loadBibleResource(self, download_type):
def load_Bible_Resource(self, download_type):
"""
Loads a web bible from bible_resources.sqlite.
``download_type``
The WebDownload type e.g. bibleserver.
:param download_type: The WebDownload type e.g. bibleserver.
"""
self.web_bible_list[download_type] = {}
bibles = BiblesResourcesDB.get_webbibles(WebDownload.Names[download_type])
@ -530,28 +537,22 @@ class BibleImportForm(OpenLPWizard):
importer = None
if bible_type == BibleFormat.OSIS:
# Import an OSIS bible.
importer = self.manager.import_bible(BibleFormat.OSIS,
name=license_version,
filename=self.field('osis_location')
)
importer = self.manager.import_bible(BibleFormat.OSIS, name=license_version,
filename=self.field('osis_location'))
elif bible_type == BibleFormat.CSV:
# Import a CSV bible.
importer = self.manager.import_bible(BibleFormat.CSV,
name=license_version,
importer = self.manager.import_bible(BibleFormat.CSV, name=license_version,
booksfile=self.field('csv_booksfile'),
versefile=self.field('csv_versefile')
)
versefile=self.field('csv_versefile'))
elif bible_type == BibleFormat.OpenSong:
# Import an OpenSong bible.
importer = self.manager.import_bible(BibleFormat.OpenSong,
name=license_version,
filename=self.field('opensong_file')
)
importer = self.manager.import_bible(BibleFormat.OpenSong, name=license_version,
filename=self.field('opensong_file'))
elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web.
self.progress_bar.setMaximum(1)
download_location = self.field('web_location')
bible_version = self.webTranslationComboBox.currentText()
bible_version = self.web_translation_combo_box.currentText()
bible = self.web_bible_list[download_location][bible_version]
importer = self.manager.import_bible(
BibleFormat.WebDownload, name=license_version,
@ -562,8 +563,7 @@ class BibleImportForm(OpenLPWizard):
proxy_password=self.field('proxy_password')
)
if importer.do_import(license_version):
self.manager.save_meta_data(license_version, license_version,
license_copyright, license_permissions)
self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions)
self.manager.reload_bibles()
if bible_type == BibleFormat.WebDownload:
self.progress_label.setText(

View File

@ -96,34 +96,34 @@ class BibleUpgradeForm(OpenLPWizard):
if not self.currentPage() == self.progress_page:
self.done(QtGui.QDialog.Rejected)
def onCurrentIdChanged(self, pageId):
def onCurrentIdChanged(self, page_id):
"""
Perform necessary functions depending on which wizard page is active.
"""
if self.page(pageId) == self.progress_page:
if self.page(page_id) == self.progress_page:
self.pre_wizard()
self.perform_wizard()
self.post_wizard()
elif self.page(pageId) == self.selectPage and not self.files:
elif self.page(page_id) == self.selectPage and not self.files:
self.next()
def onBackupBrowseButtonClicked(self):
def on_backup_browse_button_clicked(self):
"""
Show the file open dialog for the OSIS file.
"""
filename = QtGui.QFileDialog.getExistingDirectory(self,
translate('BiblesPlugin.UpgradeWizardForm', 'Select a Backup Directory'), '')
filename = QtGui.QFileDialog.getExistingDirectory(self, translate('BiblesPlugin.UpgradeWizardForm',
'Select a Backup Directory'), '')
if filename:
self.backupDirectoryEdit.setText(filename)
def onNoBackupCheckBoxToggled(self, checked):
def on_no_backup_check_box_toggled(self, checked):
"""
Enable or disable the backup directory widgets.
"""
self.backupDirectoryEdit.setEnabled(not checked)
self.backupBrowseButton.setEnabled(not checked)
def backupOldBibles(self, backup_directory):
def backup_old_bibles(self, backup_directory):
"""
Backup old bible databases in a given folder.
"""
@ -147,8 +147,8 @@ class BibleUpgradeForm(OpenLPWizard):
"""
Set up the signals used in the bible importer.
"""
self.backupBrowseButton.clicked.connect(self.onBackupBrowseButtonClicked)
self.noBackupCheckBox.toggled.connect(self.onNoBackupCheckBoxToggled)
self.backupBrowseButton.clicked.connect(self.on_backup_browse_button_clicked)
self.noBackupCheckBox.toggled.connect(self.on_no_backup_check_box_toggled)
def add_custom_pages(self):
"""
@ -238,32 +238,34 @@ class BibleUpgradeForm(OpenLPWizard):
Allow for localisation of the bible import wizard.
"""
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard'))
self.title_label.setText(WizardStrings.HeaderStyle %
translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard'))
self.information_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
self.title_label.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui',
'Welcome to the Bible Upgrade Wizard'))
self.information_label.setText(
translate('BiblesPlugin.UpgradeWizardForm',
'This wizard will help you to upgrade your existing Bibles from a prior version of OpenLP 2. '
'Click the next button below to start the upgrade process.'))
self.backup_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
self.backup_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please select a backup directory for your Bibles'))
self.backupInfoLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
self.backup_page.setSubTitle(
translate('BiblesPlugin.UpgradeWizardForm', 'Please select a backup directory for your Bibles'))
self.backupInfoLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm',
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
' This will create a backup of your current Bibles so that you can '
'simply copy the files back to your OpenLP data directory if you '
'need to revert to a previous release of OpenLP. Instructions on '
'how to restore the files can be found in our <a href="'
'http://wiki.openlp.org/faq">Frequently Asked Questions</a>.'))
self.selectLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Please select a backup location for your Bibles.'))
self.selectLabel.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Please select a backup location for your Bibles.'))
self.backupDirectoryLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Backup Directory:'))
self.noBackupCheckBox.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'There is no need to backup my Bibles'))
self.selectPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Bibles'))
self.selectPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please select the Bibles to upgrade'))
self.selectPage.setSubTitle(
translate('BiblesPlugin.UpgradeWizardForm', 'Please select the Bibles to upgrade'))
self.progress_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
self.progress_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
'Please wait while your Bibles are upgraded.'))
self.progress_page.setSubTitle(
translate('BiblesPlugin.UpgradeWizardForm', 'Please wait while your Bibles are upgraded.'))
self.progress_label.setText(WizardStrings.Ready)
self.progress_bar.setFormat('%p%')
@ -277,16 +279,18 @@ class BibleUpgradeForm(OpenLPWizard):
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
backup_path = self.backupDirectoryEdit.text()
if not backup_path:
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm',
'You need to specify a backup directory for your Bibles.'))
critical_error_message_box(
UiStrings().EmptyField,
translate('BiblesPlugin.UpgradeWizardForm', 'You need to specify a backup directory for '
'your Bibles.'))
self.backupDirectoryEdit.setFocus()
return False
else:
if not self.backupOldBibles(backup_path):
critical_error_message_box(UiStrings().Error,
translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup your '
'Bibles you need permission to write to the given directory.'))
if not self.backup_old_bibles(backup_path):
critical_error_message_box(
UiStrings().Error,
translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup '
'your Bibles you need permission to write to the given directory.'))
return False
return True
elif self.currentPage() == self.selectPage:
@ -340,8 +344,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.includeWebBible = False
proxy_server = None
if not self.files:
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'There are no Bibles that need to be upgraded.'))
self.progress_label.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'There are no Bibles that need to be upgraded.'))
self.progress_bar.hide()
return
max_bibles = 0
@ -363,10 +367,10 @@ class BibleUpgradeForm(OpenLPWizard):
self.success[number] = False
continue
self.progress_bar.reset()
old_bible = OldBibleDB(self.media_item, path=self.temp_dir,
file=filename[0])
old_bible = OldBibleDB(self.media_item, path=self.temp_dir, file=filename[0])
name = filename[1]
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
self.progress_label.setText(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') % (number + 1, max_bibles, name))
self.new_bibles[number] = BibleDB(self.media_item, path=self.path, name=name, file=filename[0])
self.new_bibles[number].register(self.plugin.upgrade_wizard)
@ -415,15 +419,15 @@ class BibleUpgradeForm(OpenLPWizard):
meta_data['download_source'].lower())
if bible and bible['language_id']:
language_id = bible['language_id']
self.new_bibles[number].save_meta('language_id',
language_id)
self.new_bibles[number].save_meta('language_id', language_id)
else:
language_id = self.new_bibles[number].get_language(name)
if not language_id:
log.warn('Upgrading from "%s" failed' % filename[0])
self.new_bibles[number].session.close()
del self.new_bibles[number]
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
self.success[number] = False
@ -433,8 +437,10 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') % (number + 1, max_bibles, name, book))
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
(number + 1, max_bibles, name, book))
book_ref_id = self.new_bibles[number].\
get_book_ref_id_by_name(book, len(books), language_id)
if not book_ref_id:
@ -445,8 +451,7 @@ class BibleUpgradeForm(OpenLPWizard):
self.success[number] = False
break
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
db_book = self.new_bibles[number].create_book(book,
book_ref_id, book_details['testament_id'])
db_book = self.new_bibles[number].create_book(book, book_ref_id, book_details['testament_id'])
# Try to import already downloaded verses.
oldbook = old_bible.get_book(book)
if oldbook:
@ -458,8 +463,7 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
self.new_bibles[number].create_verse(db_book.id,
int(verse['chapter']),
self.new_bibles[number].create_verse(db_book.id, int(verse['chapter']),
int(verse['verse']), str(verse['text']))
self.application.process_events()
self.new_bibles[number].session.commit()
@ -471,7 +475,8 @@ class BibleUpgradeForm(OpenLPWizard):
log.warn('Upgrading books from "%s" failed' % name)
self.new_bibles[number].session.close()
del self.new_bibles[number]
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
self.success[number] = False
@ -482,7 +487,8 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
(number + 1, max_bibles, name, book['name']))
book_ref_id = self.new_bibles[number].get_book_ref_id_by_name(book['name'], len(books), language_id)
@ -493,8 +499,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.success[number] = False
break
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
db_book = self.new_bibles[number].create_book(book['name'],
book_ref_id, book_details['testament_id'])
db_book = self.new_bibles[number].create_book(book['name'], book_ref_id,
book_details['testament_id'])
verses = old_bible.get_verses(book['id'])
if not verses:
log.warn('No verses found to import for book "%s"', book['name'])
@ -504,19 +510,20 @@ class BibleUpgradeForm(OpenLPWizard):
if self.stop_import_flag:
self.success[number] = False
break
self.new_bibles[number].create_verse(db_book.id,
int(verse['chapter']),
int(verse['verse']), str(verse['text']))
self.new_bibles[number].create_verse(db_book.id, int(verse['chapter']), int(verse['verse']),
str(verse['text']))
self.application.process_events()
self.new_bibles[number].session.commit()
if not self.success.get(number, True):
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
self.progress_bar.maximum() - self.progress_bar.value())
else:
self.success[number] = True
self.new_bibles[number].save_meta('name', name)
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
self.increment_progress_bar(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
if number in self.new_bibles:
self.new_bibles[number].session.close()
@ -545,12 +552,15 @@ class BibleUpgradeForm(OpenLPWizard):
failed_import_text = ''
if successful_import > 0:
if self.includeWebBible:
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible(s): %s successful%s\nPlease note that verses from Web Bibles will be downloaded '
'on demand and so an Internet connection is required.') % (successful_import, failed_import_text))
self.progress_label.setText(
translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible(s): %s successful%s\nPlease note that verses from Web Bibles will be '
'downloaded on demand and so an Internet connection is required.') %
(successful_import, failed_import_text))
else:
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible(s): %s successful%s') % (successful_import, failed_import_text))
self.progress_label.setText(
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible(s): %s successful%s') % (
successful_import, failed_import_text))
else:
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
# Remove temp directory.

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.common import translate
from openlp.core.lib.ui import create_button_box
class Ui_BookNameDialog(object):
def setupUi(self, book_name_dialog):
book_name_dialog.setObjectName('book_name_dialog')
@ -48,15 +49,15 @@ class Ui_BookNameDialog(object):
self.corresponding_layout.setColumnStretch(1, 1)
self.corresponding_layout.setSpacing(8)
self.corresponding_layout.setObjectName('corresponding_layout')
self.currentLabel = QtGui.QLabel(book_name_dialog)
self.currentLabel.setObjectName('currentLabel')
self.corresponding_layout.addWidget(self.currentLabel, 0, 0, 1, 1)
self.current_label = QtGui.QLabel(book_name_dialog)
self.current_label.setObjectName('current_label')
self.corresponding_layout.addWidget(self.current_label, 0, 0, 1, 1)
self.current_book_label = QtGui.QLabel(book_name_dialog)
self.current_book_label.setObjectName('current_book_label')
self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1)
self.correspondingLabel = QtGui.QLabel(book_name_dialog)
self.correspondingLabel.setObjectName('correspondingLabel')
self.corresponding_layout.addWidget(self.correspondingLabel, 1, 0, 1, 1)
self.corresponding_label = QtGui.QLabel(book_name_dialog)
self.corresponding_label.setObjectName('corresponding_label')
self.corresponding_layout.addWidget(self.corresponding_label, 1, 0, 1, 1)
self.corresponding_combo_box = QtGui.QComboBox(book_name_dialog)
self.corresponding_combo_box.setObjectName('corresponding_combo_box')
self.corresponding_layout.addWidget(self.corresponding_combo_box, 1, 1, 1, 1)
@ -87,11 +88,11 @@ class Ui_BookNameDialog(object):
def retranslateUi(self, book_name_dialog):
book_name_dialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
self.info_label.setText(translate('BiblesPlugin.BookNameDialog',
'The following book name cannot be matched up internally. '
self.info_label.setText(
translate('BiblesPlugin.BookNameDialog', 'The following book name cannot be matched up internally. '
'Please select the corresponding name from the list.'))
self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
self.correspondingLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
self.current_label.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
self.corresponding_label.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
self.options_group_box.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
self.old_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
self.new_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))

View File

@ -66,11 +66,11 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
"""
Set up the signals used in the booknameform.
"""
self.old_testament_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
self.new_testament_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
self.apocrypha_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
self.old_testament_check_box.stateChanged.connect(self.on_check_box_index_changed)
self.new_testament_check_box.stateChanged.connect(self.on_check_box_index_changed)
self.apocrypha_check_box.stateChanged.connect(self.on_check_box_index_changed)
def onCheckBoxIndexChanged(self, index):
def on_check_box_index_changed(self, index):
"""
Reload Combobox if CheckBox state has changed
"""
@ -119,7 +119,8 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
cor_book = self.corresponding_combo_box.currentText()
for character in '\\.^$*+?{}[]()':
cor_book = cor_book.replace(character, '\\' + character)
books = [key for key in list(self.book_names.keys()) if re.match(cor_book, str(self.book_names[key]), re.UNICODE)]
books = [key for key in list(self.book_names.keys()) if re.match(cor_book, str(self.book_names[key]),
re.UNICODE)]
books = [_f for _f in map(BiblesResourcesDB.get_book, books) if _f]
if books:
self.book_id = books[0]['id']

View File

@ -131,24 +131,28 @@ class Ui_EditBibleDialog(object):
self.book_names = BibleStrings().BookNames
edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
# Meta tab
self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.meta_tab),
translate('SongsPlugin.EditBibleForm', 'Meta Data'))
self.bible_tab_widget.setTabText(
self.bible_tab_widget.indexOf(self.meta_tab), translate('SongsPlugin.EditBibleForm', 'Meta Data'))
self.license_details_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details'))
self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
self.language_selection_label.setText(translate('BiblesPlugin.EditBibleForm',
'Book name language in search field, search results and on display:'))
self.language_selection_label.setText(
translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and '
'on display:'))
self.language_selection_combo_box.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings'))
self.language_selection_combo_box.setItemText(LanguageSelection.Bible + 1,
self.language_selection_combo_box.setItemText(
LanguageSelection.Bible + 1,
translate('BiblesPlugin.EditBibleForm', 'Bible Language'))
self.language_selection_combo_box.setItemText(LanguageSelection.Application + 1,
translate('BiblesPlugin.EditBibleForm', 'Application Language'))
self.language_selection_combo_box.setItemText(LanguageSelection.English + 1,
self.language_selection_combo_box.setItemText(
LanguageSelection.Application + 1, translate('BiblesPlugin.EditBibleForm', 'Application Language'))
self.language_selection_combo_box.setItemText(
LanguageSelection.English + 1,
translate('BiblesPlugin.EditBibleForm', 'English'))
# Book name tab
self.bible_tab_widget.setTabText(self.bible_tab_widget.indexOf(self.book_name_tab),
self.bible_tab_widget.setTabText(
self.bible_tab_widget.indexOf(self.book_name_tab),
translate('SongsPlugin.EditBibleForm', 'Custom Book Names'))
for book in BiblesResourcesDB.get_books():
self.book_name_label[book['abbreviation']].setText('%s:' % str(self.book_names[book['abbreviation']]))

View File

@ -32,6 +32,7 @@ from PyQt4 import QtGui
from openlp.core.common import translate
from openlp.core.lib.ui import create_button_box
class Ui_LanguageDialog(object):
def setupUi(self, language_dialog):
language_dialog.setObjectName('language_dialog')
@ -54,11 +55,11 @@ class Ui_LanguageDialog(object):
self.language_label.setObjectName('language_label')
self.language_h_box_layout.addWidget(self.language_label)
self.language_combo_box = QtGui.QComboBox(language_dialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())
self.language_combo_box.setSizePolicy(sizePolicy)
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())
self.language_combo_box.setSizePolicy(size_policy)
self.language_combo_box.setObjectName('language_combo_box')
self.language_h_box_layout.addWidget(self.language_combo_box)
self.language_layout.addLayout(self.language_h_box_layout)
@ -70,7 +71,8 @@ class Ui_LanguageDialog(object):
def retranslateUi(self, language_dialog):
language_dialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
self.bible_label.setText(translate('BiblesPlugin.LanguageDialog', ''))
self.info_label.setText(translate('BiblesPlugin.LanguageDialog',
'OpenLP is unable to determine the language of this translation of the Bible. Please select the language '
'from the list below.'))
self.info_label.setText(
translate('BiblesPlugin.LanguageDialog',
'OpenLP is unable to determine the language of this translation of the Bible. Please select '
'the language from the list below.'))
self.language_label.setText(translate('BiblesPlugin.LanguageDialog', 'Language:'))

View File

@ -36,8 +36,7 @@ from PyQt4.QtGui import QDialog
from openlp.core.common import translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.plugins.bibles.forms.languagedialog import \
Ui_LanguageDialog
from openlp.plugins.bibles.forms.languagedialog import Ui_LanguageDialog
from openlp.plugins.bibles.lib.db import BiblesResourcesDB

View File

@ -218,8 +218,9 @@ def update_reference_separators():
REFERENCE_MATCHES['range'] = re.compile('^\s*%s\s*$' % range_regex, re.UNICODE)
REFERENCE_MATCHES['range_separator'] = re.compile(REFERENCE_SEPARATORS['sep_l'], re.UNICODE)
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
REFERENCE_MATCHES['full'] = re.compile('^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$' \
REFERENCE_MATCHES['full'] = \
re.compile('^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$'
% dict(list(REFERENCE_SEPARATORS.items()) + [('range_regex', range_regex)]), re.UNICODE)

View File

@ -430,4 +430,3 @@ class BiblesTab(SettingsTab):
self.new_chapters_check_box.setEnabled(self.is_verse_number_visible)
self.display_style_label.setEnabled(self.is_verse_number_visible)
self.display_style_combo_box.setEnabled(self.is_verse_number_visible)

View File

@ -80,23 +80,20 @@ def init_schema(url):
meta_table = Table('metadata', metadata,
Column('key', types.Unicode(255), primary_key=True, index=True),
Column('value', types.Unicode(255)),
)
Column('value', types.Unicode(255)),)
book_table = Table('book', metadata,
Column('id', types.Integer, primary_key=True),
Column('book_reference_id', types.Integer, index=True),
Column('testament_reference_id', types.Integer),
Column('name', types.Unicode(50), index=True),
)
Column('name', types.Unicode(50), index=True),)
verse_table = Table('verse', metadata,
Column('id', types.Integer, primary_key=True, index=True),
Column('book_id', types.Integer, ForeignKey(
'book.id'), index=True),
Column('chapter', types.Integer, index=True),
Column('verse', types.Integer, index=True),
Column('text', types.UnicodeText, index=True),
)
Column('text', types.UnicodeText, index=True),)
try:
class_mapper(BibleMeta)
@ -225,7 +222,8 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
:param book_id: The id of the book being appended.
:param chapter: The chapter number.
:param text_list: A dict of the verses to be inserted. The key is the verse number, and the value is the verse text.
:param text_list: A dict of the verses to be inserted. The key is the verse number, and the value is the
verse text.
"""
log.debug('BibleDBcreate_chapter("%s", "%s")', book_id, chapter)
# Text list has book and chapter as first two elements of the array.
@ -718,8 +716,8 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
if not isinstance(source, str):
source = str(source)
source = BiblesResourcesDB.get_download_source(source)
bibles = BiblesResourcesDB.run_sql('SELECT id, name, abbreviation, '
'language_id, download_source_id FROM webbibles WHERE download_source_id = ?', (source['id'],))
bibles = BiblesResourcesDB.run_sql('SELECT id, name, abbreviation, language_id, download_source_id '
'FROM webbibles WHERE download_source_id = ?', (source['id'],))
if bibles:
return [{
'id': bible[0],
@ -824,8 +822,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
log.debug('BiblesResourcesDB.get_testament_reference()')
testaments = BiblesResourcesDB.run_sql('SELECT id, name FROM testament_reference ORDER BY id')
return [
{
'id': testament[0],
{'id': testament[0],
'name': str(testament[1])
}
for testament in testaments

View File

@ -32,7 +32,9 @@ The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
import logging
import re
import socket
import urllib.request, urllib.parse, urllib.error
import urllib.request
import urllib.parse
import urllib.error
from html.parser import HTMLParseError
from bs4 import BeautifulSoup, NavigableString, Tag

View File

@ -910,8 +910,8 @@ class BibleMediaItem(MediaManagerItem):
elif old_verse + 1 != verse and old_chapter == chapter:
# We are still in the same chapter, but a verse has been skipped.
return True
elif old_chapter + 1 == chapter and (verse != 1 or
old_verse != self.plugin.manager.get_verse_count(old_bible, old_book, old_chapter)):
elif old_chapter + 1 == chapter and (verse != 1 or old_verse !=
self.plugin.manager.get_verse_count(old_bible, old_book, old_chapter)):
# 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
# first one of the chapter.

View File

@ -33,6 +33,7 @@ from openlp.core.common import UiStrings, translate
from openlp.core.lib import SpellTextEdit
from openlp.core.lib.ui import create_button, create_button_box
class Ui_CustomSlideEditDialog(object):
def setupUi(self, custom_slide_edit_dialog):
custom_slide_edit_dialog.setObjectName('custom_slide_edit_dialog')

View File

@ -105,12 +105,10 @@ class CustomMediaItem(MediaManagerItem):
"""
Initialise the UI so it can provide Searches
"""
self.search_text_edit.set_search_types([(CustomSearch.Titles, ':/songs/song_search_title.png',
translate('SongsPlugin.MediaItem', 'Titles'),
self.search_text_edit.set_search_types(
[(CustomSearch.Titles, ':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles'),
translate('SongsPlugin.MediaItem', 'Search Titles...')),
(CustomSearch.Themes, ':/slides/slide_theme.png', UiStrings().Themes,
UiStrings().SearchThemes)
])
(CustomSearch.Themes, ':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)])
self.search_text_edit.set_current_search_type(Settings().value('%s/last search type' % self.settings_section))
self.load_list(self.plugin.db_manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
self.config_update()
@ -191,10 +189,9 @@ class CustomMediaItem(MediaManagerItem):
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
translate('CustomPlugin.MediaItem',
'Are you sure you want to delete the %n selected custom slide(s)?',
'',
QtCore.QCoreApplication.CodecForTr, len(items)),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes
| QtGui.QMessageBox.No),
'', QtCore.QCoreApplication.CodecForTr, len(items)),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
row_list = [item.row() for item in self.list_view.selectedIndexes()]
@ -348,4 +345,3 @@ class CustomMediaItem(MediaManagerItem):
func.lower(CustomSlide.text).like(search)),
order_by_ref=CustomSlide.title)
return [[custom.id, custom.title] for custom in search_results]

View File

@ -50,7 +50,8 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog):
Show the form.
:param clear: Set to False if the text input box should not be cleared when showing the dialog (default: True).
:param show_top_level_group: Set to True when "-- Top level group --" should be showed as first item (default: False).
:param show_top_level_group: Set to True when "-- Top level group --" should be showed as first item
(default: False).
:param selected_group: The ID of the group that should be selected by default when showing the dialog.
"""
if clear:

View File

@ -327,7 +327,8 @@ class ImageMediaItem(MediaManagerItem):
:param images: A List of Image Filenames objects that will be used to reload the mediamanager list.
:param initial_load: When set to False, the busy cursor and progressbar will be shown while loading images.
:param open_group: ImageGroups object of the group that must be expanded after reloading the list in the interface.
:param open_group: ImageGroups object of the group that must be expanded after reloading the list in the
interface.
"""
if not initial_load:
self.application.set_busy_cursor()
@ -462,7 +463,8 @@ class ImageMediaItem(MediaManagerItem):
:param images_list: A List of strings containing image filenames
:param group_id: The ID of the group to save the images in
:param reload_list: This boolean is set to True when the list in the interface should be reloaded after saving the new images
:param reload_list: This boolean is set to True when the list in the interface should be reloaded after saving
the new images
"""
for filename in images_list:
if not isinstance(filename, str):

View File

@ -29,7 +29,8 @@
# OOo API documentation:
# http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/XSlideShowController.html
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Basic/Getting_Information_about_UNO_Objects#Inspecting_interfaces_during_debugging
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Basic
# /Getting_Information_about_UNO_Objects#Inspecting_interfaces_during_debugging
# http://docs.go-oo.org/sd/html/classsd_1_1SlideShow.html
# http://www.oooforum.org/forum/viewtopic.phtml?t=5252
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Working_with_Presentations
@ -45,6 +46,7 @@ if os.name == 'nt':
from win32com.client import Dispatch
import pywintypes
# Declare an empty exception to match the exception imported from UNO
class ErrorCodeIOException(Exception):
pass
else:

View File

@ -132,7 +132,8 @@ class PdfController(PresentationController):
DEVNULL = open(os.devnull, 'wb')
# First try to find mupdf
try:
self.mudrawbin = check_output(['which', 'mudraw'], stderr=DEVNULL).decode(encoding='UTF-8').rstrip('\n')
self.mudrawbin = check_output(['which', 'mudraw'],
stderr=DEVNULL).decode(encoding='UTF-8').rstrip('\n')
except CalledProcessError:
self.mudrawbin = ''
# if mupdf isn't installed, fallback to ghostscript
@ -192,7 +193,8 @@ class PdfDocument(PresentationDocument):
:return: The resolution dpi to be used.
"""
# Use a postscript script to get size of the pdf. It is assumed that all pages have same size
gs_resolution_script = AppLocation.get_directory(AppLocation.PluginsDir) + '/presentations/lib/ghostscript_get_resolution.ps'
gs_resolution_script = AppLocation.get_directory(
AppLocation.PluginsDir) + '/presentations/lib/ghostscript_get_resolution.ps'
# Run the script on the pdf to get the size
runlog = []
try:

View File

@ -34,6 +34,7 @@ if os.name == 'nt':
from ctypes import cdll
from ctypes.wintypes import RECT
from openlp.core.utils import AppLocation
from openlp.core.lib import ScreenList
from .presentationcontroller import PresentationController, PresentationDocument
@ -85,8 +86,8 @@ class PptviewController(PresentationController):
if self.process:
return
log.debug('start PPTView')
dll_path = os.path.join(
self.plugin_manager.base_path, 'presentations', 'lib', 'pptviewlib', 'pptviewlib.dll')
dll_path = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
'presentations', 'lib', 'pptviewlib', 'pptviewlib.dll')
self.process = cdll.LoadLibrary(dll_path)
if log.isEnabledFor(logging.DEBUG):
self.process.SetDebug(1)

View File

@ -32,6 +32,7 @@ from PyQt4 import QtGui, QtCore
from ctypes import *
from ctypes.wintypes import RECT
class PPTViewer(QtGui.QWidget):
"""
Standalone Test Harness for the pptviewlib library
@ -169,7 +170,7 @@ class PPTViewer(QtGui.QWidget):
app.processEvents()
def openClick(self):
oldid = self.pptid;
oldid = self.pptid
rect = RECT(int(self.xEdit.text()), int(self.yEdit.text()),
int(self.widthEdit.text()), int(self.heightEdit.text()))
filename = str(self.pptEdit.text().replace('/', '\\'))
@ -178,7 +179,7 @@ class PPTViewer(QtGui.QWidget):
self.pptid = self.pptdll.OpenPPT(filename, None, rect, folder)
print('id: ' + str(self.pptid))
if oldid >= 0:
self.pptdll.ClosePPT(oldid);
self.pptdll.ClosePPT(oldid)
slides = self.pptdll.GetSlideCount(self.pptid)
print('slidecount: ' + str(slides))
self.total.setNum(self.pptdll.GetSlideCount(self.pptid))
@ -201,8 +202,7 @@ class PPTViewer(QtGui.QWidget):
app.processEvents()
def openDialog(self):
self.pptEdit.setText(QtGui.QFileDialog.getOpenFileName(self,
'Open file'))
self.pptEdit.setText(QtGui.QFileDialog.getOpenFileName(self, 'Open file'))
if __name__ == '__main__':
pptdll = cdll.LoadLibrary(r'pptviewlib.dll')

View File

@ -144,6 +144,3 @@ class HTTPSServer(HTTPServer):
server_side=True)
self.server_bind()
self.server_activate()

View File

@ -225,7 +225,8 @@ class RemoteTab(SettingsTab):
continue
for address in interface.addressEntries():
ip = address.ip()
if ip.protocol() == QtNetwork.QAbstractSocket.IPv4Protocol and ip != QtNetwork.QHostAddress.LocalHost:
if ip.protocol() == QtNetwork.QAbstractSocket.IPv4Protocol and \
ip != QtNetwork.QHostAddress.LocalHost:
return ip.toString()
return ip_address

View File

@ -64,8 +64,8 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
# Used to interrupt ongoing searches when cancel is clicked.
self.break_search = False
super(DuplicateSongRemovalForm, self).__init__(
Registry().get('main_window'), plugin, 'duplicateSongRemovalWizard', ':/wizards/wizard_duplicateremoval.bmp'
, False)
Registry().get('main_window'), plugin, 'duplicateSongRemovalWizard',
':/wizards/wizard_duplicateremoval.bmp', False)
self.setMinimumWidth(730)
def custom_signals(self):

View File

@ -601,7 +601,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
def on_verse_add_button_clicked(self):
self.verse_form.set_verse('', True)
if self.verse_form.exec_():
after_text, verse_tag, verse_num = self.verse_form.get_verse
after_text, verse_tag, verse_num = self.verse_form.get_verse()
verse_def = '%s%s' % (verse_tag, verse_num)
item = QtGui.QTableWidgetItem(after_text)
item.setData(QtCore.Qt.UserRole, verse_def)
@ -619,7 +619,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
verse_id = item.data(QtCore.Qt.UserRole)
self.verse_form.set_verse(temp_text, True, verse_id)
if self.verse_form.exec_():
after_text, verse_tag, verse_num = self.verse_form.get_verse
after_text, verse_tag, verse_num = self.verse_form.get_verse()
verse_def = '%s%s' % (verse_tag, verse_num)
item.setData(QtCore.Qt.UserRole, verse_def)
item.setText(after_text)
@ -661,7 +661,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
self.verse_form.set_verse('')
if not self.verse_form.exec_():
return
verse_list = self.verse_form.get_all_verses
verse_list = self.verse_form.get_all_verses()
verse_list = str(verse_list.replace('\r\n', '\n'))
self.verse_list_widget.clear()
self.verse_list_widget.setRowCount(0)

View File

@ -71,4 +71,3 @@ class Ui_MediaFilesDialog(object):
self.select_label.setText(translate('SongsPlugin.MediaFilesForm',
'Select one or more audio files from the list below, and click OK to import them '
'into this song.'))

View File

@ -56,4 +56,3 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
def get_selected_files(self):
return [item.data(QtCore.Qt.UserRole) for item in self.file_list_widget.selectedItems()]

View File

@ -99,7 +99,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
self.format_widgets[song_format]['removeButton'].clicked.connect(self.on_remove_button_clicked)
else:
self.format_widgets[song_format]['browseButton'].clicked.connect(self.on_browse_button_clicked)
self.format_widgets[song_format]['file_path_edit'].textChanged.connect(self.on_filepath_edit_text_changed)
self.format_widgets[song_format]['file_path_edit'].textChanged.\
connect(self.on_filepath_edit_text_changed)
def add_custom_pages(self):
"""
@ -163,7 +164,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
f_label = 'Filename:'
if select_mode == SongFormatSelect.SingleFolder:
f_label = 'Folder:'
self.format_widgets[format_list]['filepathLabel'].setText(translate('SongsPlugin.ImportWizardForm', f_label))
self.format_widgets[format_list]['filepathLabel'].setText(
translate('SongsPlugin.ImportWizardForm', f_label))
for format_list in self.disablable_formats:
self.format_widgets[format_list]['disabled_label'].setText(SongFormat.get(format_list, 'disabledLabelText'))
self.progress_page.setTitle(WizardStrings.Importing)

View File

@ -549,4 +549,3 @@ def delete_song(song_id, song_plugin):
except OSError:
log.exception('Could not remove directory: %s', save_path)
song_plugin.manager.delete_object(Song, song_id)

View File

@ -89,8 +89,8 @@ class CCLIFileImport(SongImport):
if not self.do_import_txt_file(lines):
self.log_error(filename)
else:
self.log_error(filename,
translate('SongsPlugin.CCLIFileImport', 'The file does not have a valid extension.'))
self.log_error(filename, translate('SongsPlugin.CCLIFileImport', 'The file does not have a valid '
'extension.'))
log.info('Extension %s is not valid', filename)
if self.stop_import_flag:
return

View File

@ -172,7 +172,8 @@ def init_schema(url):
session, metadata = init_db(url)
# Definition of the "authors" table
authors_table = Table('authors', metadata,
authors_table = Table(
'authors', metadata,
Column('id', types.Integer(), primary_key=True),
Column('first_name', types.Unicode(128)),
Column('last_name', types.Unicode(128)),
@ -180,7 +181,8 @@ def init_schema(url):
)
# Definition of the "media_files" table
media_files_table = Table('media_files', metadata,
media_files_table = Table(
'media_files', metadata,
Column('id', types.Integer(), primary_key=True),
Column('song_id', types.Integer(), ForeignKey('songs.id'), default=None),
Column('file_name', types.Unicode(255), nullable=False),
@ -189,14 +191,16 @@ def init_schema(url):
)
# Definition of the "song_books" table
song_books_table = Table('song_books', metadata,
song_books_table = Table(
'song_books', metadata,
Column('id', types.Integer(), primary_key=True),
Column('name', types.Unicode(128), nullable=False),
Column('publisher', types.Unicode(128))
)
# Definition of the "songs" table
songs_table = Table('songs', metadata,
songs_table = Table(
'songs', metadata,
Column('id', types.Integer(), primary_key=True),
Column('song_book_id', types.Integer(), ForeignKey('song_books.id'), default=None),
Column('title', types.Unicode(255), nullable=False),
@ -216,19 +220,22 @@ def init_schema(url):
)
# Definition of the "topics" table
topics_table = Table('topics', metadata,
topics_table = Table(
'topics', metadata,
Column('id', types.Integer(), primary_key=True),
Column('name', types.Unicode(128), index=True, nullable=False)
)
# Definition of the "authors_songs" table
authors_songs_table = Table('authors_songs', metadata,
authors_songs_table = Table(
'authors_songs', metadata,
Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True),
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True)
)
# Definition of the "songs_topics" table
songs_topics_table = Table('songs_topics', metadata,
songs_topics_table = Table(
'songs_topics', metadata,
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True),
Column('topic_id', types.Integer(), ForeignKey('topics.id'), primary_key=True)
)
@ -236,8 +243,7 @@ def init_schema(url):
mapper(Author, authors_table)
mapper(Book, song_books_table)
mapper(MediaFile, media_files_table)
mapper(Song, songs_table,
properties={
mapper(Song, songs_table, properties={
'authors': relation(Author, backref='songs', secondary=authors_songs_table, lazy=False),
'book': relation(Book, backref='songs'),
'media_files': relation(MediaFile, backref='songs', order_by=media_files_table.c.weight),

View File

@ -145,8 +145,7 @@ class DreamBeamImport(SongImport):
author_copyright = song_xml.Text2.Text.text
if author_copyright:
author_copyright = str(author_copyright)
if author_copyright.find(
str(SongStrings.CopyrightSymbol)) >= 0:
if author_copyright.find(str(SongStrings.CopyrightSymbol)) >= 0:
self.add_copyright(author_copyright)
else:
self.parse_author(author_copyright)

View File

@ -324,12 +324,9 @@ class FoilPresenter(object):
for tempx in temp:
author_temp.append(tempx)
for author in author_temp:
regex = '^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|'\
'\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
regex = '^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
author = re.compile(regex).sub('', author)
author = re.compile(
'[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('',
author)
author = re.compile('[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('', author)
author = re.compile('[N|n]ach.*$').sub('', author)
author = author.strip()
if re.search('\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', author, re.U):

View File

@ -493,9 +493,9 @@ class SongMediaItem(MediaManagerItem):
# FIXME: This file seems to be an old one (prior to 1.9.5), which means, that the search title
# (data_string[u'title']) is probably wrong. We add "@" to search title and hope that we do not add any
# duplicate. This should work for songs without alternate title.
search_results = self.plugin.manager.get_all_objects(Song,
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(' ',
item.data_string['title'].strip()) + '@').strip().lower(), Song.search_title.asc())
temp = (re.compile(r'\W+', re.UNICODE).sub(' ', item.data_string['title'].strip()) + '@').strip().lower()
search_results = \
self.plugin.manager.get_all_objects(Song, Song.search_title == temp, Song.search_title.asc())
else:
search_results = self.plugin.manager.get_all_objects(
Song, Song.search_title == item.data_string['title'], Song.search_title.asc())

View File

@ -128,11 +128,9 @@ class OpenLPSongImport(SongImport):
except UnmappedClassError:
mapper(OldMediaFile, source_media_files_table)
song_props = {
'authors': relation(OldAuthor, backref='songs',
secondary=source_authors_songs_table),
'authors': relation(OldAuthor, backref='songs', secondary=source_authors_songs_table),
'book': relation(OldBook, backref='songs'),
'topics': relation(OldTopic, backref='songs',
secondary=source_songs_topics_table)
'topics': relation(OldTopic, backref='songs', secondary=source_songs_topics_table)
}
if has_media_files:
if isinstance(source_media_files_songs_table, Table):

View File

@ -68,8 +68,8 @@ class OpenLyricsExport(RegistryProperties):
self.application.process_events()
if self.parent.stop_export_flag:
return False
self.parent.increment_progress_bar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
song.title)
self.parent.increment_progress_bar(
translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') % song.title)
xml = open_lyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml.encode()))
filename = '%s (%s)' % (song.title, ', '.join([author.display_name for author in song.authors]))
@ -81,4 +81,3 @@ class OpenLyricsExport(RegistryProperties):
tree.write(open(os.path.join(self.save_path, filename), 'wb'), encoding='utf-8', xml_declaration=True,
pretty_print=True)
return True

View File

@ -287,8 +287,7 @@ class SofImport(OooImport):
:param text: The verse text
"""
if self.italics != self.is_chorus and ((len(self.verses) > 0) or
(self.current__verse.count('\n') > 1)):
if self.italics != self.is_chorus and ((len(self.verses) > 0) or (self.current__verse.count('\n') > 1)):
self.finish_verse()
if self.italics:
self.is_chorus = True
@ -350,8 +349,8 @@ class SofImport(OooImport):
if text_arr[i] in ('JESUS', 'CHRIST', 'KING', 'ALMIGHTY', 'REDEEMER', 'SHEPHERD', 'SON', 'GOD', 'LORD',
'FATHER', 'HOLY', 'SPIRIT', 'LAMB', 'YOU', 'YOUR', 'I', 'I\'VE', 'I\'M', 'I\'LL',
'SAVIOUR', 'O', 'YOU\'RE', 'HE', 'HIS', 'HIM', 'ZION', 'EMMANUEL', 'MAJESTY', 'JESUS\'',
'JIREH', 'JUDAH', 'LION', 'LORD\'S', 'ABRAHAM', 'GOD\'S', 'FATHER\'S', 'ELIJAH' 'MARTHA',
'CHRISTMAS', 'ALPHA', 'OMEGA'):
'JIREH', 'JUDAH', 'LION', 'LORD\'S', 'ABRAHAM', 'GOD\'S', 'FATHER\'S',
'ELIJAH' 'MARTHA', 'CHRISTMAS', 'ALPHA', 'OMEGA'):
text_arr[i] = text_arr[i].capitalize()
else:
text_arr[i] = text_arr[i].lower()

View File

@ -207,4 +207,3 @@ class SundayPlusImport(SongImport):
text = text.replace('^^', '"')
text = text.replace('^', '\'')
return text.strip()

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<song>
<title>Martins Test</title>
<author>MartiÑ &amp; Martin2 Thómpson</author>
<copyright>2010 Martin Thompson</copyright>
<hymn_number>1</hymn_number>
<presentation>V1 C V2 C2 3a B1 V1 T U Rap1 Rap2 Rap3</presentation>
<ccli>Blah</ccli>
<capo print="false"></capo>
<key></key>
<aka></aka>
<key_line></key_line>
<user1></user1>
<user2></user2>
<user3></user3>
<theme>TestTheme</theme>
<alttheme>TestAltTheme</alttheme>
<tempo></tempo>
<time_sig></time_sig>
<lyrics>[3a]
. G A B
V3 Line 1
. G A B
V3 Line 2
. A B C
1 v1 Line 1___
2 v2 Line 1___
. A B C7
1 V1 Line 2
2 V2 Line 2
[b1]
Bridge 1
---
-!!
Bridge 1 line 2
[C]
. A B
Chorus 1
[C2]
. A B
Chorus 2
[T]
T Line 1
[Rap]
1 Rap 1 Line 1
2 Rap 2 Line 1
1 Rap 1 Line 2
2 Rap 2 Line 2
[rap3]
Rap 3 Line 1
Rap 3 Line 2
[X]
Unreferenced verse line 1
</lyrics>
<style index="default_style">
<title enabled="true" valign="bottom" align="center" include_verse="false" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="26" bold="true" italic="true" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#000000"/>
<subtitle enabled="true" valign="bottom" align="center" descriptive="false" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="18" bold="true" italic="true" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#000000"/>
<song_subtitle>author</song_subtitle>
<body enabled="true" auto_scale="false" valign="middle" align="center" highlight_chorus="true" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="34" bold="true" italic="false" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#FF0000">
<tabs/>
</body>
<background strip_footer="0" color="#408080" position="1"/>
</style></song>

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<song>
<title>Martins 2nd Test</title>
<author>Martin Thompson</author>
<copyright>2010 Martin Thompson</copyright>
<hymn_number>2</hymn_number>
<presentation></presentation>
<ccli>Blah</ccli>
<capo print="false"></capo>
<key></key>
<aka></aka>
<key_line></key_line>
<user1></user1>
<user2></user2>
<user3></user3>
<theme></theme>
<tempo></tempo>
<time_sig></time_sig>
<lyrics>;Comment
[V]
. A B C
1 v1 Line 1___
2 v2 Line 1___
. A B C7
1 V1 Line 2
2 V2 Line 2
[b1]
Bridge 1
Bridge 1 line 2
[C1]
Chorus 1
[C2]
Chorus 2
</lyrics>
<style index="default_style">
<title enabled="true" valign="bottom" align="center" include_verse="false" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="26" bold="true" italic="true" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#000000"/>
<subtitle enabled="true" valign="bottom" align="center" descriptive="false" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="18" bold="true" italic="true" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#000000"/>
<song_subtitle>author</song_subtitle>
<body enabled="true" auto_scale="false" valign="middle" align="center" highlight_chorus="true" margin-left="0" margin-right="0" margin-top="0" margin-bottom="0" font="Helvetica" size="34" bold="true" italic="false" underline="false" color="#FFFFFF" border="true" border_color="#000000" shadow="true" shadow_color="#000000" fill="false" fill_color="#FF0000">
<tabs/>
</body>
<background strip_footer="0" color="#408080" position="1"/>
</style></song>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<song>
<title>Test single verse</title>
<author>Martin Thompson</author>
<copyright>2010</copyright>
<ccli>123456</ccli>
<theme>Worship: Declaration</theme>
<lyrics> Line 1
Line 2
</lyrics></song>

View File

@ -1,61 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from openlp.plugins.songs.lib.opensongimport import OpenSongImport
from openlp.plugins.songs.lib.db import init_schema
from openlp.core.lib.db import Manager
import os
import codecs
import logging
LOG_FILENAME = 'import.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
from test_opensongimport import wizard_stub
# Useful test function for importing a variety of different files
# Uncomment below depending on what problem trying to make occur!
def opensong_import_lots():
ziploc = '/home/mjt/openlp/OpenSong_Data/'
files = []
files = [os.path.join(ziploc, 'RaoulSongs', 'Songs', 'Jesus Freak')]
# files.extend(glob(ziploc+u'Songs.zip'))
# files.extend(glob(ziploc+u'RaoulSongs.zip'))
# files.extend(glob(ziploc+u'SOF.zip'))
# files.extend(glob(ziploc+u'spanish_songs_for_opensong.zip'))
# files.extend(glob(ziploc+u'opensong_*.zip'))
errfile = codecs.open('import_lots_errors.txt', 'w', 'utf8')
manager = Manager('songs', init_schema)
o = OpenSongImport(manager, filenames=files)
o.import_wizard=wizard_stub()
o.do_import()
if __name__ == "__main__":
opensong_import_lots()

View File

@ -82,4 +82,3 @@ def upgrade_3(session, metadata):
op.add_column('songs', Column('temporary', types.Boolean(create_constraint=False), server_default=false()))
else:
op.add_column('songs', Column('temporary', types.Boolean(), server_default=false()))

View File

@ -60,8 +60,8 @@ class WorshipCenterProImport(SongImport):
except (pyodbc.DatabaseError, pyodbc.IntegrityError, pyodbc.InternalError, pyodbc.OperationalError) as e:
log.warn('Unable to connect the WorshipCenter Pro database %s. %s', self.import_source, str(e))
# Unfortunately no specific exception type
self.log_error(self.import_source,
translate('SongsPlugin.WorshipCenterProImport', 'Unable to connect the WorshipCenter Pro database.'))
self.log_error(self.import_source, translate('SongsPlugin.WorshipCenterProImport',
'Unable to connect the WorshipCenter Pro database.'))
return
cursor = conn.cursor()
cursor.execute('SELECT ID, Field, Value FROM __SONGDATA')

View File

@ -340,7 +340,8 @@ class OpenLyrics(object):
The first unicode string are the start tags (for the next slide). The second unicode string are the end tags.
:param text: The text to test. The text must **not** contain html tags, only OpenLP formatting tags are allowed::
:param text: The text to test. The text must **not** contain html tags, only OpenLP formatting tags
are allowed::
{st}{r}Text text text
"""

View File

@ -342,7 +342,7 @@ class SongsPlugin(Plugin):
"""
Remove temporary songs from the database
"""
songs = self.manager.get_all_objects(Song, Song.temporary == True)
songs = self.manager.get_all_objects(Song, Song.temporary is True)
for song in songs:
self.manager.delete_object(Song, song.id)

View File

@ -87,14 +87,13 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog, RegistryPrope
)
return
check_directory_exists(path)
file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
self.from_date_calendar.selectedDate().toString('ddMMyyyy'),
file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % \
(self.from_date_calendar.selectedDate().toString('ddMMyyyy'),
self.to_date_calendar.selectedDate().toString('ddMMyyyy'))
Settings().setValue(self.plugin.settings_section + '/from date', self.from_date_calendar.selectedDate())
Settings().setValue(self.plugin.settings_section + '/to date', self.to_date_calendar.selectedDate())
usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_(
SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(),
SongUsageItem, and_(SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(),
SongUsageItem.usagedate < self.to_date_calendar.selectedDate().toPyDate()),
[SongUsageItem.usagedate, SongUsageItem.usagetime])
report_file_name = os.path.join(path, file_name)
@ -103,8 +102,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog, RegistryPrope
file_handle = open(report_file_name, 'w')
for instance in usage:
record = '\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
'\"%s\",\"%s\"\n' % (instance.usagedate,
instance.usagetime, instance.title, instance.copyright,
'\"%s\",\"%s\"\n' % \
(instance.usagedate, instance.usagetime, instance.title, instance.copyright,
instance.ccl_number, instance.authors, instance.plugin_name, instance.source)
file_handle.write(record.encode('utf-8'))
self.main_window.information_message(

View File

@ -26,25 +26,30 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import sys
"""
Package to test the openlp.core.lib.ui package.
"""
from PyQt4 import QtGui
from unittest import TestCase
from openlp.plugins.songs.lib.opensongimport import OpenSongImport
from openlp.core.lib.db import Manager
from openlp.plugins.songs.lib.db import init_schema
from openlp.core.lib.ui import *
import logging
LOG_FILENAME = 'test_import_file.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
from test_opensongimport import wizard_stub
class TestUi(TestCase):
"""
Test the functions in the ui module
"""
def test(filenames):
manager = Manager('songs', init_schema)
o = OpenSongImport(manager, filenames=filenames)
o.import_wizard = wizard_stub()
o.commit = False
o.do_import()
o.print_song()
def test_add_welcome_page(self):
"""
Test appending a welcome page to a wizard
"""
# GIVEN: A wizard
wizard = QtGui.QWizard()
if __name__ == "__main__":
test(sys.argv[1:])
# WHEN: A welcome page has been added to the wizard
add_welcome_page(wizard, ':/wizards/wizard_firsttime.bmp')
# THEN: The wizard should have one page with a pixmap.
self.assertEqual(1, len(wizard.pageIds()), 'The wizard should have one page.')
self.assertIsInstance(wizard.page(0).pixmap(QtGui.QWizard.WatermarkPixmap), QtGui.QPixmap)

View File

@ -30,19 +30,78 @@
This module contains tests for the pptviewcontroller module of the Presentations plugin.
"""
import os
import shutil
if os.name == 'nt':
from ctypes import cdll
from tempfile import mkdtemp
from unittest import TestCase
from tests.functional import MagicMock, patch
from tests.helpers.testmixin import TestMixin
from openlp.plugins.presentations.lib.pptviewcontroller import PptviewDocument
from openlp.plugins.presentations.lib.pptviewcontroller import PptviewDocument, PptviewController
class TestPptviewController(TestCase, TestMixin):
"""
Test the PptviewController Class
"""
#TODO: Items left to test
# PptviewController
# __init__
# check_availablecheck_installed
# start_process(self)
# kill
def setUp(self):
"""
Set up the patches and mocks need for all tests.
"""
self.get_application()
self.build_settings()
self.mock_plugin = MagicMock()
self.temp_folder = mkdtemp()
self.mock_plugin.settings_section = self.temp_folder
def tearDown(self):
"""
Stop the patches
"""
self.destroy_settings()
shutil.rmtree(self.temp_folder)
def constructor_test(self):
"""
Test the Constructor from the PptViewController
"""
# GIVEN: No presentation controller
controller = None
# WHEN: The presentation controller object is created
controller = PptviewController(plugin=self.mock_plugin)
# THEN: The name of the presentation controller should be correct
self.assertEqual('Powerpoint Viewer', controller.name, 'The name of the presentation controller should be correct')
def check_available_test(self):
"""
Test check_available / check_installed
"""
# GIVEN: A mocked dll loader and a controller
with patch('ctypes.cdll.LoadLibrary') as mocked_load_library:
mocked_process = MagicMock()
mocked_process.CheckInstalled.return_value = True
mocked_load_library.return_value = mocked_process
controller = PptviewController(plugin=self.mock_plugin)
# WHEN: check_available is called
available = controller.check_available()
# THEN: On windows it should return True, on other platforms False
if os.name == 'nt':
self.assertTrue(available, 'check_available should return True on windows.')
else:
self.assertFalse(available, 'check_available should return False when not on windows.')
class TestPptviewDocument(TestCase):
"""

View File

@ -53,13 +53,12 @@ class TestMixin(object):
Build the settings Object and initialise it
"""
Settings.setDefaultFormat(Settings.IniFormat)
fd, self.ini_file = mkstemp('.ini')
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
def destroy_settings(self):
"""
Destroy the Settings Object
"""
if hasattr(self, 'fd'):
os.close(self.fd)
os.unlink(Settings().fileName())

View File

@ -31,6 +31,7 @@ Package to test the openlp.core.lib.pluginmanager package.
"""
import sys
import shutil
import gc
from tempfile import mkdtemp
from unittest import TestCase
@ -65,6 +66,9 @@ class TestPluginManager(TestCase, TestMixin):
del self.main_window
Settings().remove('advanced/data path')
self.destroy_settings()
# On windows we need to manually garbage collect to close sqlalchemy files
# to avoid errors when temporary files are deleted.
gc.collect()
shutil.rmtree(self.temp_dir)
def find_plugins_test(self):