From a141cc469fef3ed23044b232be4bcd9417db6a69 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 17 Sep 2011 03:20:37 +0200 Subject: gui.widgets.console: fixed error canceling nonexistent command Thanks to Joshua for pointing it out. --- ranger/gui/widgets/console.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index a575405d..00d6828b 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -125,7 +125,7 @@ class Console(Widget): def close(self, trigger_cancel_function=True): if trigger_cancel_function: - cmd = self._get_cmd() + cmd = self._get_cmd(quiet=True) if cmd: try: cmd.cancel() @@ -324,11 +324,12 @@ class Console(Widget): if self.allow_close: self.close(trigger_cancel_function=False) - def _get_cmd(self): + def _get_cmd(self, quiet=False): try: command_class = self._get_cmd_class() except KeyError: - self.fm.notify("Invalid command! Press ? for help.", bad=True) + if not quiet: + self.fm.notify("Invalid command! Press ? for help.", bad=True) except: return None else: -- cgit 1.4.1-2-gfad0