Author: andar
Revision: 6022
Log:
Add #891 remove torrents by pressing the Delete key
Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog 2009-12-13 21:50:16 UTC (rev 6021)
+++ branches/1.2_RC/ChangeLog 2009-12-13 22:16:05 UTC (rev 6022)
@@ -25,6 +25,7 @@
* Fix #782 do not ask for tray password when window is not minimized to
tray
* Fix #1036 autoconnecting to localhost daemon on start-up
* Fix issue where hosts will show up erroneously as Offline
+ * Add #891 remove torrents by pressing the Delete key
==== Console ====
* Fix using the console in Windows, but only in command-line mode
Modified: branches/1.2_RC/deluge/ui/gtkui/torrentview.py
===================================================================
--- branches/1.2_RC/deluge/ui/gtkui/torrentview.py 2009-12-13 21:50:16 UTC
(rev 6021)
+++ branches/1.2_RC/deluge/ui/gtkui/torrentview.py 2009-12-13 22:16:05 UTC
(rev 6022)
@@ -49,6 +49,7 @@
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.
@@ -146,7 +147,7 @@
return 1
if v2 > v1:
return -1
-
+
class TorrentView(listview.ListView, component.Component):
"""TorrentView handles the listing of torrents."""
def __init__(self):
@@ -238,6 +239,7 @@
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)
@@ -279,7 +281,7 @@
Saves the state of the torrent view.
"""
listview.ListView.save_state(self, "torrentview.state")
-
+
def set_filter(self, filter_dict):
"""Sets filters for the torrentview..
see: core.get_torrents_status
@@ -477,15 +479,15 @@
torrentmenu = component.get("MenuBar").torrentmenu
torrentmenu.popup(None, None, None, event.button, event.time)
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_torrent():
return
-
+
torrentmenu = component.get("MenuBar").torrentmenu
torrentmenu.popup(None, None, None, 3, event.time)
return True
@@ -526,3 +528,16 @@
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()
Modified: trunk/deluge/ui/gtkui/torrentview.py
===================================================================
--- trunk/deluge/ui/gtkui/torrentview.py 2009-12-13 21:50:16 UTC (rev
6021)
+++ trunk/deluge/ui/gtkui/torrentview.py 2009-12-13 22:16:05 UTC (rev
6022)
@@ -49,6 +49,7 @@
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.
@@ -146,7 +147,7 @@
return 1
if v2 > v1:
return -1
-
+
class TorrentView(listview.ListView, component.Component):
"""TorrentView handles the listing of torrents."""
def __init__(self):
@@ -238,6 +239,7 @@
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)
@@ -279,7 +281,7 @@
Saves the state of the torrent view.
"""
listview.ListView.save_state(self, "torrentview.state")
-
+
def set_filter(self, filter_dict):
"""Sets filters for the torrentview..
see: core.get_torrents_status
@@ -477,15 +479,15 @@
torrentmenu = component.get("MenuBar").torrentmenu
torrentmenu.popup(None, None, None, event.button, event.time)
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_torrent():
return
-
+
torrentmenu = component.get("MenuBar").torrentmenu
torrentmenu.popup(None, None, None, 3, event.time)
return True
@@ -526,3 +528,16 @@
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()
--
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en.