added dnd for 'from' list
This commit is contained in:
		| @@ -3,7 +3,8 @@ | ||||
| # Lib imports | ||||
| import gi | ||||
| gi.require_version('Gtk', '3.0') | ||||
| from gi.repository import Gtk | ||||
| gi.require_version('Gdk', '3.0') | ||||
| from gi.repository import Gtk, Gdk | ||||
|  | ||||
| # Application imports | ||||
| from mixins import CommonActionsMixin | ||||
| @@ -26,6 +27,15 @@ class ChangeView(Gtk.Box, CommonActionsMixin): | ||||
|         from_container.set_orientation(1) | ||||
|         to_container.set_orientation(1) | ||||
|  | ||||
|         fchild = from_scroll_vw.get_children()[0] | ||||
|         fchild.connect("drag-data-received", self._on_drag_data_received) | ||||
|         URI_TARGET_TYPE  = 80 | ||||
|         uri_target       = Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags(0), URI_TARGET_TYPE) | ||||
|         targets          = [ uri_target ] | ||||
|         action           = Gdk.DragAction.COPY | ||||
|         fchild.enable_model_drag_dest(targets, action) | ||||
|         fchild.enable_model_drag_source(0, targets, action) | ||||
|  | ||||
|         self.set_spacing(20) | ||||
|         self.set_border_width(2) | ||||
|         self.set_homogeneous(True) | ||||
| @@ -33,6 +43,12 @@ class ChangeView(Gtk.Box, CommonActionsMixin): | ||||
|         self.add(to_container) | ||||
|         self.show_all() | ||||
|  | ||||
|     def _on_drag_data_received(self, widget, drag_context, x, y, data, info, time): | ||||
|         if info == 80: | ||||
|             uri = data.get_uris()[0].split("file://")[1] | ||||
|             event_system.set_active_path(uri) | ||||
|  | ||||
|  | ||||
|  | ||||
|     def update_from_list(self): | ||||
|         if event_system.block_from_update: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user