From 4ae4d0c74b032aaa3c2d1794305a464e02c731df Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Oct 2014 00:27:45 +0200 Subject: [PATCH] Simplify getting of quickmarks --- qutebrowser/models/completion.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/qutebrowser/models/completion.py b/qutebrowser/models/completion.py index e8a6daba9..1678e553f 100644 --- a/qutebrowser/models/completion.py +++ b/qutebrowser/models/completion.py @@ -203,17 +203,14 @@ class QuickmarkCompletionModel(basecompletion.BaseCompletionModel): def __init__(self, match_field='url', parent=None): super().__init__(parent) - qmlist = [] + cat = self.new_category("Quickmarks") + quickmarks = objreg.get('quickmark-manager').marks.items() if match_field == 'url': - for qm_name, qm_url in objreg.get('quickmark-manager').marks.items(): - qmlist.append((qm_url, qm_name)) + for qm_name, qm_url in quickmarks: + self.new_item(cat, qm_url, qm_name) elif match_field == 'name': - for qm_name, qm_url in objreg.get('quickmark-manager').marks.items(): - qmlist.append((qm_name, qm_url)) + for qm_name, qm_url in quickmarks: + self.new_item(cat, qm_name, qm_url) else: raise ValueError("Invalid value '{}' for match_field!".format(match_field)) - - cat = self.new_category("Quickmarks") - for (name, desc) in qmlist: - self.new_item(cat, name, desc)