Fix duplicate tags in strings

This commit is contained in:
Ken Roberts 2016-05-17 06:15:53 -07:00
parent 403df406df
commit 8cc6f1dbcb
3 changed files with 15 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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,