* src/DataViews/_PedigreeView.py: Open FamilyEditor to add missing parents
svn: r6210
This commit is contained in:
parent
6d2e8b34c9
commit
614a4a5e7d
@ -1,6 +1,7 @@
|
|||||||
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
|
copy person data into clipboard; Open FamilyEditor to add missing
|
||||||
|
parents
|
||||||
|
|
||||||
2006-03-24 Don Allingham <don@gramps-project.org>
|
2006-03-24 Don Allingham <don@gramps-project.org>
|
||||||
* src/Editors/_EditFamily.py: handle single parent families on
|
* src/Editors/_EditFamily.py: handle single parent families on
|
||||||
|
@ -54,6 +54,7 @@ import NameDisplay
|
|||||||
import Utils
|
import Utils
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import ImgManip
|
import ImgManip
|
||||||
|
import Errors
|
||||||
from PluginUtils import ReportUtils
|
from PluginUtils import ReportUtils
|
||||||
from Editors import EditPerson
|
from Editors import EditPerson
|
||||||
from DdTargets import DdTargets
|
from DdTargets import DdTargets
|
||||||
@ -98,6 +99,7 @@ class _PersonWidget_base:
|
|||||||
def __init__(self, fh, person):
|
def __init__(self, fh, person):
|
||||||
self.fh = fh
|
self.fh = fh
|
||||||
self.person = person
|
self.person = person
|
||||||
|
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.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
self.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||||
@ -106,8 +108,6 @@ class _PersonWidget_base:
|
|||||||
gtk.gdk.ACTION_COPY)
|
gtk.gdk.ACTION_COPY)
|
||||||
|
|
||||||
def drag_data_get(self, widget, context, sel_data, info, time):
|
def drag_data_get(self, widget, context, sel_data, info, time):
|
||||||
print( "drag_data_get")
|
|
||||||
print sel_data.target
|
|
||||||
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)
|
||||||
sel_data.set(sel_data.target, 8, pickle.dumps(data))
|
sel_data.set(sel_data.target, 8, pickle.dumps(data))
|
||||||
@ -161,7 +161,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base):
|
|||||||
self.set_size_request(120,25)
|
self.set_size_request(120,25)
|
||||||
|
|
||||||
def on_enter_cb(self,widget,event):
|
def on_enter_cb(self,widget,event):
|
||||||
if self.person:
|
if self.person or self.force_mouse_over:
|
||||||
self.hightlight = True
|
self.hightlight = True
|
||||||
self.queue_draw()
|
self.queue_draw()
|
||||||
|
|
||||||
@ -723,6 +723,13 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
pw = PersonBoxWidget_cairo( self.format_helper, None, 0, None);
|
pw = PersonBoxWidget_cairo( self.format_helper, None, 0, None);
|
||||||
else:
|
else:
|
||||||
pw = PersonBoxWidget( self.format_helper, None, 0, None);
|
pw = PersonBoxWidget( self.format_helper, None, 0, None);
|
||||||
|
if i > 0 and lst[((i+1)/2)-1]:
|
||||||
|
fam_h = None
|
||||||
|
fam = lst[((i+1)/2)-1][2]
|
||||||
|
if fam:
|
||||||
|
fam_h = fam.get_handle()
|
||||||
|
pw.connect("button-press-event", self.missing_parent_button_press_cb,lst[((i+1)/2)-1][0].get_handle(),fam_h)
|
||||||
|
pw.force_mouse_over = True
|
||||||
if positions[i][0][2] > 1:
|
if positions[i][0][2] > 1:
|
||||||
table_widget.attach(pw,x,x+w,y,y+h,gtk.FILL,gtk.FILL,0,0)
|
table_widget.attach(pw,x,x+w,y,y+h,gtk.FILL,gtk.FILL,0,0)
|
||||||
else:
|
else:
|
||||||
@ -939,6 +946,18 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def add_parents_cb(self,obj,person_handle, family_handle):
|
||||||
|
from Editors import EditFamily
|
||||||
|
if family_handle: # one parent already exists -> Edit current family
|
||||||
|
family = self.dbstate.db.get_family_from_handle(family_handle)
|
||||||
|
else: # no parents -> create new family
|
||||||
|
family = RelLib.Family()
|
||||||
|
family.add_child_handle(person_handle)
|
||||||
|
try:
|
||||||
|
EditFamily(self.dbstate,self.uistate,[],family)
|
||||||
|
except Errors.WindowActiveError:
|
||||||
|
pass
|
||||||
|
|
||||||
def copy_person_to_clipboard_cb(self,obj,person_handle):
|
def copy_person_to_clipboard_cb(self,obj,person_handle):
|
||||||
"""Renders the person data into some lines of text and puts that into the clipboard"""
|
"""Renders the person data into some lines of text and puts that into the clipboard"""
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
@ -975,6 +994,13 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
self.build_full_nav_menu_cb(obj,event,person_handle)
|
self.build_full_nav_menu_cb(obj,event,person_handle)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def missing_parent_button_press_cb(self,obj,event,person_handle,family_handle):
|
||||||
|
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
||||||
|
self.add_parents_cb(obj,person_handle,family_handle)
|
||||||
|
elif event.button!=1:
|
||||||
|
self.build_missing_parent_nav_menu_cb(obj,event,person_handle,family_handle)
|
||||||
|
return True
|
||||||
|
|
||||||
def on_show_child_menu(self,obj):
|
def on_show_child_menu(self,obj):
|
||||||
"""User clicked button to move to child of active person"""
|
"""User clicked button to move to child of active person"""
|
||||||
|
|
||||||
@ -1169,6 +1195,20 @@ class PedigreeView(PageView.PersonNavView):
|
|||||||
item.show()
|
item.show()
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
|
def build_missing_parent_nav_menu_cb(self,obj,event,person_handle,family_handle):
|
||||||
|
menu = gtk.Menu()
|
||||||
|
menu.set_title(_('People Menu'))
|
||||||
|
|
||||||
|
add_item = gtk.ImageMenuItem(gtk.STOCK_ADD)
|
||||||
|
add_item.connect("activate",self.add_parents_cb,person_handle,family_handle)
|
||||||
|
add_item.show()
|
||||||
|
menu.append(add_item)
|
||||||
|
|
||||||
|
# Add history-based navigation
|
||||||
|
self.add_nav_portion_to_menu(menu)
|
||||||
|
self.add_settings_to_menu(menu)
|
||||||
|
menu.popup(None,None,None,event.button,event.time)
|
||||||
|
return 1
|
||||||
|
|
||||||
def build_full_nav_menu_cb(self,obj,event,person_handle):
|
def build_full_nav_menu_cb(self,obj,event,person_handle):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user