Event reordering for marriage
svn: r1255
This commit is contained in:
parent
a5b4fcd791
commit
30aa40eb21
2
configure
vendored
2
configure
vendored
@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
RELEASE=rc1
|
RELEASE=rc2
|
||||||
|
|
||||||
VERSIONSTRING=$VERSION
|
VERSIONSTRING=$VERSION
|
||||||
if test x"$RELEASE" != "x"
|
if test x"$RELEASE" != "x"
|
||||||
|
@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
|
|||||||
dnl May need to run automake && aclocal first
|
dnl May need to run automake && aclocal first
|
||||||
AC_INIT(src/gramps.py)
|
AC_INIT(src/gramps.py)
|
||||||
AM_INIT_AUTOMAKE(gramps, 0.9.0)
|
AM_INIT_AUTOMAKE(gramps, 0.9.0)
|
||||||
RELEASE=rc1
|
RELEASE=rc2
|
||||||
|
|
||||||
VERSIONSTRING=$VERSION
|
VERSIONSTRING=$VERSION
|
||||||
if test x"$RELEASE" != "x"
|
if test x"$RELEASE" != "x"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
%define ver 0.9.0
|
%define ver 0.9.0
|
||||||
%define rel rc1
|
%define rel rc2
|
||||||
%define prefix /usr
|
%define prefix /usr
|
||||||
|
|
||||||
Summary: Genealogical Research and Analysis Management Programming System.
|
Summary: Genealogical Research and Analysis Management Programming System.
|
||||||
|
@ -266,7 +266,7 @@ class EditPerson:
|
|||||||
self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,ACTION_COPY)
|
self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,ACTION_COPY)
|
||||||
self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
|
self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
|
||||||
self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
|
self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
|
||||||
self.addr_list.connect('drag_begin', self.ev_drag_begin)
|
self.addr_list.connect('drag_begin', self.ad_drag_begin)
|
||||||
|
|
||||||
self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat"))
|
self.bdate_check = DateEdit(self.bdate,self.get_widget("birth_stat"))
|
||||||
self.bdate_check.set_calendar(self.birth.getDateObj().get_calendar())
|
self.bdate_check.set_calendar(self.birth.getDateObj().get_calendar())
|
||||||
|
@ -136,9 +136,9 @@ class FamilyView:
|
|||||||
self.child_selection = self.child_list.get_selection()
|
self.child_selection = self.child_list.get_selection()
|
||||||
|
|
||||||
Utils.build_columns(self.child_list,
|
Utils.build_columns(self.child_list,
|
||||||
[ (_(''),30,0), (_('Name'),250,1), (_('ID'),50,2),
|
[ (_(''),30,-1), (_('Name'),250,-1), (_('ID'),50,-1),
|
||||||
(_('Gender'),100,3), (_('Birth Date'),150,4),
|
(_('Gender'),100,-1), (_('Birth Date'),150,-1),
|
||||||
(_('Status'),150,5), ('',0,6) ])
|
(_('Status'),150,-1), ('',0,-1) ])
|
||||||
|
|
||||||
def on_child_list_button_press(self,obj,event):
|
def on_child_list_button_press(self,obj,event):
|
||||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
@ -524,76 +524,12 @@ class FamilyView:
|
|||||||
Utils.modified()
|
Utils.modified()
|
||||||
self.load_family()
|
self.load_family()
|
||||||
|
|
||||||
def child_list_reordered(self,path,iter):
|
|
||||||
print path,iter
|
|
||||||
|
|
||||||
def on_child_list_row_move(self,clist,fm,to):
|
|
||||||
"""Validate whether or not this child can be moved within the clist.
|
|
||||||
This routine is called in the middle of the clist's callbacks, so
|
|
||||||
the state can be confusing. If the code is being debugged, the
|
|
||||||
display at this point shows that the list has been reordered when in
|
|
||||||
actuality it hasn't. All accesses to the clist data structure
|
|
||||||
reference the state just prior to the move.
|
|
||||||
|
|
||||||
This routine must keep/compute its own list indices as the functions
|
|
||||||
list.remove(), list.insert(), list.reverse() etc. do not affect the
|
|
||||||
values returned from the list.index() routine."""
|
|
||||||
|
|
||||||
family = clist.get_data("f")
|
|
||||||
|
|
||||||
# Create a list based upon the current order of the clist
|
|
||||||
clist_order = []
|
|
||||||
for i in range(clist.rows):
|
|
||||||
clist_order = clist_order + [clist.get_row_data(i)]
|
|
||||||
child = clist_order[fm]
|
|
||||||
|
|
||||||
# This function deals with ascending order lists. Convert if
|
|
||||||
# necessary.
|
|
||||||
if (self.child_sort.sort_direction() == GTK.SORT_DESCENDING):
|
|
||||||
clist_order.reverse()
|
|
||||||
max_index = len(clist_order) - 1
|
|
||||||
fm = max_index - fm
|
|
||||||
to = max_index - to
|
|
||||||
|
|
||||||
# Create a new list to match the requested order
|
|
||||||
desired_order = clist_order[:fm] + clist_order[fm+1:]
|
|
||||||
desired_order = desired_order[:to] + [child] + desired_order[to:]
|
|
||||||
|
|
||||||
# Check birth date order in the new list
|
|
||||||
if (EditPerson.birth_dates_in_order(desired_order) == 0):
|
|
||||||
clist.emit_stop_by_name("row_move")
|
|
||||||
msg = _("Invalid move. Children must be ordered by birth date.")
|
|
||||||
WarningDialog(msg)
|
|
||||||
return
|
|
||||||
|
|
||||||
# OK, this birth order works too. Update the family data structures.
|
|
||||||
family.setChildList(desired_order)
|
|
||||||
|
|
||||||
# Build a mapping of child item to list position. This would not
|
|
||||||
# be necessary if indices worked properly
|
|
||||||
i = 0
|
|
||||||
new_order = {}
|
|
||||||
for tmp in desired_order:
|
|
||||||
new_order[tmp] = i
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
# Convert the original list back to whatever ordering is being
|
|
||||||
# used by the clist itself.
|
|
||||||
if self.child_sort.sort_direction() == GTK.SORT_DESCENDING:
|
|
||||||
clist_order.reverse()
|
|
||||||
|
|
||||||
# Update the clist indices so any change of sorting works
|
|
||||||
i = 0
|
|
||||||
for tmp in clist_order:
|
|
||||||
clist.set_text(i,0,"%2d"%(new_order[tmp]+1))
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
# Need to save the changed order
|
|
||||||
Utils.modified()
|
|
||||||
|
|
||||||
|
|
||||||
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
||||||
row = self.child_list.get_row_at(x,y)
|
path = self.child_list.get_path_at_pos(x,y)
|
||||||
|
if path == None:
|
||||||
|
row = len(self.family.getChildList())
|
||||||
|
else:
|
||||||
|
row = path[0][0] -1
|
||||||
|
|
||||||
if sel_data and sel_data.data:
|
if sel_data and sel_data.data:
|
||||||
exec 'data = %s' % sel_data.data
|
exec 'data = %s' % sel_data.data
|
||||||
@ -601,17 +537,58 @@ class FamilyView:
|
|||||||
exec 'person = "%s"' % data[1]
|
exec 'person = "%s"' % data[1]
|
||||||
if mytype != 'child':
|
if mytype != 'child':
|
||||||
return
|
return
|
||||||
elif person == self.person.getId():
|
|
||||||
print row
|
|
||||||
# self.move_element(self.elist,self.etree.get_selected_row(),row)
|
|
||||||
|
|
||||||
|
s,i = self.child_selection.get_selected()
|
||||||
|
if not i:
|
||||||
|
return
|
||||||
|
spath = s.get_path(i)
|
||||||
|
src = spath[0]
|
||||||
|
list = self.family.getChildList()
|
||||||
|
obj = list[src]
|
||||||
|
list.remove(obj)
|
||||||
|
list.insert(row,obj)
|
||||||
|
|
||||||
|
if (birth_dates_in_order(list) == 0):
|
||||||
|
msg = _("Invalid move. Children must be ordered by birth date.")
|
||||||
|
WarningDialog(msg)
|
||||||
|
return
|
||||||
|
self.family.setChildList(list)
|
||||||
|
self.load_family()
|
||||||
|
Utils.modified()
|
||||||
|
|
||||||
def drag_data_get(self,widget, context, sel_data, info, time):
|
def drag_data_get(self,widget, context, sel_data, info, time):
|
||||||
ev = self.child_list.get_selected_objects()
|
store,iter = self.child_selection.get_selected()
|
||||||
|
if not iter:
|
||||||
|
return
|
||||||
|
id = self.child_model.get_value(iter,2)
|
||||||
|
person = self.parent.db.getPerson(id)
|
||||||
bits_per = 8; # we're going to pass a string
|
bits_per = 8; # we're going to pass a string
|
||||||
pickled = pickle.dumps(ev[0]);
|
pickled = pickle.dumps(person);
|
||||||
data = str(('child',self.person.getId(),pickled));
|
data = str(('child',id,pickled));
|
||||||
sel_data.set(sel_data.target, bits_per, data)
|
sel_data.set(sel_data.target, bits_per, data)
|
||||||
|
|
||||||
def drag_begin(self, context, a):
|
def drag_begin(self, context, a):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# birth_dates_in_order
|
||||||
|
#
|
||||||
|
# Check any *valid* birthdates in the list to insure that they are in
|
||||||
|
# numerically increasing order.
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def birth_dates_in_order(list):
|
||||||
|
inorder = 1
|
||||||
|
prev_date = "00000000"
|
||||||
|
for i in range(len(list)):
|
||||||
|
child = list[i]
|
||||||
|
bday = child.getBirth().getDateObj()
|
||||||
|
child_date = sort.build_sort_date(bday)
|
||||||
|
if (child_date == "99999999"):
|
||||||
|
continue
|
||||||
|
if (prev_date <= child_date): # <= allows for twins
|
||||||
|
prev_date = child_date
|
||||||
|
else:
|
||||||
|
inorder = 0
|
||||||
|
return inorder
|
||||||
|
@ -135,8 +135,8 @@ class Marriage:
|
|||||||
# set initial data
|
# set initial data
|
||||||
self.gallery.load_images()
|
self.gallery.load_images()
|
||||||
|
|
||||||
etitles = [(_('Event'),0,150),(_('Date'),1,150),(_('Place'),2,150)]
|
etitles = [(_('Event'),-1,150),(_('Date'),-1,150),(_('Place'),-1,150)]
|
||||||
atitles = [(_('Attribute'),0,150),(_('Value'),1,150)]
|
atitles = [(_('Attribute'),-1,150),(_('Value'),-1,150)]
|
||||||
|
|
||||||
self.etree = ListModel.ListModel(self.event_list, etitles,
|
self.etree = ListModel.ListModel(self.event_list, etitles,
|
||||||
self.on_select_row,
|
self.on_select_row,
|
||||||
@ -171,21 +171,17 @@ class Marriage:
|
|||||||
|
|
||||||
self.build_seal_menu()
|
self.build_seal_menu()
|
||||||
|
|
||||||
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,gtk.gdk.ACTION_COPY)
|
||||||
pycode_tgts,gtk.gdk.ACTION_COPY)
|
self.event_list.drag_source_set(gtk.gdk.BUTTON1_MASK,pycode_tgts, gtk.gdk.ACTION_COPY)
|
||||||
self.event_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
|
||||||
pycode_tgts, gtk.gdk.ACTION_COPY)
|
|
||||||
self.event_list.connect('drag_data_get', self.ev_source_drag_data_get)
|
self.event_list.connect('drag_data_get', self.ev_source_drag_data_get)
|
||||||
self.event_list.connect('drag_data_received',
|
self.event_list.connect('drag_data_received',self.ev_dest_drag_data_received)
|
||||||
self.ev_dest_drag_data_received)
|
self.event_list.connect('drag_begin', self.ev_drag_begin)
|
||||||
|
|
||||||
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,
|
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,gtk.gdk.ACTION_COPY)
|
||||||
gtk.gdk.ACTION_COPY)
|
self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, pycode_tgts,gtk.gdk.ACTION_COPY)
|
||||||
self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, pycode_tgts,
|
|
||||||
gtk.gdk.ACTION_COPY)
|
|
||||||
self.attr_list.connect('drag_data_get', self.at_source_drag_data_get)
|
self.attr_list.connect('drag_data_get', self.at_source_drag_data_get)
|
||||||
self.attr_list.connect('drag_data_received',
|
self.attr_list.connect('drag_data_received',self.at_dest_drag_data_received)
|
||||||
self.at_dest_drag_data_received)
|
self.attr_list.connect('drag_begin', self.at_drag_begin)
|
||||||
|
|
||||||
# set notes data
|
# set notes data
|
||||||
self.notes_buffer = self.notes_field.get_buffer()
|
self.notes_buffer = self.notes_field.get_buffer()
|
||||||
@ -195,6 +191,12 @@ class Marriage:
|
|||||||
self.redraw_attr_list()
|
self.redraw_attr_list()
|
||||||
top_window.show()
|
top_window.show()
|
||||||
|
|
||||||
|
def ev_drag_begin(self, context, a):
|
||||||
|
return
|
||||||
|
|
||||||
|
def at_drag_begin(self, context, a):
|
||||||
|
return
|
||||||
|
|
||||||
def build_seal_menu(self):
|
def build_seal_menu(self):
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
index = 0
|
index = 0
|
||||||
@ -262,52 +264,63 @@ class Marriage:
|
|||||||
self.atree.select_row(row+1)
|
self.atree.select_row(row+1)
|
||||||
|
|
||||||
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
||||||
|
row = self.etree.get_row_at(x,y)
|
||||||
if selection_data and selection_data.data:
|
if selection_data and selection_data.data:
|
||||||
exec 'data = %s' % selection_data.data
|
exec 'data = %s' % selection_data.data
|
||||||
exec 'mytype = "%s"' % data[0]
|
exec 'mytype = "%s"' % data[0]
|
||||||
exec 'family = "%s"' % data[1]
|
exec 'family = "%s"' % data[1]
|
||||||
if family == self.family.getId() or mytype != 'fevent':
|
if mytype != 'fevent':
|
||||||
return
|
return
|
||||||
foo = pickle.loads(data[2]);
|
elif family == self.family.getId():
|
||||||
for src in foo.getSourceRefList():
|
self.move_element(self.elist,self.etree.get_selected_row(),row)
|
||||||
base = src.getBase()
|
else:
|
||||||
newbase = self.db.findSourceNoMap(base.getId())
|
foo = pickle.loads(data[2]);
|
||||||
src.setBase(newbase)
|
for src in foo.getSourceRefList():
|
||||||
place = foo.getPlace()
|
base = src.getBase()
|
||||||
if place:
|
newbase = self.db.findSourceNoMap(base.getId())
|
||||||
foo.setPlace(self.db.findPlaceNoMap(place.getId()))
|
src.setBase(newbase)
|
||||||
self.elist.append(foo)
|
place = foo.getPlace()
|
||||||
|
if place:
|
||||||
|
foo.setPlace(self.db.findPlaceNoMap(place.getId()))
|
||||||
|
self.elist.insert(row,foo)
|
||||||
|
|
||||||
self.lists_changed = 1
|
self.lists_changed = 1
|
||||||
self.redraw_event_list()
|
self.redraw_event_list()
|
||||||
|
|
||||||
def ev_source_drag_data_get(self,widget, context, selection_data, info, time):
|
def ev_source_drag_data_get(self,widget, context, selection_data, info, time):
|
||||||
ev = widget.get_row_data(widget.focus_row)
|
ev = self.etree.get_selected_objects()
|
||||||
|
|
||||||
bits_per = 8; # we're going to pass a string
|
bits_per = 8; # we're going to pass a string
|
||||||
pickled = pickle.dumps(ev);
|
pickled = pickle.dumps(ev[0]);
|
||||||
data = str(('fevent',self.family.getId(),pickled));
|
data = str(('fevent',self.family.getId(),pickled));
|
||||||
selection_data.set(selection_data.target, bits_per, data)
|
selection_data.set(selection_data.target, bits_per, data)
|
||||||
|
|
||||||
def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
||||||
|
row = self.atree.get_row_at(x,y)
|
||||||
if selection_data and selection_data.data:
|
if selection_data and selection_data.data:
|
||||||
exec 'data = %s' % selection_data.data
|
exec 'data = %s' % selection_data.data
|
||||||
exec 'mytype = "%s"' % data[0]
|
exec 'mytype = "%s"' % data[0]
|
||||||
exec 'family = "%s"' % data[1]
|
exec 'family = "%s"' % data[1]
|
||||||
if family == self.family.getId() or mytype != 'fattr':
|
if mytype != 'fevent':
|
||||||
return
|
return
|
||||||
foo = pickle.loads(data[2]);
|
elif family == self.family.getId():
|
||||||
for src in foo.getSourceRefList():
|
self.move_element(self.elist,self.etree.get_selected_row(),row)
|
||||||
base = src.getBase()
|
else:
|
||||||
newbase = self.db.findSourceNoMap(base.getId())
|
foo = pickle.loads(data[2]);
|
||||||
src.setBase(newbase)
|
for src in foo.getSourceRefList():
|
||||||
self.alist.append(foo)
|
base = src.getBase()
|
||||||
|
newbase = self.db.findSourceNoMap(base.getId())
|
||||||
|
src.setBase(newbase)
|
||||||
|
self.alist.insert(row,foo)
|
||||||
|
|
||||||
self.lists_changed = 1
|
self.lists_changed = 1
|
||||||
self.redraw_attr_list()
|
self.redraw_attr_list()
|
||||||
|
|
||||||
def at_source_drag_data_get(self,widget, context, selection_data, info, time):
|
def at_source_drag_data_get(self,widget, context, selection_data, info, time):
|
||||||
ev = widget.get_row_data(widget.focus_row)
|
ev = self.atree.get_selected_objects()
|
||||||
|
|
||||||
bits_per = 8; # we're going to pass a string
|
bits_per = 8; # we're going to pass a string
|
||||||
pickled = pickle.dumps(ev);
|
pickled = pickle.dumps(ev[0]);
|
||||||
data = str(('fattr',self.family.getId(),pickled));
|
data = str(('fattr',self.family.getId(),pickled));
|
||||||
selection_data.set(selection_data.target, bits_per, data)
|
selection_data.set(selection_data.target, bits_per, data)
|
||||||
|
|
||||||
@ -566,3 +579,10 @@ class Marriage:
|
|||||||
name = mother.getPrimaryName().getName()
|
name = mother.getPrimaryName().getName()
|
||||||
AttrEdit.AttributeEditor(self,None,name,const.familyAttributes)
|
AttrEdit.AttributeEditor(self,None,name,const.familyAttributes)
|
||||||
|
|
||||||
|
def move_element(self,list,src,dest):
|
||||||
|
if src == -1:
|
||||||
|
return
|
||||||
|
obj = list[src]
|
||||||
|
list.remove(obj)
|
||||||
|
list.insert(dest,obj)
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ import os
|
|||||||
# internationalization
|
# internationalization
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from intl import gettext
|
from intl import gettext as _
|
||||||
_ = gettext
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -101,7 +100,7 @@ startup = 1
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
progName = "GRAMPS"
|
progName = "GRAMPS"
|
||||||
version = "0.9.0-rc1"
|
version = "0.9.0-rc2"
|
||||||
copyright = "© 2001-2002 Donald N. Allingham"
|
copyright = "© 2001-2002 Donald N. Allingham"
|
||||||
authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"]
|
authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"]
|
||||||
comments = _("GRAMPS (Genealogical Research and Analysis "
|
comments = _("GRAMPS (Genealogical Research and Analysis "
|
||||||
|
@ -30,8 +30,7 @@ import os
|
|||||||
# internationalization
|
# internationalization
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from intl import gettext
|
from intl import gettext as _
|
||||||
_ = gettext
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user