Add F2 key shortcut to rename files in Files Tab
This commit is contained in:
parent
3a7c182f83
commit
a710bcaed4
|
@ -122,7 +122,8 @@ class FilesTab(Tab):
|
|||
self._editing_index = None
|
||||
|
||||
# Filename column
|
||||
column = gtk.TreeViewColumn(_("Filename"))
|
||||
self.filename_column_name = _("Filename")
|
||||
column = gtk.TreeViewColumn(self.filename_column_name)
|
||||
render = gtk.CellRendererPixbuf()
|
||||
column.pack_start(render, False)
|
||||
column.add_attribute(render, "stock-id", 6)
|
||||
|
@ -523,16 +524,25 @@ class FilesTab(Tab):
|
|||
return True
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
# Menu key
|
||||
if gtk.gdk.keyval_name(event.keyval) != "Menu":
|
||||
return
|
||||
|
||||
if not self.get_selected_files():
|
||||
return
|
||||
|
||||
keyname = gtk.gdk.keyval_name(event.keyval)
|
||||
func = getattr(self, 'keypress_' + keyname, None)
|
||||
if func:
|
||||
return func(event)
|
||||
|
||||
def keypress_Menu(self, event):
|
||||
self.file_menu.popup(None, None, None, 3, event.time)
|
||||
return True
|
||||
|
||||
def keypress_F2(self, event):
|
||||
path, col = self.listview.get_cursor()
|
||||
for column in self.listview.get_columns():
|
||||
if column.get_title() == self.filename_column_name:
|
||||
self.listview.set_cursor(path, column, True)
|
||||
return True
|
||||
|
||||
def _on_menuitem_open_file_activate(self, menuitem):
|
||||
self._on_row_activated(None, None, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue