Gtk3: drag and drop in grampletpane fixed
svn: r20094
This commit is contained in:
parent
ad424628a4
commit
871b58ae3d
@ -711,9 +711,10 @@ class GridGramplet(GuiGramplet):
|
|||||||
"""
|
"""
|
||||||
Class that handles the plugin interfaces for the GrampletView.
|
Class that handles the plugin interfaces for the GrampletView.
|
||||||
"""
|
"""
|
||||||
TARGET_TYPE_FRAME = 80
|
TARGET_TYPE_FRAME = 80L
|
||||||
LOCAL_DRAG_TYPE = 'GRAMPLET'
|
LOCAL_DRAG_TYPE = 'GRAMPLET'
|
||||||
LOCAL_DRAG_TARGET = Gtk.TargetEntry.new(LOCAL_DRAG_TYPE, 0, TARGET_TYPE_FRAME)
|
LOCAL_DRAG_TARGET = (Gdk.atom_intern(LOCAL_DRAG_TYPE, False), 0, TARGET_TYPE_FRAME)
|
||||||
|
|
||||||
def __init__(self, pane, dbstate, uistate, title, **kwargs):
|
def __init__(self, pane, dbstate, uistate, title, **kwargs):
|
||||||
"""
|
"""
|
||||||
Internal constructor for GUI portion of a gramplet.
|
Internal constructor for GUI portion of a gramplet.
|
||||||
@ -758,8 +759,12 @@ class GridGramplet(GuiGramplet):
|
|||||||
# source:
|
# source:
|
||||||
drag = self.gvproperties
|
drag = self.gvproperties
|
||||||
drag.drag_source_set(Gdk.ModifierType.BUTTON1_MASK,
|
drag.drag_source_set(Gdk.ModifierType.BUTTON1_MASK,
|
||||||
[GridGramplet.LOCAL_DRAG_TARGET],
|
[],
|
||||||
Gdk.DragAction.COPY)
|
Gdk.DragAction.COPY)
|
||||||
|
tglist = Gtk.TargetList.new([])
|
||||||
|
tg = GridGramplet.LOCAL_DRAG_TARGET
|
||||||
|
tglist.add(tg[0], tg[1], tg[2])
|
||||||
|
drag.drag_source_set_target_list(tglist)
|
||||||
|
|
||||||
# default tooltip
|
# default tooltip
|
||||||
msg = _("Drag Properties Button to move and click it for setup")
|
msg = _("Drag Properties Button to move and click it for setup")
|
||||||
@ -775,7 +780,7 @@ class GridGramplet(GuiGramplet):
|
|||||||
if self.titlelabel_entry is None:
|
if self.titlelabel_entry is None:
|
||||||
self.titlelabel_entry = Gtk.Entry()
|
self.titlelabel_entry = Gtk.Entry()
|
||||||
parent = widget.get_parent()
|
parent = widget.get_parent()
|
||||||
parent.pack_end(self.titlelabel_entry)
|
parent.pack_end(self.titlelabel_entry, True, True, 0)
|
||||||
self.titlelabel_entry.connect("focus-out-event",
|
self.titlelabel_entry.connect("focus-out-event",
|
||||||
self.edit_title_done)
|
self.edit_title_done)
|
||||||
self.titlelabel_entry.connect("activate", self.edit_title_done)
|
self.titlelabel_entry.connect("activate", self.edit_title_done)
|
||||||
@ -966,8 +971,12 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
self.drag_dest_set(Gtk.DestDefaults.MOTION |
|
self.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||||
Gtk.DestDefaults.HIGHLIGHT |
|
Gtk.DestDefaults.HIGHLIGHT |
|
||||||
Gtk.DestDefaults.DROP,
|
Gtk.DestDefaults.DROP,
|
||||||
[Gtk.TargetEntry.new('GRAMPLET', 0, 80)],
|
[],
|
||||||
Gdk.DragAction.COPY)
|
Gdk.DragAction.COPY)
|
||||||
|
tglist = Gtk.TargetList.new([])
|
||||||
|
tg = GridGramplet.LOCAL_DRAG_TARGET
|
||||||
|
tglist.add(tg[0], tg[1], tg[2])
|
||||||
|
self.drag_dest_set_target_list(tglist)
|
||||||
self.connect('drag_drop', self.drop_widget)
|
self.connect('drag_drop', self.drop_widget)
|
||||||
self.connect('button-press-event', self._button_press)
|
self.connect('button-press-event', self._button_press)
|
||||||
|
|
||||||
@ -1228,7 +1237,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
This is the destination method for handling drag and drop
|
This is the destination method for handling drag and drop
|
||||||
of a gramplet onto the main scrolled window.
|
of a gramplet onto the main scrolled window.
|
||||||
"""
|
"""
|
||||||
button = context.get_source_widget()
|
button = Gtk.drag_get_source_widget(context)
|
||||||
hbox = button.get_parent()
|
hbox = button.get_parent()
|
||||||
mframe = hbox.get_parent()
|
mframe = hbox.get_parent()
|
||||||
mainframe = mframe.get_parent() # actually a vbox
|
mainframe = mframe.get_parent() # actually a vbox
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
An override to allow easy multiselections.
|
An override to allow easy multiselections.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from gi.repository import Gdk
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user