Add check to key_press_event for keyname returning None

This commit is contained in:
Calum Lind 2011-05-29 12:08:55 +01:00
parent 583248f558
commit 254efa88e5
1 changed files with 5 additions and 6 deletions

View File

@ -522,12 +522,11 @@ class FilesTab(Tab):
def _on_key_press_event(self, widget, event): def _on_key_press_event(self, widget, event):
keyname = gtk.gdk.keyval_name(event.keyval) keyname = gtk.gdk.keyval_name(event.keyval)
func = getattr(self, 'keypress_' + keyname, None) if keyname is not None:
selected_rows = self.listview.get_selection().get_selected_rows()[1] func = getattr(self, 'keypress_' + keyname, None)
if func and selected_rows: selected_rows = self.listview.get_selection().get_selected_rows()[1]
return func(event) if func and selected_rows:
else: return func(event)
return
def keypress_Menu(self, event): def keypress_Menu(self, event):
self.file_menu.popup(None, None, None, 3, event.time) self.file_menu.popup(None, None, None, 3, event.time)