* src/Marriage.py: proper window management on delete event.
* src/RelLib.py (Event.are_equal): Correction. * src/Date.py (is_empty): Require empty text for a date to be empty. * src/WriteXML (write_object): Remove places from Media. * src/GrampsDbBase.py (undo): Typos. * src/GrampsDBCallback: Pretty printing for warnings. svn: r4297
This commit is contained in:
parent
e5cd5c0e3d
commit
4dc68a517c
@ -1,3 +1,11 @@
|
|||||||
|
2005-04-04 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/Marriage.py: proper window management on delete event.
|
||||||
|
* src/RelLib.py (Event.are_equal): Correction.
|
||||||
|
* src/Date.py (is_empty): Require empty text for a date to be empty.
|
||||||
|
* src/WriteXML (write_object): Remove places from Media.
|
||||||
|
* src/GrampsDbBase.py (undo): Typos.
|
||||||
|
* src/GrampsDBCallback: Pretty printing for warnings.
|
||||||
|
|
||||||
2005-04-04 Don Allingham <don@gramps-project.org>
|
2005-04-04 Don Allingham <don@gramps-project.org>
|
||||||
* src/ChooseParents.py: fix father/mother relationship
|
* src/ChooseParents.py: fix father/mother relationship
|
||||||
* src/FamilyView.py: fix update of child pointers after add
|
* src/FamilyView.py: fix update of child pointers after add
|
||||||
|
@ -464,9 +464,9 @@ class Date:
|
|||||||
|
|
||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
"""
|
"""
|
||||||
Returns True if the date is a date range or a date span.
|
Returns True if the date contains no information (empty text).
|
||||||
"""
|
"""
|
||||||
return self.modifier == MOD_TEXTONLY
|
return self.modifier == MOD_TEXTONLY and not self.text
|
||||||
|
|
||||||
def is_compound(self):
|
def is_compound(self):
|
||||||
"""
|
"""
|
||||||
|
@ -120,7 +120,7 @@ class GrampsDBCallback(object):
|
|||||||
for (k,v) in s.items():
|
for (k,v) in s.items():
|
||||||
if self.__signal_map.has_key(k):
|
if self.__signal_map.has_key(k):
|
||||||
# signal name clash
|
# signal name clash
|
||||||
sys.err.write("Warning: signal name clash: ", str(k))
|
sys.err.write("Warning: signal name clash: %s\n" % str(k))
|
||||||
self.__signal_map[k] = v
|
self.__signal_map[k] = v
|
||||||
|
|
||||||
# self.__signal_map now contains the connonical list
|
# self.__signal_map now contains the connonical list
|
||||||
@ -130,7 +130,7 @@ class GrampsDBCallback(object):
|
|||||||
def connect(self, signal_name, callback):
|
def connect(self, signal_name, callback):
|
||||||
# Check that signal exists.
|
# Check that signal exists.
|
||||||
if signal_name not in self.__signal_map.keys():
|
if signal_name not in self.__signal_map.keys():
|
||||||
sys.stderr.write("Warning: attempt to connect to unknown signal: ", str(signal_name))
|
sys.stderr.write("Warning: attempt to connect to unknown signal: %s\n" % str(signal_name))
|
||||||
return
|
return
|
||||||
|
|
||||||
# Add callable to callback_map
|
# Add callable to callback_map
|
||||||
@ -146,28 +146,29 @@ class GrampsDBCallback(object):
|
|||||||
|
|
||||||
# Check signal exists
|
# Check signal exists
|
||||||
if signal_name not in self.__signal_map.keys():
|
if signal_name not in self.__signal_map.keys():
|
||||||
sys.stderr.write("Warning: attempt to emit to unknown signal: ", str(signal_name))
|
sys.stderr.write("Warning: attempt to emit to unknown signal: %s\n"
|
||||||
|
% str(signal_name))
|
||||||
return
|
return
|
||||||
|
|
||||||
# type check arguments
|
# type check arguments
|
||||||
arg_types = self.__signal_map[signal_name]
|
arg_types = self.__signal_map[signal_name]
|
||||||
if arg_types == None and len(args) > 0:
|
if arg_types == None and len(args) > 0:
|
||||||
sys.stderr.write("Warning: signal emitted with "\
|
sys.stderr.write("Warning: signal emitted with "\
|
||||||
"wrong number of args: ", str(signal_name))
|
"wrong number of args: %s\n" % str(signal_name))
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if len(args) != len(arg_types):
|
if len(args) != len(arg_types):
|
||||||
sys.stderr.write("Warning: signal emitted with "\
|
sys.stderr.write("Warning: signal emitted with "\
|
||||||
"wrong number of args: ", str(signal_name))
|
"wrong number of args: %s\n" % str(signal_name))
|
||||||
return
|
return
|
||||||
|
|
||||||
if arg_types != None:
|
if arg_types != None:
|
||||||
for i in range(0,len(arg_types)):
|
for i in range(0,len(arg_types)):
|
||||||
if not isinstance(args[i],arg_types[i]):
|
if not isinstance(args[i],arg_types[i]):
|
||||||
sys.stderr.write("Warning: signal emitted with "\
|
sys.stderr.write("Warning: signal emitted with "\
|
||||||
"wrong arg types: %s" % (str(signal_name),))
|
"wrong arg types: %s\n" % (str(signal_name),))
|
||||||
sys.stderr.write("arg passed was: %s type should be: %s"
|
sys.stderr.write(" arg passed was: %s, type should be: %s\n"
|
||||||
% (args[i],repr(arg_types[i])))
|
% (args[i],repr(arg_types[i])))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -181,9 +182,9 @@ class GrampsDBCallback(object):
|
|||||||
type(cb) == types.MethodType: # call func
|
type(cb) == types.MethodType: # call func
|
||||||
cb(*args)
|
cb(*args)
|
||||||
else:
|
else:
|
||||||
sys.stderr.write("Warning: badly formed entry in callback map")
|
sys.stderr.write("Warning: badly formed entry in callback map.\n")
|
||||||
except:
|
except:
|
||||||
sys.stderr.write("Warning: exception occured in callback function.")
|
sys.stderr.write("Warning: exception occured in callback function.\n")
|
||||||
|
|
||||||
#
|
#
|
||||||
# instance signals control methods
|
# instance signals control methods
|
||||||
|
@ -977,25 +977,25 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
|||||||
(key, handle, data) = transaction.get_record(record_id)
|
(key, handle, data) = transaction.get_record(record_id)
|
||||||
if key == PERSON_KEY:
|
if key == PERSON_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
self.emit('person-delete',([str(handle),]))
|
self.emit('person-delete',([str(handle)],))
|
||||||
del self.person_map[str(handle)]
|
del self.person_map[str(handle)]
|
||||||
else:
|
else:
|
||||||
self.person_map[str(handle)] = data
|
self.person_map[str(handle)] = data
|
||||||
self.emit('person-update',([str(handle),]))
|
self.emit('person-update',([str(handle)],))
|
||||||
elif key == FAMILY_KEY:
|
elif key == FAMILY_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
self.emit('family-delete',([str(handle),]))
|
self.emit('family-delete',([str(handle)],))
|
||||||
del self.family_map[str(handle)]
|
del self.family_map[str(handle)]
|
||||||
else:
|
else:
|
||||||
self.family_map[str(handle)] = data
|
self.family_map[str(handle)] = data
|
||||||
self.emit('family-update',([str(handle),]))
|
self.emit('family-update',([str(handle)],))
|
||||||
elif key == SOURCE_KEY:
|
elif key == SOURCE_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
self.emit('source-delete',([str(handle),]))
|
self.emit('source-delete',([str(handle)],))
|
||||||
del self.source_map[str(handle)]
|
del self.source_map[str(handle)]
|
||||||
else:
|
else:
|
||||||
self.source_map[str(handle)] = data
|
self.source_map[str(handle)] = data
|
||||||
self.emit('source-update',([str(handle),]))
|
self.emit('source-update',([str(handle)],))
|
||||||
elif key == EVENT_KEY:
|
elif key == EVENT_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
del self.event_map[str(handle)]
|
del self.event_map[str(handle)]
|
||||||
@ -1003,17 +1003,17 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
|||||||
self.event_map[str(handle)] = data
|
self.event_map[str(handle)] = data
|
||||||
elif key == PLACE_KEY:
|
elif key == PLACE_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
self.emit('place-delete',([str(handle),]))
|
self.emit('place-delete',([str(handle)],))
|
||||||
del self.place_map[str(handle)]
|
del self.place_map[str(handle)]
|
||||||
else:
|
else:
|
||||||
self.place_map[str(handle)] = data
|
self.place_map[str(handle)] = data
|
||||||
self.emit('place-update',([str(handle),]))
|
self.emit('place-update',([str(handle)],))
|
||||||
elif key == MEDIA_KEY:
|
elif key == MEDIA_KEY:
|
||||||
if data == None:
|
if data == None:
|
||||||
self.emit('media-delete',([str(handle),]))
|
self.emit('media-delete',([str(handle)],))
|
||||||
del self.media_map[str(handle)]
|
del self.media_map[str(handle)]
|
||||||
else:
|
else:
|
||||||
self.emit('media-update',([str(handle),]))
|
self.emit('media-update',([str(handle)],))
|
||||||
self.media_map[str(handle)] = data
|
self.media_map[str(handle)] = data
|
||||||
|
|
||||||
if self.undo_callback:
|
if self.undo_callback:
|
||||||
|
@ -338,7 +338,7 @@ class Marriage:
|
|||||||
child_window.close(None)
|
child_window.close(None)
|
||||||
self.child_windows = {}
|
self.child_windows = {}
|
||||||
|
|
||||||
def close(self,ok=0):
|
def close(self):
|
||||||
self.gallery.close()
|
self.gallery.close()
|
||||||
self.close_child_windows()
|
self.close_child_windows()
|
||||||
self.remove_itself_from_winsmenu()
|
self.remove_itself_from_winsmenu()
|
||||||
@ -611,25 +611,32 @@ class Marriage:
|
|||||||
return changed
|
return changed
|
||||||
|
|
||||||
def cancel_callback(self):
|
def cancel_callback(self):
|
||||||
self.close(0)
|
self.close()
|
||||||
|
|
||||||
def on_cancel_edit(self,obj):
|
def on_cancel_edit(self,obj):
|
||||||
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
||||||
global quit
|
|
||||||
self.quit = obj
|
|
||||||
SaveDialog(_('Save Changes?'),
|
SaveDialog(_('Save Changes?'),
|
||||||
_('If you close without saving, the changes you '
|
_('If you close without saving, the changes you '
|
||||||
'have made will be lost'),
|
'have made will be lost'),
|
||||||
self.cancel_callback,
|
self.cancel_callback,
|
||||||
self.save)
|
self.save)
|
||||||
else:
|
else:
|
||||||
self.close(0)
|
self.close()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
self.on_close_marriage_editor(None)
|
self.on_close_marriage_editor(None)
|
||||||
|
|
||||||
def on_delete_event(self,obj,b):
|
def on_delete_event(self,obj,b):
|
||||||
self.on_cancel_edit(obj)
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
||||||
|
SaveDialog(_('Save Changes?'),
|
||||||
|
_('If you close without saving, the changes you '
|
||||||
|
'have made will be lost'),
|
||||||
|
self.cancel_callback,
|
||||||
|
self.save)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self.close()
|
||||||
|
return False
|
||||||
|
|
||||||
def on_close_marriage_editor(self,*obj):
|
def on_close_marriage_editor(self,*obj):
|
||||||
|
|
||||||
@ -700,7 +707,7 @@ class Marriage:
|
|||||||
self.db.commit_family(self.family,trans)
|
self.db.commit_family(self.family,trans)
|
||||||
self.db.transaction_commit(trans,_("Edit Marriage"))
|
self.db.transaction_commit(trans,_("Edit Marriage"))
|
||||||
|
|
||||||
self.close(1)
|
self.close()
|
||||||
|
|
||||||
def event_edit_callback(self,event):
|
def event_edit_callback(self,event):
|
||||||
"""Birth and death events may not be in the map"""
|
"""Birth and death events may not be in the map"""
|
||||||
|
@ -2126,16 +2126,17 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
|
|
||||||
witness_list = self.get_witness_list()
|
witness_list = self.get_witness_list()
|
||||||
other_list = other.get_witness_list()
|
other_list = other.get_witness_list()
|
||||||
if (not witness_list) and (not other_list):
|
if (witness_list and not other_list) or \
|
||||||
return True
|
(other_list and not witness_list):
|
||||||
elif not (witness_list and other_list):
|
|
||||||
return False
|
return False
|
||||||
|
if witness_list and other_list:
|
||||||
|
another_list = other_list[:]
|
||||||
for a in witness_list:
|
for a in witness_list:
|
||||||
if a in other_list:
|
if a in another_list:
|
||||||
other_list.remove(a)
|
another_list.remove(a)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
if other_list:
|
if another_list:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -3735,8 +3736,10 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase):
|
|||||||
return False
|
return False
|
||||||
if (self.date and other.date and \
|
if (self.date and other.date and \
|
||||||
not self.date.is_equal(other.date)) \
|
not self.date.is_equal(other.date)) \
|
||||||
or (self.date and not other.date) \
|
or ((not self.date) and other.date and \
|
||||||
or (not self.date and other.date):
|
not other.date.is_empty()) \
|
||||||
|
or ((not other.date) and self.date and \
|
||||||
|
not self.date.is_empty()):
|
||||||
return False
|
return False
|
||||||
if self.get_text() != other.get_text():
|
if self.get_text() != other.get_text():
|
||||||
return False
|
return False
|
||||||
|
@ -844,19 +844,16 @@ class XmlWriter:
|
|||||||
self.g.write(' description="%s"' % self.fix(obj.get_description()))
|
self.g.write(' description="%s"' % self.fix(obj.get_description()))
|
||||||
alist = obj.get_attribute_list()
|
alist = obj.get_attribute_list()
|
||||||
note = obj.get_note()
|
note = obj.get_note()
|
||||||
phandle = obj.get_place_handle()
|
|
||||||
dval = obj.get_date_object()
|
dval = obj.get_date_object()
|
||||||
slist = obj.get_source_references()
|
slist = obj.get_source_references()
|
||||||
if len(alist) == 0 and len(slist) == 0 and note == "" and \
|
if len(alist) == 0 and len(slist) == 0 and note == "" \
|
||||||
phandle == "" and not dval.is_empty():
|
and not dval.is_empty():
|
||||||
self.g.write('/>\n')
|
self.g.write('/>\n')
|
||||||
else:
|
else:
|
||||||
self.g.write('>\n')
|
self.g.write('>\n')
|
||||||
self.write_attribute_list(alist)
|
self.write_attribute_list(alist)
|
||||||
if note != "":
|
if note != "":
|
||||||
self.write_note("note",obj.get_note_object(),3)
|
self.write_note("note",obj.get_note_object(),3)
|
||||||
if phandle:
|
|
||||||
self.g.write(' <place ref="%s"/>\n' % phandle)
|
|
||||||
if not dval.is_empty():
|
if not dval.is_empty():
|
||||||
self.write_date(dval,3)
|
self.write_date(dval,3)
|
||||||
for s in slist:
|
for s in slist:
|
||||||
|
Loading…
Reference in New Issue
Block a user