Ticket #892: deluge-delete.patch

File deluge-delete.patch, 1.2 KB (added by DavidKelly999, 15 years ago)

Patch for delete

  • torrentview.py

    old new  
    4949from deluge.ui.client import aclient as client
    5050from deluge.log import LOG as log
    5151import deluge.ui.gtkui.listview as listview
     52from removetorrentdialog import RemoveTorrentDialog
    5253
    5354# Status icons.. Create them from file only once to avoid constantly
    5455# re-creating them.
     
    204205                                    self.on_selection_changed)
    205206
    206207        self.treeview.connect("drag-drop", self.on_drag_drop)
     208        self.treeview.connect("key_press_event", self.on_key_press_event);
    207209
    208210    def start(self):
    209211        """Start the torrentview"""
     
    435437
    436438    def on_drag_drop(self, widget, drag_context, x, y, timestamp):
    437439        widget.stop_emission("drag-drop")
     440
     441    # Handle keyboard shortcuts
     442    def on_key_press_event(self, widget, event):
     443        keyname = gtk.gdk.keyval_name(event.keyval)
     444        func = getattr(self, 'keypress_' + keyname, None)
     445        if func:
     446            return func()
     447
     448    def keypress_Delete(self):
     449        log.debug("keypress_Delete")
     450        if self.get_selected_torrents():
     451             RemoveTorrentDialog(self.get_selected_torrents()).run()