From e1f94038760f7cb72f97e910bb93277a721003f0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 29 Jul 2014 02:24:04 +0200 Subject: [PATCH] Clean up hint command. --- qutebrowser/browser/commands.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 28de2a626..b0172d218 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -250,12 +250,12 @@ class CommandDispatcher: self._tabs.currentWidget().go_forward() @cmdutils.register(instance='mainwindow.tabs.cmd') - def hint(self, groupstr='all', targetstr='normal', *args): + def hint(self, group='all', target='normal', *args): """Start hinting. Args: - groupstr: The hinting mode to use. - targetstr: Where to open the links. + group: The hinting mode to use. + target: Where to open the links. *args: Arguments for spawn/userscript. """ widget = self._tabs.currentWidget() @@ -263,15 +263,15 @@ class CommandDispatcher: if frame is None: raise CommandError("No frame focused!") try: - group = getattr(webelem.Group, groupstr.replace('-', '_')) + group_enum = webelem.Group[group.replace('-', '_')] except AttributeError: - raise CommandError("Unknown hinting group {}!".format(groupstr)) + raise CommandError("Unknown hinting group {}!".format(group)) try: - target = getattr(hints.Target, targetstr.replace('-', '_')) + target_enum = hints.Target[target.replace('-', '_')] except AttributeError: - raise CommandError("Unknown hinting target {}!".format(targetstr)) - widget.hintmanager.start(frame, self._tabs.current_url(), group, - target, *args) + raise CommandError("Unknown hinting target {}!".format(target)) + widget.hintmanager.start(frame, self._tabs.current_url(), group_enum, + target_enum, *args) @cmdutils.register(instance='mainwindow.tabs.cmd', hide=True) def follow_hint(self):