mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 19:44:52 +00:00
Add drag n' drop support for torrent file adding
This commit is contained in:
parent
f26f9c6331
commit
63ede39505
3 changed files with 27 additions and 2 deletions
|
@ -1,8 +1,10 @@
|
|||
Deluge 0.9.04 - "1.0.0_RC4" (In Development)
|
||||
Core:
|
||||
* Fix building with gcc 4.3
|
||||
* Fix do not create torrentfiles folder unless 'copy_torrent_file' is True
|
||||
|
||||
GtkUI:
|
||||
* Add drag n' drop support for adding .torrent files
|
||||
* Fix selecting torrents when right-clicking on them in torrentview and filestab
|
||||
* Fix new release check
|
||||
* Display 'total_wanted' instead of 'total_size' in Size column
|
||||
|
|
|
@ -36,10 +36,13 @@ pygtk.require('2.0')
|
|||
import gtk, gtk.glade
|
||||
import gobject
|
||||
import pkg_resources
|
||||
from urlparse import urlparse
|
||||
import urllib
|
||||
|
||||
from deluge.ui.client import aclient as client
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.gtkui.ipcinterface import process_arg
|
||||
|
||||
import deluge.common
|
||||
|
||||
|
@ -65,17 +68,26 @@ class MainWindow(component.Component):
|
|||
# UI when it is minimized.
|
||||
self.is_minimized = False
|
||||
|
||||
self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL, [('text/uri-list', 0,
|
||||
80)], gtk.gdk.ACTION_COPY)
|
||||
|
||||
# Connect events
|
||||
self.window.connect("window-state-event", self.on_window_state_event)
|
||||
self.window.connect("configure-event", self.on_window_configure_event)
|
||||
self.window.connect("delete-event", self.on_window_delete_event)
|
||||
self.window.connect("drag-data-received", self.on_drag_data_received_event)
|
||||
self.vpaned.connect("notify::position", self.on_vpaned_position_event)
|
||||
|
||||
if not(self.config["start_in_tray"] and \
|
||||
self.config["enable_system_tray"]) and not \
|
||||
self.window.get_property("visible"):
|
||||
log.debug("Showing window")
|
||||
self.show()
|
||||
self.show() def on_drag_data_received_event(self, widget, drag_context, x, y, selection_data, info, timestamp):
|
||||
args = []
|
||||
for uri in selection_data.data.split():
|
||||
args.append(urllib.unquote(urlparse(uri).path))
|
||||
process_args(args)
|
||||
drag_context.finish(True, True)
|
||||
|
||||
def show(self):
|
||||
try:
|
||||
|
@ -139,7 +151,7 @@ class MainWindow(component.Component):
|
|||
if self.config["window_maximized"] == True:
|
||||
self.window.maximize()
|
||||
self.vpaned.set_position(
|
||||
self.config["window_height"] - self.config["window_pane_position"])
|
||||
self.config["window_heighfrom deluge.ui.gtkui.ipcinterface import process_argt"] - self.config["window_pane_position"])
|
||||
|
||||
def on_window_configure_event(self, widget, event):
|
||||
if self.config["window_maximized"] == False and self.visible:
|
||||
|
@ -183,3 +195,9 @@ class MainWindow(component.Component):
|
|||
self.config.set("window_pane_position",
|
||||
self.config["window_height"] - self.vpaned.get_position())
|
||||
|
||||
def on_drag_data_received_event(self, widget, drag_context, x, y, selection_data, info, timestamp):
|
||||
args = []
|
||||
for uri in selection_data.data.split():
|
||||
args.append(urllib.unquote(urlparse(uri).path))
|
||||
process_args(args)
|
||||
drag_context.finish(True, True)
|
||||
|
|
|
@ -182,6 +182,8 @@ class TorrentView(listview.ListView, component.Component):
|
|||
# changes.
|
||||
self.treeview.get_selection().connect("changed",
|
||||
self.on_selection_changed)
|
||||
|
||||
self.treeview.connect("drag-drop", self.on_drag_drop)
|
||||
|
||||
def start(self):
|
||||
"""Start the torrentview"""
|
||||
|
@ -466,3 +468,6 @@ class TorrentView(listview.ListView, component.Component):
|
|||
component.get("TorrentDetails").update()
|
||||
component.get("ToolBar").update_buttons()
|
||||
component.get("MenuBar").update_menu()
|
||||
|
||||
def on_drag_drop(self, widget, drag_context, x, y, timestamp):
|
||||
widget.stop_emission("drag-drop")
|
||||
|
|
Loading…
Add table
Reference in a new issue