mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-25 18:59:38 +00:00
Add #891 remove torrents by pressing the Delete key
This commit is contained in:
parent
b69e25e308
commit
0042fb1767
@ -49,6 +49,7 @@ from deluge.ui.client import client
|
||||
from deluge.log import LOG as log
|
||||
import listview
|
||||
from deluge.ui.tracker_icons import TrackerIcons
|
||||
from removetorrentdialog import RemoveTorrentDialog
|
||||
|
||||
# Status icons.. Create them from file only once to avoid constantly
|
||||
# re-creating them.
|
||||
@ -238,6 +239,7 @@ class TorrentView(listview.ListView, component.Component):
|
||||
self.on_selection_changed)
|
||||
|
||||
self.treeview.connect("drag-drop", self.on_drag_drop)
|
||||
self.treeview.connect("key_press_event", self.on_key_press_event)
|
||||
|
||||
client.register_event_handler("TorrentStateChangedEvent", self.on_torrentstatechanged_event)
|
||||
client.register_event_handler("TorrentAddedEvent", self.on_torrentadded_event)
|
||||
@ -526,3 +528,16 @@ class TorrentView(listview.ListView, component.Component):
|
||||
def on_torrentqueuechanged_event(self):
|
||||
self.mark_dirty()
|
||||
self.update()
|
||||
|
||||
# Handle keyboard shortcuts
|
||||
def on_key_press_event(self, widget, event):
|
||||
keyname = gtk.gdk.keyval_name(event.keyval)
|
||||
func = getattr(self, 'keypress_' + keyname, None)
|
||||
if func:
|
||||
return func()
|
||||
|
||||
def keypress_Delete(self):
|
||||
log.debug("keypress_Delete")
|
||||
torrents = self.get_selected_torrents()
|
||||
if torrents:
|
||||
RemoveTorrentDialog(torrents).run()
|
||||
|
Loading…
x
Reference in New Issue
Block a user