From c70c8ea45d44dd8379babeccd478ac992cf2546f Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 29 May 2011 12:08:55 +0100 Subject: [PATCH] Add check to key_press_event for keyname returning None --- deluge/ui/gtkui/files_tab.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index f3431ecc5..a9476caac 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -525,12 +525,11 @@ class FilesTab(Tab): def _on_key_press_event(self, widget, event): keyname = gtk.gdk.keyval_name(event.keyval) - func = getattr(self, 'keypress_' + keyname, None) - selected_rows = self.listview.get_selection().get_selected_rows()[1] - if func and selected_rows: - return func(event) - else: - return + if keyname is not None: + func = getattr(self, 'keypress_' + keyname, None) + selected_rows = self.listview.get_selection().get_selected_rows()[1] + if func and selected_rows: + return func(event) def keypress_Menu(self, event): self.file_menu.popup(None, None, None, 3, event.time)