forked from openlp/openlp
head
This commit is contained in:
commit
2c93a5840b
@ -51,8 +51,10 @@ def trace_error_handler(logger):
|
|||||||
|
|
||||||
:param logger: logger to use so traceback is logged to correct class
|
:param logger: logger to use so traceback is logged to correct class
|
||||||
"""
|
"""
|
||||||
|
log_string = "OpenLP Error trace"
|
||||||
for tb in traceback.extract_stack():
|
for tb in traceback.extract_stack():
|
||||||
logger.error('Called by ' + tb[3] + ' at line ' + str(tb[1]) + ' in ' + tb[0])
|
log_string = '%s\n File %s at line %d \n\t called %s' % (log_string, tb[0], tb[1], tb[3])
|
||||||
|
logger.error(log_string)
|
||||||
|
|
||||||
|
|
||||||
def check_directory_exists(directory, do_not_log=False):
|
def check_directory_exists(directory, do_not_log=False):
|
||||||
|
@ -76,7 +76,7 @@ class AppLocation(object):
|
|||||||
elif dir_type == AppLocation.PluginsDir:
|
elif dir_type == AppLocation.PluginsDir:
|
||||||
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
|
app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
|
||||||
return get_frozen_path(os.path.join(app_path, 'plugins'),
|
return get_frozen_path(os.path.join(app_path, 'plugins'),
|
||||||
os.path.join(os.path.split(openlp.__file__)[0], 'plugins'))
|
os.path.join(os.path.split(openlp.__file__)[0], 'plugins'))
|
||||||
elif dir_type == AppLocation.VersionDir:
|
elif dir_type == AppLocation.VersionDir:
|
||||||
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
return get_frozen_path(os.path.abspath(os.path.split(sys.argv[0])[0]), os.path.split(openlp.__file__)[0])
|
||||||
elif dir_type == AppLocation.LanguageDir:
|
elif dir_type == AppLocation.LanguageDir:
|
||||||
|
@ -91,4 +91,4 @@ class OpenLPMixin(object):
|
|||||||
Common log exception handler which prints the calling path
|
Common log exception handler which prints the calling path
|
||||||
"""
|
"""
|
||||||
trace_error_handler(self.logger)
|
trace_error_handler(self.logger)
|
||||||
self.logger.exception(message)
|
self.logger.exception(message)
|
||||||
|
@ -62,11 +62,9 @@ class Registry(object):
|
|||||||
registry = cls()
|
registry = cls()
|
||||||
registry.service_list = {}
|
registry.service_list = {}
|
||||||
registry.functions_list = {}
|
registry.functions_list = {}
|
||||||
registry.running_under_test = False
|
|
||||||
registry.initialising = True
|
|
||||||
# Allow the tests to remove Registry entries but not the live system
|
# Allow the tests to remove Registry entries but not the live system
|
||||||
if 'nose' in sys.argv[0]:
|
registry.running_under_test = 'nose' in sys.argv[0]
|
||||||
registry.running_under_test = True
|
registry.initialising = True
|
||||||
return registry
|
return registry
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
@ -128,7 +126,7 @@ class Registry(object):
|
|||||||
:param event: The function description..
|
:param event: The function description..
|
||||||
:param function: The function to be called when the event happens.
|
:param function: The function to be called when the event happens.
|
||||||
"""
|
"""
|
||||||
if self.running_under_test is False:
|
if not self.running_under_test:
|
||||||
trace_error_handler(log)
|
trace_error_handler(log)
|
||||||
log.error('Invalid Method call for key %s' % event)
|
log.error('Invalid Method call for key %s' % event)
|
||||||
raise KeyError('Invalid Method call for key %s' % event)
|
raise KeyError('Invalid Method call for key %s' % event)
|
||||||
|
@ -149,4 +149,4 @@ class RegistryProperties(object):
|
|||||||
"""
|
"""
|
||||||
if not hasattr(self, '_alerts_manager') or not self._alerts_manager:
|
if not hasattr(self, '_alerts_manager') or not self._alerts_manager:
|
||||||
self._alerts_manager = Registry().get('alerts_manager')
|
self._alerts_manager = Registry().get('alerts_manager')
|
||||||
return self._alerts_manager
|
return self._alerts_manager
|
||||||
|
@ -73,8 +73,9 @@ class UiStrings(object):
|
|||||||
self.Default = translate('OpenLP.Ui', 'Default')
|
self.Default = translate('OpenLP.Ui', 'Default')
|
||||||
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
|
self.DefaultColor = translate('OpenLP.Ui', 'Default Color:')
|
||||||
self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M',
|
self.DefaultServiceName = translate('OpenLP.Ui', 'Service %Y-%m-%d %H-%M',
|
||||||
'This may not contain any of the following characters: /\\?*|<>\[\]":+\n'
|
'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.Delete = translate('OpenLP.Ui', '&Delete')
|
||||||
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
|
self.DisplayStyle = translate('OpenLP.Ui', 'Display style:')
|
||||||
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
|
self.Duplicate = translate('OpenLP.Ui', 'Duplicate Error')
|
||||||
@ -132,7 +133,7 @@ class UiStrings(object):
|
|||||||
self.Service = translate('OpenLP.Ui', 'Service')
|
self.Service = translate('OpenLP.Ui', 'Service')
|
||||||
self.Split = translate('OpenLP.Ui', 'Optional &Split')
|
self.Split = translate('OpenLP.Ui', 'Optional &Split')
|
||||||
self.SplitToolTip = translate('OpenLP.Ui',
|
self.SplitToolTip = translate('OpenLP.Ui',
|
||||||
'Split a slide into two only if it does not fit on the screen as one slide.')
|
'Split a slide into two only if it does not fit on the screen as one slide.')
|
||||||
self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
|
self.StartTimeCode = translate('OpenLP.Ui', 'Start %s')
|
||||||
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
|
self.StopPlaySlidesInLoop = translate('OpenLP.Ui', 'Stop Play Slides in Loop')
|
||||||
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')
|
self.StopPlaySlidesToEnd = translate('OpenLP.Ui', 'Stop Play Slides to End')
|
||||||
|
@ -87,10 +87,11 @@ def upgrade_db(url, upgrade):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
metadata_table = Table('metadata', metadata,
|
metadata_table = Table(
|
||||||
Column('key', types.Unicode(64), primary_key=True),
|
'metadata', metadata,
|
||||||
Column('value', types.UnicodeText(), default=None)
|
Column('key', types.Unicode(64), primary_key=True),
|
||||||
)
|
Column('value', types.UnicodeText(), default=None)
|
||||||
|
)
|
||||||
metadata_table.create(checkfirst=True)
|
metadata_table.create(checkfirst=True)
|
||||||
mapper(Metadata, metadata_table)
|
mapper(Metadata, metadata_table)
|
||||||
version_meta = session.query(Metadata).get('version')
|
version_meta = session.query(Metadata).get('version')
|
||||||
@ -131,7 +132,6 @@ def delete_database(plugin_name, db_file_name=None):
|
|||||||
:param plugin_name: The name of the plugin to remove the database for
|
:param plugin_name: The name of the plugin to remove the database for
|
||||||
:param db_file_name: The database file name. Defaults to None resulting in the plugin_name being used.
|
:param db_file_name: The database file name. Defaults to None resulting in the plugin_name being used.
|
||||||
"""
|
"""
|
||||||
db_file_path = None
|
|
||||||
if db_file_name:
|
if db_file_name:
|
||||||
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), db_file_name)
|
db_file_path = os.path.join(AppLocation.get_section_data_path(plugin_name), db_file_name)
|
||||||
else:
|
else:
|
||||||
|
@ -63,4 +63,4 @@ class FileDialog(QtGui.QFileDialog):
|
|||||||
UiStrings().FileNotFoundMessage % file)
|
UiStrings().FileNotFoundMessage % file)
|
||||||
continue
|
continue
|
||||||
file_list.append(file)
|
file_list.append(file)
|
||||||
return file_list
|
return file_list
|
||||||
|
@ -117,7 +117,9 @@ is the function which has to be called from outside. The generated and returned
|
|||||||
display: table-cell;
|
display: table-cell;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
-webkit-transition: opacity 0.4s ease;
|
-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 {
|
.lyricsmain {
|
||||||
-webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px;
|
-webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; text-shadow: #000000 5px 5px;
|
||||||
@ -720,12 +722,12 @@ def build_lyrics_format_css(theme_data, width, height):
|
|||||||
else:
|
else:
|
||||||
padding_bottom = '0'
|
padding_bottom = '0'
|
||||||
lyrics = '%s word-wrap: break-word; ' \
|
lyrics = '%s word-wrap: break-word; ' \
|
||||||
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
'text-align: %s; vertical-align: %s; font-family: %s; ' \
|
||||||
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \
|
||||||
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \
|
||||||
(justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
|
(justify, align, valign, theme_data.font_main_name, theme_data.font_main_size,
|
||||||
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
|
theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom,
|
||||||
left_margin, width, height)
|
left_margin, width, height)
|
||||||
if theme_data.font_main_italics:
|
if theme_data.font_main_italics:
|
||||||
lyrics += 'font-style:italic; '
|
lyrics += 'font-style:italic; '
|
||||||
if theme_data.font_main_bold:
|
if theme_data.font_main_bold:
|
||||||
|
@ -113,8 +113,8 @@ class Image(object):
|
|||||||
:param path: The image's file path. This should be an existing file path.
|
: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
|
:param source: The source describes the image's origin. Possible values are described in the
|
||||||
:class:`~openlp.core.lib.ImageSource` class.
|
: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
|
:param background: A ``QtGui.QColor`` object specifying the colour to be used to fill the gabs if the image's
|
||||||
match with the display ratio.
|
ratio does not match with the display ratio.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.path = path
|
self.path = path
|
||||||
|
@ -393,4 +393,4 @@ class Plugin(QtCore.QObject, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
The plugin's needs to handle a new song creation
|
The plugin's needs to handle a new song creation
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
@ -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
|
A list of tuples to be used in the search type menu. The first item in the list will be preselected as the
|
||||||
default.
|
default.
|
||||||
|
|
||||||
:param items: The list of tuples to use. The tuples should contain an integer identifier, an icon (QIcon instance or
|
: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::
|
||||||
string) and a title for the item in the menu. In short, they should look like this::
|
|
||||||
|
|
||||||
(<identifier>, <icon>, <title>, <place holder text>)
|
(<identifier>, <icon>, <title>, <place holder text>)
|
||||||
|
|
||||||
@ -179,15 +178,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
correct action on the button, and set the current search type (using the list of identifiers provided by the
|
correct action on the button, and set the current search type (using the list of identifiers provided by the
|
||||||
developer), the ``searchTypeChanged(int)`` signal is emitted with the identifier.
|
developer), the ``searchTypeChanged(int)`` signal is emitted with the identifier.
|
||||||
"""
|
"""
|
||||||
sender = self.sender()
|
|
||||||
for action in self.menu_button.menu().actions():
|
for action in self.menu_button.menu().actions():
|
||||||
|
# Why is this needed?
|
||||||
action.setChecked(False)
|
action.setChecked(False)
|
||||||
self.menu_button.setDefaultAction(sender)
|
self.set_current_search_type(self.sender().data())
|
||||||
self._current_search_type = sender.data()
|
|
||||||
# setplaceholder_text has been implemented in Qt 4.7 and in at least
|
|
||||||
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
|
||||||
try:
|
|
||||||
self.setPlaceholderText(self.menu_button.defaultAction().placeholder_text)
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
self.emit(QtCore.SIGNAL('searchTypeChanged(int)'), self._current_search_type)
|
|
||||||
|
@ -74,11 +74,13 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
|
|||||||
:param name: A string which is set as object name.
|
:param name: A string which is set as object name.
|
||||||
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
|
:param standard_buttons: A list of strings for the used buttons. It might contain: ``ok``, ``save``, ``cancel``,
|
||||||
``close``, and ``defaults``.
|
``close``, and ``defaults``.
|
||||||
:param custom_buttons: A list of additional buttons. If a item is a instance of QtGui.QAbstractButton it is added
|
:param custom_buttons: A list of additional buttons. If an item is an instance of QtGui.QAbstractButton it is added
|
||||||
with QDialogButtonBox.ActionRole. Other wise the item has to be a tuple of a button and a ButtonRole.
|
with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.
|
||||||
"""
|
"""
|
||||||
if custom_buttons is None:
|
if custom_buttons is None:
|
||||||
custom_buttons = []
|
custom_buttons = []
|
||||||
|
if standard_buttons is None:
|
||||||
|
standard_buttons = []
|
||||||
buttons = QtGui.QDialogButtonBox.NoButton
|
buttons = QtGui.QDialogButtonBox.NoButton
|
||||||
if 'ok' in standard_buttons:
|
if 'ok' in standard_buttons:
|
||||||
buttons |= QtGui.QDialogButtonBox.Ok
|
buttons |= QtGui.QDialogButtonBox.Ok
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -263,7 +263,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
Setup the interface translation strings.
|
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.ui_group_box.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
|
||||||
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
|
self.data_directory_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Data Location'))
|
||||||
self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
|
self.recent_label.setText(translate('OpenLP.AdvancedTab', 'Number of recent files to display:'))
|
||||||
@ -319,7 +319,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
|
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
|
||||||
'OpenLP data files. These files WILL be replaced during a copy.'))
|
'OpenLP data files. These files WILL be replaced during a copy.'))
|
||||||
self.display_workaround_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
|
self.display_workaround_group_box.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
|
||||||
self.x11_bypass_check_box.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager'))
|
self.x11_bypass_check_box.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager'))
|
||||||
self.alternate_rows_check_box.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
|
self.alternate_rows_check_box.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
|
||||||
# Slide Limits
|
# Slide Limits
|
||||||
self.slide_group_box.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
self.slide_group_box.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
||||||
@ -375,7 +375,8 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.current_data_path = AppLocation.get_data_path()
|
self.current_data_path = AppLocation.get_data_path()
|
||||||
if not os.path.exists(self.current_data_path):
|
if not os.path.exists(self.current_data_path):
|
||||||
log.error('Data path not found %s' % 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'
|
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n%s\n\n'
|
||||||
'This data directory was previously changed from the OpenLP '
|
'This data directory was previously changed from the OpenLP '
|
||||||
'default location. If the new location was on removable '
|
'default location. If the new location was on removable '
|
||||||
@ -537,8 +538,9 @@ class AdvancedTab(SettingsTab):
|
|||||||
# Make sure they want to change the data.
|
# Make sure they want to change the data.
|
||||||
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
|
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Confirm Data Directory Change'),
|
||||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
|
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 '
|
'location of the OpenLP data directory to:\n\n%s\n\nThe data '
|
||||||
'will be changed when OpenLP is closed.').replace('%s', new_data_path),
|
'directory will be changed when OpenLP is closed.').
|
||||||
|
replace('%s', new_data_path),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
@ -561,8 +563,9 @@ class AdvancedTab(SettingsTab):
|
|||||||
# default.
|
# default.
|
||||||
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
||||||
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
|
translate('OpenLP.AdvancedTab', 'Are you sure you want to change the '
|
||||||
'location of the OpenLP data directory to the default location?\n\nThis'
|
'location of the OpenLP data directory to the default '
|
||||||
' location will be used after OpenLP is closed.'),
|
'location?\n\nThis location will be used after OpenLP is '
|
||||||
|
'closed.'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
@ -588,7 +591,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
else:
|
else:
|
||||||
self.new_data_directory_has_files_label.hide()
|
self.new_data_directory_has_files_label.hide()
|
||||||
|
|
||||||
def check_data_overwrite(self, data_path ):
|
def check_data_overwrite(self, data_path):
|
||||||
"""
|
"""
|
||||||
Check if there's already data in the target directory.
|
Check if there's already data in the target directory.
|
||||||
"""
|
"""
|
||||||
@ -602,8 +605,8 @@ class AdvancedTab(SettingsTab):
|
|||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
|
'WARNING: \n\nThe location you have selected \n\n%s\n\n'
|
||||||
'appears to contain OpenLP data files. Do you wish to '
|
'appears to contain OpenLP data files. Do you wish to '
|
||||||
'replace these files with the current data files?').replace
|
'replace these files with the current data files?').
|
||||||
('%s', os.path.abspath(data_path,)),
|
replace('%s', os.path.abspath(data_path,)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
|
@ -83,9 +83,8 @@ class Ui_ExceptionDialog(object):
|
|||||||
self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
|
self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button',
|
||||||
icon=':/general/general_open.png',
|
icon=':/general/general_open.png',
|
||||||
click=self.on_attach_file_button_clicked)
|
click=self.on_attach_file_button_clicked)
|
||||||
self.button_box = create_button_box(exception_dialog, 'button_box',
|
self.button_box = create_button_box(exception_dialog, 'button_box', ['close'],
|
||||||
['close'], [self.send_report_button,
|
[self.send_report_button, self.save_report_button, self.attach_tile_button])
|
||||||
self.save_report_button, self.attach_tile_button])
|
|
||||||
self.exception_layout.addWidget(self.button_box)
|
self.exception_layout.addWidget(self.button_box)
|
||||||
|
|
||||||
self.retranslateUi(exception_dialog)
|
self.retranslateUi(exception_dialog)
|
||||||
|
@ -157,7 +157,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
|
|||||||
'--- Exception Traceback ---\n%s\n'
|
'--- Exception Traceback ---\n%s\n'
|
||||||
'--- System information ---\n%s\n'
|
'--- System information ---\n%s\n'
|
||||||
'--- Library Versions ---\n%s\n')
|
'--- Library Versions ---\n%s\n')
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
filename = QtGui.QFileDialog.getSaveFileName(
|
||||||
|
self,
|
||||||
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
|
translate('OpenLP.ExceptionForm', 'Save Crash Report'),
|
||||||
Settings().value(self.settings_section + '/last directory'),
|
Settings().value(self.settings_section + '/last directory'),
|
||||||
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
|
translate('OpenLP.ExceptionForm', 'Text files (*.txt *.log *.text)'))
|
||||||
@ -185,14 +186,13 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
|
|||||||
Opening systems default email client and inserting exception log and system information.
|
Opening systems default email client and inserting exception log and system information.
|
||||||
"""
|
"""
|
||||||
body = translate('OpenLP.ExceptionForm',
|
body = translate('OpenLP.ExceptionForm',
|
||||||
'*OpenLP Bug Report*\n'
|
'*OpenLP Bug Report*\n'
|
||||||
'Version: %s\n\n'
|
'Version: %s\n\n'
|
||||||
'--- Details of the Exception. ---\n\n%s\n\n '
|
'--- Details of the Exception. ---\n\n%s\n\n '
|
||||||
'--- Exception Traceback ---\n%s\n'
|
'--- Exception Traceback ---\n%s\n'
|
||||||
'--- System information ---\n%s\n'
|
'--- System information ---\n%s\n'
|
||||||
'--- Library Versions ---\n%s\n',
|
'--- Library Versions ---\n%s\n',
|
||||||
'Please add the information that bug reports are favoured written '
|
'Please add the information that bug reports are favoured written in English.')
|
||||||
'in English.')
|
|
||||||
content = self._create_report()
|
content = self._create_report()
|
||||||
source = ''
|
source = ''
|
||||||
exception = ''
|
exception = ''
|
||||||
|
@ -57,4 +57,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
|
|||||||
else:
|
else:
|
||||||
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
|
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
|
||||||
self.file_name_edit.setFocus()
|
self.file_name_edit.setFocus()
|
||||||
return QtGui.QDialog.exec_(self)
|
return QtGui.QDialog.exec_(self)
|
||||||
|
@ -468,4 +468,4 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
|
|||||||
Set the status of a plugin.
|
Set the status of a plugin.
|
||||||
"""
|
"""
|
||||||
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
|
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
|
||||||
Settings().setValue(tag, status)
|
Settings().setValue(tag, status)
|
||||||
|
@ -174,4 +174,4 @@ class FormattingTagController(object):
|
|||||||
if end and end != end_html:
|
if end and end != end_html:
|
||||||
return translate('OpenLP.FormattingTagForm',
|
return translate('OpenLP.FormattingTagForm',
|
||||||
'End tag %s does not match end tag for start tag %s' % (end, start_html)), None
|
'End tag %s does not match end tag for start tag %s' % (end, start_html)), None
|
||||||
return None, None
|
return None, None
|
||||||
|
@ -102,8 +102,7 @@ class Ui_FormattingTagDialog(object):
|
|||||||
self.edit_button_layout.addWidget(self.delete_button)
|
self.edit_button_layout.addWidget(self.delete_button)
|
||||||
self.edit_button_layout.addStretch()
|
self.edit_button_layout.addStretch()
|
||||||
self.list_data_grid_layout.addLayout(self.edit_button_layout)
|
self.list_data_grid_layout.addLayout(self.edit_button_layout)
|
||||||
self.button_box = create_button_box(formatting_tag_dialog, 'button_box',
|
self.button_box = create_button_box(formatting_tag_dialog, 'button_box', ['cancel', 'save', 'defaults'])
|
||||||
['cancel', 'save', 'defaults'])
|
|
||||||
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
|
self.save_button = self.button_box.button(QtGui.QDialogButtonBox.Save)
|
||||||
self.save_button.setObjectName('save_button')
|
self.save_button.setObjectName('save_button')
|
||||||
self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults)
|
self.restore_button = self.button_box.button(QtGui.QDialogButtonBox.RestoreDefaults)
|
||||||
|
@ -204,4 +204,3 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
|
|||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
#self.tag_table_widget.selectRow(pre_row - 1)
|
#self.tag_table_widget.selectRow(pre_row - 1)
|
||||||
self.tag_table_widget.resizeRowsToContents()
|
self.tag_table_widget.resizeRowsToContents()
|
||||||
|
|
||||||
|
@ -223,7 +223,8 @@ class GeneralTab(SettingsTab):
|
|||||||
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
|
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
|
||||||
'Prompt to save before starting a new service'))
|
'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_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_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
|
||||||
self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
|
self.timeout_spin_box.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
|
||||||
self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
|
self.ccli_group_box.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
|
||||||
|
@ -160,4 +160,4 @@ class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
Returns the number of slides this widget holds.
|
Returns the number of slides this widget holds.
|
||||||
"""
|
"""
|
||||||
return super(ListPreviewWidget, self).rowCount()
|
return super(ListPreviewWidget, self).rowCount()
|
||||||
|
@ -601,4 +601,3 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
|
|||||||
:param signal: The signal to be fired
|
:param signal: The signal to be fired
|
||||||
"""
|
"""
|
||||||
QtCore.QObject.connect(self.media_object, signal, slot)
|
QtCore.QObject.connect(self.media_object, signal, slot)
|
||||||
|
|
||||||
|
@ -598,13 +598,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
self.live_controller.display.setFocus()
|
self.live_controller.display.setFocus()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
if self.arguments:
|
if self.arguments:
|
||||||
args = []
|
self.open_cmd_line_files()
|
||||||
for a in self.arguments:
|
|
||||||
args.extend([a])
|
|
||||||
filename = args[0]
|
|
||||||
if not isinstance(filename, str):
|
|
||||||
filename = str(filename, sys.getfilesystemencoding())
|
|
||||||
self.service_manager_contents.load_file(filename)
|
|
||||||
elif Settings().value(self.general_settings_section + '/auto open'):
|
elif Settings().value(self.general_settings_section + '/auto open'):
|
||||||
self.service_manager_contents.load_Last_file()
|
self.service_manager_contents.load_Last_file()
|
||||||
self.timer_version_id = self.startTimer(1000)
|
self.timer_version_id = self.startTimer(1000)
|
||||||
@ -652,7 +646,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
translate('OpenLP.MainWindow', 'Are you sure you want to re-run the First '
|
translate('OpenLP.MainWindow', 'Are you sure you want to re-run the First '
|
||||||
'Time Wizard?\n\nRe-running this wizard may make changes to your '
|
'Time Wizard?\n\nRe-running this wizard may make changes to your '
|
||||||
'current OpenLP configuration and possibly add songs to your '
|
'current OpenLP configuration and possibly add songs to your '
|
||||||
'#existing songs list and change your default theme.'),
|
'existing songs list and change your default theme.'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
@ -887,7 +881,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
# application terminates normally. We need to exit without saving configuration.
|
# application terminates normally. We need to exit without saving configuration.
|
||||||
QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
|
QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
|
||||||
translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will '
|
translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will '
|
||||||
'be applied the next time you start OpenLP.'),
|
'be applied the next time you start OpenLP.'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
self.settings_imported = True
|
self.settings_imported = True
|
||||||
self.clean_up()
|
self.clean_up()
|
||||||
@ -1042,8 +1036,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
|
ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
|
||||||
translate('OpenLP.MainWindow', 'Are you sure you want to close '
|
translate('OpenLP.MainWindow', 'Are you sure you want to close '
|
||||||
'OpenLP?'),
|
'OpenLP?'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.Yes)
|
QtGui.QMessageBox.Yes)
|
||||||
if ret == QtGui.QMessageBox.Yes:
|
if ret == QtGui.QMessageBox.Yes:
|
||||||
self.clean_up()
|
self.clean_up()
|
||||||
@ -1234,16 +1228,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
self.recent_files_menu.clear()
|
self.recent_files_menu.clear()
|
||||||
for file_id, filename in enumerate(recent_files_to_display):
|
for file_id, filename in enumerate(recent_files_to_display):
|
||||||
log.debug('Recent file name: %s', filename)
|
log.debug('Recent file name: %s', filename)
|
||||||
action = create_action(self, '',
|
action = create_action(self, '', text='&%d %s' % (file_id + 1,
|
||||||
text='&%d %s' % (file_id + 1,
|
|
||||||
os.path.splitext(os.path.basename(str(filename)))[0]), data=filename,
|
os.path.splitext(os.path.basename(str(filename)))[0]), data=filename,
|
||||||
triggers=self.service_manager_contents.on_recent_service_clicked)
|
triggers=self.service_manager_contents.on_recent_service_clicked)
|
||||||
self.recent_files_menu.addAction(action)
|
self.recent_files_menu.addAction(action)
|
||||||
clear_recent_files_action = create_action(self, '',
|
clear_recent_files_action = create_action(self, '',
|
||||||
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of '
|
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of '
|
||||||
'recent files'),
|
'recent files'),
|
||||||
statustip=translate('OpenLP.MainWindow', 'Clear the list of recent '
|
statustip=translate('OpenLP.MainWindow', 'Clear the list of recent '
|
||||||
'files.'),
|
'files.'),
|
||||||
enabled=bool(self.recent_files),
|
enabled=bool(self.recent_files),
|
||||||
triggers=self.clear_recent_file_menu)
|
triggers=self.clear_recent_file_menu)
|
||||||
add_actions(self.recent_files_menu, (None, clear_recent_files_action))
|
add_actions(self.recent_files_menu, (None, clear_recent_files_action))
|
||||||
@ -1352,8 +1345,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
self.application.set_normal_cursor()
|
self.application.set_normal_cursor()
|
||||||
log.exception('Data copy failed %s' % str(why))
|
log.exception('Data copy failed %s' % str(why))
|
||||||
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
||||||
translate('OpenLP.MainWindow',
|
translate('OpenLP.MainWindow', 'OpenLP Data directory copy failed\n\n%s').
|
||||||
'OpenLP Data directory copy failed\n\n%s').replace('%s', str(why)),
|
replace('%s', str(why)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@ -1366,4 +1359,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
|
|||||||
settings.remove('advanced/data path')
|
settings.remove('advanced/data path')
|
||||||
self.application.set_normal_cursor()
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
|
def open_cmd_line_files(self):
|
||||||
|
"""
|
||||||
|
Open files passed in through command line arguments
|
||||||
|
"""
|
||||||
|
args = []
|
||||||
|
for a in self.arguments:
|
||||||
|
args.extend([a])
|
||||||
|
for arg in args:
|
||||||
|
filename = arg
|
||||||
|
if not isinstance(filename, str):
|
||||||
|
filename = str(filename, sys.getfilesystemencoding())
|
||||||
|
if filename.endswith(('.osz', '.oszl')):
|
||||||
|
self.service_manager_contents.load_file(filename)
|
||||||
|
@ -383,7 +383,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
if not is_valid:
|
if not is_valid:
|
||||||
# Media could not be loaded correctly
|
# Media could not be loaded correctly
|
||||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||||
return False
|
return False
|
||||||
# dont care about actual theme, set a black background
|
# dont care about actual theme, set a black background
|
||||||
if controller.is_live and not controller.media_info.is_background:
|
if controller.is_live and not controller.media_info.is_background:
|
||||||
@ -402,7 +402,7 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
if autoplay:
|
if autoplay:
|
||||||
if not self.media_play(controller):
|
if not self.media_play(controller):
|
||||||
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
critical_error_message_box(translate('MediaPlugin.MediaItem', 'Unsupported File'),
|
||||||
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
translate('MediaPlugin.MediaItem', 'Unsupported File'))
|
||||||
return False
|
return False
|
||||||
self.set_controls_visible(controller, True)
|
self.set_controls_visible(controller, True)
|
||||||
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
|
log.debug('use %s controller' % self.current_media_players[controller.controller_type])
|
||||||
@ -644,9 +644,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
return
|
return
|
||||||
display = self._define_display(self.live_controller)
|
display = self._define_display(self.live_controller)
|
||||||
if self.live_controller.controller_type in self.current_media_players and \
|
if self.live_controller.controller_type in self.current_media_players and \
|
||||||
self.current_media_players[self.live_controller.controller_type].state == MediaState.Playing:
|
self.current_media_players[self.live_controller.controller_type].state == MediaState.Playing:
|
||||||
self.current_media_players[self.live_controller.controller_type].pause(display)
|
self.current_media_players[self.live_controller.controller_type].pause(display)
|
||||||
self.current_media_players[self.live_controller.controller_type].set_visible(display, False)
|
self.current_media_players[self.live_controller.controller_type].set_visible(display, False)
|
||||||
|
|
||||||
def media_blank(self, msg):
|
def media_blank(self, msg):
|
||||||
"""
|
"""
|
||||||
@ -701,4 +701,4 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
if controller.is_live:
|
if controller.is_live:
|
||||||
return controller.display
|
return controller.display
|
||||||
return controller.preview_display
|
return controller.preview_display
|
||||||
|
@ -150,4 +150,4 @@ class MediaPlayer(RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
Returns Information about the player
|
Returns Information about the player
|
||||||
"""
|
"""
|
||||||
return ''
|
return ''
|
||||||
|
@ -105,7 +105,7 @@ class PhononPlayer(MediaPlayer):
|
|||||||
if ext not in mime_type_list:
|
if ext not in mime_type_list:
|
||||||
mime_type_list.append(ext)
|
mime_type_list.append(ext)
|
||||||
log.info('MediaPlugin: %s additional extensions: %s' %
|
log.info('MediaPlugin: %s additional extensions: %s' %
|
||||||
(mimetype, ' '.join(self.additional_extensions[mimetype])))
|
(mimetype, ' '.join(self.additional_extensions[mimetype])))
|
||||||
|
|
||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
"""
|
"""
|
||||||
|
66
openlp/core/ui/media/vendor/vlc.py
vendored
66
openlp/core/ui/media/vendor/vlc.py
vendored
@ -48,13 +48,13 @@ import sys
|
|||||||
from inspect import getargspec
|
from inspect import getargspec
|
||||||
|
|
||||||
__version__ = "N/A"
|
__version__ = "N/A"
|
||||||
build_date = "Mon Apr 1 23:47:38 2013"
|
build_date = "Tue Jul 2 10:35:53 2013"
|
||||||
|
|
||||||
if sys.version_info[0] > 2:
|
if sys.version_info[0] > 2:
|
||||||
str = str
|
str = str
|
||||||
str = str
|
unicode = str
|
||||||
bytes = bytes
|
bytes = bytes
|
||||||
str = (str, bytes)
|
basestring = (str, bytes)
|
||||||
PYTHON3 = True
|
PYTHON3 = True
|
||||||
def str_to_bytes(s):
|
def str_to_bytes(s):
|
||||||
"""Translate string or bytes to bytes.
|
"""Translate string or bytes to bytes.
|
||||||
@ -73,14 +73,14 @@ if sys.version_info[0] > 2:
|
|||||||
return b
|
return b
|
||||||
else:
|
else:
|
||||||
str = str
|
str = str
|
||||||
str = str
|
unicode = unicode
|
||||||
bytes = str
|
bytes = str
|
||||||
str = str
|
basestring = basestring
|
||||||
PYTHON3 = False
|
PYTHON3 = False
|
||||||
def str_to_bytes(s):
|
def str_to_bytes(s):
|
||||||
"""Translate string or bytes to bytes.
|
"""Translate string or bytes to bytes.
|
||||||
"""
|
"""
|
||||||
if isinstance(s, str):
|
if isinstance(s, unicode):
|
||||||
return s.encode(sys.getfilesystemencoding())
|
return s.encode(sys.getfilesystemencoding())
|
||||||
else:
|
else:
|
||||||
return s
|
return s
|
||||||
@ -89,7 +89,7 @@ else:
|
|||||||
"""Translate bytes to unicode string.
|
"""Translate bytes to unicode string.
|
||||||
"""
|
"""
|
||||||
if isinstance(b, str):
|
if isinstance(b, str):
|
||||||
return str(b, sys.getfilesystemencoding())
|
return unicode(b, sys.getfilesystemencoding())
|
||||||
else:
|
else:
|
||||||
return b
|
return b
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ def find_lib():
|
|||||||
p = find_library('libvlc.dll')
|
p = find_library('libvlc.dll')
|
||||||
if p is None:
|
if p is None:
|
||||||
try: # some registry settings
|
try: # some registry settings
|
||||||
import winreg as w # leaner than win32api, win32con
|
import _winreg as w # leaner than win32api, win32con
|
||||||
for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:
|
for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:
|
||||||
try:
|
try:
|
||||||
r = w.OpenKey(r, 'Software\\VideoLAN\\VLC')
|
r = w.OpenKey(r, 'Software\\VideoLAN\\VLC')
|
||||||
@ -168,7 +168,7 @@ class VLCException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_Ints = (int, int)
|
_Ints = (int, long)
|
||||||
except NameError: # no long in Python 3+
|
except NameError: # no long in Python 3+
|
||||||
_Ints = int
|
_Ints = int
|
||||||
_Seqs = (list, tuple)
|
_Seqs = (list, tuple)
|
||||||
@ -327,6 +327,9 @@ class _Enum(ctypes.c_uint):
|
|||||||
n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,))
|
n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,))
|
||||||
return '.'.join((self.__class__.__name__, n))
|
return '.'.join((self.__class__.__name__, n))
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return self.value
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '.'.join((self.__class__.__module__, self.__str__()))
|
return '.'.join((self.__class__.__module__, self.__str__()))
|
||||||
|
|
||||||
@ -1294,7 +1297,7 @@ class Instance(_Ctype):
|
|||||||
i = args[0]
|
i = args[0]
|
||||||
if isinstance(i, _Ints):
|
if isinstance(i, _Ints):
|
||||||
return _Constructor(cls, i)
|
return _Constructor(cls, i)
|
||||||
elif isinstance(i, str):
|
elif isinstance(i, basestring):
|
||||||
args = i.strip().split()
|
args = i.strip().split()
|
||||||
elif isinstance(i, _Seqs):
|
elif isinstance(i, _Seqs):
|
||||||
args = i
|
args = i
|
||||||
@ -2078,7 +2081,7 @@ class MediaList(_Ctype):
|
|||||||
@param mrl: a media instance or a MRL.
|
@param mrl: a media instance or a MRL.
|
||||||
@return: 0 on success, -1 if the media list is read-only.
|
@return: 0 on success, -1 if the media list is read-only.
|
||||||
"""
|
"""
|
||||||
if isinstance(mrl, str):
|
if isinstance(mrl, basestring):
|
||||||
mrl = (self.get_instance() or get_default_instance()).media_new(mrl)
|
mrl = (self.get_instance() or get_default_instance()).media_new(mrl)
|
||||||
return libvlc_media_list_add_media(self, mrl)
|
return libvlc_media_list_add_media(self, mrl)
|
||||||
|
|
||||||
@ -3351,6 +3354,39 @@ def libvlc_event_type_name(event_type):
|
|||||||
ctypes.c_char_p, ctypes.c_uint)
|
ctypes.c_char_p, ctypes.c_uint)
|
||||||
return f(event_type)
|
return f(event_type)
|
||||||
|
|
||||||
|
def libvlc_log_get_context(ctx):
|
||||||
|
'''Gets debugging informations about a log message: the name of the VLC module
|
||||||
|
emitting the message and the message location within the source code.
|
||||||
|
The returned module name and file name will be NULL if unknown.
|
||||||
|
The returned line number will similarly be zero if unknown.
|
||||||
|
@param ctx: message context (as passed to the @ref libvlc_log_cb callback).
|
||||||
|
@return: module module name storage (or NULL), file source code file name storage (or NULL), line source code file line number storage (or NULL).
|
||||||
|
@version: LibVLC 2.1.0 or later.
|
||||||
|
'''
|
||||||
|
f = _Cfunctions.get('libvlc_log_get_context', None) or \
|
||||||
|
_Cfunction('libvlc_log_get_context', ((1,), (2,), (2,), (2,),), None,
|
||||||
|
None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint))
|
||||||
|
return f(ctx)
|
||||||
|
|
||||||
|
def libvlc_log_get_object(ctx, id):
|
||||||
|
'''Gets VLC object informations about a log message: the type name of the VLC
|
||||||
|
object emitting the message, the object header if any and a temporaly-unique
|
||||||
|
object identifier. These informations are mainly meant for B{manual}
|
||||||
|
troubleshooting.
|
||||||
|
The returned type name may be "generic" if unknown, but it cannot be NULL.
|
||||||
|
The returned header will be NULL if unset; in current versions, the header
|
||||||
|
is used to distinguish for VLM inputs.
|
||||||
|
The returned object ID will be zero if the message is not associated with
|
||||||
|
any VLC object.
|
||||||
|
@param ctx: message context (as passed to the @ref libvlc_log_cb callback).
|
||||||
|
@return: name object name storage (or NULL), header object header (or NULL), line source code file line number storage (or NULL).
|
||||||
|
@version: LibVLC 2.1.0 or later.
|
||||||
|
'''
|
||||||
|
f = _Cfunctions.get('libvlc_log_get_object', None) or \
|
||||||
|
_Cfunction('libvlc_log_get_object', ((1,), (2,), (2,), (1,),), None,
|
||||||
|
None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint))
|
||||||
|
return f(ctx, id)
|
||||||
|
|
||||||
def libvlc_log_unset(p_instance):
|
def libvlc_log_unset(p_instance):
|
||||||
'''Unsets the logging callback for a LibVLC instance. This is rarely needed:
|
'''Unsets the logging callback for a LibVLC instance. This is rarely needed:
|
||||||
the callback is implicitly unset when the instance is destroyed.
|
the callback is implicitly unset when the instance is destroyed.
|
||||||
@ -5827,7 +5863,7 @@ def libvlc_vlm_get_event_manager(p_instance):
|
|||||||
# libvlc_printerr
|
# libvlc_printerr
|
||||||
# libvlc_set_exit_handler
|
# libvlc_set_exit_handler
|
||||||
|
|
||||||
# 15 function(s) not wrapped as methods:
|
# 17 function(s) not wrapped as methods:
|
||||||
# libvlc_audio_output_device_list_release
|
# libvlc_audio_output_device_list_release
|
||||||
# libvlc_audio_output_list_release
|
# libvlc_audio_output_list_release
|
||||||
# libvlc_clearerr
|
# libvlc_clearerr
|
||||||
@ -5838,6 +5874,8 @@ def libvlc_vlm_get_event_manager(p_instance):
|
|||||||
# libvlc_get_changeset
|
# libvlc_get_changeset
|
||||||
# libvlc_get_compiler
|
# libvlc_get_compiler
|
||||||
# libvlc_get_version
|
# libvlc_get_version
|
||||||
|
# libvlc_log_get_context
|
||||||
|
# libvlc_log_get_object
|
||||||
# libvlc_media_tracks_release
|
# libvlc_media_tracks_release
|
||||||
# libvlc_module_description_list_release
|
# libvlc_module_description_list_release
|
||||||
# libvlc_new
|
# libvlc_new
|
||||||
@ -5910,9 +5948,9 @@ def debug_callback(event, *args, **kwds):
|
|||||||
'''
|
'''
|
||||||
l = ['event %s' % (event.type,)]
|
l = ['event %s' % (event.type,)]
|
||||||
if args:
|
if args:
|
||||||
l.extend(list(map(str, args)))
|
l.extend(map(str, args))
|
||||||
if kwds:
|
if kwds:
|
||||||
l.extend(sorted('%s=%s' % t for t in list(kwds.items())))
|
l.extend(sorted('%s=%s' % t for t in kwds.items()))
|
||||||
print('Debug callback (%s)' % ', '.join(l))
|
print('Debug callback (%s)' % ', '.join(l))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -291,4 +291,4 @@ class VlcPlayer(MediaPlayer):
|
|||||||
'<br/> <strong>' + translate('Media.player', 'Audio') +
|
'<br/> <strong>' + translate('Media.player', 'Audio') +
|
||||||
'</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
|
'</strong><br/>' + str(AUDIO_EXT) + '<br/><strong>' +
|
||||||
translate('Media.player', 'Video') + '</strong><br/>' +
|
translate('Media.player', 'Video') + '</strong><br/>' +
|
||||||
str(VIDEO_EXT) + '<br/>')
|
str(VIDEO_EXT) + '<br/>')
|
||||||
|
@ -154,4 +154,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
|
|||||||
elif self.active_plugin.status == PluginStatus.Disabled:
|
elif self.active_plugin.status == PluginStatus.Disabled:
|
||||||
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
||||||
self.plugin_list_widget.currentItem().setText(
|
self.plugin_list_widget.currentItem().setText(
|
||||||
status_text % self.active_plugin.name_strings['singular'])
|
status_text % self.active_plugin.name_strings['singular'])
|
||||||
|
@ -394,4 +394,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties)
|
|||||||
return
|
return
|
||||||
for item in self.service_manager.service_items:
|
for item in self.service_manager.service_items:
|
||||||
# Trigger Audit requests
|
# Trigger Audit requests
|
||||||
Registry().register_function('print_service_started', [item['service_item']])
|
Registry().register_function('print_service_started', [item['service_item']])
|
||||||
|
@ -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:
|
if self._file_name.endswith('oszl') or self.service_has_all_original_files:
|
||||||
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite '
|
'OpenLP Service Files (*.osz);; OpenLP Service '
|
||||||
'(*.oszl)'))
|
'Files - lite (*.oszl)'))
|
||||||
else:
|
else:
|
||||||
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||||
translate('OpenLP.ServiceManager',
|
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)
|
self.log_exception('Service file is cannot be extracted as zip: %s' % file_name)
|
||||||
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
|
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
|
||||||
translate('OpenLP.ServiceManager',
|
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()
|
self.application.set_normal_cursor()
|
||||||
return
|
return
|
||||||
finally:
|
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())
|
tree_widget_item.setText(0, service_item_from_item.get_display_title())
|
||||||
tips = []
|
tips = []
|
||||||
if service_item_from_item.temporary_edit:
|
if service_item_from_item.temporary_edit:
|
||||||
tips.append('<strong>%s:</strong> <em>%s</em>' %
|
tips.append('<strong>%s:</strong> <em>%s</em>' % (translate('OpenLP.ServiceManager', 'Edit'),
|
||||||
(translate('OpenLP.ServiceManager', 'Edit'),
|
|
||||||
(translate('OpenLP.ServiceManager', 'Service copy only'))))
|
(translate('OpenLP.ServiceManager', 'Service copy only'))))
|
||||||
if service_item_from_item.theme and service_item_from_item.theme != -1:
|
if service_item_from_item.theme and service_item_from_item.theme != -1:
|
||||||
tips.append('<strong>%s:</strong> <em>%s</em>' %
|
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):
|
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
|
Finds the first selected ServiceItem in the list and returns the position of the service_item_from_item and its
|
||||||
child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service
|
selected child item. For example, if the third child item (in the Slidecontroller known as slide) in the
|
||||||
item is selected this will return::
|
second service item is selected this will return::
|
||||||
|
|
||||||
(1, 2)
|
(1, 2)
|
||||||
"""
|
"""
|
||||||
@ -1632,4 +1632,4 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
|
|||||||
Print a Service Order Sheet.
|
Print a Service Order Sheet.
|
||||||
"""
|
"""
|
||||||
setting_dialog = PrintServiceForm()
|
setting_dialog = PrintServiceForm()
|
||||||
setting_dialog.exec_()
|
setting_dialog.exec_()
|
||||||
|
@ -74,4 +74,4 @@ class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
Translate the UI on the fly
|
Translate the UI on the fly
|
||||||
"""
|
"""
|
||||||
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||||
|
@ -151,4 +151,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
|
|||||||
:param function: The function to be called
|
:param function: The function to be called
|
||||||
"""
|
"""
|
||||||
if not function in self.processes:
|
if not function in self.processes:
|
||||||
self.processes.append(function)
|
self.processes.append(function)
|
||||||
|
@ -285,7 +285,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties)
|
|||||||
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
||||||
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
||||||
'shortcuts to their defaults?'),
|
'shortcuts to their defaults?'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
self._adjust_button(self.primary_push_button, False, text='')
|
self._adjust_button(self.primary_push_button, False, text='')
|
||||||
|
@ -170,14 +170,14 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
|
size_toolbar_policy.setHeightForWidth(self.toolbar.sizePolicy().hasHeightForWidth())
|
||||||
self.toolbar.setSizePolicy(size_toolbar_policy)
|
self.toolbar.setSizePolicy(size_toolbar_policy)
|
||||||
self.previous_item = create_action(self, 'previousItem_' + self.type_prefix,
|
self.previous_item = create_action(self, 'previousItem_' + self.type_prefix,
|
||||||
text=translate('OpenLP.SlideController', 'Previous Slide'),
|
text=translate('OpenLP.SlideController', 'Previous Slide'),
|
||||||
icon=':/slides/slide_previous.png',
|
icon=':/slides/slide_previous.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
|
tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
category=self.category, triggers=self.on_slide_selected_previous)
|
category=self.category, triggers=self.on_slide_selected_previous)
|
||||||
self.toolbar.addAction(self.previous_item)
|
self.toolbar.addAction(self.previous_item)
|
||||||
self.next_item = create_action(self, 'nextItem_' + self.type_prefix,
|
self.next_item = create_action(self, 'nextItem_' + self.type_prefix,
|
||||||
text=translate('OpenLP.SlideController', 'Next Slide'),
|
text=translate('OpenLP.SlideController', 'Next Slide'),
|
||||||
icon=':/slides/slide_next.png',
|
icon=':/slides/slide_next.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Move to next.'),
|
tooltip=translate('OpenLP.SlideController', 'Move to next.'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
@ -195,17 +195,17 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
|
self.hide_menu.setMenu(QtGui.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
|
||||||
self.toolbar.add_toolbar_widget(self.hide_menu)
|
self.toolbar.add_toolbar_widget(self.hide_menu)
|
||||||
self.blank_screen = create_action(self, 'blankScreen',
|
self.blank_screen = create_action(self, 'blankScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Blank Screen'),
|
text=translate('OpenLP.SlideController', 'Blank Screen'),
|
||||||
icon=':/slides/slide_blank.png',
|
icon=':/slides/slide_blank.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category,
|
checked=False, can_shortcuts=True, category=self.category,
|
||||||
triggers=self.on_blank_display)
|
triggers=self.on_blank_display)
|
||||||
self.theme_screen = create_action(self, 'themeScreen',
|
self.theme_screen = create_action(self, 'themeScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Blank to Theme'),
|
text=translate('OpenLP.SlideController', 'Blank to Theme'),
|
||||||
icon=':/slides/slide_theme.png',
|
icon=':/slides/slide_theme.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category,
|
checked=False, can_shortcuts=True, category=self.category,
|
||||||
triggers=self.on_theme_display)
|
triggers=self.on_theme_display)
|
||||||
self.desktop_screen = create_action(self, 'desktopScreen',
|
self.desktop_screen = create_action(self, 'desktopScreen',
|
||||||
text=translate('OpenLP.SlideController', 'Show Desktop'),
|
text=translate('OpenLP.SlideController', 'Show Desktop'),
|
||||||
icon=':/slides/slide_desktop.png',
|
icon=':/slides/slide_desktop.png',
|
||||||
checked=False, can_shortcuts=True, category=self.category,
|
checked=False, can_shortcuts=True, category=self.category,
|
||||||
triggers=self.on_hide_display)
|
triggers=self.on_hide_display)
|
||||||
@ -255,15 +255,16 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
self.toolbar.add_toolbar_widget(self.delay_spin_box)
|
self.toolbar.add_toolbar_widget(self.delay_spin_box)
|
||||||
else:
|
else:
|
||||||
self.toolbar.add_toolbar_action('goLive', icon=':/general/general_live.png',
|
self.toolbar.add_toolbar_action('goLive', icon=':/general/general_live.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Move to live.'),
|
tooltip=translate('OpenLP.SlideController', 'Move to live.'),
|
||||||
triggers=self.on_go_live)
|
triggers=self.on_go_live)
|
||||||
self.toolbar.add_toolbar_action('addToService', icon=':/general/general_add.png',
|
self.toolbar.add_toolbar_action('addToService', icon=':/general/general_add.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Add to Service.'),
|
tooltip=translate('OpenLP.SlideController', 'Add to Service.'),
|
||||||
triggers=self.on_preview_add_to_service)
|
triggers=self.on_preview_add_to_service)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png',
|
self.toolbar.add_toolbar_action('editSong', icon=':/general/general_edit.png',
|
||||||
tooltip=translate('OpenLP.SlideController', 'Edit and reload song preview.')
|
tooltip=translate('OpenLP.SlideController',
|
||||||
, triggers=self.on_edit_song)
|
'Edit and reload song preview.'),
|
||||||
|
triggers=self.on_edit_song)
|
||||||
self.controller_layout.addWidget(self.toolbar)
|
self.controller_layout.addWidget(self.toolbar)
|
||||||
# Build the Media Toolbar
|
# Build the Media Toolbar
|
||||||
self.media_controller.register_controller(self)
|
self.media_controller.register_controller(self)
|
||||||
@ -355,7 +356,7 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
{'key': 'O', 'configurable': True, 'text': translate('OpenLP.SlideController', 'Go to "Other"')}
|
{'key': 'O', 'configurable': True, 'text': translate('OpenLP.SlideController', 'Go to "Other"')}
|
||||||
]
|
]
|
||||||
shortcuts.extend([{'key': str(number)} for number in range(10)])
|
shortcuts.extend([{'key': str(number)} for number in range(10)])
|
||||||
self.controller.addActions([create_action(self, 'shortcutAction_%s' % s['key'],
|
self.controller.addActions([create_action(self, 'shortcutAction_%s' % s['key'],
|
||||||
text=s.get('text'),
|
text=s.get('text'),
|
||||||
can_shortcuts=True,
|
can_shortcuts=True,
|
||||||
context=QtCore.Qt.WidgetWithChildrenShortcut,
|
context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
@ -394,9 +395,9 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
Called, when a shortcut has been activated to jump to a chorus, verse, etc.
|
Called, when a shortcut has been activated to jump to a chorus, verse, etc.
|
||||||
|
|
||||||
**Note**: This implementation is based on shortcuts. But it rather works like "key sequenes". You have to
|
**Note**: This implementation is based on shortcuts. But it rather works like "key sequenes". You have to
|
||||||
press one key after the other and **not** at the same time.
|
press one key after the other and **not** at the same time.
|
||||||
For example to jump to "V3" you have to press "V" and afterwards but within a time frame of 350ms
|
For example to jump to "V3" you have to press "V" and afterwards but within a time frame of 350ms
|
||||||
you have to press "3".
|
you have to press "3".
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -456,21 +457,21 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
self.previous_service = create_action(parent, 'previousService',
|
self.previous_service = create_action(parent, 'previousService',
|
||||||
text=translate('OpenLP.SlideController', 'Previous Service'),
|
text=translate('OpenLP.SlideController', 'Previous Service'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
category=self.category,
|
category=self.category,
|
||||||
triggers=self.service_previous)
|
triggers=self.service_previous)
|
||||||
self.next_service = create_action(parent, 'nextService',
|
self.next_service = create_action(parent, 'nextService',
|
||||||
text=translate('OpenLP.SlideController', 'Next Service'),
|
text=translate('OpenLP.SlideController', 'Next Service'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
category=self.category,
|
category=self.category,
|
||||||
triggers=self.service_next)
|
triggers=self.service_next)
|
||||||
self.escape_item = create_action(parent, 'escapeItem',
|
self.escape_item = create_action(parent, 'escapeItem',
|
||||||
text=translate('OpenLP.SlideController', 'Escape Item'),
|
text=translate('OpenLP.SlideController', 'Escape Item'),
|
||||||
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
|
||||||
category=self.category,
|
category=self.category,
|
||||||
triggers=self.live_escape)
|
triggers=self.live_escape)
|
||||||
|
|
||||||
def live_escape(self):
|
def live_escape(self, field=None):
|
||||||
"""
|
"""
|
||||||
If you press ESC on the live screen it should close the display temporarily.
|
If you press ESC on the live screen it should close the display temporarily.
|
||||||
"""
|
"""
|
||||||
@ -1038,7 +1039,6 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
self.preview_widget.change_slide(row)
|
self.preview_widget.change_slide(row)
|
||||||
self.update_preview()
|
self.update_preview()
|
||||||
Registry().execute('slidecontroller_%s_changed' % self.type_prefix, row)
|
|
||||||
|
|
||||||
def update_preview(self):
|
def update_preview(self):
|
||||||
"""
|
"""
|
||||||
@ -1242,7 +1242,7 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
if self.service_item:
|
if self.service_item:
|
||||||
self.service_manager.add_service_item(self.service_item)
|
self.service_manager.add_service_item(self.service_item)
|
||||||
|
|
||||||
def on_go_live_click(self):
|
def on_go_live_click(self, field=None):
|
||||||
"""
|
"""
|
||||||
triggered by clicking the Preview slide items
|
triggered by clicking the Preview slide items
|
||||||
"""
|
"""
|
||||||
@ -1255,7 +1255,7 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
self.on_media_close()
|
self.on_media_close()
|
||||||
self.on_go_live()
|
self.on_go_live()
|
||||||
|
|
||||||
def on_go_live(self):
|
def on_go_live(self, field=None):
|
||||||
"""
|
"""
|
||||||
If preview copy slide item to live controller from Preview Controller
|
If preview copy slide item to live controller from Preview Controller
|
||||||
"""
|
"""
|
||||||
@ -1325,7 +1325,7 @@ class SlideController(DisplayController, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
Update how much time is remaining
|
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
|
seconds = self.display.audio_player.media_object.remainingTime() // 1000
|
||||||
minutes = seconds // 60
|
minutes = seconds // 60
|
||||||
|
@ -74,12 +74,12 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
|
|||||||
self.minute_finish_spin_box.value() * 60 + self.second_finish_spin_box.value()
|
self.minute_finish_spin_box.value() * 60 + self.second_finish_spin_box.value()
|
||||||
if end > self.item['service_item'].media_length:
|
if end > self.item['service_item'].media_length:
|
||||||
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
||||||
message=translate('OpenLP.StartTime_form',
|
message=translate('OpenLP.StartTime_form',
|
||||||
'Finish time is set after the end of the media item'))
|
'Finish time is set after the end of the media item'))
|
||||||
return
|
return
|
||||||
elif start > end:
|
elif start > end:
|
||||||
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
||||||
message=translate('OpenLP.StartTime_form',
|
message=translate('OpenLP.StartTime_form',
|
||||||
'Start time is after the finish time of the media item'))
|
'Start time is after the finish time of the media item'))
|
||||||
return
|
return
|
||||||
self.item['service_item'].start_time = start
|
self.item['service_item'].start_time = start
|
||||||
@ -94,4 +94,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
|
|||||||
seconds -= 3600 * hours
|
seconds -= 3600 * hours
|
||||||
minutes = seconds // 60
|
minutes = seconds // 60
|
||||||
seconds -= 60 * minutes
|
seconds -= 60 * minutes
|
||||||
return hours, minutes, seconds
|
return hours, minutes, seconds
|
||||||
|
@ -180,7 +180,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
|
|||||||
self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
|
self.theme.background_type == background_image and is_not_image_file(self.theme.background_filename):
|
||||||
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
|
QtGui.QMessageBox.critical(self, translate('OpenLP.ThemeWizard', 'Background Image Empty'),
|
||||||
translate('OpenLP.ThemeWizard', '_you have not selected a '
|
translate('OpenLP.ThemeWizard', '_you have not selected a '
|
||||||
'background image. Please select one before continuing.'))
|
'background image. Please select one before continuing.'))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@ -540,4 +540,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
|
|||||||
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
|
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
|
||||||
if new_color.isValid():
|
if new_color.isValid():
|
||||||
field = new_color.name()
|
field = new_color.name()
|
||||||
return field
|
return field
|
||||||
|
@ -517,7 +517,7 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
|
|||||||
"""
|
"""
|
||||||
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
|
ret = QtGui.QMessageBox.question(self, translate('OpenLP.ThemeManager', 'Theme Already Exists'),
|
||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'Theme %s already exists. Do you want to replace it?')
|
'Theme %s already exists. Do you want to replace it?')
|
||||||
.replace('%s', theme_name),
|
.replace('%s', theme_name),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No),
|
QtGui.QMessageBox.No),
|
||||||
@ -753,4 +753,4 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
|
|||||||
% (theme, plugin.name))
|
% (theme, plugin.name))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -385,10 +385,10 @@ class Ui_ThemeWizard(object):
|
|||||||
QtCore.SLOT('setDisabled(bool)'))
|
QtCore.SLOT('setDisabled(bool)'))
|
||||||
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
|
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_y_spin_box,
|
||||||
QtCore.SLOT('setDisabled(bool)'))
|
QtCore.SLOT('setDisabled(bool)'))
|
||||||
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'), self.footer_width_spin_box,
|
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
|
||||||
QtCore.SLOT('setDisabled(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.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
|
||||||
QtCore.SLOT('setDisabled(bool)'))
|
self.footer_height_spin_box, QtCore.SLOT('setDisabled(bool)'))
|
||||||
|
|
||||||
def retranslateUi(self, themeWizard):
|
def retranslateUi(self, themeWizard):
|
||||||
"""
|
"""
|
||||||
@ -409,15 +409,18 @@ class Ui_ThemeWizard(object):
|
|||||||
self.background_combo_box.setItemText(BackgroundType.Gradient,
|
self.background_combo_box.setItemText(BackgroundType.Gradient,
|
||||||
translate('OpenLP.ThemeWizard', 'Gradient'))
|
translate('OpenLP.ThemeWizard', 'Gradient'))
|
||||||
self.background_combo_box.setItemText(BackgroundType.Image, UiStrings().Image)
|
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.color_label.setText(translate('OpenLP.ThemeWizard', 'color:'))
|
||||||
self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
|
self.gradient_start_label.setText(translate('OpenLP.ThemeWizard', 'Starting color:'))
|
||||||
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
|
self.gradient_end_label.setText(translate('OpenLP.ThemeWizard', 'Ending color:'))
|
||||||
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
|
self.gradient_type_label.setText(translate('OpenLP.ThemeWizard', 'Gradient:'))
|
||||||
self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal,
|
self.gradient_combo_box.setItemText(BackgroundGradientType.Horizontal,
|
||||||
translate('OpenLP.ThemeWizard', 'Horizontal'))
|
translate('OpenLP.ThemeWizard', 'Horizontal'))
|
||||||
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical, translate('OpenLP.ThemeWizard', 'Vertical'))
|
self.gradient_combo_box.setItemText(BackgroundGradientType.Vertical,
|
||||||
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular, translate('OpenLP.ThemeWizard', 'Circular'))
|
translate('OpenLP.ThemeWizard', 'Vertical'))
|
||||||
|
self.gradient_combo_box.setItemText(BackgroundGradientType.Circular,
|
||||||
|
translate('OpenLP.ThemeWizard', 'Circular'))
|
||||||
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop,
|
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftTop,
|
||||||
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
|
translate('OpenLP.ThemeWizard', 'Top Left - Bottom Right'))
|
||||||
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom,
|
self.gradient_combo_box.setItemText(BackgroundGradientType.LeftBottom,
|
||||||
@ -486,6 +489,6 @@ class Ui_ThemeWizard(object):
|
|||||||
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
|
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
|
||||||
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
|
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))
|
||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
label_width = max(self.background_label.minimumSizeHint().width(),
|
label_width = max(self.background_label.minimumSizeHint().width(),
|
||||||
self.horizontal_label.minimumSizeHint().width())
|
self.horizontal_label.minimumSizeHint().width())
|
||||||
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
|
@ -303,4 +303,4 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
|
|||||||
QtGui.QFileDialog.ShowDirsOnly)
|
QtGui.QFileDialog.ShowDirsOnly)
|
||||||
if folder:
|
if folder:
|
||||||
editbox.setText(folder)
|
editbox.setText(folder)
|
||||||
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)
|
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)
|
||||||
|
@ -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'
|
'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36'
|
||||||
],
|
],
|
||||||
'darwin': [
|
'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_8_3) AppleWebKit/537.31 (KHTML, like Gecko) '
|
||||||
'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',
|
'Chrome/26.0.1410.43 Safari/537.31',
|
||||||
'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_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': [
|
'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; Linux i686) AppleWebKit/537.22 (KHTML, like Gecko) Ubuntu Chromium/25.0.1364.160 '
|
||||||
'Mozilla/5.0 (X11; CrOS armv7l 2913.260.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.99 Safari/537.11',
|
'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'
|
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.27 (KHTML, like Gecko) Chrome/26.0.1389.0 Safari/537.27'
|
||||||
],
|
],
|
||||||
'default': [
|
'default': [
|
||||||
@ -144,9 +149,9 @@ def get_application_version():
|
|||||||
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision
|
||||||
# number in the full version.
|
# number in the full version.
|
||||||
if tree_revision == tag_revision:
|
if tree_revision == tag_revision:
|
||||||
full_version = tag_version
|
full_version = tag_version
|
||||||
else:
|
else:
|
||||||
full_version = '%s-bzr%s' % (tag_version, tree_revision)
|
full_version = '%s-bzr%s' % (tag_version, tree_revision)
|
||||||
else:
|
else:
|
||||||
# We're not running the development version, let's use the file.
|
# We're not running the development version, let's use the file.
|
||||||
filepath = AppLocation.get_directory(AppLocation.VersionDir)
|
filepath = AppLocation.get_directory(AppLocation.VersionDir)
|
||||||
|
@ -295,7 +295,7 @@ class ActionList(object):
|
|||||||
ActionList.shortcut_map[shortcuts[1]] = actions
|
ActionList.shortcut_map[shortcuts[1]] = actions
|
||||||
else:
|
else:
|
||||||
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
|
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
|
||||||
(shortcuts[1], action.objectName()))
|
(shortcuts[1], action.objectName()))
|
||||||
shortcuts.remove(shortcuts[1])
|
shortcuts.remove(shortcuts[1])
|
||||||
# Check the primary shortcut.
|
# Check the primary shortcut.
|
||||||
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
||||||
@ -306,7 +306,7 @@ class ActionList(object):
|
|||||||
ActionList.shortcut_map[shortcuts[0]] = actions
|
ActionList.shortcut_map[shortcuts[0]] = actions
|
||||||
else:
|
else:
|
||||||
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
|
log.warn('Shortcut "%s" is removed from "%s" because another action already uses this shortcut.' %
|
||||||
(shortcuts[0], action.objectName()))
|
(shortcuts[0], action.objectName()))
|
||||||
shortcuts.remove(shortcuts[0])
|
shortcuts.remove(shortcuts[0])
|
||||||
action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
|
action.setShortcuts([QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class LanguageManager(object):
|
|||||||
log.debug('Translation files: %s', AppLocation.get_directory(
|
log.debug('Translation files: %s', AppLocation.get_directory(
|
||||||
AppLocation.LanguageDir))
|
AppLocation.LanguageDir))
|
||||||
trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir))
|
trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir))
|
||||||
file_names = trans_dir.entryList('*.qm', QtCore.QDir.Files, QtCore.QDir.Name)
|
file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Files, QtCore.QDir.Name)
|
||||||
# Remove qm files from the list which start with "qt_".
|
# Remove qm files from the list which start with "qt_".
|
||||||
file_names = [file_ for file_ in file_names if not file_.startswith('qt_')]
|
file_names = [file_ for file_ in file_names if not file_.startswith('qt_')]
|
||||||
return list(map(trans_dir.filePath, file_names))
|
return list(map(trans_dir.filePath, file_names))
|
||||||
@ -126,8 +126,9 @@ class LanguageManager(object):
|
|||||||
log.info('Language file: \'%s\' written to conf file' % language)
|
log.info('Language file: \'%s\' written to conf file' % language)
|
||||||
if message:
|
if message:
|
||||||
QtGui.QMessageBox.information(None,
|
QtGui.QMessageBox.information(None,
|
||||||
translate('OpenLP.LanguageManager', 'Language'),
|
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
|
@staticmethod
|
||||||
def init_qm_list():
|
def init_qm_list():
|
||||||
|
@ -246,4 +246,4 @@ class AlertsPlugin(Plugin):
|
|||||||
align = VerticalType.Names[self.settings_tab.location]
|
align = VerticalType.Names[self.settings_tab.location]
|
||||||
frame.evaluateJavaScript('update_css("%s", "%s", "%s", "%s", "%s")' %
|
frame.evaluateJavaScript('update_css("%s", "%s", "%s", "%s", "%s")' %
|
||||||
(align, self.settings_tab.font_face, self.settings_tab.font_size,
|
(align, self.settings_tab.font_face, self.settings_tab.font_size,
|
||||||
self.settings_tab.font_color, self.settings_tab.background_color))
|
self.settings_tab.font_color, self.settings_tab.background_color))
|
||||||
|
@ -46,7 +46,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
self.manager = plugin.manager
|
self.manager = plugin.manager
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.item_id = None
|
self.item_id = None
|
||||||
super(AlertForm, self).__init__( Registry().get('main_window'))
|
super(AlertForm, self).__init__(Registry().get('main_window'))
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.display_button.clicked.connect(self.on_display_clicked)
|
self.display_button.clicked.connect(self.on_display_clicked)
|
||||||
self.display_close_button.clicked.connect(self.on_display_close_clicked)
|
self.display_close_button.clicked.connect(self.on_display_close_clicked)
|
||||||
|
@ -97,4 +97,4 @@ class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject, RegistryProperti
|
|||||||
self.live_controller.display.alert('', alert_tab.location)
|
self.live_controller.display.alert('', alert_tab.location)
|
||||||
self.killTimer(self.timer_id)
|
self.killTimer(self.timer_id)
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.generate_alert()
|
self.generate_alert()
|
||||||
|
@ -113,8 +113,8 @@ class BiblePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
super(BiblePlugin, self).app_startup()
|
super(BiblePlugin, self).app_startup()
|
||||||
if self.manager.old_bible_databases:
|
if self.manager.old_bible_databases:
|
||||||
if QtGui.QMessageBox.information(self.main_window,
|
if QtGui.QMessageBox.information(
|
||||||
translate('OpenLP', 'Information'),
|
self.main_window, translate('OpenLP', 'Information'),
|
||||||
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n'
|
translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n'
|
||||||
'Should OpenLP upgrade now?'),
|
'Should OpenLP upgrade now?'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
|
||||||
|
@ -44,6 +44,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB, clean_filename
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class WebDownload(object):
|
class WebDownload(object):
|
||||||
"""
|
"""
|
||||||
Provides an enumeration for the web bible types available to OpenLP.
|
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.
|
Set up the UI for the bible wizard.
|
||||||
"""
|
"""
|
||||||
super(BibleImportForm, self).setupUi(image)
|
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
|
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
|
the import is available and accordingly to disable or enable the next
|
||||||
button.
|
button.
|
||||||
"""
|
"""
|
||||||
self.selectStack.setCurrentIndex(index)
|
self.select_stack.setCurrentIndex(index)
|
||||||
|
|
||||||
def custom_init(self):
|
def custom_init(self):
|
||||||
"""
|
"""
|
||||||
Perform any custom initialisation for bible importing.
|
Perform any custom initialisation for bible importing.
|
||||||
"""
|
"""
|
||||||
self.manager.set_process_dialog(self)
|
self.manager.set_process_dialog(self)
|
||||||
self.loadWebBibles()
|
self.load_Web_Bibles()
|
||||||
self.restart()
|
self.restart()
|
||||||
self.selectStack.setCurrentIndex(0)
|
self.select_stack.setCurrentIndex(0)
|
||||||
|
|
||||||
def custom_signals(self):
|
def custom_signals(self):
|
||||||
"""
|
"""
|
||||||
Set up the signals used in the bible importer.
|
Set up the signals used in the bible importer.
|
||||||
"""
|
"""
|
||||||
self.webSourceComboBox.currentIndexChanged.connect(self.onWebSourceComboBoxIndexChanged)
|
self.web_source_combo_box.currentIndexChanged.connect(self.on_web_source_combo_box_index_changed)
|
||||||
self.osisBrowseButton.clicked.connect(self.onOsisBrowseButtonClicked)
|
self.osis_browse_button.clicked.connect(self.on_osis_browse_button_clicked)
|
||||||
self.csvBooksButton.clicked.connect(self.onCsvBooksBrowseButtonClicked)
|
self.csv_books_button.clicked.connect(self.on_csv_books_browse_button_clicked)
|
||||||
self.csvVersesButton.clicked.connect(self.onCsvVersesBrowseButtonClicked)
|
self.csv_verses_button.clicked.connect(self.on_csv_verses_browse_button_clicked)
|
||||||
self.openSongBrowseButton.clicked.connect(self.onOpenSongBrowseButtonClicked)
|
self.open_song_browse_button.clicked.connect(self.on_open_song_browse_button_clicked)
|
||||||
|
|
||||||
def add_custom_pages(self):
|
def add_custom_pages(self):
|
||||||
"""
|
"""
|
||||||
Add the bible import specific wizard pages.
|
Add the bible import specific wizard pages.
|
||||||
"""
|
"""
|
||||||
# Select Page
|
# Select Page
|
||||||
self.selectPage = QtGui.QWizardPage()
|
self.select_page = QtGui.QWizardPage()
|
||||||
self.selectPage.setObjectName('SelectPage')
|
self.select_page.setObjectName('SelectPage')
|
||||||
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
|
self.select_page_layout = QtGui.QVBoxLayout(self.select_page)
|
||||||
self.selectPageLayout.setObjectName('SelectPageLayout')
|
self.select_page_layout.setObjectName('SelectPageLayout')
|
||||||
self.formatLayout = QtGui.QFormLayout()
|
self.format_layout = QtGui.QFormLayout()
|
||||||
self.formatLayout.setObjectName('FormatLayout')
|
self.format_layout.setObjectName('FormatLayout')
|
||||||
self.formatLabel = QtGui.QLabel(self.selectPage)
|
self.format_label = QtGui.QLabel(self.select_page)
|
||||||
self.formatLabel.setObjectName('FormatLabel')
|
self.format_label.setObjectName('FormatLabel')
|
||||||
self.formatComboBox = QtGui.QComboBox(self.selectPage)
|
self.format_combo_box = QtGui.QComboBox(self.select_page)
|
||||||
self.formatComboBox.addItems(['', '', '', ''])
|
self.format_combo_box.addItems(['', '', '', ''])
|
||||||
self.formatComboBox.setObjectName('FormatComboBox')
|
self.format_combo_box.setObjectName('FormatComboBox')
|
||||||
self.formatLayout.addRow(self.formatLabel, self.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.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.format_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectPageLayout.addLayout(self.formatLayout)
|
self.select_page_layout.addLayout(self.format_layout)
|
||||||
self.selectStack = QtGui.QStackedLayout()
|
self.select_stack = QtGui.QStackedLayout()
|
||||||
self.selectStack.setObjectName('SelectStack')
|
self.select_stack.setObjectName('SelectStack')
|
||||||
self.osisWidget = QtGui.QWidget(self.selectPage)
|
self.osis_widget = QtGui.QWidget(self.select_page)
|
||||||
self.osisWidget.setObjectName('OsisWidget')
|
self.osis_widget.setObjectName('OsisWidget')
|
||||||
self.osisLayout = QtGui.QFormLayout(self.osisWidget)
|
self.osis_layout = QtGui.QFormLayout(self.osis_widget)
|
||||||
self.osisLayout.setMargin(0)
|
self.osis_layout.setMargin(0)
|
||||||
self.osisLayout.setObjectName('OsisLayout')
|
self.osis_layout.setObjectName('OsisLayout')
|
||||||
self.osisFileLabel = QtGui.QLabel(self.osisWidget)
|
self.osis_file_label = QtGui.QLabel(self.osis_widget)
|
||||||
self.osisFileLabel.setObjectName('OsisFileLabel')
|
self.osis_file_label.setObjectName('OsisFileLabel')
|
||||||
self.osisFileLayout = QtGui.QHBoxLayout()
|
self.osis_file_layout = QtGui.QHBoxLayout()
|
||||||
self.osisFileLayout.setObjectName('OsisFileLayout')
|
self.osis_file_layout.setObjectName('OsisFileLayout')
|
||||||
self.osisFileEdit = QtGui.QLineEdit(self.osisWidget)
|
self.osis_file_edit = QtGui.QLineEdit(self.osis_widget)
|
||||||
self.osisFileEdit.setObjectName('OsisFileEdit')
|
self.osis_file_edit.setObjectName('OsisFileEdit')
|
||||||
self.osisFileLayout.addWidget(self.osisFileEdit)
|
self.osis_file_layout.addWidget(self.osis_file_edit)
|
||||||
self.osisBrowseButton = QtGui.QToolButton(self.osisWidget)
|
self.osis_browse_button = QtGui.QToolButton(self.osis_widget)
|
||||||
self.osisBrowseButton.setIcon(self.open_icon)
|
self.osis_browse_button.setIcon(self.open_icon)
|
||||||
self.osisBrowseButton.setObjectName('OsisBrowseButton')
|
self.osis_browse_button.setObjectName('OsisBrowseButton')
|
||||||
self.osisFileLayout.addWidget(self.osisBrowseButton)
|
self.osis_file_layout.addWidget(self.osis_browse_button)
|
||||||
self.osisLayout.addRow(self.osisFileLabel, self.osisFileLayout)
|
self.osis_layout.addRow(self.osis_file_label, self.osis_file_layout)
|
||||||
self.osisLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.osis_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectStack.addWidget(self.osisWidget)
|
self.select_stack.addWidget(self.osis_widget)
|
||||||
self.csvWidget = QtGui.QWidget(self.selectPage)
|
self.csv_widget = QtGui.QWidget(self.select_page)
|
||||||
self.csvWidget.setObjectName('CsvWidget')
|
self.csv_widget.setObjectName('CsvWidget')
|
||||||
self.csvLayout = QtGui.QFormLayout(self.csvWidget)
|
self.csv_layout = QtGui.QFormLayout(self.csv_widget)
|
||||||
self.csvLayout.setMargin(0)
|
self.csv_layout.setMargin(0)
|
||||||
self.csvLayout.setObjectName('CsvLayout')
|
self.csv_layout.setObjectName('CsvLayout')
|
||||||
self.csvBooksLabel = QtGui.QLabel(self.csvWidget)
|
self.csv_books_label = QtGui.QLabel(self.csv_widget)
|
||||||
self.csvBooksLabel.setObjectName('CsvBooksLabel')
|
self.csv_books_label.setObjectName('CsvBooksLabel')
|
||||||
self.csvBooksLayout = QtGui.QHBoxLayout()
|
self.csv_books_layout = QtGui.QHBoxLayout()
|
||||||
self.csvBooksLayout.setObjectName('CsvBooksLayout')
|
self.csv_books_layout.setObjectName('CsvBooksLayout')
|
||||||
self.csvBooksEdit = QtGui.QLineEdit(self.csvWidget)
|
self.csv_books_edit = QtGui.QLineEdit(self.csv_widget)
|
||||||
self.csvBooksEdit.setObjectName('CsvBooksEdit')
|
self.csv_books_edit.setObjectName('CsvBooksEdit')
|
||||||
self.csvBooksLayout.addWidget(self.csvBooksEdit)
|
self.csv_books_layout.addWidget(self.csv_books_edit)
|
||||||
self.csvBooksButton = QtGui.QToolButton(self.csvWidget)
|
self.csv_books_button = QtGui.QToolButton(self.csv_widget)
|
||||||
self.csvBooksButton.setIcon(self.open_icon)
|
self.csv_books_button.setIcon(self.open_icon)
|
||||||
self.csvBooksButton.setObjectName('CsvBooksButton')
|
self.csv_books_button.setObjectName('CsvBooksButton')
|
||||||
self.csvBooksLayout.addWidget(self.csvBooksButton)
|
self.csv_books_layout.addWidget(self.csv_books_button)
|
||||||
self.csvLayout.addRow(self.csvBooksLabel, self.csvBooksLayout)
|
self.csv_layout.addRow(self.csv_books_label, self.csv_books_layout)
|
||||||
self.csvVersesLabel = QtGui.QLabel(self.csvWidget)
|
self.csv_verses_label = QtGui.QLabel(self.csv_widget)
|
||||||
self.csvVersesLabel.setObjectName('CsvVersesLabel')
|
self.csv_verses_label.setObjectName('CsvVersesLabel')
|
||||||
self.csvVersesLayout = QtGui.QHBoxLayout()
|
self.csv_verses_layout = QtGui.QHBoxLayout()
|
||||||
self.csvVersesLayout.setObjectName('CsvVersesLayout')
|
self.csv_verses_layout.setObjectName('CsvVersesLayout')
|
||||||
self.csvVersesEdit = QtGui.QLineEdit(self.csvWidget)
|
self.csv_verses_edit = QtGui.QLineEdit(self.csv_widget)
|
||||||
self.csvVersesEdit.setObjectName('CsvVersesEdit')
|
self.csv_verses_edit.setObjectName('CsvVersesEdit')
|
||||||
self.csvVersesLayout.addWidget(self.csvVersesEdit)
|
self.csv_verses_layout.addWidget(self.csv_verses_edit)
|
||||||
self.csvVersesButton = QtGui.QToolButton(self.csvWidget)
|
self.csv_verses_button = QtGui.QToolButton(self.csv_widget)
|
||||||
self.csvVersesButton.setIcon(self.open_icon)
|
self.csv_verses_button.setIcon(self.open_icon)
|
||||||
self.csvVersesButton.setObjectName('CsvVersesButton')
|
self.csv_verses_button.setObjectName('CsvVersesButton')
|
||||||
self.csvVersesLayout.addWidget(self.csvVersesButton)
|
self.csv_verses_layout.addWidget(self.csv_verses_button)
|
||||||
self.csvLayout.addRow(self.csvVersesLabel, self.csvVersesLayout)
|
self.csv_layout.addRow(self.csv_verses_label, self.csv_verses_layout)
|
||||||
self.csvLayout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.csv_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectStack.addWidget(self.csvWidget)
|
self.select_stack.addWidget(self.csv_widget)
|
||||||
self.openSongWidget = QtGui.QWidget(self.selectPage)
|
self.open_song_widget = QtGui.QWidget(self.select_page)
|
||||||
self.openSongWidget.setObjectName('OpenSongWidget')
|
self.open_song_widget.setObjectName('OpenSongWidget')
|
||||||
self.openSongLayout = QtGui.QFormLayout(self.openSongWidget)
|
self.open_song_layout = QtGui.QFormLayout(self.open_song_widget)
|
||||||
self.openSongLayout.setMargin(0)
|
self.open_song_layout.setMargin(0)
|
||||||
self.openSongLayout.setObjectName('OpenSongLayout')
|
self.open_song_layout.setObjectName('OpenSongLayout')
|
||||||
self.openSongFileLabel = QtGui.QLabel(self.openSongWidget)
|
self.open_song_file_label = QtGui.QLabel(self.open_song_widget)
|
||||||
self.openSongFileLabel.setObjectName('OpenSongFileLabel')
|
self.open_song_file_label.setObjectName('OpenSongFileLabel')
|
||||||
self.openSongFileLayout = QtGui.QHBoxLayout()
|
self.open_song_file_layout = QtGui.QHBoxLayout()
|
||||||
self.openSongFileLayout.setObjectName('OpenSongFileLayout')
|
self.open_song_file_layout.setObjectName('OpenSongFileLayout')
|
||||||
self.openSongFileEdit = QtGui.QLineEdit(self.openSongWidget)
|
self.open_song_file_edit = QtGui.QLineEdit(self.open_song_widget)
|
||||||
self.openSongFileEdit.setObjectName('OpenSongFileEdit')
|
self.open_song_file_edit.setObjectName('OpenSongFileEdit')
|
||||||
self.openSongFileLayout.addWidget(self.openSongFileEdit)
|
self.open_song_file_layout.addWidget(self.open_song_file_edit)
|
||||||
self.openSongBrowseButton = QtGui.QToolButton(self.openSongWidget)
|
self.open_song_browse_button = QtGui.QToolButton(self.open_song_widget)
|
||||||
self.openSongBrowseButton.setIcon(self.open_icon)
|
self.open_song_browse_button.setIcon(self.open_icon)
|
||||||
self.openSongBrowseButton.setObjectName('OpenSongBrowseButton')
|
self.open_song_browse_button.setObjectName('OpenSongBrowseButton')
|
||||||
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
|
self.open_song_file_layout.addWidget(self.open_song_browse_button)
|
||||||
self.openSongLayout.addRow(self.openSongFileLabel, self.openSongFileLayout)
|
self.open_song_layout.addRow(self.open_song_file_label, self.open_song_file_layout)
|
||||||
self.openSongLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
self.open_song_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.spacer)
|
||||||
self.selectStack.addWidget(self.openSongWidget)
|
self.select_stack.addWidget(self.open_song_widget)
|
||||||
self.webTabWidget = QtGui.QTabWidget(self.selectPage)
|
self.web_tab_widget = QtGui.QTabWidget(self.select_page)
|
||||||
self.webTabWidget.setObjectName('WebTabWidget')
|
self.web_tab_widget.setObjectName('WebTabWidget')
|
||||||
self.webBibleTab = QtGui.QWidget()
|
self.web_bible_tab = QtGui.QWidget()
|
||||||
self.webBibleTab.setObjectName('WebBibleTab')
|
self.web_bible_tab.setObjectName('WebBibleTab')
|
||||||
self.webBibleLayout = QtGui.QFormLayout(self.webBibleTab)
|
self.web_bible_layout = QtGui.QFormLayout(self.web_bible_tab)
|
||||||
self.webBibleLayout.setObjectName('WebBibleLayout')
|
self.web_bible_layout.setObjectName('WebBibleLayout')
|
||||||
self.webSourceLabel = QtGui.QLabel(self.webBibleTab)
|
self.web_source_label = QtGui.QLabel(self.web_bible_tab)
|
||||||
self.webSourceLabel.setObjectName('WebSourceLabel')
|
self.web_source_label.setObjectName('WebSourceLabel')
|
||||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webSourceLabel)
|
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_source_label)
|
||||||
self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab)
|
self.web_source_combo_box = QtGui.QComboBox(self.web_bible_tab)
|
||||||
self.webSourceComboBox.setObjectName('WebSourceComboBox')
|
self.web_source_combo_box.setObjectName('WebSourceComboBox')
|
||||||
self.webSourceComboBox.addItems(['', '', ''])
|
self.web_source_combo_box.addItems(['', '', ''])
|
||||||
self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webSourceComboBox)
|
self.web_bible_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_source_combo_box)
|
||||||
self.webTranslationLabel = QtGui.QLabel(self.webBibleTab)
|
self.web_translation_label = QtGui.QLabel(self.web_bible_tab)
|
||||||
self.webTranslationLabel.setObjectName('webTranslationLabel')
|
self.web_translation_label.setObjectName('web_translation_label')
|
||||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webTranslationLabel)
|
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_translation_label)
|
||||||
self.webTranslationComboBox = QtGui.QComboBox(self.webBibleTab)
|
self.web_translation_combo_box = QtGui.QComboBox(self.web_bible_tab)
|
||||||
self.webTranslationComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
self.web_translation_combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||||
self.webTranslationComboBox.setObjectName('WebTranslationComboBox')
|
self.web_translation_combo_box.setObjectName('WebTranslationComboBox')
|
||||||
self.webBibleLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webTranslationComboBox)
|
self.web_bible_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_translation_combo_box)
|
||||||
self.webTabWidget.addTab(self.webBibleTab, '')
|
self.web_tab_widget.addTab(self.web_bible_tab, '')
|
||||||
self.webProxyTab = QtGui.QWidget()
|
self.web_proxy_tab = QtGui.QWidget()
|
||||||
self.webProxyTab.setObjectName('WebProxyTab')
|
self.web_proxy_tab.setObjectName('WebProxyTab')
|
||||||
self.webProxyLayout = QtGui.QFormLayout(self.webProxyTab)
|
self.web_proxy_layout = QtGui.QFormLayout(self.web_proxy_tab)
|
||||||
self.webProxyLayout.setObjectName('WebProxyLayout')
|
self.web_proxy_layout.setObjectName('WebProxyLayout')
|
||||||
self.webServerLabel = QtGui.QLabel(self.webProxyTab)
|
self.web_server_label = QtGui.QLabel(self.web_proxy_tab)
|
||||||
self.webServerLabel.setObjectName('WebServerLabel')
|
self.web_server_label.setObjectName('WebServerLabel')
|
||||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.webServerLabel)
|
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.web_server_label)
|
||||||
self.webServerEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.web_server_edit = QtGui.QLineEdit(self.web_proxy_tab)
|
||||||
self.webServerEdit.setObjectName('WebServerEdit')
|
self.web_server_edit.setObjectName('WebServerEdit')
|
||||||
self.webProxyLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webServerEdit)
|
self.web_proxy_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.web_server_edit)
|
||||||
self.webUserLabel = QtGui.QLabel(self.webProxyTab)
|
self.web_user_label = QtGui.QLabel(self.web_proxy_tab)
|
||||||
self.webUserLabel.setObjectName('WebUserLabel')
|
self.web_user_label.setObjectName('WebUserLabel')
|
||||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.webUserLabel)
|
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.web_user_label)
|
||||||
self.webUserEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.web_user_edit = QtGui.QLineEdit(self.web_proxy_tab)
|
||||||
self.webUserEdit.setObjectName('WebUserEdit')
|
self.web_user_edit.setObjectName('WebUserEdit')
|
||||||
self.webProxyLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.webUserEdit)
|
self.web_proxy_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.web_user_edit)
|
||||||
self.webPasswordLabel = QtGui.QLabel(self.webProxyTab)
|
self.web_password_label = QtGui.QLabel(self.web_proxy_tab)
|
||||||
self.webPasswordLabel.setObjectName('WebPasswordLabel')
|
self.web_password_label.setObjectName('WebPasswordLabel')
|
||||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.webPasswordLabel)
|
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.web_password_label)
|
||||||
self.webPasswordEdit = QtGui.QLineEdit(self.webProxyTab)
|
self.web_password_edit = QtGui.QLineEdit(self.web_proxy_tab)
|
||||||
self.webPasswordEdit.setObjectName('WebPasswordEdit')
|
self.web_password_edit.setObjectName('WebPasswordEdit')
|
||||||
self.webProxyLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.webPasswordEdit)
|
self.web_proxy_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.web_password_edit)
|
||||||
self.webTabWidget.addTab(self.webProxyTab, '')
|
self.web_tab_widget.addTab(self.web_proxy_tab, '')
|
||||||
self.selectStack.addWidget(self.webTabWidget)
|
self.select_stack.addWidget(self.web_tab_widget)
|
||||||
self.selectPageLayout.addLayout(self.selectStack)
|
self.select_page_layout.addLayout(self.select_stack)
|
||||||
self.addPage(self.selectPage)
|
self.addPage(self.select_page)
|
||||||
# License Page
|
# License Page
|
||||||
self.licenseDetailsPage = QtGui.QWizardPage()
|
self.license_details_page = QtGui.QWizardPage()
|
||||||
self.licenseDetailsPage.setObjectName('LicenseDetailsPage')
|
self.license_details_page.setObjectName('LicenseDetailsPage')
|
||||||
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
|
self.license_details_layout = QtGui.QFormLayout(self.license_details_page)
|
||||||
self.licenseDetailsLayout.setObjectName('LicenseDetailsLayout')
|
self.license_details_layout.setObjectName('LicenseDetailsLayout')
|
||||||
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.version_name_label = QtGui.QLabel(self.license_details_page)
|
||||||
self.versionNameLabel.setObjectName('VersionNameLabel')
|
self.version_name_label.setObjectName('VersionNameLabel')
|
||||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.versionNameLabel)
|
self.license_details_layout.setWidget(0, QtGui.QFormLayout.LabelRole, self.version_name_label)
|
||||||
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.version_name_edit = QtGui.QLineEdit(self.license_details_page)
|
||||||
self.versionNameEdit.setObjectName('VersionNameEdit')
|
self.version_name_edit.setObjectName('VersionNameEdit')
|
||||||
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.versionNameEdit)
|
self.license_details_layout.setWidget(0, QtGui.QFormLayout.FieldRole, self.version_name_edit)
|
||||||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.copyright_label = QtGui.QLabel(self.license_details_page)
|
||||||
self.copyrightLabel.setObjectName('CopyrightLabel')
|
self.copyright_label.setObjectName('CopyrightLabel')
|
||||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyrightLabel)
|
self.license_details_layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.copyright_label)
|
||||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.copyright_edit = QtGui.QLineEdit(self.license_details_page)
|
||||||
self.copyrightEdit.setObjectName('CopyrightEdit')
|
self.copyright_edit.setObjectName('CopyrightEdit')
|
||||||
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyrightEdit)
|
self.license_details_layout.setWidget(1, QtGui.QFormLayout.FieldRole, self.copyright_edit)
|
||||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
|
self.permissions_label = QtGui.QLabel(self.license_details_page)
|
||||||
self.permissionsLabel.setObjectName('PermissionsLabel')
|
self.permissions_label.setObjectName('PermissionsLabel')
|
||||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
self.license_details_layout.setWidget(2, QtGui.QFormLayout.LabelRole, self.permissions_label)
|
||||||
self.permissionsLabel)
|
self.permissions_edit = QtGui.QLineEdit(self.license_details_page)
|
||||||
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
|
self.permissions_edit.setObjectName('PermissionsEdit')
|
||||||
self.permissionsEdit.setObjectName('PermissionsEdit')
|
self.license_details_layout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissions_edit)
|
||||||
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissionsEdit)
|
self.addPage(self.license_details_page)
|
||||||
self.addPage(self.licenseDetailsPage)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
Allow for localisation of the bible import wizard.
|
Allow for localisation of the bible import wizard.
|
||||||
"""
|
"""
|
||||||
self.setWindowTitle(translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
self.setWindowTitle(translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
|
||||||
self.title_label.setText(WizardStrings.HeaderStyle %
|
self.title_label.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui',
|
||||||
translate('OpenLP.Ui', 'Welcome to the Bible Import Wizard'))
|
'Welcome to the Bible Import Wizard'))
|
||||||
self.information_label.setText(
|
self.information_label.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'This wizard will help you to import Bibles from a variety of '
|
'This wizard will help you to import Bibles from a variety of '
|
||||||
'formats. Click the next button below to start the process by '
|
'formats. Click the next button below to start the process by '
|
||||||
'selecting a format to import from.'))
|
'selecting a format to import from.'))
|
||||||
self.selectPage.setTitle(WizardStrings.ImportSelect)
|
self.select_page.setTitle(WizardStrings.ImportSelect)
|
||||||
self.selectPage.setSubTitle(WizardStrings.ImportSelectLong)
|
self.select_page.setSubTitle(WizardStrings.ImportSelectLong)
|
||||||
self.formatLabel.setText(WizardStrings.FormatLabel)
|
self.format_label.setText(WizardStrings.FormatLabel)
|
||||||
self.formatComboBox.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
|
self.format_combo_box.setItemText(BibleFormat.OSIS, WizardStrings.OSIS)
|
||||||
self.formatComboBox.setItemText(BibleFormat.CSV, WizardStrings.CSV)
|
self.format_combo_box.setItemText(BibleFormat.CSV, WizardStrings.CSV)
|
||||||
self.formatComboBox.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
|
self.format_combo_box.setItemText(BibleFormat.OpenSong, WizardStrings.OS)
|
||||||
self.formatComboBox.setItemText(BibleFormat.WebDownload,
|
self.format_combo_box.setItemText(BibleFormat.WebDownload, translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
|
'Web Download'))
|
||||||
self.osisFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
self.osis_file_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.csvBooksLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
self.csv_books_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Books file:'))
|
||||||
self.csvVersesLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Verses file:'))
|
self.csv_verses_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Verses file:'))
|
||||||
self.openSongFileLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
self.open_song_file_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible file:'))
|
||||||
self.webSourceLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
self.web_source_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Location:'))
|
||||||
self.webSourceComboBox.setItemText(WebDownload.Crosswalk,
|
self.web_source_combo_box.setItemText(WebDownload.Crosswalk, translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
|
'Crosswalk'))
|
||||||
self.webSourceComboBox.setItemText(WebDownload.BibleGateway,
|
self.web_source_combo_box.setItemText(WebDownload.BibleGateway, translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
|
'BibleGateway'))
|
||||||
self.webSourceComboBox.setItemText(WebDownload.Bibleserver,
|
self.web_source_combo_box.setItemText(WebDownload.Bibleserver, translate('BiblesPlugin.ImportWizardForm',
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bibleserver'))
|
'Bibleserver'))
|
||||||
self.webTranslationLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
self.web_translation_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
|
||||||
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webBibleTab),
|
self.web_tab_widget.setTabText(self.web_tab_widget.indexOf(self.web_bible_tab),
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
|
||||||
self.webServerLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
self.web_server_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Server:'))
|
||||||
self.webUserLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
self.web_user_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Username:'))
|
||||||
self.webPasswordLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
self.web_password_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Password:'))
|
||||||
self.webTabWidget.setTabText(self.webTabWidget.indexOf(self.webProxyTab),
|
self.web_tab_widget.setTabText(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
self.web_tab_widget.indexOf(self.web_proxy_tab), translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Proxy Server (Optional)'))
|
'Proxy Server (Optional)'))
|
||||||
self.licenseDetailsPage.setTitle(
|
self.license_details_page.setTitle(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
|
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.'))
|
'Set up the Bible\'s license details.'))
|
||||||
self.versionNameLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
||||||
self.copyrightLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||||
self.permissionsLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||||
self.progress_page.setTitle(WizardStrings.Importing)
|
self.progress_page.setTitle(WizardStrings.Importing)
|
||||||
self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Please wait while your Bible is imported.'))
|
'Please wait while your Bible is imported.'))
|
||||||
self.progress_label.setText(WizardStrings.Ready)
|
self.progress_label.setText(WizardStrings.Ready)
|
||||||
self.progress_bar.setFormat('%p%')
|
self.progress_bar.setFormat('%p%')
|
||||||
# Align all QFormLayouts towards each other.
|
# Align all QFormLayouts towards each other.
|
||||||
labelWidth = max(self.formatLabel.minimumSizeHint().width(),
|
label_width = max(self.format_label.minimumSizeHint().width(),
|
||||||
self.osisFileLabel.minimumSizeHint().width(),
|
self.osis_file_label.minimumSizeHint().width(),
|
||||||
self.csvBooksLabel.minimumSizeHint().width(),
|
self.csv_books_label.minimumSizeHint().width(),
|
||||||
self.csvVersesLabel.minimumSizeHint().width(),
|
self.csv_verses_label.minimumSizeHint().width(),
|
||||||
self.openSongFileLabel.minimumSizeHint().width())
|
self.open_song_file_label.minimumSizeHint().width())
|
||||||
self.spacer.changeSize(labelWidth, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
self.spacer.changeSize(label_width, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
"""
|
"""
|
||||||
@ -340,122 +340,130 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
if self.currentPage() == self.welcome_page:
|
if self.currentPage() == self.welcome_page:
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.select_page:
|
||||||
if self.field('source_format') == BibleFormat.OSIS:
|
if self.field('source_format') == BibleFormat.OSIS:
|
||||||
if not self.field('osis_location'):
|
if not self.field('osis_location'):
|
||||||
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||||
self.osisFileEdit.setFocus()
|
self.osis_file_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field('source_format') == BibleFormat.CSV:
|
elif self.field('source_format') == BibleFormat.CSV:
|
||||||
if not self.field('csv_booksfile'):
|
if not self.field('csv_booksfile'):
|
||||||
critical_error_message_box(UiStrings().NFSs, translate('BiblesPlugin.ImportWizardForm',
|
critical_error_message_box(
|
||||||
'You need to specify a file with books of the Bible to use in the import.'))
|
UiStrings().NFSs, translate('BiblesPlugin.ImportWizardForm',
|
||||||
self.csvBooksEdit.setFocus()
|
'You need to specify a file with books of the Bible to use in the '
|
||||||
|
'import.'))
|
||||||
|
self.csv_books_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not self.field('csv_versefile'):
|
elif not self.field('csv_versefile'):
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
UiStrings().NFSs,
|
||||||
'You need to specify a file of Bible verses to import.'))
|
translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file of Bible verses to '
|
||||||
self.csvVersesEdit.setFocus()
|
'import.'))
|
||||||
|
self.csv_verses_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field('source_format') == BibleFormat.OpenSong:
|
elif self.field('source_format') == BibleFormat.OpenSong:
|
||||||
if not self.field('opensong_file'):
|
if not self.field('opensong_file'):
|
||||||
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
critical_error_message_box(UiStrings().NFSs, WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
self.openSongFileEdit.setFocus()
|
self.open_song_file_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field('source_format') == BibleFormat.WebDownload:
|
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
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.licenseDetailsPage:
|
elif self.currentPage() == self.license_details_page:
|
||||||
license_version = self.field('license_version')
|
license_version = self.field('license_version')
|
||||||
license_copyright = self.field('license_copyright')
|
license_copyright = self.field('license_copyright')
|
||||||
path = AppLocation.get_section_data_path('bibles')
|
path = AppLocation.get_section_data_path('bibles')
|
||||||
if not license_version:
|
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.'))
|
translate('BiblesPlugin.ImportWizardForm', 'You need to specify a version name for your Bible.'))
|
||||||
self.versionNameEdit.setFocus()
|
self.version_name_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif not license_copyright:
|
elif not license_copyright:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(
|
||||||
|
UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible. '
|
translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible. '
|
||||||
'Bibles in the Public Domain need to be marked as such.'))
|
'Bibles in the Public Domain need to be marked as such.'))
|
||||||
self.copyrightEdit.setFocus()
|
self.copyright_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.manager.exists(license_version):
|
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',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'This Bible already exists. Please import a different Bible or first delete the existing one.'))
|
'This Bible already exists. Please import a different Bible or first delete the '
|
||||||
self.versionNameEdit.setFocus()
|
'existing one.'))
|
||||||
|
self.version_name_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif os.path.exists(os.path.join(path, clean_filename(
|
elif os.path.exists(os.path.join(path, clean_filename(license_version))):
|
||||||
license_version))):
|
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists. Please import '
|
translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists. Please import '
|
||||||
'a different Bible or first delete the existing one.'))
|
'a different Bible or first delete the existing one.'))
|
||||||
self.versionNameEdit.setFocus()
|
self.version_name_edit.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
if self.currentPage() == self.progress_page:
|
if self.currentPage() == self.progress_page:
|
||||||
return True
|
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
|
Setup the list of Bibles when you select a different source on the web download page.
|
||||||
download page.
|
|
||||||
|
|
||||||
``index``
|
:param index: The index of the combo box.
|
||||||
The index of the combo box.
|
|
||||||
"""
|
"""
|
||||||
self.webTranslationComboBox.clear()
|
self.web_translation_combo_box.clear()
|
||||||
bibles = list(self.web_bible_list[index].keys())
|
bibles = list(self.web_bible_list[index].keys())
|
||||||
bibles.sort(key=get_locale_key)
|
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.
|
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.
|
Show the file open dialog for the books CSV file.
|
||||||
"""
|
"""
|
||||||
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvBooksEdit, 'last directory import',
|
self.get_file_name(
|
||||||
'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
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.
|
Show the file open dialog for the verses CSV file.
|
||||||
"""
|
"""
|
||||||
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csvVersesEdit, 'last directory import',
|
self.get_file_name(WizardStrings.OpenTypeFile % WizardStrings.CSV, self.csv_verses_edit,
|
||||||
'%s (*.csv)' % translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
'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.
|
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):
|
def register_fields(self):
|
||||||
"""
|
"""
|
||||||
Register the bible import wizard fields.
|
Register the bible import wizard fields.
|
||||||
"""
|
"""
|
||||||
self.selectPage.registerField('source_format', self.formatComboBox)
|
self.select_page.registerField('source_format', self.format_combo_box)
|
||||||
self.selectPage.registerField('osis_location', self.osisFileEdit)
|
self.select_page.registerField('osis_location', self.osis_file_edit)
|
||||||
self.selectPage.registerField('csv_booksfile', self.csvBooksEdit)
|
self.select_page.registerField('csv_booksfile', self.csv_books_edit)
|
||||||
self.selectPage.registerField('csv_versefile', self.csvVersesEdit)
|
self.select_page.registerField('csv_versefile', self.csv_verses_edit)
|
||||||
self.selectPage.registerField('opensong_file', self.openSongFileEdit)
|
self.select_page.registerField('opensong_file', self.open_song_file_edit)
|
||||||
self.selectPage.registerField('web_location', self.webSourceComboBox)
|
self.select_page.registerField('web_location', self.web_source_combo_box)
|
||||||
self.selectPage.registerField('web_biblename', self.webTranslationComboBox)
|
self.select_page.registerField('web_biblename', self.web_translation_combo_box)
|
||||||
self.selectPage.registerField('proxy_server', self.webServerEdit)
|
self.select_page.registerField('proxy_server', self.web_server_edit)
|
||||||
self.selectPage.registerField('proxy_username', self.webUserEdit)
|
self.select_page.registerField('proxy_username', self.web_user_edit)
|
||||||
self.selectPage.registerField('proxy_password', self.webPasswordEdit)
|
self.select_page.registerField('proxy_password', self.web_password_edit)
|
||||||
self.licenseDetailsPage.registerField('license_version', self.versionNameEdit)
|
self.license_details_page.registerField('license_version', self.version_name_edit)
|
||||||
self.licenseDetailsPage.registerField('license_copyright', self.copyrightEdit)
|
self.license_details_page.registerField('license_copyright', self.copyright_edit)
|
||||||
self.licenseDetailsPage.registerField('license_permissions', self.permissionsEdit)
|
self.license_details_page.registerField('license_permissions', self.permissions_edit)
|
||||||
|
|
||||||
def setDefaults(self):
|
def setDefaults(self):
|
||||||
"""
|
"""
|
||||||
@ -472,33 +480,32 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.setField('csv_versefile', '')
|
self.setField('csv_versefile', '')
|
||||||
self.setField('opensong_file', '')
|
self.setField('opensong_file', '')
|
||||||
self.setField('web_location', WebDownload.Crosswalk)
|
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_server', settings.value('proxy address'))
|
||||||
self.setField('proxy_username', settings.value('proxy username'))
|
self.setField('proxy_username', settings.value('proxy username'))
|
||||||
self.setField('proxy_password', settings.value('proxy password'))
|
self.setField('proxy_password', settings.value('proxy password'))
|
||||||
self.setField('license_version', self.versionNameEdit.text())
|
self.setField('license_version', self.version_name_edit.text())
|
||||||
self.setField('license_copyright', self.copyrightEdit.text())
|
self.setField('license_copyright', self.copyright_edit.text())
|
||||||
self.setField('license_permissions', self.permissionsEdit.text())
|
self.setField('license_permissions', self.permissions_edit.text())
|
||||||
self.onWebSourceComboBoxIndexChanged(WebDownload.Crosswalk)
|
self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def loadWebBibles(self):
|
def load_Web_Bibles(self):
|
||||||
"""
|
"""
|
||||||
Load the lists of Crosswalk, BibleGateway and Bibleserver bibles.
|
Load the lists of Crosswalk, BibleGateway and Bibleserver bibles.
|
||||||
"""
|
"""
|
||||||
# Load Crosswalk Bibles.
|
# Load Crosswalk Bibles.
|
||||||
self.loadBibleResource(WebDownload.Crosswalk)
|
self.load_Bible_Resource(WebDownload.Crosswalk)
|
||||||
# Load BibleGateway Bibles.
|
# Load BibleGateway Bibles.
|
||||||
self.loadBibleResource(WebDownload.BibleGateway)
|
self.load_Bible_Resource(WebDownload.BibleGateway)
|
||||||
# Load and Bibleserver Bibles.
|
# 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.
|
Loads a web bible from bible_resources.sqlite.
|
||||||
|
|
||||||
``download_type``
|
:param download_type: The WebDownload type e.g. bibleserver.
|
||||||
The WebDownload type e.g. bibleserver.
|
|
||||||
"""
|
"""
|
||||||
self.web_bible_list[download_type] = {}
|
self.web_bible_list[download_type] = {}
|
||||||
bibles = BiblesResourcesDB.get_webbibles(WebDownload.Names[download_type])
|
bibles = BiblesResourcesDB.get_webbibles(WebDownload.Names[download_type])
|
||||||
@ -530,28 +537,22 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
importer = None
|
importer = None
|
||||||
if bible_type == BibleFormat.OSIS:
|
if bible_type == BibleFormat.OSIS:
|
||||||
# Import an OSIS bible.
|
# Import an OSIS bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.OSIS,
|
importer = self.manager.import_bible(BibleFormat.OSIS, name=license_version,
|
||||||
name=license_version,
|
filename=self.field('osis_location'))
|
||||||
filename=self.field('osis_location')
|
|
||||||
)
|
|
||||||
elif bible_type == BibleFormat.CSV:
|
elif bible_type == BibleFormat.CSV:
|
||||||
# Import a CSV bible.
|
# Import a CSV bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.CSV,
|
importer = self.manager.import_bible(BibleFormat.CSV, name=license_version,
|
||||||
name=license_version,
|
booksfile=self.field('csv_booksfile'),
|
||||||
booksfile=self.field('csv_booksfile'),
|
versefile=self.field('csv_versefile'))
|
||||||
versefile=self.field('csv_versefile')
|
|
||||||
)
|
|
||||||
elif bible_type == BibleFormat.OpenSong:
|
elif bible_type == BibleFormat.OpenSong:
|
||||||
# Import an OpenSong bible.
|
# Import an OpenSong bible.
|
||||||
importer = self.manager.import_bible(BibleFormat.OpenSong,
|
importer = self.manager.import_bible(BibleFormat.OpenSong, name=license_version,
|
||||||
name=license_version,
|
filename=self.field('opensong_file'))
|
||||||
filename=self.field('opensong_file')
|
|
||||||
)
|
|
||||||
elif bible_type == BibleFormat.WebDownload:
|
elif bible_type == BibleFormat.WebDownload:
|
||||||
# Import a bible from the web.
|
# Import a bible from the web.
|
||||||
self.progress_bar.setMaximum(1)
|
self.progress_bar.setMaximum(1)
|
||||||
download_location = self.field('web_location')
|
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]
|
bible = self.web_bible_list[download_location][bible_version]
|
||||||
importer = self.manager.import_bible(
|
importer = self.manager.import_bible(
|
||||||
BibleFormat.WebDownload, name=license_version,
|
BibleFormat.WebDownload, name=license_version,
|
||||||
@ -562,13 +563,12 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
proxy_password=self.field('proxy_password')
|
proxy_password=self.field('proxy_password')
|
||||||
)
|
)
|
||||||
if importer.do_import(license_version):
|
if importer.do_import(license_version):
|
||||||
self.manager.save_meta_data(license_version, license_version,
|
self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions)
|
||||||
license_copyright, license_permissions)
|
|
||||||
self.manager.reload_bibles()
|
self.manager.reload_bibles()
|
||||||
if bible_type == BibleFormat.WebDownload:
|
if bible_type == BibleFormat.WebDownload:
|
||||||
self.progress_label.setText(
|
self.progress_label.setText(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
|
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
|
||||||
'downloaded on\ndemand and thus an internet connection is required.'))
|
'downloaded on\ndemand and thus an internet connection is required.'))
|
||||||
else:
|
else:
|
||||||
self.progress_label.setText(WizardStrings.FinishedImport)
|
self.progress_label.setText(WizardStrings.FinishedImport)
|
||||||
else:
|
else:
|
||||||
|
@ -78,7 +78,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
Set up the UI for the bible wizard.
|
Set up the UI for the bible wizard.
|
||||||
"""
|
"""
|
||||||
super(BibleUpgradeForm, self).setupUi(image)
|
super(BibleUpgradeForm, self).setupUi(image)
|
||||||
Registry().execute('openlp_stop_wizard', self.stop_import)
|
Registry().register_function('openlp_stop_wizard', self.stop_import)
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
@ -96,34 +96,34 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if not self.currentPage() == self.progress_page:
|
if not self.currentPage() == self.progress_page:
|
||||||
self.done(QtGui.QDialog.Rejected)
|
self.done(QtGui.QDialog.Rejected)
|
||||||
|
|
||||||
def onCurrentIdChanged(self, pageId):
|
def onCurrentIdChanged(self, page_id):
|
||||||
"""
|
"""
|
||||||
Perform necessary functions depending on which wizard page is active.
|
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.pre_wizard()
|
||||||
self.perform_wizard()
|
self.perform_wizard()
|
||||||
self.post_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()
|
self.next()
|
||||||
|
|
||||||
def onBackupBrowseButtonClicked(self):
|
def on_backup_browse_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the OSIS file.
|
Show the file open dialog for the OSIS file.
|
||||||
"""
|
"""
|
||||||
filename = QtGui.QFileDialog.getExistingDirectory(self,
|
filename = QtGui.QFileDialog.getExistingDirectory(self, translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Select a Backup Directory'), '')
|
'Select a Backup Directory'), '')
|
||||||
if filename:
|
if filename:
|
||||||
self.backupDirectoryEdit.setText(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.
|
Enable or disable the backup directory widgets.
|
||||||
"""
|
"""
|
||||||
self.backupDirectoryEdit.setEnabled(not checked)
|
self.backupDirectoryEdit.setEnabled(not checked)
|
||||||
self.backupBrowseButton.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.
|
Backup old bible databases in a given folder.
|
||||||
"""
|
"""
|
||||||
@ -147,8 +147,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Set up the signals used in the bible importer.
|
Set up the signals used in the bible importer.
|
||||||
"""
|
"""
|
||||||
self.backupBrowseButton.clicked.connect(self.onBackupBrowseButtonClicked)
|
self.backupBrowseButton.clicked.connect(self.on_backup_browse_button_clicked)
|
||||||
self.noBackupCheckBox.toggled.connect(self.onNoBackupCheckBoxToggled)
|
self.noBackupCheckBox.toggled.connect(self.on_no_backup_check_box_toggled)
|
||||||
|
|
||||||
def add_custom_pages(self):
|
def add_custom_pages(self):
|
||||||
"""
|
"""
|
||||||
@ -238,32 +238,34 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
Allow for localisation of the bible import wizard.
|
Allow for localisation of the bible import wizard.
|
||||||
"""
|
"""
|
||||||
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard'))
|
self.setWindowTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Bible Upgrade Wizard'))
|
||||||
self.title_label.setText(WizardStrings.HeaderStyle %
|
self.title_label.setText(WizardStrings.HeaderStyle % translate('OpenLP.Ui',
|
||||||
translate('OpenLP.Ui', 'Welcome to the Bible Upgrade Wizard'))
|
'Welcome to the Bible Upgrade Wizard'))
|
||||||
self.information_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.information_label.setText(
|
||||||
'This wizard will help you to upgrade your existing Bibles from a prior version of OpenLP 2. '
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'Click the next button below to start the upgrade process.'))
|
'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.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Backup Directory'))
|
||||||
self.backup_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
self.backup_page.setSubTitle(
|
||||||
'Please select a backup directory for your Bibles'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'Please select a backup directory for your Bibles'))
|
||||||
self.backupInfoLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.backupInfoLabel.setText(
|
||||||
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
' This will create a backup of your current Bibles so that you can '
|
'Previous releases of OpenLP 2.0 are unable to use upgraded Bibles.'
|
||||||
'simply copy the files back to your OpenLP data directory if you '
|
' This will create a backup of your current Bibles so that you can '
|
||||||
'need to revert to a previous release of OpenLP. Instructions on '
|
'simply copy the files back to your OpenLP data directory if you '
|
||||||
'how to restore the files can be found in our <a href="'
|
'need to revert to a previous release of OpenLP. Instructions on '
|
||||||
'http://wiki.openlp.org/faq">Frequently Asked Questions</a>.'))
|
'how to restore the files can be found in our <a href="'
|
||||||
self.selectLabel.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
'http://wiki.openlp.org/faq">Frequently Asked Questions</a>.'))
|
||||||
'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.backupDirectoryLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Backup Directory:'))
|
||||||
self.noBackupCheckBox.setText(
|
self.noBackupCheckBox.setText(
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'There is no need to backup my Bibles'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'There is no need to backup my Bibles'))
|
||||||
self.selectPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Bibles'))
|
self.selectPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Select Bibles'))
|
||||||
self.selectPage.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
self.selectPage.setSubTitle(
|
||||||
'Please select the Bibles to upgrade'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'Please select the Bibles to upgrade'))
|
||||||
self.progress_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
|
self.progress_page.setTitle(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading'))
|
||||||
self.progress_page.setSubTitle(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progress_page.setSubTitle(
|
||||||
'Please wait while your Bibles are upgraded.'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'Please wait while your Bibles are upgraded.'))
|
||||||
self.progress_label.setText(WizardStrings.Ready)
|
self.progress_label.setText(WizardStrings.Ready)
|
||||||
self.progress_bar.setFormat('%p%')
|
self.progress_bar.setFormat('%p%')
|
||||||
|
|
||||||
@ -277,16 +279,18 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
|
if not self.noBackupCheckBox.checkState() == QtCore.Qt.Checked:
|
||||||
backup_path = self.backupDirectoryEdit.text()
|
backup_path = self.backupDirectoryEdit.text()
|
||||||
if not backup_path:
|
if not backup_path:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
UiStrings().EmptyField,
|
||||||
'You need to specify a backup directory for your Bibles.'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'You need to specify a backup directory for '
|
||||||
|
'your Bibles.'))
|
||||||
self.backupDirectoryEdit.setFocus()
|
self.backupDirectoryEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if not self.backupOldBibles(backup_path):
|
if not self.backup_old_bibles(backup_path):
|
||||||
critical_error_message_box(UiStrings().Error,
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup your '
|
UiStrings().Error,
|
||||||
'Bibles you need permission to write to the given directory.'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'The backup was not successful.\nTo backup '
|
||||||
|
'your Bibles you need permission to write to the given directory.'))
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
@ -340,8 +344,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.includeWebBible = False
|
self.includeWebBible = False
|
||||||
proxy_server = None
|
proxy_server = None
|
||||||
if not self.files:
|
if not self.files:
|
||||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progress_label.setText(
|
||||||
'There are no Bibles that need to be upgraded.'))
|
translate('BiblesPlugin.UpgradeWizardForm', 'There are no Bibles that need to be upgraded.'))
|
||||||
self.progress_bar.hide()
|
self.progress_bar.hide()
|
||||||
return
|
return
|
||||||
max_bibles = 0
|
max_bibles = 0
|
||||||
@ -363,11 +367,11 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
self.progress_bar.reset()
|
self.progress_bar.reset()
|
||||||
old_bible = OldBibleDB(self.media_item, path=self.temp_dir,
|
old_bible = OldBibleDB(self.media_item, path=self.temp_dir, file=filename[0])
|
||||||
file=filename[0])
|
|
||||||
name = filename[1]
|
name = filename[1]
|
||||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progress_label.setText(
|
||||||
'Upgrading Bible %s of %s: "%s"\nUpgrading ...') % (number + 1, max_bibles, name))
|
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] = BibleDB(self.media_item, path=self.path, name=name, file=filename[0])
|
||||||
self.new_bibles[number].register(self.plugin.upgrade_wizard)
|
self.new_bibles[number].register(self.plugin.upgrade_wizard)
|
||||||
metadata = old_bible.get_metadata()
|
metadata = old_bible.get_metadata()
|
||||||
@ -404,7 +408,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'),
|
translate('BiblesPlugin.UpgradeWizardForm', 'Download Error'),
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'To upgrade your Web Bibles an Internet connection is required.'))
|
'To upgrade your Web Bibles an Internet connection is required.'))
|
||||||
self.increment_progress_bar(translate(
|
self.increment_progress_bar(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\nFailed') %
|
'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\nFailed') %
|
||||||
(number + 1, max_bibles, name), self.progress_bar.maximum() - self.progress_bar.value())
|
(number + 1, max_bibles, name), self.progress_bar.maximum() - self.progress_bar.value())
|
||||||
@ -415,16 +419,16 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
meta_data['download_source'].lower())
|
meta_data['download_source'].lower())
|
||||||
if bible and bible['language_id']:
|
if bible and bible['language_id']:
|
||||||
language_id = bible['language_id']
|
language_id = bible['language_id']
|
||||||
self.new_bibles[number].save_meta('language_id',
|
self.new_bibles[number].save_meta('language_id', language_id)
|
||||||
language_id)
|
|
||||||
else:
|
else:
|
||||||
language_id = self.new_bibles[number].get_language(name)
|
language_id = self.new_bibles[number].get_language(name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.warn('Upgrading from "%s" failed' % filename[0])
|
log.warn('Upgrading from "%s" failed' % filename[0])
|
||||||
self.new_bibles[number].session.close()
|
self.new_bibles[number].session.close()
|
||||||
del self.new_bibles[number]
|
del self.new_bibles[number]
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
self.progress_bar.maximum() - self.progress_bar.value())
|
self.progress_bar.maximum() - self.progress_bar.value())
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
@ -433,8 +437,10 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') % (number + 1, max_bibles, name, book))
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
|
||||||
|
(number + 1, max_bibles, name, book))
|
||||||
book_ref_id = self.new_bibles[number].\
|
book_ref_id = self.new_bibles[number].\
|
||||||
get_book_ref_id_by_name(book, len(books), language_id)
|
get_book_ref_id_by_name(book, len(books), language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
@ -445,8 +451,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
db_book = self.new_bibles[number].create_book(book,
|
db_book = self.new_bibles[number].create_book(book, book_ref_id, book_details['testament_id'])
|
||||||
book_ref_id, book_details['testament_id'])
|
|
||||||
# Try to import already downloaded verses.
|
# Try to import already downloaded verses.
|
||||||
oldbook = old_bible.get_book(book)
|
oldbook = old_bible.get_book(book)
|
||||||
if oldbook:
|
if oldbook:
|
||||||
@ -458,9 +463,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.new_bibles[number].create_verse(db_book.id,
|
self.new_bibles[number].create_verse(db_book.id, int(verse['chapter']),
|
||||||
int(verse['chapter']),
|
int(verse['verse']), str(verse['text']))
|
||||||
int(verse['verse']), str(verse['text']))
|
|
||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
self.new_bibles[number].session.commit()
|
self.new_bibles[number].session.commit()
|
||||||
else:
|
else:
|
||||||
@ -471,8 +475,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
log.warn('Upgrading books from "%s" failed' % name)
|
log.warn('Upgrading books from "%s" failed' % name)
|
||||||
self.new_bibles[number].session.close()
|
self.new_bibles[number].session.close()
|
||||||
del self.new_bibles[number]
|
del self.new_bibles[number]
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
self.progress_bar.maximum() - self.progress_bar.value())
|
self.progress_bar.maximum() - self.progress_bar.value())
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
continue
|
continue
|
||||||
@ -482,8 +487,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nUpgrading %s ...') %
|
||||||
(number + 1, max_bibles, name, book['name']))
|
(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)
|
book_ref_id = self.new_bibles[number].get_book_ref_id_by_name(book['name'], len(books), language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
@ -493,8 +499,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
db_book = self.new_bibles[number].create_book(book['name'],
|
db_book = self.new_bibles[number].create_book(book['name'], book_ref_id,
|
||||||
book_ref_id, book_details['testament_id'])
|
book_details['testament_id'])
|
||||||
verses = old_bible.get_verses(book['id'])
|
verses = old_bible.get_verses(book['id'])
|
||||||
if not verses:
|
if not verses:
|
||||||
log.warn('No verses found to import for book "%s"', book['name'])
|
log.warn('No verses found to import for book "%s"', book['name'])
|
||||||
@ -504,20 +510,21 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
self.success[number] = False
|
self.success[number] = False
|
||||||
break
|
break
|
||||||
self.new_bibles[number].create_verse(db_book.id,
|
self.new_bibles[number].create_verse(db_book.id, int(verse['chapter']), int(verse['verse']),
|
||||||
int(verse['chapter']),
|
str(verse['text']))
|
||||||
int(verse['verse']), str(verse['text']))
|
|
||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
self.new_bibles[number].session.commit()
|
self.new_bibles[number].session.commit()
|
||||||
if not self.success.get(number, True):
|
if not self.success.get(number, True):
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nFailed') % (number + 1, max_bibles, name),
|
||||||
self.progress_bar.maximum() - self.progress_bar.value())
|
self.progress_bar.maximum() - self.progress_bar.value())
|
||||||
else:
|
else:
|
||||||
self.success[number] = True
|
self.success[number] = True
|
||||||
self.new_bibles[number].save_meta('name', name)
|
self.new_bibles[number].save_meta('name', name)
|
||||||
self.increment_progress_bar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.increment_progress_bar(
|
||||||
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
'Upgrading Bible %s of %s: "%s"\nComplete') % (number + 1, max_bibles, name))
|
||||||
if number in self.new_bibles:
|
if number in self.new_bibles:
|
||||||
self.new_bibles[number].session.close()
|
self.new_bibles[number].session.close()
|
||||||
# Close the last bible's connection if possible.
|
# Close the last bible's connection if possible.
|
||||||
@ -545,12 +552,15 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
failed_import_text = ''
|
failed_import_text = ''
|
||||||
if successful_import > 0:
|
if successful_import > 0:
|
||||||
if self.includeWebBible:
|
if self.includeWebBible:
|
||||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progress_label.setText(
|
||||||
'Upgrading Bible(s): %s successful%s\nPlease note that verses from Web Bibles will be downloaded '
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
'on demand and so an Internet connection is required.') % (successful_import, failed_import_text))
|
'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:
|
else:
|
||||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm',
|
self.progress_label.setText(
|
||||||
'Upgrading Bible(s): %s successful%s') % (successful_import, failed_import_text))
|
translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible(s): %s successful%s') % (
|
||||||
|
successful_import, failed_import_text))
|
||||||
else:
|
else:
|
||||||
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
|
self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.'))
|
||||||
# Remove temp directory.
|
# Remove temp directory.
|
||||||
|
@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
class Ui_BookNameDialog(object):
|
class Ui_BookNameDialog(object):
|
||||||
def setupUi(self, book_name_dialog):
|
def setupUi(self, book_name_dialog):
|
||||||
book_name_dialog.setObjectName('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.setColumnStretch(1, 1)
|
||||||
self.corresponding_layout.setSpacing(8)
|
self.corresponding_layout.setSpacing(8)
|
||||||
self.corresponding_layout.setObjectName('corresponding_layout')
|
self.corresponding_layout.setObjectName('corresponding_layout')
|
||||||
self.currentLabel = QtGui.QLabel(book_name_dialog)
|
self.current_label = QtGui.QLabel(book_name_dialog)
|
||||||
self.currentLabel.setObjectName('currentLabel')
|
self.current_label.setObjectName('current_label')
|
||||||
self.corresponding_layout.addWidget(self.currentLabel, 0, 0, 1, 1)
|
self.corresponding_layout.addWidget(self.current_label, 0, 0, 1, 1)
|
||||||
self.current_book_label = QtGui.QLabel(book_name_dialog)
|
self.current_book_label = QtGui.QLabel(book_name_dialog)
|
||||||
self.current_book_label.setObjectName('current_book_label')
|
self.current_book_label.setObjectName('current_book_label')
|
||||||
self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1)
|
self.corresponding_layout.addWidget(self.current_book_label, 0, 1, 1, 1)
|
||||||
self.correspondingLabel = QtGui.QLabel(book_name_dialog)
|
self.corresponding_label = QtGui.QLabel(book_name_dialog)
|
||||||
self.correspondingLabel.setObjectName('correspondingLabel')
|
self.corresponding_label.setObjectName('corresponding_label')
|
||||||
self.corresponding_layout.addWidget(self.correspondingLabel, 1, 0, 1, 1)
|
self.corresponding_layout.addWidget(self.corresponding_label, 1, 0, 1, 1)
|
||||||
self.corresponding_combo_box = QtGui.QComboBox(book_name_dialog)
|
self.corresponding_combo_box = QtGui.QComboBox(book_name_dialog)
|
||||||
self.corresponding_combo_box.setObjectName('corresponding_combo_box')
|
self.corresponding_combo_box.setObjectName('corresponding_combo_box')
|
||||||
self.corresponding_layout.addWidget(self.corresponding_combo_box, 1, 1, 1, 1)
|
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):
|
def retranslateUi(self, book_name_dialog):
|
||||||
book_name_dialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
|
book_name_dialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name'))
|
||||||
self.info_label.setText(translate('BiblesPlugin.BookNameDialog',
|
self.info_label.setText(
|
||||||
'The following book name cannot be matched up internally. '
|
translate('BiblesPlugin.BookNameDialog', 'The following book name cannot be matched up internally. '
|
||||||
'Please select the corresponding name from the list.'))
|
'Please select the corresponding name from the list.'))
|
||||||
self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
|
self.current_label.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:'))
|
||||||
self.correspondingLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
|
self.corresponding_label.setText(translate('BiblesPlugin.BookNameDialog', 'Corresponding name:'))
|
||||||
self.options_group_box.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
|
self.options_group_box.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From'))
|
||||||
self.old_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
|
self.old_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'Old Testament'))
|
||||||
self.new_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))
|
self.new_testament_check_box.setText(translate('BiblesPlugin.BookNameDialog', 'New Testament'))
|
||||||
|
@ -52,7 +52,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
"""
|
"""
|
||||||
log.info('BookNameForm loaded')
|
log.info('BookNameForm loaded')
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent=None):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
@ -66,11 +66,11 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
"""
|
"""
|
||||||
Set up the signals used in the booknameform.
|
Set up the signals used in the booknameform.
|
||||||
"""
|
"""
|
||||||
self.old_testament_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.onCheckBoxIndexChanged)
|
self.new_testament_check_box.stateChanged.connect(self.on_check_box_index_changed)
|
||||||
self.apocrypha_check_box.stateChanged.connect(self.onCheckBoxIndexChanged)
|
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
|
Reload Combobox if CheckBox state has changed
|
||||||
"""
|
"""
|
||||||
@ -119,7 +119,8 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
cor_book = self.corresponding_combo_box.currentText()
|
cor_book = self.corresponding_combo_box.currentText()
|
||||||
for character in '\\.^$*+?{}[]()':
|
for character in '\\.^$*+?{}[]()':
|
||||||
cor_book = cor_book.replace(character, '\\' + character)
|
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]
|
books = [_f for _f in map(BiblesResourcesDB.get_book, books) if _f]
|
||||||
if books:
|
if books:
|
||||||
self.book_id = books[0]['id']
|
self.book_id = books[0]['id']
|
||||||
|
@ -107,7 +107,7 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.book_name_widget_layout = QtGui.QFormLayout(self.book_name_widget)
|
self.book_name_widget_layout = QtGui.QFormLayout(self.book_name_widget)
|
||||||
self.book_name_widget_layout.setObjectName('book_name_widget_layout')
|
self.book_name_widget_layout.setObjectName('book_name_widget_layout')
|
||||||
self.book_name_label = {}
|
self.book_name_label = {}
|
||||||
self.book_name_edit= {}
|
self.book_name_edit = {}
|
||||||
for book in BiblesResourcesDB.get_books():
|
for book in BiblesResourcesDB.get_books():
|
||||||
self.book_name_label[book['abbreviation']] = QtGui.QLabel(self.book_name_widget)
|
self.book_name_label[book['abbreviation']] = QtGui.QLabel(self.book_name_widget)
|
||||||
self.book_name_label[book['abbreviation']].setObjectName('book_name_label[%s]' % book['abbreviation'])
|
self.book_name_label[book['abbreviation']].setObjectName('book_name_label[%s]' % book['abbreviation'])
|
||||||
@ -131,24 +131,28 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.book_names = BibleStrings().BookNames
|
self.book_names = BibleStrings().BookNames
|
||||||
edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
|
edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor'))
|
||||||
# Meta tab
|
# Meta tab
|
||||||
self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.meta_tab),
|
self.bible_tab_widget.setTabText(
|
||||||
translate('SongsPlugin.EditBibleForm', 'Meta Data'))
|
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.license_details_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details'))
|
||||||
self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
||||||
self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
||||||
self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
||||||
self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
||||||
self.language_selection_label.setText(translate('BiblesPlugin.EditBibleForm',
|
self.language_selection_label.setText(
|
||||||
'Book name language in search field, search results and on display:'))
|
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(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'))
|
translate('BiblesPlugin.EditBibleForm', 'Bible Language'))
|
||||||
self.language_selection_combo_box.setItemText(LanguageSelection.Application + 1,
|
self.language_selection_combo_box.setItemText(
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Application Language'))
|
LanguageSelection.Application + 1, translate('BiblesPlugin.EditBibleForm', 'Application Language'))
|
||||||
self.language_selection_combo_box.setItemText(LanguageSelection.English + 1,
|
self.language_selection_combo_box.setItemText(
|
||||||
|
LanguageSelection.English + 1,
|
||||||
translate('BiblesPlugin.EditBibleForm', 'English'))
|
translate('BiblesPlugin.EditBibleForm', 'English'))
|
||||||
# Book name tab
|
# 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'))
|
translate('SongsPlugin.EditBibleForm', 'Custom Book Names'))
|
||||||
for book in BiblesResourcesDB.get_books():
|
for book in BiblesResourcesDB.get_books():
|
||||||
self.book_name_label[book['abbreviation']].setText('%s:' % str(self.book_names[book['abbreviation']]))
|
self.book_name_label[book['abbreviation']].setText('%s:' % str(self.book_names[book['abbreviation']]))
|
||||||
|
@ -176,7 +176,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
UiStrings().EmptyField,
|
UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') %
|
translate('BiblesPlugin.BibleEditForm', 'You need to specify a book name for "%s".') %
|
||||||
self.book_names[abbreviation])
|
self.book_names[abbreviation])
|
||||||
return False
|
return False
|
||||||
elif not book_regex.match(new_book_name):
|
elif not book_regex.match(new_book_name):
|
||||||
self.book_name_edit[abbreviation].setFocus()
|
self.book_name_edit[abbreviation].setFocus()
|
||||||
|
@ -32,6 +32,7 @@ from PyQt4 import QtGui
|
|||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
class Ui_LanguageDialog(object):
|
class Ui_LanguageDialog(object):
|
||||||
def setupUi(self, language_dialog):
|
def setupUi(self, language_dialog):
|
||||||
language_dialog.setObjectName('language_dialog')
|
language_dialog.setObjectName('language_dialog')
|
||||||
@ -54,11 +55,11 @@ class Ui_LanguageDialog(object):
|
|||||||
self.language_label.setObjectName('language_label')
|
self.language_label.setObjectName('language_label')
|
||||||
self.language_h_box_layout.addWidget(self.language_label)
|
self.language_h_box_layout.addWidget(self.language_label)
|
||||||
self.language_combo_box = QtGui.QComboBox(language_dialog)
|
self.language_combo_box = QtGui.QComboBox(language_dialog)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
size_policy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
size_policy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
size_policy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())
|
size_policy.setHeightForWidth(self.language_combo_box.sizePolicy().hasHeightForWidth())
|
||||||
self.language_combo_box.setSizePolicy(sizePolicy)
|
self.language_combo_box.setSizePolicy(size_policy)
|
||||||
self.language_combo_box.setObjectName('language_combo_box')
|
self.language_combo_box.setObjectName('language_combo_box')
|
||||||
self.language_h_box_layout.addWidget(self.language_combo_box)
|
self.language_h_box_layout.addWidget(self.language_combo_box)
|
||||||
self.language_layout.addLayout(self.language_h_box_layout)
|
self.language_layout.addLayout(self.language_h_box_layout)
|
||||||
@ -70,7 +71,8 @@ class Ui_LanguageDialog(object):
|
|||||||
def retranslateUi(self, language_dialog):
|
def retranslateUi(self, language_dialog):
|
||||||
language_dialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
|
language_dialog.setWindowTitle(translate('BiblesPlugin.LanguageDialog', 'Select Language'))
|
||||||
self.bible_label.setText(translate('BiblesPlugin.LanguageDialog', ''))
|
self.bible_label.setText(translate('BiblesPlugin.LanguageDialog', ''))
|
||||||
self.info_label.setText(translate('BiblesPlugin.LanguageDialog',
|
self.info_label.setText(
|
||||||
'OpenLP is unable to determine the language of this translation of the Bible. Please select the language '
|
translate('BiblesPlugin.LanguageDialog',
|
||||||
'from the list below.'))
|
'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:'))
|
self.language_label.setText(translate('BiblesPlugin.LanguageDialog', 'Language:'))
|
||||||
|
@ -36,8 +36,7 @@ from PyQt4.QtGui import QDialog
|
|||||||
|
|
||||||
from openlp.core.common import translate
|
from openlp.core.common import translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.plugins.bibles.forms.languagedialog import \
|
from openlp.plugins.bibles.forms.languagedialog import Ui_LanguageDialog
|
||||||
Ui_LanguageDialog
|
|
||||||
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BiblesResourcesDB
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,9 +218,10 @@ def update_reference_separators():
|
|||||||
REFERENCE_MATCHES['range'] = re.compile('^\s*%s\s*$' % range_regex, re.UNICODE)
|
REFERENCE_MATCHES['range'] = re.compile('^\s*%s\s*$' % range_regex, re.UNICODE)
|
||||||
REFERENCE_MATCHES['range_separator'] = re.compile(REFERENCE_SEPARATORS['sep_l'], re.UNICODE)
|
REFERENCE_MATCHES['range_separator'] = re.compile(REFERENCE_SEPARATORS['sep_l'], re.UNICODE)
|
||||||
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
|
# full reference match: <book>(<range>(,(?!$)|(?=$)))+
|
||||||
REFERENCE_MATCHES['full'] = re.compile('^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
|
REFERENCE_MATCHES['full'] = \
|
||||||
'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$' \
|
re.compile('^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*'
|
||||||
% dict(list(REFERENCE_SEPARATORS.items()) + [('range_regex', range_regex)]), re.UNICODE)
|
'(?P<ranges>(?:%(range_regex)s(?:%(sep_l)s(?!\s*$)|(?=\s*$)))+)\s*$'
|
||||||
|
% dict(list(REFERENCE_SEPARATORS.items()) + [('range_regex', range_regex)]), re.UNICODE)
|
||||||
|
|
||||||
|
|
||||||
def get_reference_separator(separator_type):
|
def get_reference_separator(separator_type):
|
||||||
|
@ -422,7 +422,7 @@ class BiblesTab(SettingsTab):
|
|||||||
color.setAlpha(128)
|
color.setAlpha(128)
|
||||||
palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color)
|
palette.setColor(QtGui.QPalette.Active, QtGui.QPalette.Text, color)
|
||||||
return palette
|
return palette
|
||||||
|
|
||||||
def check_is_verse_number_visible(self):
|
def check_is_verse_number_visible(self):
|
||||||
"""
|
"""
|
||||||
Enables / Disables verse settings dependent on is_verse_number_visible
|
Enables / Disables verse settings dependent on is_verse_number_visible
|
||||||
@ -430,4 +430,3 @@ class BiblesTab(SettingsTab):
|
|||||||
self.new_chapters_check_box.setEnabled(self.is_verse_number_visible)
|
self.new_chapters_check_box.setEnabled(self.is_verse_number_visible)
|
||||||
self.display_style_label.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)
|
self.display_style_combo_box.setEnabled(self.is_verse_number_visible)
|
||||||
|
|
||||||
|
@ -80,23 +80,20 @@ def init_schema(url):
|
|||||||
|
|
||||||
meta_table = Table('metadata', metadata,
|
meta_table = Table('metadata', metadata,
|
||||||
Column('key', types.Unicode(255), primary_key=True, index=True),
|
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,
|
book_table = Table('book', metadata,
|
||||||
Column('id', types.Integer, primary_key=True),
|
Column('id', types.Integer, primary_key=True),
|
||||||
Column('book_reference_id', types.Integer, index=True),
|
Column('book_reference_id', types.Integer, index=True),
|
||||||
Column('testament_reference_id', types.Integer),
|
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,
|
verse_table = Table('verse', metadata,
|
||||||
Column('id', types.Integer, primary_key=True, index=True),
|
Column('id', types.Integer, primary_key=True, index=True),
|
||||||
Column('book_id', types.Integer, ForeignKey(
|
Column('book_id', types.Integer, ForeignKey(
|
||||||
'book.id'), index=True),
|
'book.id'), index=True),
|
||||||
Column('chapter', types.Integer, index=True),
|
Column('chapter', types.Integer, index=True),
|
||||||
Column('verse', types.Integer, index=True),
|
Column('verse', types.Integer, index=True),
|
||||||
Column('text', types.UnicodeText, index=True),
|
Column('text', types.UnicodeText, index=True),)
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
class_mapper(BibleMeta)
|
class_mapper(BibleMeta)
|
||||||
@ -157,7 +154,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
if 'path' in kwargs:
|
if 'path' in kwargs:
|
||||||
self.path = kwargs['path']
|
self.path = kwargs['path']
|
||||||
self.wizard = None
|
self.wizard = None
|
||||||
Registry().execute('openlp_stop_wizard', self.stop_import)
|
Registry().register_function('openlp_stop_wizard', self.stop_import)
|
||||||
|
|
||||||
def stop_import(self):
|
def stop_import(self):
|
||||||
"""
|
"""
|
||||||
@ -194,7 +191,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
:param testament: *Defaults to 1.* The testament_reference_id from
|
:param testament: *Defaults to 1.* The testament_reference_id from
|
||||||
bibles_resources.sqlite of the testament this book belongs to.
|
bibles_resources.sqlite of the testament this book belongs to.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.create_book("%s", "%s")', name, bk_ref_id)
|
log.debug('BibleDB.create_book("%s", "%s")' % (name, bk_ref_id))
|
||||||
book = Book.populate(name=name, book_reference_id=bk_ref_id, testament_reference_id=testament)
|
book = Book.populate(name=name, book_reference_id=bk_ref_id, testament_reference_id=testament)
|
||||||
self.save_object(book)
|
self.save_object(book)
|
||||||
return book
|
return book
|
||||||
@ -205,7 +202,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
|
|
||||||
:param book: The book object
|
:param book: The book object
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.update_book("%s")', book.name)
|
log.debug('BibleDB.update_book("%s")' % book.name)
|
||||||
return self.save_object(book)
|
return self.save_object(book)
|
||||||
|
|
||||||
def delete_book(self, db_book):
|
def delete_book(self, db_book):
|
||||||
@ -214,7 +211,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
|
|
||||||
:param db_book: The book object.
|
:param db_book: The book object.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.delete_book("%s")', db_book.name)
|
log.debug('BibleDB.delete_book("%s")' % db_book.name)
|
||||||
if self.delete_object(Book, db_book.id):
|
if self.delete_object(Book, db_book.id):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -225,9 +222,10 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
|
|
||||||
:param book_id: The id of the book being appended.
|
:param book_id: The id of the book being appended.
|
||||||
:param chapter: The chapter number.
|
: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)
|
log.debug('BibleDBcreate_chapter("%s", "%s")' % (book_id, chapter))
|
||||||
# Text list has book and chapter as first two elements of the array.
|
# Text list has book and chapter as first two elements of the array.
|
||||||
for verse_number, verse_text in text_list.items():
|
for verse_number, verse_text in text_list.items():
|
||||||
verse = Verse.populate(
|
verse = Verse.populate(
|
||||||
@ -269,7 +267,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
if not isinstance(value, str):
|
if not isinstance(value, str):
|
||||||
value = str(value)
|
value = str(value)
|
||||||
log.debug('BibleDB.save_meta("%s/%s")', key, value)
|
log.debug('BibleDB.save_meta("%s/%s")' % (key, value))
|
||||||
meta = self.get_object(BibleMeta, key)
|
meta = self.get_object(BibleMeta, key)
|
||||||
if meta:
|
if meta:
|
||||||
meta.value = value
|
meta.value = value
|
||||||
@ -283,7 +281,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
|
|
||||||
:param book: The name of the book to return.
|
:param book: The name of the book to return.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.get_book("%s")', book)
|
log.debug('BibleDB.get_book("%s")' % book)
|
||||||
return self.get_object_filtered(Book, Book.name.like(book + '%'))
|
return self.get_object_filtered(Book, Book.name.like(book + '%'))
|
||||||
|
|
||||||
def get_books(self):
|
def get_books(self):
|
||||||
@ -294,17 +292,17 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
log.debug('BibleDB.get_books()')
|
log.debug('BibleDB.get_books()')
|
||||||
return self.get_all_objects(Book, order_by_ref=Book.id)
|
return self.get_all_objects(Book, order_by_ref=Book.id)
|
||||||
|
|
||||||
def get_book_by_book_ref_id(self, id):
|
def get_book_by_book_ref_id(self, ref_id):
|
||||||
"""
|
"""
|
||||||
Return a book object from the database.
|
Return a book object from the database.
|
||||||
|
|
||||||
:param id: The reference id of the book to return.
|
:param ref_id: The reference id of the book to return.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.get_book_by_book_ref_id("%s")', id)
|
log.debug('BibleDB.get_book_by_book_ref_id("%s")' % ref_id)
|
||||||
return self.get_object_filtered(Book, Book.book_reference_id.like(id))
|
return self.get_object_filtered(Book, Book.book_reference_id.like(ref_id))
|
||||||
|
|
||||||
def get_book_ref_id_by_name(self, book, maxbooks, language_id=None):
|
def get_book_ref_id_by_name(self, book, maxbooks, language_id=None):
|
||||||
log.debug('BibleDB.get_book_ref_id_by_name:("%s", "%s")', book, language_id)
|
log.debug('BibleDB.get_book_ref_id_by_name:("%s", "%s")' % (book, language_id))
|
||||||
book_id = None
|
book_id = None
|
||||||
if BiblesResourcesDB.get_book(book, True):
|
if BiblesResourcesDB.get_book(book, True):
|
||||||
book_temp = BiblesResourcesDB.get_book(book, True)
|
book_temp = BiblesResourcesDB.get_book(book, True)
|
||||||
@ -330,7 +328,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
:param book: The name of the book, according to the selected language.
|
:param book: The name of the book, according to the selected language.
|
||||||
:param language_selection: The language selection the user has chosen in the settings section of the Bible.
|
:param language_selection: The language selection the user has chosen in the settings section of the Bible.
|
||||||
"""
|
"""
|
||||||
log.debug('get_book_ref_id_by_localised_name("%s", "%s")', book, language_selection)
|
log.debug('get_book_ref_id_by_localised_name("%s", "%s")' % (book, language_selection))
|
||||||
from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
|
from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
|
||||||
book_names = BibleStrings().BookNames
|
book_names = BibleStrings().BookNames
|
||||||
# escape reserved characters
|
# escape reserved characters
|
||||||
@ -378,14 +376,14 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
[(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
|
[(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
|
||||||
:param show_error:
|
:param show_error:
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.get_verses("%s")', reference_list)
|
log.debug('BibleDB.get_verses("%s")' % reference_list)
|
||||||
verse_list = []
|
verse_list = []
|
||||||
book_error = False
|
book_error = False
|
||||||
for book_id, chapter, start_verse, end_verse in reference_list:
|
for book_id, chapter, start_verse, end_verse in reference_list:
|
||||||
db_book = self.get_book_by_book_ref_id(book_id)
|
db_book = self.get_book_by_book_ref_id(book_id)
|
||||||
if db_book:
|
if db_book:
|
||||||
book_id = db_book.book_reference_id
|
book_id = db_book.book_reference_id
|
||||||
log.debug('Book name corrected to "%s"', db_book.name)
|
log.debug('Book name corrected to "%s"' % db_book.name)
|
||||||
if end_verse == -1:
|
if end_verse == -1:
|
||||||
end_verse = self.get_verse_count(book_id, chapter)
|
end_verse = self.get_verse_count(book_id, chapter)
|
||||||
verses = self.session.query(Verse) \
|
verses = self.session.query(Verse) \
|
||||||
@ -397,7 +395,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
.all()
|
.all()
|
||||||
verse_list.extend(verses)
|
verse_list.extend(verses)
|
||||||
else:
|
else:
|
||||||
log.debug('OpenLP failed to find book with id "%s"', book_id)
|
log.debug('OpenLP failed to find book with id "%s"' % book_id)
|
||||||
book_error = True
|
book_error = True
|
||||||
if book_error and show_error:
|
if book_error and show_error:
|
||||||
critical_error_message_box(
|
critical_error_message_box(
|
||||||
@ -416,7 +414,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
contains spaces, it will split apart and AND'd on the list of
|
contains spaces, it will split apart and AND'd on the list of
|
||||||
values.
|
values.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.verse_search("%s")', text)
|
log.debug('BibleDB.verse_search("%s")' % text)
|
||||||
verses = self.session.query(Verse)
|
verses = self.session.query(Verse)
|
||||||
if text.find(',') > -1:
|
if text.find(',') > -1:
|
||||||
keywords = ['%%%s%%' % keyword.strip() for keyword in text.split(',')]
|
keywords = ['%%%s%%' % keyword.strip() for keyword in text.split(',')]
|
||||||
@ -435,9 +433,9 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
|
|
||||||
:param book: The book object to get the chapter count for.
|
:param book: The book object to get the chapter count for.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.get_chapter_count("%s")', book.name)
|
log.debug('BibleDB.get_chapter_count("%s")' % book.name)
|
||||||
count = self.session.query(func.max(Verse.chapter)).join(Book).filter(
|
count = self.session.query(func.max(Verse.chapter)).join(Book).filter(
|
||||||
Book.book_reference_id==book.book_reference_id).scalar()
|
Book.book_reference_id == book.book_reference_id).scalar()
|
||||||
if not count:
|
if not count:
|
||||||
return 0
|
return 0
|
||||||
return count
|
return count
|
||||||
@ -449,7 +447,7 @@ class BibleDB(QtCore.QObject, Manager, RegistryProperties):
|
|||||||
:param book_ref_id: The book reference id.
|
:param book_ref_id: The book reference id.
|
||||||
:param chapter: The chapter to get the verse count for.
|
:param chapter: The chapter to get the verse count for.
|
||||||
"""
|
"""
|
||||||
log.debug('BibleDB.get_verse_count("%s", "%s")', book_ref_id, chapter)
|
log.debug('BibleDB.get_verse_count("%s", "%s")' % (book_ref_id, chapter))
|
||||||
count = self.session.query(func.max(Verse.verse)).join(Book) \
|
count = self.session.query(func.max(Verse.verse)).join(Book) \
|
||||||
.filter(Book.book_reference_id == book_ref_id) \
|
.filter(Book.book_reference_id == book_ref_id) \
|
||||||
.filter(Verse.chapter == chapter) \
|
.filter(Verse.chapter == chapter) \
|
||||||
@ -563,9 +561,9 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
Return a book by name or abbreviation.
|
Return a book by name or abbreviation.
|
||||||
|
|
||||||
:param name: The name or abbreviation of the book.
|
:param name: The name or abbreviation of the book.
|
||||||
:param lower: True if the comparsion should be only lowercase
|
:param lower: True if the comparison should be only lowercase
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_book("%s")', name)
|
log.debug('BiblesResourcesDB.get_book("%s")' % name)
|
||||||
if not isinstance(name, str):
|
if not isinstance(name, str):
|
||||||
name = str(name)
|
name = str(name)
|
||||||
if lower:
|
if lower:
|
||||||
@ -594,7 +592,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
:param string: The string to search for in the book names or abbreviations.
|
:param string: The string to search for in the book names or abbreviations.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_book_like("%s")', string)
|
log.debug('BiblesResourcesDB.get_book_like("%s")' % string)
|
||||||
if not isinstance(string, str):
|
if not isinstance(string, str):
|
||||||
name = str(string)
|
name = str(string)
|
||||||
books = BiblesResourcesDB.run_sql(
|
books = BiblesResourcesDB.run_sql(
|
||||||
@ -613,17 +611,17 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_book_by_id(id):
|
def get_book_by_id(book_id):
|
||||||
"""
|
"""
|
||||||
Return a book by id.
|
Return a book by id.
|
||||||
|
|
||||||
:param id: The id of the book.
|
:param book_id: The id of the book.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_book_by_id("%s")', id)
|
log.debug('BiblesResourcesDB.get_book_by_id("%s")' % book_id)
|
||||||
if not isinstance(id, int):
|
if not isinstance(book_id, int):
|
||||||
id = int(id)
|
book_id = int(book_id)
|
||||||
books = BiblesResourcesDB.run_sql(
|
books = BiblesResourcesDB.run_sql(
|
||||||
'SELECT id, testament_id, name, abbreviation, chapters FROM book_reference WHERE id = ?', (id, ))
|
'SELECT id, testament_id, name, abbreviation, chapters FROM book_reference WHERE id = ?', (book_id, ))
|
||||||
if books:
|
if books:
|
||||||
return {
|
return {
|
||||||
'id': books[0][0],
|
'id': books[0][0],
|
||||||
@ -643,7 +641,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
:param book_ref_id: The id of a book.
|
:param book_ref_id: The id of a book.
|
||||||
:param chapter: The chapter number.
|
:param chapter: The chapter number.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_chapter("%s", "%s")', book_ref_id, chapter)
|
log.debug('BiblesResourcesDB.get_chapter("%s", "%s")' % (book_ref_id, chapter))
|
||||||
if not isinstance(chapter, int):
|
if not isinstance(chapter, int):
|
||||||
chapter = int(chapter)
|
chapter = int(chapter)
|
||||||
chapters = BiblesResourcesDB.run_sql(
|
chapters = BiblesResourcesDB.run_sql(
|
||||||
@ -666,7 +664,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
:param book_ref_id: The id of the book.
|
:param book_ref_id: The id of the book.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_chapter_count("%s")', book_ref_id)
|
log.debug('BiblesResourcesDB.get_chapter_count("%s")' % book_ref_id)
|
||||||
details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
if details:
|
if details:
|
||||||
return details['chapters']
|
return details['chapters']
|
||||||
@ -680,7 +678,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
:param book_ref_id: The id of the book.
|
:param book_ref_id: The id of the book.
|
||||||
:param chapter: The number of the chapter.
|
:param chapter: The number of the chapter.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_verse_count("%s", "%s")', book_ref_id, chapter)
|
log.debug('BiblesResourcesDB.get_verse_count("%s", "%s")' % (book_ref_id, chapter))
|
||||||
details = BiblesResourcesDB.get_chapter(book_ref_id, chapter)
|
details = BiblesResourcesDB.get_chapter(book_ref_id, chapter)
|
||||||
if details:
|
if details:
|
||||||
return details['verse_count']
|
return details['verse_count']
|
||||||
@ -693,7 +691,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
:param source: The name or abbreviation of the book.
|
:param source: The name or abbreviation of the book.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_download_source("%s")', source)
|
log.debug('BiblesResourcesDB.get_download_source("%s")' % source)
|
||||||
if not isinstance(source, str):
|
if not isinstance(source, str):
|
||||||
source = str(source)
|
source = str(source)
|
||||||
source = source.title()
|
source = source.title()
|
||||||
@ -714,12 +712,12 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
:param source: The source of the web_bible.
|
:param source: The source of the web_bible.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_webbibles("%s")', source)
|
log.debug('BiblesResourcesDB.get_webbibles("%s")' % source)
|
||||||
if not isinstance(source, str):
|
if not isinstance(source, str):
|
||||||
source = str(source)
|
source = str(source)
|
||||||
source = BiblesResourcesDB.get_download_source(source)
|
source = BiblesResourcesDB.get_download_source(source)
|
||||||
bibles = BiblesResourcesDB.run_sql('SELECT id, name, abbreviation, '
|
bibles = BiblesResourcesDB.run_sql('SELECT id, name, abbreviation, language_id, download_source_id '
|
||||||
'language_id, download_source_id FROM webbibles WHERE download_source_id = ?', (source['id'],))
|
'FROM webbibles WHERE download_source_id = ?', (source['id'],))
|
||||||
if bibles:
|
if bibles:
|
||||||
return [{
|
return [{
|
||||||
'id': bible[0],
|
'id': bible[0],
|
||||||
@ -739,7 +737,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
:param abbreviation: The abbreviation of the web_bible.
|
:param abbreviation: The abbreviation of the web_bible.
|
||||||
:param source: The source of the web_bible.
|
:param source: The source of the web_bible.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_webbibles("%s", "%s")', abbreviation, source)
|
log.debug('BiblesResourcesDB.get_webbibles("%s", "%s")' % (abbreviation, source))
|
||||||
if not isinstance(abbreviation, str):
|
if not isinstance(abbreviation, str):
|
||||||
abbreviation = str(abbreviation)
|
abbreviation = str(abbreviation)
|
||||||
if not isinstance(source, str):
|
if not isinstance(source, str):
|
||||||
@ -767,7 +765,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
:param name: The name to search the id.
|
:param name: The name to search the id.
|
||||||
:param language_id: The language_id for which language should be searched
|
:param language_id: The language_id for which language should be searched
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_alternative_book_name("%s", "%s")', name, language_id)
|
log.debug('BiblesResourcesDB.get_alternative_book_name("%s", "%s")' % (name, language_id))
|
||||||
if language_id:
|
if language_id:
|
||||||
books = BiblesResourcesDB.run_sql(
|
books = BiblesResourcesDB.run_sql(
|
||||||
'SELECT book_reference_id, name FROM alternative_book_names WHERE language_id = ? ORDER BY id',
|
'SELECT book_reference_id, name FROM alternative_book_names WHERE language_id = ? ORDER BY id',
|
||||||
@ -786,7 +784,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
|
|
||||||
:param name: The name or abbreviation of the language.
|
:param name: The name or abbreviation of the language.
|
||||||
"""
|
"""
|
||||||
log.debug('BiblesResourcesDB.get_language("%s")', name)
|
log.debug('BiblesResourcesDB.get_language("%s")' % name)
|
||||||
if not isinstance(name, str):
|
if not isinstance(name, str):
|
||||||
name = str(name)
|
name = str(name)
|
||||||
language = BiblesResourcesDB.run_sql(
|
language = BiblesResourcesDB.run_sql(
|
||||||
@ -824,10 +822,9 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||||||
log.debug('BiblesResourcesDB.get_testament_reference()')
|
log.debug('BiblesResourcesDB.get_testament_reference()')
|
||||||
testaments = BiblesResourcesDB.run_sql('SELECT id, name FROM testament_reference ORDER BY id')
|
testaments = BiblesResourcesDB.run_sql('SELECT id, name FROM testament_reference ORDER BY id')
|
||||||
return [
|
return [
|
||||||
{
|
{'id': testament[0],
|
||||||
'id': testament[0],
|
'name': str(testament[1])
|
||||||
'name': str(testament[1])
|
}
|
||||||
}
|
|
||||||
for testament in testaments
|
for testament in testaments
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -883,7 +880,7 @@ class AlternativeBookNamesDB(QtCore.QObject, Manager):
|
|||||||
:param name: The name to search the id.
|
:param name: The name to search the id.
|
||||||
:param language_id: The language_id for which language should be searched
|
:param language_id: The language_id for which language should be searched
|
||||||
"""
|
"""
|
||||||
log.debug('AlternativeBookNamesDB.get_book_reference_id("%s", "%s")', name, language_id)
|
log.debug('AlternativeBookNamesDB.get_book_reference_id("%s", "%s")' % (name, language_id))
|
||||||
if language_id:
|
if language_id:
|
||||||
books = AlternativeBookNamesDB.run_sql(
|
books = AlternativeBookNamesDB.run_sql(
|
||||||
'SELECT book_reference_id, name FROM alternative_book_names WHERE language_id = ?', (language_id, ))
|
'SELECT book_reference_id, name FROM alternative_book_names WHERE language_id = ?', (language_id, ))
|
||||||
@ -904,8 +901,8 @@ class AlternativeBookNamesDB(QtCore.QObject, Manager):
|
|||||||
:param book_reference_id: The book_reference_id of the book.
|
:param book_reference_id: The book_reference_id of the book.
|
||||||
:param language_id: The language to which the alternative book name belong.
|
:param language_id: The language to which the alternative book name belong.
|
||||||
"""
|
"""
|
||||||
log.debug('AlternativeBookNamesDB.create_alternative_book_name("%s", "%s", "%s")',
|
log.debug('AlternativeBookNamesDB.create_alternative_book_name("%s", "%s", "%s")' %
|
||||||
name, book_reference_id, language_id)
|
(name, book_reference_id, language_id))
|
||||||
return AlternativeBookNamesDB.run_sql(
|
return AlternativeBookNamesDB.run_sql(
|
||||||
'INSERT INTO alternative_book_names(book_reference_id, language_id, name) '
|
'INSERT INTO alternative_book_names(book_reference_id, language_id, name) '
|
||||||
'VALUES (?, ?, ?)', (book_reference_id, language_id, name), True)
|
'VALUES (?, ?, ?)', (book_reference_id, language_id, name), True)
|
||||||
@ -934,7 +931,7 @@ class OldBibleDB(QtCore.QObject, Manager):
|
|||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
if 'path' not in kwargs:
|
if 'path' not in kwargs:
|
||||||
raise KeyError('Missing keyword argument "path".')
|
raise KeyError('Missing keyword argument "path".')
|
||||||
if 'file' not in kwargs:
|
if 'file' not in kwargs:
|
||||||
raise KeyError('Missing keyword argument "file".')
|
raise KeyError('Missing keyword argument "file".')
|
||||||
if 'path' in kwargs:
|
if 'path' in kwargs:
|
||||||
self.path = kwargs['path']
|
self.path = kwargs['path']
|
||||||
|
@ -32,7 +32,9 @@ The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import urllib.request, urllib.parse, urllib.error
|
import urllib.request
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.error
|
||||||
from html.parser import HTMLParseError
|
from html.parser import HTMLParseError
|
||||||
|
|
||||||
from bs4 import BeautifulSoup, NavigableString, Tag
|
from bs4 import BeautifulSoup, NavigableString, Tag
|
||||||
@ -487,7 +489,7 @@ class HTTPBible(BibleDB, RegistryProperties):
|
|||||||
(self.download_source, self.download_name))
|
(self.download_source, self.download_name))
|
||||||
return False
|
return False
|
||||||
self.wizard.progress_bar.setMaximum(len(books) + 2)
|
self.wizard.progress_bar.setMaximum(len(books) + 2)
|
||||||
self.wizard.increment_progress_bar(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...'))
|
self.wizard.increment_progress_bar(translate('BiblesPlugin.HTTPBible', 'Registering Language...'))
|
||||||
bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower())
|
bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower())
|
||||||
if bible['language_id']:
|
if bible['language_id']:
|
||||||
language_id = bible['language_id']
|
language_id = bible['language_id']
|
||||||
|
@ -664,7 +664,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
db_book = bibles[second_bible].get_book_by_book_ref_id(verse.book.book_reference_id)
|
db_book = bibles[second_bible].get_book_by_book_ref_id(verse.book.book_reference_id)
|
||||||
if not db_book:
|
if not db_book:
|
||||||
log.debug('Passage "%s %d:%d" not found in Second Bible' %
|
log.debug('Passage "%s %d:%d" not found in Second Bible' %
|
||||||
(verse.book.name, verse.chapter, verse.verse))
|
(verse.book.name, verse.chapter, verse.verse))
|
||||||
passage_not_found = True
|
passage_not_found = True
|
||||||
count += 1
|
count += 1
|
||||||
continue
|
continue
|
||||||
@ -910,8 +910,8 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
elif old_verse + 1 != verse and old_chapter == chapter:
|
elif old_verse + 1 != verse and old_chapter == chapter:
|
||||||
# We are still in the same chapter, but a verse has been skipped.
|
# We are still in the same chapter, but a verse has been skipped.
|
||||||
return True
|
return True
|
||||||
elif old_chapter + 1 == chapter and (verse != 1 or
|
elif old_chapter + 1 == chapter and (verse != 1 or old_verse !=
|
||||||
old_verse != self.plugin.manager.get_verse_count(old_bible, old_book, old_chapter)):
|
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
|
# We are in the following chapter, but the last verse was not the
|
||||||
# last verse of the chapter or the current verse is not the
|
# last verse of the chapter or the current verse is not the
|
||||||
# first one of the chapter.
|
# first one of the chapter.
|
||||||
|
@ -31,10 +31,8 @@ The :mod:`upgrade` module provides a way for the database and schema that is the
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from sqlalchemy import Table, func, select, insert
|
|
||||||
|
|
||||||
__version__ = 1
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
__version__ = 1
|
||||||
|
|
||||||
|
|
||||||
def upgrade_1(session, metadata):
|
def upgrade_1(session, metadata):
|
||||||
@ -43,136 +41,4 @@ def upgrade_1(session, metadata):
|
|||||||
|
|
||||||
This upgrade renames a number of keys to a single naming convention.
|
This upgrade renames a number of keys to a single naming convention.
|
||||||
"""
|
"""
|
||||||
metadata_table = Table('metadata', metadata, autoload=True)
|
log.info('No upgrades to perform')
|
||||||
# Copy "Version" to "name" ("version" used by upgrade system)
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='name',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'Version'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "Copyright" to "copyright"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='copyright',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'Copyright'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "Permissions" to "permissions"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='permissions',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'Permissions'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "Bookname language" to "book_name_language"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'Bookname language'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='book_name_language',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'Bookname language'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "download source" to "download_source"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'download source'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
log.debug('download source: %s', value_count)
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='download_source',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'download source'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "download name" to "download_name"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'download name'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
log.debug('download name: %s', value_count)
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='download_name',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'download name'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "proxy server" to "proxy_server"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'proxy server'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
log.debug('proxy server: %s', value_count)
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='proxy_server',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'proxy server'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "proxy username" to "proxy_username"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'proxy username'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
log.debug('proxy username: %s', value_count)
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='proxy_username',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'proxy username'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# Copy "proxy password" to "proxy_password"
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
value_count = session.execute(
|
|
||||||
select(
|
|
||||||
[func.count(metadata_table.c.value)],
|
|
||||||
metadata_table.c.key == 'proxy password'
|
|
||||||
)
|
|
||||||
).scalar()
|
|
||||||
log.debug('proxy password: %s', value_count)
|
|
||||||
if value_count > 0:
|
|
||||||
session.execute(insert(metadata_table).values(
|
|
||||||
key='proxy_password',
|
|
||||||
value=select(
|
|
||||||
[metadata_table.c.value],
|
|
||||||
metadata_table.c.key == 'proxy password'
|
|
||||||
).as_scalar()
|
|
||||||
))
|
|
||||||
# TODO: Clean up in a subsequent release of OpenLP (like 2.0 final)
|
|
||||||
#session.execute(delete(metadata_table)\
|
|
||||||
# .where(metadata_table.c.key == u'dbversion'))
|
|
||||||
session.commit()
|
|
||||||
|
Binary file not shown.
@ -33,6 +33,7 @@ from openlp.core.common import UiStrings, translate
|
|||||||
from openlp.core.lib import SpellTextEdit
|
from openlp.core.lib import SpellTextEdit
|
||||||
from openlp.core.lib.ui import create_button, create_button_box
|
from openlp.core.lib.ui import create_button, create_button_box
|
||||||
|
|
||||||
|
|
||||||
class Ui_CustomSlideEditDialog(object):
|
class Ui_CustomSlideEditDialog(object):
|
||||||
def setupUi(self, custom_slide_edit_dialog):
|
def setupUi(self, custom_slide_edit_dialog):
|
||||||
custom_slide_edit_dialog.setObjectName('custom_slide_edit_dialog')
|
custom_slide_edit_dialog.setObjectName('custom_slide_edit_dialog')
|
||||||
@ -45,7 +46,7 @@ class Ui_CustomSlideEditDialog(object):
|
|||||||
self.insert_button = create_button(custom_slide_edit_dialog, 'insertButton',
|
self.insert_button = create_button(custom_slide_edit_dialog, 'insertButton',
|
||||||
icon=':/general/general_add.png')
|
icon=':/general/general_add.png')
|
||||||
self.button_box = create_button_box(custom_slide_edit_dialog, 'button_box', ['cancel', 'save'],
|
self.button_box = create_button_box(custom_slide_edit_dialog, 'button_box', ['cancel', 'save'],
|
||||||
[self.split_button, self.insert_button])
|
[self.split_button, self.insert_button])
|
||||||
self.dialog_layout.addWidget(self.button_box)
|
self.dialog_layout.addWidget(self.button_box)
|
||||||
self.retranslateUi(custom_slide_edit_dialog)
|
self.retranslateUi(custom_slide_edit_dialog)
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from sqlalchemy.sql import or_, func, and_
|
from sqlalchemy.sql import or_, func, and_
|
||||||
|
|
||||||
from openlp.core.common import Registry, Settings, UiStrings, translate
|
from openlp.core.common import Registry, Settings, UiStrings, translate
|
||||||
from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus,\
|
from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus, \
|
||||||
check_item_selected
|
check_item_selected
|
||||||
from openlp.plugins.custom.forms.editcustomform import EditCustomForm
|
from openlp.plugins.custom.forms.editcustomform import EditCustomForm
|
||||||
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
|
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
@ -105,12 +105,10 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Initialise the UI so it can provide Searches
|
Initialise the UI so it can provide Searches
|
||||||
"""
|
"""
|
||||||
self.search_text_edit.set_search_types([(CustomSearch.Titles, ':/songs/song_search_title.png',
|
self.search_text_edit.set_search_types(
|
||||||
translate('SongsPlugin.MediaItem', 'Titles'),
|
[(CustomSearch.Titles, ':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles'),
|
||||||
translate('SongsPlugin.MediaItem', 'Search Titles...')),
|
translate('SongsPlugin.MediaItem', 'Search Titles...')),
|
||||||
(CustomSearch.Themes, ':/slides/slide_theme.png', UiStrings().Themes,
|
(CustomSearch.Themes, ':/slides/slide_theme.png', UiStrings().Themes, UiStrings().SearchThemes)])
|
||||||
UiStrings().SearchThemes)
|
|
||||||
])
|
|
||||||
self.search_text_edit.set_current_search_type(Settings().value('%s/last search type' % self.settings_section))
|
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.load_list(self.plugin.db_manager.get_all_objects(CustomSlide, order_by_ref=CustomSlide.title))
|
||||||
self.config_update()
|
self.config_update()
|
||||||
@ -191,10 +189,9 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
|
if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete,
|
||||||
translate('CustomPlugin.MediaItem',
|
translate('CustomPlugin.MediaItem',
|
||||||
'Are you sure you want to delete the %n selected custom slide(s)?',
|
'Are you sure you want to delete the %n selected custom slide(s)?',
|
||||||
'',
|
'', QtCore.QCoreApplication.CodecForTr, len(items)),
|
||||||
QtCore.QCoreApplication.CodecForTr, len(items)),
|
QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
| QtGui.QMessageBox.No),
|
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
row_list = [item.row() for item in self.list_view.selectedIndexes()]
|
row_list = [item.row() for item in self.list_view.selectedIndexes()]
|
||||||
@ -348,4 +345,3 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
func.lower(CustomSlide.text).like(search)),
|
func.lower(CustomSlide.text).like(search)),
|
||||||
order_by_ref=CustomSlide.title)
|
order_by_ref=CustomSlide.title)
|
||||||
return [[custom.id, custom.title] for custom in search_results]
|
return [[custom.id, custom.title] for custom in search_results]
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog):
|
|||||||
Show the form.
|
Show the form.
|
||||||
|
|
||||||
:param clear: Set to False if the text input box should not be cleared when showing the dialog (default: True).
|
: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.
|
:param selected_group: The ID of the group that should be selected by default when showing the dialog.
|
||||||
"""
|
"""
|
||||||
if clear:
|
if clear:
|
||||||
|
@ -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 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 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:
|
if not initial_load:
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
@ -462,7 +463,8 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
:param images_list: A List of strings containing image filenames
|
:param images_list: A List of strings containing image filenames
|
||||||
:param group_id: The ID of the group to save the images in
|
: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:
|
for filename in images_list:
|
||||||
if not isinstance(filename, str):
|
if not isinstance(filename, str):
|
||||||
|
@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, UiStrings,\
|
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, UiStrings,\
|
||||||
translate
|
translate
|
||||||
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, ServiceItem, ServiceItemContext, \
|
from openlp.core.lib import ItemCapabilities, MediaManagerItem, MediaType, ServiceItem, ServiceItemContext, \
|
||||||
build_icon, check_item_selected
|
build_icon, check_item_selected
|
||||||
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
||||||
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
||||||
@ -161,7 +161,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
Called to replace Live background with the media selected.
|
Called to replace Live background with the media selected.
|
||||||
"""
|
"""
|
||||||
if check_item_selected(self.list_view,
|
if check_item_selected(self.list_view,
|
||||||
translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem',
|
||||||
'You must select a media file to replace the background with.')):
|
'You must select a media file to replace the background with.')):
|
||||||
item = self.list_view.currentItem()
|
item = self.list_view.currentItem()
|
||||||
filename = item.data(QtCore.Qt.UserRole)
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
@ -170,12 +170,12 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
service_item.title = 'webkit'
|
service_item.title = 'webkit'
|
||||||
service_item.processor = 'webkit'
|
service_item.processor = 'webkit'
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
service_item.add_from_command(path, name,CLAPPERBOARD)
|
service_item.add_from_command(path, name, CLAPPERBOARD)
|
||||||
if self.media_controller.video(DisplayControllerType.Live, service_item, video_behind_text=True):
|
if self.media_controller.video(DisplayControllerType.Live, service_item, video_behind_text=True):
|
||||||
self.reset_action.setVisible(True)
|
self.reset_action.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
translate('MediaPlugin.MediaItem',
|
translate('MediaPlugin.MediaItem',
|
||||||
'There was no display item to amend.'))
|
'There was no display item to amend.'))
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
# OOo API documentation:
|
# OOo API documentation:
|
||||||
# http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/XSlideShowController.html
|
# 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://docs.go-oo.org/sd/html/classsd_1_1SlideShow.html
|
||||||
# http://www.oooforum.org/forum/viewtopic.phtml?t=5252
|
# http://www.oooforum.org/forum/viewtopic.phtml?t=5252
|
||||||
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Working_with_Presentations
|
# http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Working_with_Presentations
|
||||||
@ -45,6 +46,7 @@ if os.name == 'nt':
|
|||||||
from win32com.client import Dispatch
|
from win32com.client import Dispatch
|
||||||
import pywintypes
|
import pywintypes
|
||||||
# Declare an empty exception to match the exception imported from UNO
|
# Declare an empty exception to match the exception imported from UNO
|
||||||
|
|
||||||
class ErrorCodeIOException(Exception):
|
class ErrorCodeIOException(Exception):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -204,7 +206,7 @@ class ImpressDocument(PresentationDocument):
|
|||||||
Class which holds information and controls a single presentation.
|
Class which holds information and controls a single presentation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__ (self, controller, presentation):
|
def __init__(self, controller, presentation):
|
||||||
"""
|
"""
|
||||||
Constructor, store information about the file and initialise.
|
Constructor, store information about the file and initialise.
|
||||||
"""
|
"""
|
||||||
@ -353,7 +355,7 @@ class ImpressDocument(PresentationDocument):
|
|||||||
log.debug('unblank screen OpenOffice')
|
log.debug('unblank screen OpenOffice')
|
||||||
return self.control.resume()
|
return self.control.resume()
|
||||||
|
|
||||||
def blank_screen (self):
|
def blank_screen(self):
|
||||||
"""
|
"""
|
||||||
Blanks the screen.
|
Blanks the screen.
|
||||||
"""
|
"""
|
||||||
|
@ -132,7 +132,8 @@ class PdfController(PresentationController):
|
|||||||
DEVNULL = open(os.devnull, 'wb')
|
DEVNULL = open(os.devnull, 'wb')
|
||||||
# First try to find mupdf
|
# First try to find mupdf
|
||||||
try:
|
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:
|
except CalledProcessError:
|
||||||
self.mudrawbin = ''
|
self.mudrawbin = ''
|
||||||
# if mupdf isn't installed, fallback to ghostscript
|
# if mupdf isn't installed, fallback to ghostscript
|
||||||
@ -192,7 +193,8 @@ class PdfDocument(PresentationDocument):
|
|||||||
:return: The resolution dpi to be used.
|
: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
|
# 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
|
# Run the script on the pdf to get the size
|
||||||
runlog = []
|
runlog = []
|
||||||
try:
|
try:
|
||||||
|
@ -34,6 +34,7 @@ if os.name == 'nt':
|
|||||||
from ctypes import cdll
|
from ctypes import cdll
|
||||||
from ctypes.wintypes import RECT
|
from ctypes.wintypes import RECT
|
||||||
|
|
||||||
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
from .presentationcontroller import PresentationController, PresentationDocument
|
from .presentationcontroller import PresentationController, PresentationDocument
|
||||||
|
|
||||||
@ -85,8 +86,8 @@ class PptviewController(PresentationController):
|
|||||||
if self.process:
|
if self.process:
|
||||||
return
|
return
|
||||||
log.debug('start PPTView')
|
log.debug('start PPTView')
|
||||||
dll_path = os.path.join(
|
dll_path = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
|
||||||
self.plugin_manager.base_path, 'presentations', 'lib', 'pptviewlib', 'pptviewlib.dll')
|
'plugins', 'presentations', 'lib', 'pptviewlib', 'pptviewlib.dll')
|
||||||
self.process = cdll.LoadLibrary(dll_path)
|
self.process = cdll.LoadLibrary(dll_path)
|
||||||
if log.isEnabledFor(logging.DEBUG):
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
self.process.SetDebug(1)
|
self.process.SetDebug(1)
|
||||||
|
@ -32,6 +32,7 @@ from PyQt4 import QtGui, QtCore
|
|||||||
from ctypes import *
|
from ctypes import *
|
||||||
from ctypes.wintypes import RECT
|
from ctypes.wintypes import RECT
|
||||||
|
|
||||||
|
|
||||||
class PPTViewer(QtGui.QWidget):
|
class PPTViewer(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
Standalone Test Harness for the pptviewlib library
|
Standalone Test Harness for the pptviewlib library
|
||||||
@ -169,16 +170,16 @@ class PPTViewer(QtGui.QWidget):
|
|||||||
app.processEvents()
|
app.processEvents()
|
||||||
|
|
||||||
def openClick(self):
|
def openClick(self):
|
||||||
oldid = self.pptid;
|
oldid = self.pptid
|
||||||
rect = RECT(int(self.xEdit.text()), int(self.yEdit.text()),
|
rect = RECT(int(self.xEdit.text()), int(self.yEdit.text()),
|
||||||
int(self.widthEdit.text()), int(self.heightEdit.text()))
|
int(self.widthEdit.text()), int(self.heightEdit.text()))
|
||||||
filename = str(self.pptEdit.text().replace('/', '\\'))
|
filename = str(self.pptEdit.text().replace('/', '\\'))
|
||||||
folder = str(self.folderEdit.text().replace('/', '\\'))
|
folder = str(self.folderEdit.text().replace('/', '\\'))
|
||||||
print(filename, folder)
|
print(filename, folder)
|
||||||
self.pptid = self.pptdll.OpenPPT(filename, None, rect, folder)
|
self.pptid = self.pptdll.OpenPPT(filename, None, rect, folder)
|
||||||
print('id: ' + str(self.pptid))
|
print('id: ' + str(self.pptid))
|
||||||
if oldid >= 0:
|
if oldid >= 0:
|
||||||
self.pptdll.ClosePPT(oldid);
|
self.pptdll.ClosePPT(oldid)
|
||||||
slides = self.pptdll.GetSlideCount(self.pptid)
|
slides = self.pptdll.GetSlideCount(self.pptid)
|
||||||
print('slidecount: ' + str(slides))
|
print('slidecount: ' + str(slides))
|
||||||
self.total.setNum(self.pptdll.GetSlideCount(self.pptid))
|
self.total.setNum(self.pptdll.GetSlideCount(self.pptid))
|
||||||
@ -201,8 +202,7 @@ class PPTViewer(QtGui.QWidget):
|
|||||||
app.processEvents()
|
app.processEvents()
|
||||||
|
|
||||||
def openDialog(self):
|
def openDialog(self):
|
||||||
self.pptEdit.setText(QtGui.QFileDialog.getOpenFileName(self,
|
self.pptEdit.setText(QtGui.QFileDialog.getOpenFileName(self, 'Open file'))
|
||||||
'Open file'))
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pptdll = cdll.LoadLibrary(r'pptviewlib.dll')
|
pptdll = cdll.LoadLibrary(r'pptviewlib.dll')
|
||||||
|
@ -28,15 +28,15 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
"""
|
"""
|
||||||
The :mod:`http` module contains the API web server. This is a lightweight web
|
The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact
|
||||||
server used by remotes to interact with OpenLP. It uses JSON to communicate with
|
with OpenLP. It uses JSON to communicate with the remotes.
|
||||||
the remotes.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ssl
|
import ssl
|
||||||
import socket
|
import socket
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
@ -53,8 +53,8 @@ log = logging.getLogger(__name__)
|
|||||||
class CustomHandler(BaseHTTPRequestHandler, HttpRouter):
|
class CustomHandler(BaseHTTPRequestHandler, HttpRouter):
|
||||||
"""
|
"""
|
||||||
Stateless session handler to handle the HTTP request and process it.
|
Stateless session handler to handle the HTTP request and process it.
|
||||||
This class handles just the overrides to the base methods and the logic to invoke the
|
This class handles just the overrides to the base methods and the logic to invoke the methods within the HttpRouter
|
||||||
methods within the HttpRouter class.
|
class.
|
||||||
DO not try change the structure as this is as per the documentation.
|
DO not try change the structure as this is as per the documentation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -116,9 +116,20 @@ class OpenLPServer():
|
|||||||
log.debug('Started ssl httpd...')
|
log.debug('Started ssl httpd...')
|
||||||
else:
|
else:
|
||||||
port = Settings().value(self.settings_section + '/port')
|
port = Settings().value(self.settings_section + '/port')
|
||||||
self.httpd = ThreadingHTTPServer((address, port), CustomHandler)
|
loop = 1
|
||||||
|
while loop < 3:
|
||||||
|
try:
|
||||||
|
self.httpd = ThreadingHTTPServer((address, port), CustomHandler)
|
||||||
|
except OSError:
|
||||||
|
loop += 1
|
||||||
|
time.sleep(0.1)
|
||||||
|
except:
|
||||||
|
log.error('Failed to start server ')
|
||||||
log.debug('Started non ssl httpd...')
|
log.debug('Started non ssl httpd...')
|
||||||
self.httpd.serve_forever()
|
if hasattr(self, 'httpd') and self.httpd:
|
||||||
|
self.httpd.serve_forever()
|
||||||
|
else:
|
||||||
|
log.debug('Failed to start server')
|
||||||
|
|
||||||
def stop_server(self):
|
def stop_server(self):
|
||||||
"""
|
"""
|
||||||
@ -144,6 +155,3 @@ class HTTPSServer(HTTPServer):
|
|||||||
server_side=True)
|
server_side=True)
|
||||||
self.server_bind()
|
self.server_bind()
|
||||||
self.server_activate()
|
self.server_activate()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +225,8 @@ class RemoteTab(SettingsTab):
|
|||||||
continue
|
continue
|
||||||
for address in interface.addressEntries():
|
for address in interface.addressEntries():
|
||||||
ip = address.ip()
|
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.toString()
|
||||||
return ip_address
|
return ip_address
|
||||||
|
|
||||||
@ -262,9 +263,9 @@ class RemoteTab(SettingsTab):
|
|||||||
Settings().value(self.settings_section + '/port') != self.port_spin_box.value() or \
|
Settings().value(self.settings_section + '/port') != self.port_spin_box.value() or \
|
||||||
Settings().value(self.settings_section + '/https port') != self.https_port_spin_box.value() or \
|
Settings().value(self.settings_section + '/https port') != self.https_port_spin_box.value() or \
|
||||||
Settings().value(self.settings_section + '/https enabled') != \
|
Settings().value(self.settings_section + '/https enabled') != \
|
||||||
self.https_settings_group_box.isChecked() or \
|
self.https_settings_group_box.isChecked() or \
|
||||||
Settings().value(self.settings_section + '/authentication enabled') != \
|
Settings().value(self.settings_section + '/authentication enabled') != \
|
||||||
self.user_login_group_box.isChecked():
|
self.user_login_group_box.isChecked():
|
||||||
self.settings_form.register_post_process('remotes_config_updated')
|
self.settings_form.register_post_process('remotes_config_updated')
|
||||||
Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
|
Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
|
||||||
Settings().setValue(self.settings_section + '/https port', self.https_port_spin_box.value())
|
Settings().setValue(self.settings_section + '/https port', self.https_port_spin_box.value())
|
||||||
|
@ -36,14 +36,14 @@ from openlp.plugins.remotes.lib import RemoteTab, OpenLPServer
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
'remotes/twelve hour': True,
|
'remotes/twelve hour': True,
|
||||||
'remotes/port': 4316,
|
'remotes/port': 4316,
|
||||||
'remotes/https port': 4317,
|
'remotes/https port': 4317,
|
||||||
'remotes/https enabled': False,
|
'remotes/https enabled': False,
|
||||||
'remotes/user id': 'openlp',
|
'remotes/user id': 'openlp',
|
||||||
'remotes/password': 'password',
|
'remotes/password': 'password',
|
||||||
'remotes/authentication enabled': False,
|
'remotes/authentication enabled': False,
|
||||||
'remotes/ip address': '0.0.0.0'
|
'remotes/ip address': '0.0.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
|
|||||||
# Used to interrupt ongoing searches when cancel is clicked.
|
# Used to interrupt ongoing searches when cancel is clicked.
|
||||||
self.break_search = False
|
self.break_search = False
|
||||||
super(DuplicateSongRemovalForm, self).__init__(
|
super(DuplicateSongRemovalForm, self).__init__(
|
||||||
Registry().get('main_window'), plugin, 'duplicateSongRemovalWizard', ':/wizards/wizard_duplicateremoval.bmp'
|
Registry().get('main_window'), plugin, 'duplicateSongRemovalWizard',
|
||||||
, False)
|
':/wizards/wizard_duplicateremoval.bmp', False)
|
||||||
self.setMinimumWidth(730)
|
self.setMinimumWidth(730)
|
||||||
|
|
||||||
def custom_signals(self):
|
def custom_signals(self):
|
||||||
@ -349,4 +349,4 @@ class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
|
|||||||
self.button(QtGui.QWizard.FinishButton).show()
|
self.button(QtGui.QWizard.FinishButton).show()
|
||||||
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
|
||||||
self.button(QtGui.QWizard.NextButton).hide()
|
self.button(QtGui.QWizard.NextButton).hide()
|
||||||
self.button(QtGui.QWizard.CancelButton).hide()
|
self.button(QtGui.QWizard.CancelButton).hide()
|
||||||
|
@ -185,11 +185,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
if len(invalid_verses) > 1:
|
if len(invalid_verses) > 1:
|
||||||
msg = translate('SongsPlugin.EditSongForm', 'There are no verses corresponding to "%(invalid)s".'
|
msg = translate('SongsPlugin.EditSongForm', 'There are no verses corresponding to "%(invalid)s".'
|
||||||
'Valid entries are %(valid)s.\nPlease enter the verses separated by spaces.') % \
|
'Valid entries are %(valid)s.\nPlease enter the verses separated by spaces.') % \
|
||||||
{'invalid': ', '.join(invalid_verses), 'valid' : valid}
|
{'invalid': ', '.join(invalid_verses), 'valid': valid}
|
||||||
else:
|
else:
|
||||||
msg = translate('SongsPlugin.EditSongForm', 'There is no verse corresponding to "%(invalid)s".'
|
msg = translate('SongsPlugin.EditSongForm', 'There is no verse corresponding to "%(invalid)s".'
|
||||||
'Valid entries are %(valid)s.\nPlease enter the verses separated by spaces.') % \
|
'Valid entries are %(valid)s.\nPlease enter the verses separated by spaces.') % \
|
||||||
{'invalid': invalid_verses[0], 'valid' : valid}
|
{'invalid': invalid_verses[0], 'valid': valid}
|
||||||
critical_error_message_box(title=translate('SongsPlugin.EditSongForm', 'Invalid Verse Order'),
|
critical_error_message_box(title=translate('SongsPlugin.EditSongForm', 'Invalid Verse Order'),
|
||||||
message=msg)
|
message=msg)
|
||||||
return len(invalid_verses) == 0
|
return len(invalid_verses) == 0
|
||||||
@ -257,7 +257,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
self.song.lyrics = str(sxml.extract_xml(), 'utf-8')
|
self.song.lyrics = str(sxml.extract_xml(), 'utf-8')
|
||||||
for verse in multiple:
|
for verse in multiple:
|
||||||
self.song.verse_order = re.sub('([' + verse.upper() + verse.lower() + '])(\W|$)',
|
self.song.verse_order = re.sub('([' + verse.upper() + verse.lower() + '])(\W|$)',
|
||||||
r'\g<1>1\2', self.song.verse_order)
|
r'\g<1>1\2', self.song.verse_order)
|
||||||
except:
|
except:
|
||||||
log.exception('Problem processing song Lyrics \n%s', sxml.dump_xml())
|
log.exception('Problem processing song Lyrics \n%s', sxml.dump_xml())
|
||||||
raise
|
raise
|
||||||
@ -601,7 +601,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
def on_verse_add_button_clicked(self):
|
def on_verse_add_button_clicked(self):
|
||||||
self.verse_form.set_verse('', True)
|
self.verse_form.set_verse('', True)
|
||||||
if self.verse_form.exec_():
|
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)
|
verse_def = '%s%s' % (verse_tag, verse_num)
|
||||||
item = QtGui.QTableWidgetItem(after_text)
|
item = QtGui.QTableWidgetItem(after_text)
|
||||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
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)
|
verse_id = item.data(QtCore.Qt.UserRole)
|
||||||
self.verse_form.set_verse(temp_text, True, verse_id)
|
self.verse_form.set_verse(temp_text, True, verse_id)
|
||||||
if self.verse_form.exec_():
|
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)
|
verse_def = '%s%s' % (verse_tag, verse_num)
|
||||||
item.setData(QtCore.Qt.UserRole, verse_def)
|
item.setData(QtCore.Qt.UserRole, verse_def)
|
||||||
item.setText(after_text)
|
item.setText(after_text)
|
||||||
@ -661,7 +661,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
self.verse_form.set_verse('')
|
self.verse_form.set_verse('')
|
||||||
if not self.verse_form.exec_():
|
if not self.verse_form.exec_():
|
||||||
return
|
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'))
|
verse_list = str(verse_list.replace('\r\n', '\n'))
|
||||||
self.verse_list_widget.clear()
|
self.verse_list_widget.clear()
|
||||||
self.verse_list_widget.setRowCount(0)
|
self.verse_list_widget.setRowCount(0)
|
||||||
@ -955,4 +955,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
|
|||||||
log.exception('Could not remove directory: %s', save_path)
|
log.exception('Could not remove directory: %s', save_path)
|
||||||
clean_song(self.manager, self.song)
|
clean_song(self.manager, self.song)
|
||||||
self.manager.save_object(self.song)
|
self.manager.save_object(self.song)
|
||||||
self.media_item.auto_select_id = self.song.id
|
self.media_item.auto_select_id = self.song.id
|
||||||
|
@ -71,4 +71,3 @@ class Ui_MediaFilesDialog(object):
|
|||||||
self.select_label.setText(translate('SongsPlugin.MediaFilesForm',
|
self.select_label.setText(translate('SongsPlugin.MediaFilesForm',
|
||||||
'Select one or more audio files from the list below, and click OK to import them '
|
'Select one or more audio files from the list below, and click OK to import them '
|
||||||
'into this song.'))
|
'into this song.'))
|
||||||
|
|
||||||
|
@ -56,4 +56,3 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
|
|||||||
|
|
||||||
def get_selected_files(self):
|
def get_selected_files(self):
|
||||||
return [item.data(QtCore.Qt.UserRole) for item in self.file_list_widget.selectedItems()]
|
return [item.data(QtCore.Qt.UserRole) for item in self.file_list_widget.selectedItems()]
|
||||||
|
|
||||||
|
@ -99,7 +99,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
|
|||||||
self.format_widgets[song_format]['removeButton'].clicked.connect(self.on_remove_button_clicked)
|
self.format_widgets[song_format]['removeButton'].clicked.connect(self.on_remove_button_clicked)
|
||||||
else:
|
else:
|
||||||
self.format_widgets[song_format]['browseButton'].clicked.connect(self.on_browse_button_clicked)
|
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):
|
def add_custom_pages(self):
|
||||||
"""
|
"""
|
||||||
@ -163,7 +164,8 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
|
|||||||
f_label = 'Filename:'
|
f_label = 'Filename:'
|
||||||
if select_mode == SongFormatSelect.SingleFolder:
|
if select_mode == SongFormatSelect.SingleFolder:
|
||||||
f_label = 'Folder:'
|
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:
|
for format_list in self.disablable_formats:
|
||||||
self.format_widgets[format_list]['disabled_label'].setText(SongFormat.get(format_list, 'disabledLabelText'))
|
self.format_widgets[format_list]['disabled_label'].setText(SongFormat.get(format_list, 'disabledLabelText'))
|
||||||
self.progress_page.setTitle(WizardStrings.Importing)
|
self.progress_page.setTitle(WizardStrings.Importing)
|
||||||
@ -244,7 +246,7 @@ class SongImportForm(OpenLPWizard, RegistryProperties):
|
|||||||
if file_names:
|
if file_names:
|
||||||
listbox.addItems(file_names)
|
listbox.addItems(file_names)
|
||||||
Settings().setValue(self.plugin.settings_section + '/last directory import',
|
Settings().setValue(self.plugin.settings_section + '/last directory import',
|
||||||
os.path.split(str(file_names[0]))[0])
|
os.path.split(str(file_names[0]))[0])
|
||||||
|
|
||||||
def get_list_of_files(self, list_box):
|
def get_list_of_files(self, list_box):
|
||||||
"""
|
"""
|
||||||
|
@ -162,6 +162,6 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
self.edit_book_button.setText(UiStrings().Edit)
|
self.edit_book_button.setText(UiStrings().Edit)
|
||||||
self.delete_book_button.setText(UiStrings().Delete)
|
self.delete_book_button.setText(UiStrings().Delete)
|
||||||
type_list_width = max(self.fontMetrics().width(SongStrings.Authors),
|
type_list_width = max(self.fontMetrics().width(SongStrings.Authors),
|
||||||
self.fontMetrics().width(SongStrings.Topics),
|
self.fontMetrics().width(SongStrings.Topics),
|
||||||
self.fontMetrics().width(SongStrings.SongBooks))
|
self.fontMetrics().width(SongStrings.SongBooks))
|
||||||
self.type_list_widget.setFixedWidth(type_list_width + self.type_list_widget.iconSize().width() + 32)
|
self.type_list_widget.setFixedWidth(type_list_width + self.type_list_widget.iconSize().width() + 32)
|
||||||
|
@ -531,4 +531,4 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog, RegistryPrope
|
|||||||
edit_button.setEnabled(False)
|
edit_button.setEnabled(False)
|
||||||
else:
|
else:
|
||||||
delete_button.setEnabled(True)
|
delete_button.setEnabled(True)
|
||||||
edit_button.setEnabled(True)
|
edit_button.setEnabled(True)
|
||||||
|
@ -191,7 +191,7 @@ class SongReviewWidget(QtGui.QWidget):
|
|||||||
self.song_remove_button.setObjectName('song_remove_button')
|
self.song_remove_button.setObjectName('song_remove_button')
|
||||||
self.song_remove_button.setIcon(build_icon(':/songs/song_delete.png'))
|
self.song_remove_button.setIcon(build_icon(':/songs/song_delete.png'))
|
||||||
self.song_remove_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
self.song_remove_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
self.song_vertical_layout.addWidget(self.song_remove_button, alignment = QtCore.Qt.AlignHCenter)
|
self.song_vertical_layout.addWidget(self.song_remove_button, alignment=QtCore.Qt.AlignHCenter)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.song_remove_button.setText('Remove')
|
self.song_remove_button.setText('Remove')
|
||||||
|
@ -549,4 +549,3 @@ def delete_song(song_id, song_plugin):
|
|||||||
except OSError:
|
except OSError:
|
||||||
log.exception('Could not remove directory: %s', save_path)
|
log.exception('Could not remove directory: %s', save_path)
|
||||||
song_plugin.manager.delete_object(Song, song_id)
|
song_plugin.manager.delete_object(Song, song_id)
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ class CCLIFileImport(SongImport):
|
|||||||
if not self.do_import_txt_file(lines):
|
if not self.do_import_txt_file(lines):
|
||||||
self.log_error(filename)
|
self.log_error(filename)
|
||||||
else:
|
else:
|
||||||
self.log_error(filename,
|
self.log_error(filename, translate('SongsPlugin.CCLIFileImport', 'The file does not have a valid '
|
||||||
translate('SongsPlugin.CCLIFileImport', 'The file does not have a valid extension.'))
|
'extension.'))
|
||||||
log.info('Extension %s is not valid', filename)
|
log.info('Extension %s is not valid', filename)
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
return
|
return
|
||||||
|
@ -172,7 +172,8 @@ def init_schema(url):
|
|||||||
session, metadata = init_db(url)
|
session, metadata = init_db(url)
|
||||||
|
|
||||||
# Definition of the "authors" table
|
# Definition of the "authors" table
|
||||||
authors_table = Table('authors', metadata,
|
authors_table = Table(
|
||||||
|
'authors', metadata,
|
||||||
Column('id', types.Integer(), primary_key=True),
|
Column('id', types.Integer(), primary_key=True),
|
||||||
Column('first_name', types.Unicode(128)),
|
Column('first_name', types.Unicode(128)),
|
||||||
Column('last_name', types.Unicode(128)),
|
Column('last_name', types.Unicode(128)),
|
||||||
@ -180,7 +181,8 @@ def init_schema(url):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "media_files" table
|
# 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('id', types.Integer(), primary_key=True),
|
||||||
Column('song_id', types.Integer(), ForeignKey('songs.id'), default=None),
|
Column('song_id', types.Integer(), ForeignKey('songs.id'), default=None),
|
||||||
Column('file_name', types.Unicode(255), nullable=False),
|
Column('file_name', types.Unicode(255), nullable=False),
|
||||||
@ -189,14 +191,16 @@ def init_schema(url):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "song_books" table
|
# 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('id', types.Integer(), primary_key=True),
|
||||||
Column('name', types.Unicode(128), nullable=False),
|
Column('name', types.Unicode(128), nullable=False),
|
||||||
Column('publisher', types.Unicode(128))
|
Column('publisher', types.Unicode(128))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "songs" table
|
# Definition of the "songs" table
|
||||||
songs_table = Table('songs', metadata,
|
songs_table = Table(
|
||||||
|
'songs', metadata,
|
||||||
Column('id', types.Integer(), primary_key=True),
|
Column('id', types.Integer(), primary_key=True),
|
||||||
Column('song_book_id', types.Integer(), ForeignKey('song_books.id'), default=None),
|
Column('song_book_id', types.Integer(), ForeignKey('song_books.id'), default=None),
|
||||||
Column('title', types.Unicode(255), nullable=False),
|
Column('title', types.Unicode(255), nullable=False),
|
||||||
@ -216,19 +220,22 @@ def init_schema(url):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "topics" table
|
# Definition of the "topics" table
|
||||||
topics_table = Table('topics', metadata,
|
topics_table = Table(
|
||||||
|
'topics', metadata,
|
||||||
Column('id', types.Integer(), primary_key=True),
|
Column('id', types.Integer(), primary_key=True),
|
||||||
Column('name', types.Unicode(128), index=True, nullable=False)
|
Column('name', types.Unicode(128), index=True, nullable=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "authors_songs" table
|
# 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('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True),
|
||||||
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True)
|
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Definition of the "songs_topics" table
|
# 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('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True),
|
||||||
Column('topic_id', types.Integer(), ForeignKey('topics.id'), primary_key=True)
|
Column('topic_id', types.Integer(), ForeignKey('topics.id'), primary_key=True)
|
||||||
)
|
)
|
||||||
@ -236,13 +243,12 @@ def init_schema(url):
|
|||||||
mapper(Author, authors_table)
|
mapper(Author, authors_table)
|
||||||
mapper(Book, song_books_table)
|
mapper(Book, song_books_table)
|
||||||
mapper(MediaFile, media_files_table)
|
mapper(MediaFile, media_files_table)
|
||||||
mapper(Song, songs_table,
|
mapper(Song, songs_table, properties={
|
||||||
properties={
|
'authors': relation(Author, backref='songs', secondary=authors_songs_table, lazy=False),
|
||||||
'authors': relation(Author, backref='songs', secondary=authors_songs_table, lazy=False),
|
'book': relation(Book, backref='songs'),
|
||||||
'book': relation(Book, backref='songs'),
|
'media_files': relation(MediaFile, backref='songs', order_by=media_files_table.c.weight),
|
||||||
'media_files': relation(MediaFile, backref='songs', order_by=media_files_table.c.weight),
|
'topics': relation(Topic, backref='songs', secondary=songs_topics_table)
|
||||||
'topics': relation(Topic, backref='songs', secondary=songs_topics_table)
|
})
|
||||||
})
|
|
||||||
mapper(Topic, topics_table)
|
mapper(Topic, topics_table)
|
||||||
|
|
||||||
metadata.create_all(checkfirst=True)
|
metadata.create_all(checkfirst=True)
|
||||||
|
@ -120,7 +120,7 @@ class DreamBeamImport(SongImport):
|
|||||||
author_copyright = song_xml.Author.text
|
author_copyright = song_xml.Author.text
|
||||||
if hasattr(song_xml, 'SongLyrics'):
|
if hasattr(song_xml, 'SongLyrics'):
|
||||||
for lyrics_item in song_xml.SongLyrics.iterchildren():
|
for lyrics_item in song_xml.SongLyrics.iterchildren():
|
||||||
verse_type = lyrics_item.get('Type')
|
verse_type = lyrics_item.get('Type')
|
||||||
verse_number = lyrics_item.get('Number')
|
verse_number = lyrics_item.get('Number')
|
||||||
verse_text = str(lyrics_item.text)
|
verse_text = str(lyrics_item.text)
|
||||||
self.add_verse(verse_text, ('%s%s' % (verse_type[:1], verse_number)))
|
self.add_verse(verse_text, ('%s%s' % (verse_type[:1], verse_number)))
|
||||||
@ -145,8 +145,7 @@ class DreamBeamImport(SongImport):
|
|||||||
author_copyright = song_xml.Text2.Text.text
|
author_copyright = song_xml.Text2.Text.text
|
||||||
if author_copyright:
|
if author_copyright:
|
||||||
author_copyright = str(author_copyright)
|
author_copyright = str(author_copyright)
|
||||||
if author_copyright.find(
|
if author_copyright.find(str(SongStrings.CopyrightSymbol)) >= 0:
|
||||||
str(SongStrings.CopyrightSymbol)) >= 0:
|
|
||||||
self.add_copyright(author_copyright)
|
self.add_copyright(author_copyright)
|
||||||
else:
|
else:
|
||||||
self.parse_author(author_copyright)
|
self.parse_author(author_copyright)
|
||||||
|
@ -49,7 +49,7 @@ class EasySlidesImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Initialise the class.
|
Initialise the class.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager, **kwargs)
|
super(EasySlidesImport, self).__init__(manager, **kwargs)
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
log.info('Importing EasySlides XML file %s', self.import_source)
|
log.info('Importing EasySlides XML file %s', self.import_source)
|
||||||
|
@ -73,7 +73,7 @@ class EasyWorshipSongImport(SongImport):
|
|||||||
ability to import EasyWorship song files.
|
ability to import EasyWorship song files.
|
||||||
"""
|
"""
|
||||||
def __init__(self, manager, **kwargs):
|
def __init__(self, manager, **kwargs):
|
||||||
SongImport.__init__(self, manager, **kwargs)
|
super(EasyWorshipSongImport, self).__init__(manager, **kwargs)
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -298,10 +298,10 @@ class FoilPresenter(object):
|
|||||||
temp = copyright.partition('Rechte')
|
temp = copyright.partition('Rechte')
|
||||||
copyright = temp[0]
|
copyright = temp[0]
|
||||||
markers = ['Text +u\.?n?d? +Melodie[\w\,\. ]*:',
|
markers = ['Text +u\.?n?d? +Melodie[\w\,\. ]*:',
|
||||||
'Text +u\.?n?d? +Musik', 'T & M', 'Melodie und Satz',
|
'Text +u\.?n?d? +Musik', 'T & M', 'Melodie und Satz',
|
||||||
'Text[\w\,\. ]*:', 'Melodie', 'Musik', 'Satz',
|
'Text[\w\,\. ]*:', 'Melodie', 'Musik', 'Satz',
|
||||||
'Weise', '[dD]eutsch', '[dD]t[\.\:]', 'Englisch',
|
'Weise', '[dD]eutsch', '[dD]t[\.\:]', 'Englisch',
|
||||||
'[oO]riginal', 'Bearbeitung', '[R|r]efrain']
|
'[oO]riginal', 'Bearbeitung', '[R|r]efrain']
|
||||||
for marker in markers:
|
for marker in markers:
|
||||||
copyright = re.compile(marker).sub('<marker>', copyright, re.U)
|
copyright = re.compile(marker).sub('<marker>', copyright, re.U)
|
||||||
copyright = re.compile('(?<=<marker>) *:').sub('', copyright)
|
copyright = re.compile('(?<=<marker>) *:').sub('', copyright)
|
||||||
@ -324,12 +324,9 @@ class FoilPresenter(object):
|
|||||||
for tempx in temp:
|
for tempx in temp:
|
||||||
author_temp.append(tempx)
|
author_temp.append(tempx)
|
||||||
for author in author_temp:
|
for author in author_temp:
|
||||||
regex = '^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|'\
|
regex = '^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
|
||||||
'\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
|
|
||||||
author = re.compile(regex).sub('', author)
|
author = re.compile(regex).sub('', author)
|
||||||
author = re.compile(
|
author = re.compile('[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('', author)
|
||||||
'[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub('',
|
|
||||||
author)
|
|
||||||
author = re.compile('[N|n]ach.*$').sub('', author)
|
author = re.compile('[N|n]ach.*$').sub('', author)
|
||||||
author = author.strip()
|
author = author.strip()
|
||||||
if re.search('\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', author, re.U):
|
if re.search('\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s', author, re.U):
|
||||||
|
@ -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
|
# 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
|
# (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.
|
# duplicate. This should work for songs without alternate title.
|
||||||
search_results = self.plugin.manager.get_all_objects(Song,
|
temp = (re.compile(r'\W+', re.UNICODE).sub(' ', item.data_string['title'].strip()) + '@').strip().lower()
|
||||||
Song.search_title == (re.compile(r'\W+', re.UNICODE).sub(' ',
|
search_results = \
|
||||||
item.data_string['title'].strip()) + '@').strip().lower(), Song.search_title.asc())
|
self.plugin.manager.get_all_objects(Song, Song.search_title == temp, Song.search_title.asc())
|
||||||
else:
|
else:
|
||||||
search_results = self.plugin.manager.get_all_objects(
|
search_results = self.plugin.manager.get_all_objects(
|
||||||
Song, Song.search_title == item.data_string['title'], Song.search_title.asc())
|
Song, Song.search_title == item.data_string['title'], Song.search_title.asc())
|
||||||
|
@ -128,11 +128,9 @@ class OpenLPSongImport(SongImport):
|
|||||||
except UnmappedClassError:
|
except UnmappedClassError:
|
||||||
mapper(OldMediaFile, source_media_files_table)
|
mapper(OldMediaFile, source_media_files_table)
|
||||||
song_props = {
|
song_props = {
|
||||||
'authors': relation(OldAuthor, backref='songs',
|
'authors': relation(OldAuthor, backref='songs', secondary=source_authors_songs_table),
|
||||||
secondary=source_authors_songs_table),
|
|
||||||
'book': relation(OldBook, backref='songs'),
|
'book': relation(OldBook, backref='songs'),
|
||||||
'topics': relation(OldTopic, backref='songs',
|
'topics': relation(OldTopic, backref='songs', secondary=source_songs_topics_table)
|
||||||
secondary=source_songs_topics_table)
|
|
||||||
}
|
}
|
||||||
if has_media_files:
|
if has_media_files:
|
||||||
if isinstance(source_media_files_songs_table, Table):
|
if isinstance(source_media_files_songs_table, Table):
|
||||||
|
@ -68,8 +68,8 @@ class OpenLyricsExport(RegistryProperties):
|
|||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
if self.parent.stop_export_flag:
|
if self.parent.stop_export_flag:
|
||||||
return False
|
return False
|
||||||
self.parent.increment_progress_bar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
|
self.parent.increment_progress_bar(
|
||||||
song.title)
|
translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') % song.title)
|
||||||
xml = open_lyrics.song_to_xml(song)
|
xml = open_lyrics.song_to_xml(song)
|
||||||
tree = etree.ElementTree(etree.fromstring(xml.encode()))
|
tree = etree.ElementTree(etree.fromstring(xml.encode()))
|
||||||
filename = '%s (%s)' % (song.title, ', '.join([author.display_name for author in song.authors]))
|
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,
|
tree.write(open(os.path.join(self.save_path, filename), 'wb'), encoding='utf-8', xml_declaration=True,
|
||||||
pretty_print=True)
|
pretty_print=True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class PowerSongImport(SongImport):
|
|||||||
parse_error = True
|
parse_error = True
|
||||||
self.log_error(os.path.basename(file), str(
|
self.log_error(os.path.basename(file), str(
|
||||||
translate('SongsPlugin.PowerSongImport', 'Invalid %s file. Unexpected byte value.')) %
|
translate('SongsPlugin.PowerSongImport', 'Invalid %s file. Unexpected byte value.')) %
|
||||||
ps_string)
|
ps_string)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if label == 'TITLE':
|
if label == 'TITLE':
|
||||||
@ -145,7 +145,7 @@ class PowerSongImport(SongImport):
|
|||||||
if not found_copyright:
|
if not found_copyright:
|
||||||
self.log_error(self.title, str(
|
self.log_error(self.title, str(
|
||||||
translate('SongsPlugin.PowerSongImport', 'Invalid %s file. Missing "COPYRIGHTLINE" header.')) %
|
translate('SongsPlugin.PowerSongImport', 'Invalid %s file. Missing "COPYRIGHTLINE" header.')) %
|
||||||
ps_string)
|
ps_string)
|
||||||
continue
|
continue
|
||||||
# Check that file had at least one verse
|
# Check that file had at least one verse
|
||||||
if not self.verses:
|
if not self.verses:
|
||||||
|
@ -287,8 +287,7 @@ class SofImport(OooImport):
|
|||||||
|
|
||||||
:param text: The verse text
|
:param text: The verse text
|
||||||
"""
|
"""
|
||||||
if self.italics != self.is_chorus and ((len(self.verses) > 0) or
|
if self.italics != self.is_chorus and ((len(self.verses) > 0) or (self.current__verse.count('\n') > 1)):
|
||||||
(self.current__verse.count('\n') > 1)):
|
|
||||||
self.finish_verse()
|
self.finish_verse()
|
||||||
if self.italics:
|
if self.italics:
|
||||||
self.is_chorus = True
|
self.is_chorus = True
|
||||||
@ -348,10 +347,10 @@ class SofImport(OooImport):
|
|||||||
for i in range(1, len(text_arr)):
|
for i in range(1, len(text_arr)):
|
||||||
# Do not translate these. Fixed strings in SOF song file
|
# Do not translate these. Fixed strings in SOF song file
|
||||||
if text_arr[i] in ('JESUS', 'CHRIST', 'KING', 'ALMIGHTY', 'REDEEMER', 'SHEPHERD', 'SON', 'GOD', 'LORD',
|
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',
|
'FATHER', 'HOLY', 'SPIRIT', 'LAMB', 'YOU', 'YOUR', 'I', 'I\'VE', 'I\'M', 'I\'LL',
|
||||||
'SAVIOUR', 'O', 'YOU\'RE', 'HE', 'HIS', 'HIM', 'ZION', 'EMMANUEL', 'MAJESTY', 'JESUS\'',
|
'SAVIOUR', 'O', 'YOU\'RE', 'HE', 'HIS', 'HIM', 'ZION', 'EMMANUEL', 'MAJESTY', 'JESUS\'',
|
||||||
'JIREH', 'JUDAH', 'LION', 'LORD\'S', 'ABRAHAM', 'GOD\'S', 'FATHER\'S', 'ELIJAH' 'MARTHA',
|
'JIREH', 'JUDAH', 'LION', 'LORD\'S', 'ABRAHAM', 'GOD\'S', 'FATHER\'S',
|
||||||
'CHRISTMAS', 'ALPHA', 'OMEGA'):
|
'ELIJAH' 'MARTHA', 'CHRISTMAS', 'ALPHA', 'OMEGA'):
|
||||||
text_arr[i] = text_arr[i].capitalize()
|
text_arr[i] = text_arr[i].capitalize()
|
||||||
else:
|
else:
|
||||||
text_arr[i] = text_arr[i].lower()
|
text_arr[i] = text_arr[i].lower()
|
||||||
|
@ -97,7 +97,7 @@ class SongBeamerImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Initialise the Song Beamer importer.
|
Initialise the Song Beamer importer.
|
||||||
"""
|
"""
|
||||||
SongImport.__init__(self, manager, **kwargs)
|
super(SongBeamerImport, self).__init__(manager, **kwargs)
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self):
|
||||||
"""
|
"""
|
||||||
|
@ -114,7 +114,7 @@ def _remove_typos(diff):
|
|||||||
if len(diff) >= 3:
|
if len(diff) >= 3:
|
||||||
for index in range(len(diff) - 3, -1, -1):
|
for index in range(len(diff) - 3, -1, -1):
|
||||||
if _op_length(diff[index]) >= MIN_FRAGMENT_SIZE and diff[index + 1][0] != "equal" and \
|
if _op_length(diff[index]) >= MIN_FRAGMENT_SIZE and diff[index + 1][0] != "equal" and \
|
||||||
_op_length(diff[index + 1]) <= MAX_TYPO_SIZE and _op_length(diff[index + 2]) >= MIN_FRAGMENT_SIZE:
|
_op_length(diff[index + 1]) <= MAX_TYPO_SIZE and _op_length(diff[index + 2]) >= MIN_FRAGMENT_SIZE:
|
||||||
del diff[index + 1]
|
del diff[index + 1]
|
||||||
# Remove typo at the end of the string.
|
# Remove typo at the end of the string.
|
||||||
if len(diff) >= 2:
|
if len(diff) >= 2:
|
||||||
|
@ -364,7 +364,7 @@ class SongImport(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
if not hasattr(self, 'save_path'):
|
if not hasattr(self, 'save_path'):
|
||||||
self.save_path = os.path.join(AppLocation.get_section_data_path(self.import_wizard.plugin.name),
|
self.save_path = os.path.join(AppLocation.get_section_data_path(self.import_wizard.plugin.name),
|
||||||
'audio', str(song_id))
|
'audio', str(song_id))
|
||||||
check_directory_exists(self.save_path)
|
check_directory_exists(self.save_path)
|
||||||
if not filename.startswith(self.save_path):
|
if not filename.startswith(self.save_path):
|
||||||
old_file, filename = filename, os.path.join(self.save_path, os.path.split(filename)[1])
|
old_file, filename = filename, os.path.join(self.save_path, os.path.split(filename)[1])
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user