* src/RelLib.py (Witness.__init__): Typo.
* src/plugins/Check.py (cleanup_missing_photos): Use new mediaref detection/removal, icons, window management. * src/plugins/summary.glade: non-modal dialog. * src/plugins/Verify.py (VerifyResults): Use title once. svn: r4232
This commit is contained in:
parent
11df9a8830
commit
11e374e464
@ -1,3 +1,10 @@
|
|||||||
|
2005-03-24 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/RelLib.py (Witness.__init__): Typo.
|
||||||
|
* src/plugins/Check.py (cleanup_missing_photos): Use new mediaref
|
||||||
|
detection/removal, icons, window management.
|
||||||
|
* src/plugins/summary.glade: non-modal dialog.
|
||||||
|
* src/plugins/Verify.py (VerifyResults): Use title once.
|
||||||
|
|
||||||
2005-03-24 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-03-24 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/DdTargets.py: new module to manage drag and drop target data.
|
* src/DdTargets.py: new module to manage drag and drop target data.
|
||||||
* src/Makefile.am: added DdTargets.py
|
* src/Makefile.am: added DdTargets.py
|
||||||
|
@ -583,8 +583,8 @@ class DateBase:
|
|||||||
def set_date(self, date) :
|
def set_date(self, date) :
|
||||||
"""
|
"""
|
||||||
Sets the date of the DateBase instance.
|
Sets the date of the DateBase instance.
|
||||||
|
|
||||||
The date is parsed into a L{Date} instance.
|
The date is parsed into a L{Date} instance.
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
@param date: String representation of a date. The locale specific
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
||||||
@ -596,9 +596,9 @@ class DateBase:
|
|||||||
def get_date(self) :
|
def get_date(self) :
|
||||||
"""
|
"""
|
||||||
Returns a string representation of the date of the DateBase instance.
|
Returns a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
This representation is based off the default date display format
|
This representation is based off the default date display format
|
||||||
determined by the locale's L{DateDisplay} instance.
|
determined by the locale's L{DateDisplay} instance.
|
||||||
|
|
||||||
@return: Returns a string representing the DateBase date
|
@return: Returns a string representing the DateBase date
|
||||||
@rtype: str
|
@rtype: str
|
||||||
@ -610,10 +610,10 @@ class DateBase:
|
|||||||
def get_quote_date(self) :
|
def get_quote_date(self) :
|
||||||
"""
|
"""
|
||||||
Returns a string representation of the date of the DateBase instance.
|
Returns a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
This representation is based off the default date display format
|
This representation is based off the default date display format
|
||||||
determined by the locale's L{DateDisplay} instance. The date is
|
determined by the locale's L{DateDisplay} instance. The date is
|
||||||
enclosed in quotes if the L{Date} is not a valid date.
|
enclosed in quotes if the L{Date} is not a valid date.
|
||||||
|
|
||||||
@return: Returns a string representing the DateBase date
|
@return: Returns a string representing the DateBase date
|
||||||
@rtype: str
|
@rtype: str
|
||||||
@ -698,10 +698,10 @@ class AttributeBase:
|
|||||||
# Ugly hack: the existing objects may have their attribute lists
|
# Ugly hack: the existing objects may have their attribute lists
|
||||||
# called either attr_list or attribute_list.
|
# called either attr_list or attribute_list.
|
||||||
try:
|
try:
|
||||||
self.attribute_list = [ Attribute(attribute) \
|
self.attribute_list = [ Attribute(attribute) \
|
||||||
for attribute in source.attribute_list ]
|
for attribute in source.attribute_list ]
|
||||||
except:
|
except:
|
||||||
self.attribute_list = [ Attribute(attribute) \
|
self.attribute_list = [ Attribute(attribute) \
|
||||||
for attribute in source.attrlist ]
|
for attribute in source.attrlist ]
|
||||||
else:
|
else:
|
||||||
self.attribute_list = []
|
self.attribute_list = []
|
||||||
@ -1663,7 +1663,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
|
|||||||
check_list = [self.lds_seal,self.note]
|
check_list = [self.lds_seal,self.note]
|
||||||
add_list = [item for item in check_list if item]
|
add_list = [item for item in check_list if item]
|
||||||
return self.media_list + self.attribute_list + \
|
return self.media_list + self.attribute_list + \
|
||||||
self.source_list + add_list
|
self.source_list + add_list
|
||||||
|
|
||||||
def get_sourcref_child_list(self):
|
def get_sourcref_child_list(self):
|
||||||
"""
|
"""
|
||||||
@ -3662,7 +3662,7 @@ class Witness(BaseObject,PrivacyBase):
|
|||||||
the person's name.
|
the person's name.
|
||||||
"""
|
"""
|
||||||
def __init__(self,type=Event.NAME,val="",comment=""):
|
def __init__(self,type=Event.NAME,val="",comment=""):
|
||||||
PrivacyBase.__init__(self,source)
|
PrivacyBase.__init__(self)
|
||||||
self.set_type(type)
|
self.set_type(type)
|
||||||
self.set_value(val)
|
self.set_value(val)
|
||||||
self.set_comment(comment)
|
self.set_comment(comment)
|
||||||
|
@ -67,7 +67,7 @@ def runTool(database,active_person,callback,parent=None):
|
|||||||
|
|
||||||
errs = checker.build_report(0)
|
errs = checker.build_report(0)
|
||||||
if errs:
|
if errs:
|
||||||
checker.report(0)
|
Report(checker.text.getvalue(),parent)
|
||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
@ -82,6 +82,7 @@ class CheckIntegrity:
|
|||||||
def __init__(self,db,parent,trans):
|
def __init__(self,db,parent,trans):
|
||||||
self.db = db
|
self.db = db
|
||||||
self.trans = trans
|
self.trans = trans
|
||||||
|
self.parent = parent
|
||||||
self.bad_photo = []
|
self.bad_photo = []
|
||||||
self.replaced_photo = []
|
self.replaced_photo = []
|
||||||
self.removed_photo = []
|
self.removed_photo = []
|
||||||
@ -126,53 +127,37 @@ class CheckIntegrity:
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def remove_clicked():
|
def remove_clicked():
|
||||||
# File is lost => remove all references and the object itself
|
# File is lost => remove all references and the object itself
|
||||||
for person_handle in self.db.get_family_handles():
|
|
||||||
p = self.db.get_person_from_handle(person_handle)
|
for handle in self.db.get_person_handles(sort_handles=False):
|
||||||
nl = p.get_media_list()
|
person = self.db.get_person_from_handle(handle)
|
||||||
changed = 0
|
if person.has_media_reference(ObjectId):
|
||||||
for o in nl:
|
person.remove_media_references([ObjectId])
|
||||||
if o.get_reference_handle() == ObjectId:
|
self.db.commit_person(person,self.trans)
|
||||||
changed = 1
|
|
||||||
nl.remove(o)
|
for handle in self.db.get_family_handles():
|
||||||
if changed:
|
family = self.db.get_family_from_handle(handle)
|
||||||
p.set_media_list(nl)
|
if family.has_media_reference(ObjectId):
|
||||||
self.db.commit_person(p,self.trans)
|
family.remove_media_references([ObjectId])
|
||||||
|
self.db.commit_family(family,self.trans)
|
||||||
|
|
||||||
for key in self.db.get_person_handles(sort_handles=False):
|
for handle in self.db.get_event_handles():
|
||||||
p = self.db.get_person_from_handle(key)
|
event = self.db.get_event_from_handle(handle)
|
||||||
nl = p.get_media_list()
|
if event.has_media_reference(ObjectId):
|
||||||
changed = 0
|
event.remove_media_references([ObjectId])
|
||||||
for o in nl:
|
self.db.commit_event(event,self.trans)
|
||||||
if o.get_reference_handle() == ObjectId:
|
|
||||||
changed = 1
|
|
||||||
nl.remove(o)
|
|
||||||
if changed:
|
|
||||||
p.set_media_list(nl)
|
|
||||||
self.db.commit_person(p,self.trans)
|
|
||||||
|
|
||||||
for key in self.db.get_source_handles():
|
|
||||||
p = self.db.get_source_from_handle(key)
|
|
||||||
nl = p.get_media_list()
|
|
||||||
changed = 0
|
|
||||||
for o in nl:
|
|
||||||
if o.get_reference_handle() == ObjectId:
|
|
||||||
changed = 1
|
|
||||||
nl.remove(o)
|
|
||||||
if changed:
|
|
||||||
p.set_media_list(nl)
|
|
||||||
self.db.commit_source(p,self.trans)
|
|
||||||
|
|
||||||
for key in self.db.get_place_handles():
|
for handle in self.db.get_source_handles():
|
||||||
p = self.db.get_place_handle(key)
|
source = self.db.get_source_from_handle(handle)
|
||||||
nl = p.get_media_list()
|
if source.has_media_reference(ObjectId):
|
||||||
changed = 0
|
source.remove_media_references([ObjectId])
|
||||||
for o in nl:
|
self.db.commit_source(source,self.trans)
|
||||||
if o.get_reference_handle() == ObjectId:
|
|
||||||
changed = 1
|
for handle in self.db.get_place_handles():
|
||||||
nl.remove(o)
|
place = self.db.get_place_from_handle(handle)
|
||||||
if changed:
|
if place.has_media_reference(ObjectId):
|
||||||
p.set_media_list(nl)
|
place.remove_media_references([ObjectId])
|
||||||
self.db.commit_place(p,self.trans)
|
self.db.commit_place(p,self.trans)
|
||||||
|
|
||||||
self.removed_photo.append(ObjectId)
|
self.removed_photo.append(ObjectId)
|
||||||
self.db.remove_object(ObjectId,self.trans)
|
self.db.remove_object(ObjectId,self.trans)
|
||||||
|
|
||||||
@ -185,15 +170,11 @@ class CheckIntegrity:
|
|||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
|
|
||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
import shutil
|
|
||||||
|
|
||||||
name = fs_top.get_filename()
|
name = fs_top.get_filename()
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
shutil.copyfile(name,photo_name)
|
obj = self.db.get_object_from_handle(ObjectId)
|
||||||
try:
|
obj.set_path(name)
|
||||||
shutil.copystat(name,photo_name)
|
self.db.commit_media_object(obj,self.trans)
|
||||||
except:
|
|
||||||
pass
|
|
||||||
self.replaced_photo.append(ObjectId)
|
self.replaced_photo.append(ObjectId)
|
||||||
else:
|
else:
|
||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
@ -218,11 +199,11 @@ class CheckIntegrity:
|
|||||||
else:
|
else:
|
||||||
if missmedia_action == 0:
|
if missmedia_action == 0:
|
||||||
mmd = MissingMediaDialog(_("Media object could not be found"),
|
mmd = MissingMediaDialog(_("Media object could not be found"),
|
||||||
_("%(file_name)s is referenced in the database, but no longer exists. "
|
_("The file:\n %(file_name)s \nis referenced in the database, but no longer exists. "
|
||||||
"The file may have been deleted or moved to a different location. "
|
"The file may have been deleted or moved to a different location. "
|
||||||
"You may choose to either remove the reference from the database, "
|
"You may choose to either remove the reference from the database, "
|
||||||
"keep the reference to the missing file, or select a new file."
|
"keep the reference to the missing file, or select a new file."
|
||||||
) % { 'file_name' : photo_name },
|
) % { 'file_name' : '<b>%s</b>' % photo_name },
|
||||||
remove_clicked, leave_clicked, select_clicked)
|
remove_clicked, leave_clicked, select_clicked)
|
||||||
missmedia_action = mmd.default_action
|
missmedia_action = mmd.default_action
|
||||||
elif missmedia_action == 1:
|
elif missmedia_action == 1:
|
||||||
@ -252,10 +233,10 @@ class CheckIntegrity:
|
|||||||
mother_handle = family.get_mother_handle()
|
mother_handle = family.get_mother_handle()
|
||||||
father_handle = family.get_father_handle()
|
father_handle = family.get_father_handle()
|
||||||
if father_handle:
|
if father_handle:
|
||||||
father = self.db.get_person_from_handle(father_handle)
|
father = self.db.get_person_from_handle(father_handle)
|
||||||
if mother_handle:
|
if mother_handle:
|
||||||
mother = self.db.get_person_from_handle(mother_handle)
|
mother = self.db.get_person_from_handle(mother_handle)
|
||||||
type = family.get_relationship()
|
rel_type = family.get_relationship()
|
||||||
|
|
||||||
if not father_handle and not mother_handle:
|
if not father_handle and not mother_handle:
|
||||||
continue
|
continue
|
||||||
@ -272,7 +253,7 @@ class CheckIntegrity:
|
|||||||
else:
|
else:
|
||||||
fgender = father.get_gender()
|
fgender = father.get_gender()
|
||||||
mgender = mother.get_gender()
|
mgender = mother.get_gender()
|
||||||
if type != RelLib.Family.CIVIL_UNION:
|
if rel_type != RelLib.Family.CIVIL_UNION:
|
||||||
if fgender == mgender and fgender != RelLib.Person.UNKNOWN:
|
if fgender == mgender and fgender != RelLib.Person.UNKNOWN:
|
||||||
family.set_relationship(RelLib.Family.CIVIL_UNION)
|
family.set_relationship(RelLib.Family.CIVIL_UNION)
|
||||||
self.fam_rel.append(family_handle)
|
self.fam_rel.append(family_handle)
|
||||||
@ -307,7 +288,8 @@ class CheckIntegrity:
|
|||||||
print "No errors were found: the database has passed internal checks."
|
print "No errors were found: the database has passed internal checks."
|
||||||
else:
|
else:
|
||||||
OkDialog(_("No errors were found"),
|
OkDialog(_("No errors were found"),
|
||||||
_('The database has passed internal checks'))
|
_('The database has passed internal checks'),
|
||||||
|
self.parent.topWindow)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
self.text = cStringIO.StringIO()
|
self.text = cStringIO.StringIO()
|
||||||
@ -382,24 +364,59 @@ class CheckIntegrity:
|
|||||||
|
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
def report(self,cl=0):
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Display the results
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class Report:
|
||||||
|
def __init__(self,text,parent,cl=0):
|
||||||
if cl:
|
if cl:
|
||||||
print self.text.getvalue()
|
print text
|
||||||
else:
|
return
|
||||||
base = os.path.dirname(__file__)
|
self.text = text
|
||||||
glade_file = base + os.sep + "summary.glade"
|
self.parent = parent
|
||||||
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
|
||||||
topDialog.signal_autoconnect({
|
|
||||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
|
||||||
})
|
|
||||||
title = _("Check Integrity")
|
|
||||||
top = topDialog.get_widget("summary")
|
|
||||||
textwindow = topDialog.get_widget("textwindow")
|
|
||||||
|
|
||||||
Utils.set_titles(top,topDialog.get_widget("title"),title)
|
self.win_key = self
|
||||||
textwindow.get_buffer().set_text(self.text.getvalue())
|
|
||||||
self.text.close()
|
base = os.path.dirname(__file__)
|
||||||
top.show()
|
glade_file = base + os.sep + "summary.glade"
|
||||||
|
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
||||||
|
topDialog.signal_autoconnect({
|
||||||
|
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.title = _("Integrity Check Results")
|
||||||
|
self.window = topDialog.get_widget("summary")
|
||||||
|
self.window.set_icon(self.parent.topWindow.get_icon())
|
||||||
|
textwindow = topDialog.get_widget("textwindow")
|
||||||
|
textwindow.get_buffer().set_text(self.text)
|
||||||
|
|
||||||
|
Utils.set_titles(self.window,topDialog.get_widget("title"),self.title)
|
||||||
|
|
||||||
|
self.add_result_to_menu()
|
||||||
|
self.window.show()
|
||||||
|
|
||||||
|
def on_result_delete_event(self,obj,b):
|
||||||
|
self.remove_result_from_menu()
|
||||||
|
|
||||||
|
def close_result(self,obj):
|
||||||
|
self.remove_result_from_menu()
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
|
def add_result_to_menu(self):
|
||||||
|
self.parent.child_windows[self.win_key] = self.window
|
||||||
|
self.result_parent_menu_item = gtk.MenuItem(self.title)
|
||||||
|
self.result_parent_menu_item.connect("activate",self.present_result)
|
||||||
|
self.result_parent_menu_item.show()
|
||||||
|
self.parent.winsmenu.append(self.result_parent_menu_item)
|
||||||
|
|
||||||
|
def remove_result_from_menu(self):
|
||||||
|
del self.parent.child_windows[self.win_key]
|
||||||
|
self.result_parent_menu_item.destroy()
|
||||||
|
|
||||||
|
def present_result(self,obj):
|
||||||
|
self.window.present()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -501,9 +501,10 @@ class VerifyResults:
|
|||||||
self.glade_file = base + os.sep + "verify.glade"
|
self.glade_file = base + os.sep + "verify.glade"
|
||||||
|
|
||||||
self.top = gtk.glade.XML(self.glade_file,"verify_result","gramps")
|
self.top = gtk.glade.XML(self.glade_file,"verify_result","gramps")
|
||||||
|
self.title = _('Database Verification Results')
|
||||||
Utils.set_titles(self.top.get_widget('verify_result'),
|
Utils.set_titles(self.top.get_widget('verify_result'),
|
||||||
self.top.get_widget('title'),
|
self.top.get_widget('title'),
|
||||||
_('Database Verification Results'))
|
self.title)
|
||||||
|
|
||||||
self.top.signal_autoconnect({
|
self.top.signal_autoconnect({
|
||||||
"destroy_passed_object" : self.close_result,
|
"destroy_passed_object" : self.close_result,
|
||||||
@ -527,7 +528,7 @@ class VerifyResults:
|
|||||||
|
|
||||||
def add_result_to_menu(self):
|
def add_result_to_menu(self):
|
||||||
self.parent.child_windows[self.win_key] = self.window
|
self.parent.child_windows[self.win_key] = self.window
|
||||||
self.result_parent_menu_item = gtk.MenuItem(_('Database Verification Results'))
|
self.result_parent_menu_item = gtk.MenuItem(self.title)
|
||||||
self.result_parent_menu_item.connect("activate",self.present_result)
|
self.result_parent_menu_item.connect("activate",self.present_result)
|
||||||
self.result_parent_menu_item.show()
|
self.result_parent_menu_item.show()
|
||||||
self.parent.winsmenu.append(self.result_parent_menu_item)
|
self.parent.winsmenu.append(self.result_parent_menu_item)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<property name="title" translatable="yes"></property>
|
<property name="title" translatable="yes"></property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">False</property>
|
||||||
<property name="default_width">450</property>
|
<property name="default_width">450</property>
|
||||||
<property name="default_height">400</property>
|
<property name="default_height">400</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user