Shift-click to edit spouse, re-implemented family name guessing
svn: r1537
This commit is contained in:
parent
fc1daf4b66
commit
b2be35af0a
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
Version 0.9.2
|
Version 0.9.2
|
||||||
|
* Fixed pedigree view problem that prevented display from updating
|
||||||
* Fixed duplicate place problem.
|
* Fixed duplicate place problem.
|
||||||
|
* Re-implemented family name guessing
|
||||||
|
* Better error handling with reports
|
||||||
* Language-specific relationship calculation framework.
|
* Language-specific relationship calculation framework.
|
||||||
Volunteers needed to create language-specific plugins.
|
Volunteers needed to create language-specific plugins.
|
||||||
* New Family Tree Maker style reports (Ancestor and Descendant).
|
* New Family Tree Maker style reports (Ancestor and Descendant).
|
||||||
|
@ -159,7 +159,11 @@ class FamilyView:
|
|||||||
self.display_marriage(self.person.getFamilyList()[row[0]])
|
self.display_marriage(self.person.getFamilyList()[row[0]])
|
||||||
|
|
||||||
def edit_relationship(self,obj,event):
|
def edit_relationship(self,obj,event):
|
||||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
if event.state & gtk.gdk.SHIFT_MASK and \
|
||||||
|
event.type == gtk.gdk.BUTTON_PRESS and \
|
||||||
|
event.button == 1 and self.selected_spouse:
|
||||||
|
self.parent.load_person(self.selected_spouse)
|
||||||
|
elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
if self.person:
|
if self.person:
|
||||||
try:
|
try:
|
||||||
if self.selected_spouse:
|
if self.selected_spouse:
|
||||||
|
@ -91,6 +91,7 @@ class DispBox:
|
|||||||
self.bkgnd.destroy()
|
self.bkgnd.destroy()
|
||||||
self.textbox.destroy()
|
self.textbox.destroy()
|
||||||
self.group.destroy()
|
self.group.destroy()
|
||||||
|
return
|
||||||
|
|
||||||
def group_event(self,obj,event):
|
def group_event(self,obj,event):
|
||||||
"""Handle events over a drawn box. Doubleclick would edit,
|
"""Handle events over a drawn box. Doubleclick would edit,
|
||||||
@ -110,14 +111,12 @@ class DispBox:
|
|||||||
|
|
||||||
def expand(self):
|
def expand(self):
|
||||||
"""Expand a box to include additional information"""
|
"""Expand a box to include additional information"""
|
||||||
self.group.raise_to_top()
|
|
||||||
self.textbox.set(text=self.exp)
|
self.textbox.set(text=self.exp)
|
||||||
self.bkgnd.set(y1=-self.h,y2=self.h*2)
|
self.bkgnd.set(y1=-self.h,y2=self.h*2)
|
||||||
self.shadow.set(y1=-self.h+_PAD,y2=self.h*2+_PAD)
|
self.shadow.set(y1=-self.h+_PAD,y2=self.h*2+_PAD)
|
||||||
|
|
||||||
def shrink(self):
|
def shrink(self):
|
||||||
"""Expand a box to include additional information"""
|
"""Expand a box to include additional information"""
|
||||||
self.group.raise_to_top()
|
|
||||||
self.textbox.set(text=self.name)
|
self.textbox.set(text=self.name)
|
||||||
self.bkgnd.set(y1=0,y2=self.h)
|
self.bkgnd.set(y1=0,y2=self.h)
|
||||||
self.shadow.set(y1=_PAD,y2=self.h+_PAD)
|
self.shadow.set(y1=_PAD,y2=self.h+_PAD)
|
||||||
|
@ -18,17 +18,31 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GTK/Gnome modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# gramps modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
import Utils
|
import Utils
|
||||||
import AutoComp
|
import AutoComp
|
||||||
import const
|
import const
|
||||||
import RelLib
|
import RelLib
|
||||||
from intl import gettext as _
|
from intl import gettext as _
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# QuickAdd
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
class QuickAdd:
|
class QuickAdd:
|
||||||
def __init__(self,db,sex,callback):
|
def __init__(self,db,sex,callback,default_name = ""):
|
||||||
self.db = db
|
self.db = db
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
|
||||||
@ -41,15 +55,19 @@ class QuickAdd:
|
|||||||
|
|
||||||
self.window = self.xml.get_widget("addperson")
|
self.window = self.xml.get_widget("addperson")
|
||||||
title = self.xml.get_widget('title')
|
title = self.xml.get_widget('title')
|
||||||
|
combo = self.xml.get_widget("surnameCombo")
|
||||||
|
self.surname = self.xml.get_widget("surname")
|
||||||
|
self.given = self.xml.get_widget("given")
|
||||||
|
|
||||||
Utils.set_titles(self.window,title, _('Add Person'))
|
Utils.set_titles(self.window,title, _('Add Person'))
|
||||||
|
|
||||||
self.c = AutoComp.AutoCombo(self.xml.get_widget("surnameCombo"),
|
self.c = AutoComp.AutoCombo(combo,self.db.getSurnames())
|
||||||
self.db.getSurnames())
|
if default_name:
|
||||||
|
self.surname.set_text(default_name)
|
||||||
|
|
||||||
def close(self,obj):
|
def close(self,obj):
|
||||||
surname = self.xml.get_widget("surname").get_text()
|
surname = self.surname.get_text()
|
||||||
given = self.xml.get_widget("given").get_text()
|
given = self.given.get_text()
|
||||||
person = RelLib.Person()
|
person = RelLib.Person()
|
||||||
name = person.getPrimaryName()
|
name = person.getPrimaryName()
|
||||||
name.setSurname(surname)
|
name.setSurname(surname)
|
||||||
|
@ -41,6 +41,8 @@ import RelLib
|
|||||||
import const
|
import const
|
||||||
import Utils
|
import Utils
|
||||||
import ListModel
|
import ListModel
|
||||||
|
import GrampsCfg
|
||||||
|
from RelLib import Person
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -57,6 +59,11 @@ class SelectChild:
|
|||||||
self.add_person = add_person
|
self.add_person = add_person
|
||||||
self.xml = gtk.glade.XML(const.gladeFile,"select_child")
|
self.xml = gtk.glade.XML(const.gladeFile,"select_child")
|
||||||
|
|
||||||
|
if person:
|
||||||
|
self.default_name = person.getPrimaryName().getSurname().upper()
|
||||||
|
else:
|
||||||
|
self.default_name = ""
|
||||||
|
|
||||||
self.xml.signal_autoconnect({
|
self.xml.signal_autoconnect({
|
||||||
"on_save_child_clicked" : self.on_save_child_clicked,
|
"on_save_child_clicked" : self.on_save_child_clicked,
|
||||||
"on_show_toggled" : self.on_show_toggled,
|
"on_show_toggled" : self.on_show_toggled,
|
||||||
@ -164,10 +171,22 @@ class SelectChild:
|
|||||||
|
|
||||||
person_list.append(person.getId())
|
person_list.append(person.getId())
|
||||||
|
|
||||||
|
iter = None
|
||||||
for idval in person_list:
|
for idval in person_list:
|
||||||
dinfo = self.db.getPersonDisplay(idval)
|
dinfo = self.db.getPersonDisplay(idval)
|
||||||
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
||||||
self.refmodel.add(rdata)
|
new_iter = self.refmodel.add(rdata)
|
||||||
|
names = dinfo[0].split(',')
|
||||||
|
if len(names):
|
||||||
|
ln = names[0].upper()
|
||||||
|
if self.default_name and ln == self.default_name and not iter:
|
||||||
|
iter = new_iter
|
||||||
|
|
||||||
|
if iter:
|
||||||
|
self.refmodel.selection.select_iter(iter)
|
||||||
|
path = self.refmodel.model.get_path(iter)
|
||||||
|
col = self.add_child.get_column(0)
|
||||||
|
self.add_child.scroll_to_cell(path,col,1,0.5,0.0)
|
||||||
|
|
||||||
def on_save_child_clicked(self,obj):
|
def on_save_child_clicked(self,obj):
|
||||||
store,iter = self.refmodel.selection.get_selected()
|
store,iter = self.refmodel.selection.get_selected()
|
||||||
@ -213,7 +232,18 @@ class SelectChild:
|
|||||||
class to create a new person."""
|
class to create a new person."""
|
||||||
|
|
||||||
import QuickAdd
|
import QuickAdd
|
||||||
QuickAdd.QuickAdd(self.db,"male",self.add_new_parent)
|
|
||||||
|
autoname = GrampsCfg.lastnamegen
|
||||||
|
|
||||||
|
if autoname == 0:
|
||||||
|
name = self.north_american(0)
|
||||||
|
elif autoname == 2:
|
||||||
|
name = self.latin_american(0)
|
||||||
|
elif autoname == 3:
|
||||||
|
name = self.icelandic(0)
|
||||||
|
else:
|
||||||
|
name = ""
|
||||||
|
QuickAdd.QuickAdd(self.db,"male",self.add_new_parent, name)
|
||||||
|
|
||||||
def add_new_parent(self,person):
|
def add_new_parent(self,person):
|
||||||
"""Adds a new person to either the father list or the mother list,
|
"""Adds a new person to either the father list or the mother list,
|
||||||
@ -223,3 +253,49 @@ class SelectChild:
|
|||||||
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
||||||
self.refmodel.add_and_select(rdata)
|
self.refmodel.add_and_select(rdata)
|
||||||
self.add_person(person)
|
self.add_person(person)
|
||||||
|
|
||||||
|
def north_american(self,val):
|
||||||
|
if self.person.getGender() == Person.male:
|
||||||
|
return self.person.getPrimaryName().getSurname()
|
||||||
|
elif self.family:
|
||||||
|
f = self.family.getFather()
|
||||||
|
if f:
|
||||||
|
return f.getPrimaryName().getSurname()
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def no_name(self,val):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def latin_american(self,val):
|
||||||
|
if self.family:
|
||||||
|
father = self.family.getFather()
|
||||||
|
mother = self.family.getMother()
|
||||||
|
if not father or not mother:
|
||||||
|
return ""
|
||||||
|
fsn = father.getPrimaryName().getSurname()
|
||||||
|
msn = mother.getPrimaryName().getSurname()
|
||||||
|
if not father or not mother:
|
||||||
|
return ""
|
||||||
|
try:
|
||||||
|
return "%s %s" % (fsn.split()[0],msn.split()[0])
|
||||||
|
except:
|
||||||
|
return ""
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def icelandic(self,val):
|
||||||
|
fname = ""
|
||||||
|
if self.person.getGender() == Person.male:
|
||||||
|
fname = self.person.getPrimaryName().getFirstName()
|
||||||
|
elif self.family:
|
||||||
|
f = self.family.getFather()
|
||||||
|
if f:
|
||||||
|
fname = f.getPrimaryName().getFirstName()
|
||||||
|
if fname:
|
||||||
|
fname = string.split(fname)[0]
|
||||||
|
if val == 0:
|
||||||
|
return "%ssson" % fname
|
||||||
|
elif val == 1:
|
||||||
|
return "%sdóttir" % fname
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
@ -1802,7 +1802,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label361">
|
<widget class="GtkLabel" id="label361">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"><b>Spouse</b></property>
|
<property name="label" translatable="yes"><b>Relationship</b></property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">True</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
@ -1949,7 +1949,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="sp_list">
|
<widget class="GtkTreeView" id="sp_list">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="tooltip" translatable="yes">Double-click to edit the relationship information</property>
|
<property name="tooltip" translatable="yes">Double-click to edit the relationship information, Shift-click to edit the person</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="headers_visible">False</property>
|
<property name="headers_visible">False</property>
|
||||||
<property name="rules_hint">True</property>
|
<property name="rules_hint">True</property>
|
||||||
@ -4033,7 +4033,7 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="childlist">
|
<widget class="GtkTreeView" id="childlist">
|
||||||
<property name="width_request">320</property>
|
<property name="width_request">400</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="headers_visible">True</property>
|
<property name="headers_visible">True</property>
|
||||||
|
@ -1183,7 +1183,7 @@ class Gramps:
|
|||||||
model.selection.select_iter(iter);
|
model.selection.select_iter(iter);
|
||||||
itpath = model.model.get_path(iter)
|
itpath = model.model.get_path(iter)
|
||||||
col = model.tree.get_column(0)
|
col = model.tree.get_column(0)
|
||||||
model.tree.scroll_to_cell(itpath,col,1,0.5,0.0)
|
model.tree.scroll_to_cell(itpath,col,1,0.5,0)
|
||||||
|
|
||||||
def change_active_person(self,person):
|
def change_active_person(self,person):
|
||||||
if person != self.active_person:
|
if person != self.active_person:
|
||||||
@ -1410,6 +1410,8 @@ class Gramps:
|
|||||||
self.db.buildPersonDisplay(epo.person.getId())
|
self.db.buildPersonDisplay(epo.person.getId())
|
||||||
self.change_active_person(epo.person)
|
self.change_active_person(epo.person)
|
||||||
self.redisplay_person_list(epo.person)
|
self.redisplay_person_list(epo.person)
|
||||||
|
if self.views.get_current_page() == 1:
|
||||||
|
self.family_view.load_family()
|
||||||
for p in plist:
|
for p in plist:
|
||||||
self.place_view.new_place_after_edit(p)
|
self.place_view.new_place_after_edit(p)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user