fiddling around with text dnd
This commit is contained in:
parent
6322a5ba0d
commit
c81df8ab05
32
terminator
32
terminator
|
@ -215,10 +215,11 @@ class TerminatorTerm:
|
|||
self._vte.connect ("popup-menu", self.on_vte_popup_menu)
|
||||
|
||||
"""drag and drop"""
|
||||
target = [ ( "vte", 0, 81 ), ('text/plain', 0, 0) ]
|
||||
self._vte.drag_source_set( gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON3_MASK, target, gtk.gdk.ACTION_COPY)
|
||||
#self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,target, gtk.gdk.ACTION_COPY)
|
||||
self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,target, gtk.gdk.ACTION_COPY)
|
||||
srctargets = [ ( "vte", 0, 81 ) ]
|
||||
dsttargets = [ ( "vte", 0, 81 ), ('text/plain', 0, 0) , ("STRING", 0, 0), ("COMPOUND_TEXT", 0, 0)]
|
||||
self._vte.drag_source_set( gtk.gdk.CONTROL_MASK | gtk.gdk.BUTTON3_MASK, srctargets, gtk.gdk.ACTION_COPY)
|
||||
#self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,dsttargets, gtk.gdk.ACTION_COPY)
|
||||
self._vte.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |gtk.DEST_DEFAULT_DROP ,dsttargets, gtk.gdk.ACTION_COPY)
|
||||
self._vte.connect("drag-data-get", self.on_drag_data_get, self)
|
||||
|
||||
#for testing purpose: drag-motion
|
||||
|
@ -261,6 +262,22 @@ class TerminatorTerm:
|
|||
|
||||
def on_drag_motion(self, widget, drag_context, x, y, time, data):
|
||||
#print "Drag Motion on ",
|
||||
"""
|
||||
x-special/gnome-icon-list
|
||||
text/uri-list
|
||||
UTF8_STRING
|
||||
COMPOUND_TEXT
|
||||
TEXT
|
||||
STRING
|
||||
text/plain;charset=utf-8
|
||||
text/plain;charset=UTF-8
|
||||
text/plain
|
||||
"""
|
||||
print "motion"
|
||||
|
||||
if 'text/plain' in drag_context.targets:
|
||||
#copy text from another widget
|
||||
return
|
||||
srcwidget = drag_context.get_source_widget()
|
||||
if widget == srcwidget:
|
||||
#on self
|
||||
|
@ -340,6 +357,13 @@ class TerminatorTerm:
|
|||
|
||||
def on_drag_data_received(self, widget, drag_context, x, y, selection_data, info, time, data):
|
||||
print "Drag Data Received on "
|
||||
if selection_data.type == 'text/plain':
|
||||
#copy text to destination
|
||||
txt = selection_data.data.strip()
|
||||
if txt[0:7] == "file://":
|
||||
txt = txt[7:]
|
||||
self._vte.feed_child("'%s'" % txt)
|
||||
return
|
||||
widgetsrc = data.terminator.term_list[int(selection_data.data)]
|
||||
srcvte = drag_context.get_source_widget()
|
||||
#check if computation requireds
|
||||
|
|
Loading…
Reference in New Issue