From 254efa88e593634ad9b1109d1380133242763882 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 53db593b2..51330ceb6 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -522,12 +522,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)