set drag and drop icon

svn: r6212
This commit is contained in:
Don Allingham 2006-03-27 05:06:10 +00:00
parent ad4ed7ac60
commit 5b04d86d82
4 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2006-03-26 Don Allingham <don@gramps-project.org>
* src/DataViews/_PedigreeView.py: start of dnd-icon - not working yet
* src/DataViews/_PersonView.py: set dnd icon
* src/PageView.py: set dnd icon
2006-03-25 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2006-03-25 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DataViews/_PedigreeView.py: Add DnD support to the person boxes; * src/DataViews/_PedigreeView.py: Add DnD support to the person boxes;
copy person data into clipboard; Open FamilyEditor to add missing copy person data into clipboard; Open FamilyEditor to add missing

View File

@ -102,11 +102,15 @@ class _PersonWidget_base:
self.force_mouse_over = False self.force_mouse_over = False
if self.person: if self.person:
self.connect("drag_data_get", self.drag_data_get) self.connect("drag_data_get", self.drag_data_get)
#self.connect('drag_begin', self.drag_begin)
self.drag_source_set(gtk.gdk.BUTTON1_MASK, self.drag_source_set(gtk.gdk.BUTTON1_MASK,
[DdTargets.PERSON_LINK.target()]+ [DdTargets.PERSON_LINK.target()]+
[t.target() for t in DdTargets._all_text_types], [t.target() for t in DdTargets._all_text_types],
gtk.gdk.ACTION_COPY) gtk.gdk.ACTION_COPY)
def drag_begin(self, widget, context, data):
self.drag_source_set_icon_stock('gramps-person')
def drag_data_get(self, widget, context, sel_data, info, time): def drag_data_get(self, widget, context, sel_data, info, time):
if sel_data.target == DdTargets.PERSON_LINK.drag_type: if sel_data.target == DdTargets.PERSON_LINK.drag_type:
data = (DdTargets.PERSON_LINK.drag_type, id(self), self.person.get_handle(), 0) data = (DdTargets.PERSON_LINK.drag_type, id(self), self.person.get_handle(), 0)

View File

@ -170,6 +170,7 @@ class PersonView(PageView.PersonNavView):
self.build_columns() self.build_columns()
self.tree.connect('button-press-event', self.button_press) self.tree.connect('button-press-event', self.button_press)
self.tree.connect('drag_data_get', self.drag_data_get) self.tree.connect('drag_data_get', self.drag_data_get)
self.tree.connect('drag_begin', self.drag_begin)
self.selection = self.tree.get_selection() self.selection = self.tree.get_selection()
self.selection.set_mode(gtk.SELECTION_MULTIPLE) self.selection.set_mode(gtk.SELECTION_MULTIPLE)
@ -182,6 +183,9 @@ class PersonView(PageView.PersonNavView):
self.setup_filter() self.setup_filter()
return self.vbox return self.vbox
def drag_begin(self, widget, *data):
widget.drag_source_set_icon_stock(self.get_stock())
def ui_definition(self): def ui_definition(self):
""" """
Specifies the UIManager XML code that defines the menus and buttons Specifies the UIManager XML code that defines the menus and buttons

View File

@ -355,6 +355,9 @@ class ListView(PageView):
def drag_info(self): def drag_info(self):
return None return None
def drag_begin(self, widget, *data):
widget.drag_source_set_icon_stock(self.get_stock())
def column_order(self): def column_order(self):
assert False assert False
@ -380,6 +383,7 @@ class ListView(PageView):
self.list.connect('key-press-event',self.key_press) self.list.connect('key-press-event',self.key_press)
if self.drag_info(): if self.drag_info():
self.list.connect('drag_data_get', self.drag_data_get) self.list.connect('drag_data_get', self.drag_data_get)
self.list.connect('drag_begin', self.drag_begin)
scrollwindow = gtk.ScrolledWindow() scrollwindow = gtk.ScrolledWindow()
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)