Style fixes.

This commit is contained in:
Joel Torstensson 2015-03-03 18:48:27 +01:00
parent 8e0c1cff7b
commit 68774a2c75
3 changed files with 8 additions and 6 deletions

View File

@ -289,7 +289,7 @@ class DownloadItem(QObject):
download_dir = config.get('storage', 'download-directory') download_dir = config.get('storage', 'download-directory')
if download_dir is None: if download_dir is None:
download_dir = standarddir.get(QStandardPaths.DownloadLocation) download_dir = standarddir.get(QStandardPaths.DownloadLocation)
return download_dir + os.sep return download_dir
def _die(self, msg): def _die(self, msg):
"""Abort the download and emit an error.""" """Abort the download and emit an error."""
@ -375,11 +375,13 @@ class DownloadItem(QObject):
"""Get the suggestion of file path""" """Get the suggestion of file path"""
suggestion = config.get('completion', 'download-path-suggestion') suggestion = config.get('completion', 'download-path-suggestion')
if suggestion == 'path': if suggestion == 'path':
return self._download_dir() return self._download_dir() + os.sep
elif suggestion == 'filename': elif suggestion == 'filename':
return self.basename return self.basename
else: elif suggestion == 'both':
return os.path.join(self._download_dir(), self.basename) return os.path.join(self._download_dir(), self.basename)
else:
raise ValueError("Invalid suggestion value {}!".format(suggestion))
def delete(self): def delete(self):
"""Delete the downloaded file""" """Delete the downloaded file"""

View File

@ -306,8 +306,8 @@ DATA = collections.OrderedDict([
('completion', sect.KeyValue( ('completion', sect.KeyValue(
('download-path-suggestion', ('download-path-suggestion',
SettingValue(typ.DownloadPath(), 'path'), SettingValue(typ.DownloadPathSuggestion(), 'path'),
"What to show in the suggestion for the download question."), "What to display in the download filename input."),
('show', ('show',
SettingValue(typ.Bool(), 'true'), SettingValue(typ.Bool(), 'true'),

View File

@ -1416,7 +1416,7 @@ class NewInstanceOpenTarget(BaseType):
('window', "Open in a new window.")) ('window', "Open in a new window."))
class DownloadPath(BaseType): class DownloadPathSuggestion(BaseType):
"""How to format the question when downloading.""" """How to format the question when downloading."""