From 8cc6f1dbcb8da8654adbaffe0d2e113303535255 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Tue, 17 May 2016 06:15:53 -0700 Subject: [PATCH] Fix duplicate tags in strings --- openlp/core/lib/db.py | 15 +++++++++------ openlp/core/lib/htmlbuilder.py | 11 +++++------ openlp/core/lib/mediamanageritem.py | 3 +-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 812758a4b..3decb0a3b 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -68,9 +68,11 @@ def get_db_path(plugin_name, db_file_name=None): :return: The path to the database as type str """ if db_file_name is None: - return 'sqlite:///%s/%s.sqlite' % (AppLocation.get_section_data_path(plugin_name), plugin_name) + return 'sqlite:///{path}/{plugin}.sqlite'.format(path=AppLocation.get_section_data_path(plugin_name), + plugin=plugin_name) else: - return 'sqlite:///%s/%s' % (AppLocation.get_section_data_path(plugin_name), db_file_name) + return 'sqlite:///{path}/{name}'.format(path=AppLocation.get_section_data_path(plugin_name), + name=db_file_name) def handle_db_error(plugin_name, db_file_name): @@ -101,10 +103,11 @@ def init_url(plugin_name, db_file_name=None): if db_type == 'sqlite': db_url = get_db_path(plugin_name, db_file_name) else: - db_url = '%s://%s:%s@%s/%s' % (db_type, urlquote(settings.value('db username')), - urlquote(settings.value('db password')), - urlquote(settings.value('db hostname')), - urlquote(settings.value('db database'))) + db_url = '{type}://{user}:{password}@{host}/{db}'.format(type=db_type, + user=urlquote(settings.value('db username')), + password=urlquote(settings.value('db password')), + host=urlquote(settings.value('db hostname')), + db=urlquote(settings.value('db database'))) settings.endGroup() return db_url diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 364b52faa..b6ceb7e0f 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -637,8 +637,8 @@ def build_background_css(item, width): background = 'background: -webkit-gradient(linear, left top, right top, from({start}), to({end})) ' \ 'fixed'.format(start=theme.background_start_color, end=theme.background_end_color) else: - background = 'background: -webkit-gradient(radial, {width1} 50%, 100, {width2} 50%, {width3}, ' \ - 'from({start}), to({end})) fixed'.format(width1=width, width2=width, width3=width, + background = 'background: -webkit-gradient(radial, {width} 50%, 100, {width} 50%, {width}, ' \ + 'from({start}), to({end})) fixed'.format(width=width, start=theme.background_start_color, end=theme.background_end_color) return background @@ -677,10 +677,9 @@ def build_lyrics_css(item): lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height()) lyricsmain += build_lyrics_outline_css(theme_data) if theme_data.font_main_shadow: - lyricsmain += ' text-shadow: {theme} {shadow1}px ' \ - '{shadow2}px;'.format(theme=theme_data.font_main_shadow_color, - shadow1=theme_data.font_main_shadow_size, - shadow2=theme_data.font_main_shadow_size) + lyricsmain += ' text-shadow: {theme} {shadow}px ' \ + '{shadow}px;'.format(theme=teme_data.font_main_shadow_color, + shadow=theme_data.font_main_shadow_size) lyrics_css = style % (lyricstable, lyrics, lyricsmain) return lyrics_css diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 6e8327365..358c82543 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -380,8 +380,7 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties): self.load_list(full_list, target_group) last_dir = os.path.split(files[0])[0] Settings().setValue(self.settings_section + '/last directory', last_dir) - Settings().setValue('{section1}/{section2} files'.format(section1=self.settings_section, - section2=self.settings_section), + Settings().setValue('{section}/{section} files'.format(section=self.settings_section), self.get_file_list()) if duplicates_found: critical_error_message_box(UiStrings().Duplicate,