forked from openlp/openlp
Head 2074
This commit is contained in:
commit
56501b69f7
@ -612,18 +612,18 @@ class AdvancedTab(SettingsTab):
|
||||
def generateServiceNameExample(self):
|
||||
preset_is_valid = True
|
||||
if self.serviceNameDay.currentIndex() == 7:
|
||||
time = datetime.now()
|
||||
local_time = datetime.now()
|
||||
else:
|
||||
now = datetime.now()
|
||||
day_delta = self.serviceNameDay.currentIndex() - now.weekday()
|
||||
if day_delta < 0:
|
||||
day_delta += 7
|
||||
time = now + timedelta(days=day_delta)
|
||||
time = time.replace(hour = self.serviceNameTime.time().hour(),
|
||||
local_time = time.replace(hour = self.serviceNameTime.time().hour(),
|
||||
minute = self.serviceNameTime.time().minute())
|
||||
try:
|
||||
service_name_example = format_time(unicode(
|
||||
self.serviceNameEdit.text()))
|
||||
self.serviceNameEdit.text()), local_time)
|
||||
except ValueError:
|
||||
preset_is_valid = False
|
||||
service_name_example = translate('OpenLP.AdvancedTab',
|
||||
@ -674,6 +674,7 @@ class AdvancedTab(SettingsTab):
|
||||
options = QtGui.QFileDialog.ShowDirsOnly))
|
||||
# Set the new data path.
|
||||
if new_data_path:
|
||||
new_data_path = os.path.normpath(new_data_path)
|
||||
if self.currentDataPath.lower() == new_data_path.lower():
|
||||
self.onDataDirectoryCancelButtonClicked()
|
||||
return
|
||||
|
@ -971,6 +971,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
setting_sections.extend([self.themesSettingsSection])
|
||||
setting_sections.extend([self.displayTagsSection])
|
||||
setting_sections.extend([self.headerSection])
|
||||
setting_sections.extend([u'crashreport'])
|
||||
# Add plugin sections.
|
||||
for plugin in self.pluginManager.plugins:
|
||||
setting_sections.extend([plugin.name])
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate
|
||||
@ -107,8 +108,13 @@ class MediaController(object):
|
||||
AppLocation.get_directory(AppLocation.AppDir),
|
||||
u'core', u'ui', u'media')
|
||||
for filename in os.listdir(controller_dir):
|
||||
if filename.endswith(u'player.py') and not \
|
||||
filename == 'mediaplayer.py':
|
||||
# TODO vlc backend is not yet working on Mac OS X.
|
||||
# For now just ignore vlc backend on Mac OS X.
|
||||
if sys.platform == 'darwin' and filename == 'vlcplayer.py':
|
||||
log.warn(u'Disabling vlc media player')
|
||||
continue
|
||||
if filename.endswith(u'player.py')and not\
|
||||
filename == 'mediaplayer.py':
|
||||
path = os.path.join(controller_dir, filename)
|
||||
if os.path.isfile(path):
|
||||
modulename = u'openlp.core.ui.media.' + \
|
||||
@ -116,7 +122,9 @@ class MediaController(object):
|
||||
log.debug(u'Importing controller %s', modulename)
|
||||
try:
|
||||
__import__(modulename, globals(), locals(), [])
|
||||
except ImportError:
|
||||
# On some platforms importing vlc.py might cause
|
||||
# also OSError exceptions. (e.g. Mac OS X)
|
||||
except (ImportError, OSError):
|
||||
log.warn(u'Failed to import %s on path %s',
|
||||
modulename, path)
|
||||
player_classes = MediaPlayer.__subclasses__()
|
||||
|
120
openlp/core/ui/media/vendor/vlc.py
vendored
120
openlp/core/ui/media/vendor/vlc.py
vendored
@ -48,7 +48,48 @@ import sys
|
||||
from inspect import getargspec
|
||||
|
||||
__version__ = "N/A"
|
||||
build_date = "Thu Jun 14 15:22:46 2012"
|
||||
build_date = "Fri Sep 28 22:48:50 2012"
|
||||
|
||||
if sys.version_info[0] > 2:
|
||||
str = str
|
||||
unicode = str
|
||||
bytes = bytes
|
||||
basestring = (str, bytes)
|
||||
PYTHON3 = True
|
||||
def str_to_bytes(s):
|
||||
"""Translate string or bytes to bytes.
|
||||
"""
|
||||
if isinstance(s, str):
|
||||
return bytes(s, sys.getfilesystemencoding())
|
||||
else:
|
||||
return s
|
||||
|
||||
def bytes_to_str(b):
|
||||
"""Translate bytes to string.
|
||||
"""
|
||||
if isinstance(b, bytes):
|
||||
return b.decode(sys.getfilesystemencoding())
|
||||
else:
|
||||
return b
|
||||
else:
|
||||
str = str
|
||||
unicode = unicode
|
||||
bytes = str
|
||||
basestring = basestring
|
||||
PYTHON3 = False
|
||||
def str_to_bytes(s):
|
||||
"""Translate string or bytes to bytes.
|
||||
"""
|
||||
if isinstance(s, unicode):
|
||||
return s.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
return s
|
||||
|
||||
def bytes_to_str(b):
|
||||
"""Translate bytes to unicode string.
|
||||
"""
|
||||
if isinstance(b, str):
|
||||
return unicode(b, sys.getfilesystemencoding())
|
||||
|
||||
# Internal guard to prevent internal classes to be directly
|
||||
# instanciated.
|
||||
@ -220,7 +261,7 @@ def string_result(result, func, arguments):
|
||||
"""
|
||||
if result:
|
||||
# make a python string copy
|
||||
s = ctypes.string_at(result)
|
||||
s = bytes_to_str(ctypes.string_at(result))
|
||||
# free original string ptr
|
||||
libvlc_free(result)
|
||||
return s
|
||||
@ -241,16 +282,32 @@ class FILE(ctypes.Structure):
|
||||
pass
|
||||
FILE_ptr = ctypes.POINTER(FILE)
|
||||
|
||||
PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile
|
||||
PyFile_FromFile.restype = ctypes.py_object
|
||||
PyFile_FromFile.argtypes = [FILE_ptr,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr)]
|
||||
if PYTHON3:
|
||||
PyFile_FromFd = ctypes.pythonapi.PyFile_FromFd
|
||||
PyFile_FromFd.restype = ctypes.py_object
|
||||
PyFile_FromFd.argtypes = [ctypes.c_int,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_int,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_int ]
|
||||
|
||||
PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile
|
||||
PyFile_AsFile.restype = FILE_ptr
|
||||
PyFile_AsFile.argtypes = [ctypes.py_object]
|
||||
PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor
|
||||
PyFile_AsFd.restype = ctypes.c_int
|
||||
PyFile_AsFd.argtypes = [ctypes.py_object]
|
||||
else:
|
||||
PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile
|
||||
PyFile_FromFile.restype = ctypes.py_object
|
||||
PyFile_FromFile.argtypes = [FILE_ptr,
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_char_p,
|
||||
ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr)]
|
||||
|
||||
PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile
|
||||
PyFile_AsFile.restype = FILE_ptr
|
||||
PyFile_AsFile.argtypes = [ctypes.py_object]
|
||||
|
||||
# Generated enum types #
|
||||
|
||||
@ -1155,6 +1212,8 @@ class Instance(_Ctype):
|
||||
# no parameters passed, for win32 and MacOS,
|
||||
# specify the plugin_path if detected earlier
|
||||
args = ['vlc', '--plugin-path=' + plugin_path]
|
||||
if PYTHON3:
|
||||
args = [ str_to_bytes(a) for a in args ]
|
||||
return libvlc_new(len(args), args)
|
||||
|
||||
def media_player_new(self, uri=None):
|
||||
@ -1195,12 +1254,12 @@ class Instance(_Ctype):
|
||||
"""
|
||||
if ':' in mrl and mrl.index(':') > 1:
|
||||
# Assume it is a URL
|
||||
m = libvlc_media_new_location(self, mrl)
|
||||
m = libvlc_media_new_location(self, str_to_bytes(mrl))
|
||||
else:
|
||||
# Else it should be a local path.
|
||||
m = libvlc_media_new_path(self, mrl)
|
||||
m = libvlc_media_new_path(self, str_to_bytes(mrl))
|
||||
for o in options:
|
||||
libvlc_media_add_option(m, o)
|
||||
libvlc_media_add_option(m, str_to_bytes(o))
|
||||
m._instance = self
|
||||
return m
|
||||
|
||||
@ -1664,6 +1723,9 @@ class LogIterator(_Ctype):
|
||||
return i.contents
|
||||
raise StopIteration
|
||||
|
||||
def __next__(self):
|
||||
return self.next()
|
||||
|
||||
|
||||
def free(self):
|
||||
'''Frees memory allocated by L{log_get_iterator}().
|
||||
@ -3125,18 +3187,6 @@ def libvlc_vprinterr(fmt, ap):
|
||||
ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p)
|
||||
return f(fmt, ap)
|
||||
|
||||
def libvlc_printerr(fmt, args):
|
||||
'''Sets the LibVLC error status and message for the current thread.
|
||||
Any previous error is overridden.
|
||||
@param fmt: the format string.
|
||||
@param args: the arguments.
|
||||
@return: a nul terminated string in any case.
|
||||
'''
|
||||
f = _Cfunctions.get('libvlc_printerr', None) or \
|
||||
_Cfunction('libvlc_printerr', ((1,), (1,),), None,
|
||||
ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p)
|
||||
return f(fmt, args)
|
||||
|
||||
def libvlc_new(argc, argv):
|
||||
'''Create and initialize a libvlc instance.
|
||||
This functions accept a list of "command line" arguments similar to the
|
||||
@ -5828,11 +5878,12 @@ def libvlc_vlm_get_event_manager(p_instance):
|
||||
return f(p_instance)
|
||||
|
||||
|
||||
# 2 function(s) blacklisted:
|
||||
# 3 function(s) blacklisted:
|
||||
# libvlc_printerr
|
||||
# libvlc_set_exit_handler
|
||||
# libvlc_video_set_callbacks
|
||||
|
||||
# 18 function(s) not wrapped as methods:
|
||||
# 17 function(s) not wrapped as methods:
|
||||
# libvlc_audio_output_list_release
|
||||
# libvlc_clearerr
|
||||
# libvlc_clock
|
||||
@ -5847,7 +5898,6 @@ def libvlc_vlm_get_event_manager(p_instance):
|
||||
# libvlc_log_unsubscribe
|
||||
# libvlc_module_description_list_release
|
||||
# libvlc_new
|
||||
# libvlc_printerr
|
||||
# libvlc_track_description_list_release
|
||||
# libvlc_track_description_release
|
||||
# libvlc_vprinterr
|
||||
@ -5908,7 +5958,7 @@ def libvlc_hex_version():
|
||||
"""Return the libvlc version in hex or 0 if unavailable.
|
||||
"""
|
||||
try:
|
||||
return _dot2int(libvlc_get_version().split()[0])
|
||||
return _dot2int(bytes_to_str(libvlc_get_version()).split()[0])
|
||||
except ValueError:
|
||||
return 0
|
||||
|
||||
@ -5957,8 +6007,8 @@ if __name__ == '__main__':
|
||||
"""Print libvlc version"""
|
||||
try:
|
||||
print('Build date: %s (%#x)' % (build_date, hex_version()))
|
||||
print('LibVLC version: %s (%#x)' % (libvlc_get_version(), libvlc_hex_version()))
|
||||
print('LibVLC compiler: %s' % libvlc_get_compiler())
|
||||
print('LibVLC version: %s (%#x)' % (bytes_to_str(libvlc_get_version()), libvlc_hex_version()))
|
||||
print('LibVLC compiler: %s' % bytes_to_str(libvlc_get_compiler()))
|
||||
if plugin_path:
|
||||
print('Plugin path: %s' % plugin_path)
|
||||
except:
|
||||
@ -5997,7 +6047,7 @@ if __name__ == '__main__':
|
||||
player.video_set_marquee_int(VideoMarqueeOption.Refresh, 1000) # millisec (or sec?)
|
||||
##t = '$L / $D or $P at $T'
|
||||
t = '%Y-%m-%d %H:%M:%S'
|
||||
player.video_set_marquee_string(VideoMarqueeOption.Text, t)
|
||||
player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t))
|
||||
|
||||
# Some event manager examples. Note, the callback can be any Python
|
||||
# callable and does not need to be decorated. Optionally, specify
|
||||
@ -6017,7 +6067,7 @@ if __name__ == '__main__':
|
||||
print_version()
|
||||
media = player.get_media()
|
||||
print('State: %s' % player.get_state())
|
||||
print('Media: %s' % media.get_mrl())
|
||||
print('Media: %s' % bytes_to_str(media.get_mrl()))
|
||||
print('Track: %s/%s' % (player.video_get_track(), player.video_get_track_count()))
|
||||
print('Current time: %s/%s' % (player.get_time(), media.get_duration()))
|
||||
print('Position: %s' % player.get_position())
|
||||
@ -6078,7 +6128,7 @@ if __name__ == '__main__':
|
||||
|
||||
print('Press q to quit, ? to get help.%s' % os.linesep)
|
||||
while True:
|
||||
k = getch().decode('utf8') # Python 3+
|
||||
k = getch()
|
||||
print('> %s' % k)
|
||||
if k in keybindings:
|
||||
keybindings[k]()
|
||||
|
@ -675,7 +675,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
service_day = Settings().value(
|
||||
u'advanced/default service day', 7).toInt()[0]
|
||||
if service_day == 7:
|
||||
time = datetime.now()
|
||||
local_time = datetime.now()
|
||||
else:
|
||||
service_hour = Settings().value(
|
||||
u'advanced/default service hour', 11).toInt()[0]
|
||||
@ -686,7 +686,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
if day_delta < 0:
|
||||
day_delta += 7
|
||||
time = now + timedelta(days=day_delta)
|
||||
time = time.replace(hour=service_hour, minute=service_minute)
|
||||
local_time = time.replace(hour=service_hour, minute=service_minute)
|
||||
default_pattern = unicode(Settings().value(
|
||||
u'advanced/default service name',
|
||||
translate('OpenLP.AdvancedTab', 'Service %Y-%m-%d %H-%M',
|
||||
@ -694,7 +694,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
'/\\?*|<>\[\]":+\nSee http://docs.python.org/library/'
|
||||
'datetime.html#strftime-strptime-behavior for more '
|
||||
'information.')).toString())
|
||||
default_filename = format_time(default_pattern)
|
||||
default_filename = format_time(default_pattern, local_time)
|
||||
else:
|
||||
default_filename = u''
|
||||
directory = unicode(SettingsManager.get_last_dir(
|
||||
|
@ -157,7 +157,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
u'outlineColorButton', self.outlineColorButton)
|
||||
self.mainAreaPage.registerField(
|
||||
u'outlineSizeSpinBox', self.outlineSizeSpinBox)
|
||||
self.mainAreaPage.registerField(u'shadowCheckBox', self.shadowCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'shadowCheckBox', self.shadowCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'mainBoldCheckBox', self.mainBoldCheckBox)
|
||||
self.mainAreaPage.registerField(
|
||||
@ -168,8 +169,10 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
u'shadowSizeSpinBox', self.shadowSizeSpinBox)
|
||||
self.mainAreaPage.registerField(
|
||||
u'footerSizeSpinBox', self.footerSizeSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionX', self.mainXSpinBox)
|
||||
self.areaPositionPage.registerField(u'mainPositionY', self.mainYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionX', self.mainXSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionY', self.mainYSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
u'mainPositionWidth', self.mainWidthSpinBox)
|
||||
self.areaPositionPage.registerField(
|
||||
@ -202,7 +205,8 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
"""
|
||||
Updates the lines on a page on the wizard
|
||||
"""
|
||||
self.mainLineCountLabel.setText(unicode(translate('OpenLP.ThemeForm',
|
||||
self.mainLineCountLabel.setText(unicode(translate(
|
||||
'OpenLP.ThemeWizard',
|
||||
'(approximately %d lines per slide)')) % int(lines))
|
||||
|
||||
def resizeEvent(self, event=None):
|
||||
@ -224,6 +228,19 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
self.previewBoxLabel.setFixedSize(pixmapWidth + 2 * frameWidth,
|
||||
pixmapHeight + 2 * frameWidth)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
background_image = BackgroundType.to_string(BackgroundType.Image)
|
||||
if self.page(self.currentId()) == self.backgroundPage and \
|
||||
self.theme.background_type == background_image and \
|
||||
self.imageFileEdit.text().isEmpty():
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('OpenLP.ThemeWizard', 'Background Image Empty'),
|
||||
translate('OpenLP.ThemeWizard', 'You have not selected a '
|
||||
'background image. Please select one before continuing.'))
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def onCurrentIdChanged(self, pageId):
|
||||
"""
|
||||
Detects Page changes and updates as appropriate.
|
||||
@ -521,7 +538,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
images_filter = u'%s;;%s (*.*) (*)' % (
|
||||
images_filter, UiStrings().AllFiles)
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||
translate('OpenLP.ThemeForm', 'Select Image'), u'',
|
||||
translate('OpenLP.ThemeWizard', 'Select Image'), u'',
|
||||
images_filter)
|
||||
if filename:
|
||||
self.theme.background_filename = unicode(filename)
|
||||
@ -603,14 +620,14 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
||||
self.theme.theme_name = unicode(self.field(u'name').toString())
|
||||
if not self.theme.theme_name:
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
||||
translate('OpenLP.ThemeForm',
|
||||
translate('OpenLP.ThemeWizard', 'Theme Name Missing'),
|
||||
translate('OpenLP.ThemeWizard',
|
||||
'There is no name for this theme. Please enter one.'))
|
||||
return
|
||||
if self.theme.theme_name == u'-1' or self.theme.theme_name == u'None':
|
||||
critical_error_message_box(
|
||||
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
||||
translate('OpenLP.ThemeForm',
|
||||
translate('OpenLP.ThemeWizard', 'Theme Name Invalid'),
|
||||
translate('OpenLP.ThemeWizard',
|
||||
'Invalid theme name. Please enter one.'))
|
||||
return
|
||||
saveFrom = None
|
||||
|
@ -257,6 +257,7 @@ class ThemeManager(QtGui.QWidget):
|
||||
theme.set_default_header_footer()
|
||||
self.themeForm.theme = theme
|
||||
self.themeForm.exec_()
|
||||
self.loadThemes()
|
||||
|
||||
def onRenameTheme(self):
|
||||
"""
|
||||
@ -283,7 +284,6 @@ class ThemeManager(QtGui.QWidget):
|
||||
plugin.renameTheme(old_theme_name, new_theme_name)
|
||||
self.mainwindow.renderer.update_theme(
|
||||
new_theme_name, old_theme_name)
|
||||
self.loadThemes()
|
||||
|
||||
def onCopyTheme(self):
|
||||
"""
|
||||
|
@ -35,7 +35,6 @@ import os
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
from openlp.core.lib.settings import Settings
|
||||
@ -137,7 +136,7 @@ class AppLocation(object):
|
||||
else:
|
||||
path = AppLocation.get_directory(AppLocation.DataDir)
|
||||
check_directory_exists(path)
|
||||
return path
|
||||
return os.path.normpath(path)
|
||||
|
||||
@staticmethod
|
||||
def get_section_data_path(section):
|
||||
@ -471,16 +470,21 @@ def get_uno_instance(resolver):
|
||||
+ u'urp;StarOffice.ComponentContext')
|
||||
|
||||
|
||||
def format_time(text):
|
||||
def format_time(text, local_time):
|
||||
"""
|
||||
Workaround for Python built-in time formatting fuction time.strftime().
|
||||
|
||||
time.strftime() accepts only ascii characters. This function accepts
|
||||
unicode string and passes individual % placeholders to time.strftime().
|
||||
This ensures only ascii characters are passed to time.strftime().
|
||||
|
||||
``text``
|
||||
The text to be processed.
|
||||
``local_time``
|
||||
The time to be used to add to the string. This is a time object
|
||||
"""
|
||||
def match_formatting(match):
|
||||
return time.strftime(match.group())
|
||||
return local_time.strftime(match.group())
|
||||
return re.sub('\%[a-zA-Z]', match_formatting, text)
|
||||
|
||||
|
||||
|
@ -160,10 +160,12 @@ class BGExtract(object):
|
||||
verse = verse.strip()
|
||||
try:
|
||||
verse = int(verse)
|
||||
except (TypeError, ValueError):
|
||||
except ValueError:
|
||||
verse_parts = verse.split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
verse = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||
verses.append((verse, text))
|
||||
verse_list = {}
|
||||
for verse, text in verses[::-1]:
|
||||
@ -194,6 +196,10 @@ class BGExtract(object):
|
||||
try:
|
||||
clean_verse_num = int(str(raw_verse_num))
|
||||
except ValueError:
|
||||
verse_parts = str(raw_verse_num).split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
clean_verse_num = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
||||
if clean_verse_num:
|
||||
verse_text = raw_verse_num.next
|
||||
|
@ -366,15 +366,20 @@ class BibleManager(object):
|
||||
"""
|
||||
log.debug(u'BibleManager.get_language_selection("%s")', bible)
|
||||
language_selection = self.get_meta_data(bible, u'book_name_language')
|
||||
if language_selection:
|
||||
try:
|
||||
language_selection = int(language_selection.value)
|
||||
except (ValueError, TypeError):
|
||||
language_selection = LanguageSelection.Application
|
||||
if language_selection is None or language_selection == -1:
|
||||
if not language_selection or \
|
||||
language_selection.value == "None" or \
|
||||
language_selection.value == "-1":
|
||||
# If None is returned, it's not the singleton object but a
|
||||
# BibleMeta object with the value "None"
|
||||
language_selection = Settings().value(
|
||||
self.settingsSection + u'/bookname language',
|
||||
self.settingsSection + u'/book name language',
|
||||
QtCore.QVariant(0)).toInt()[0]
|
||||
else:
|
||||
language_selection = language_selection.value
|
||||
try:
|
||||
language_selection = int(language_selection)
|
||||
except (ValueError, TypeError):
|
||||
language_selection = LanguageSelection.Application
|
||||
return language_selection
|
||||
|
||||
def verse_search(self, bible, second_bible, text):
|
||||
|
@ -103,10 +103,20 @@ class OpenSongBible(BibleDB):
|
||||
for verse in chapter.v:
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
verse_number = 0
|
||||
try:
|
||||
verse_number = int(verse.attrib[u'n'])
|
||||
except ValueError:
|
||||
verse_parts = verse.attrib[u'n'].split(u'-')
|
||||
if len(verse_parts) > 1:
|
||||
verse_number = int(verse_parts[0])
|
||||
except TypeError:
|
||||
log.warn(u'Illegal verse number: %s',
|
||||
unicode(verse.attrib[u'n']))
|
||||
self.create_verse(
|
||||
db_book.id,
|
||||
int(chapter.attrib[u'n'].split()[-1]),
|
||||
int(verse.attrib[u'n']),
|
||||
verse_number,
|
||||
unicode(self.get_text(verse)))
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2926
resources/i18n/fi.ts
2926
resources/i18n/fi.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2286
resources/i18n/id.ts
2286
resources/i18n/id.ts
File diff suppressed because it is too large
Load Diff
2870
resources/i18n/it.ts
2870
resources/i18n/it.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3308
resources/i18n/ko.ts
3308
resources/i18n/ko.ts
File diff suppressed because it is too large
Load Diff
3184
resources/i18n/nb.ts
3184
resources/i18n/nb.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3534
resources/i18n/pl.ts
3534
resources/i18n/pl.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1668
resources/i18n/ru.ts
1668
resources/i18n/ru.ts
File diff suppressed because it is too large
Load Diff
2912
resources/i18n/sk.ts
2912
resources/i18n/sk.ts
File diff suppressed because it is too large
Load Diff
3542
resources/i18n/sq.ts
3542
resources/i18n/sq.ts
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user