* 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>
|
||||
* src/DdTargets.py: new module to manage drag and drop target data.
|
||||
* src/Makefile.am: added DdTargets.py
|
||||
|
@ -583,8 +583,8 @@ class DateBase:
|
||||
def set_date(self, date) :
|
||||
"""
|
||||
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
|
||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
||||
@ -596,9 +596,9 @@ class DateBase:
|
||||
def get_date(self) :
|
||||
"""
|
||||
Returns a string representation of the date of the DateBase instance.
|
||||
|
||||
This representation is based off the default date display format
|
||||
determined by the locale's L{DateDisplay} instance.
|
||||
|
||||
This representation is based off the default date display format
|
||||
determined by the locale's L{DateDisplay} instance.
|
||||
|
||||
@return: Returns a string representing the DateBase date
|
||||
@rtype: str
|
||||
@ -610,10 +610,10 @@ class DateBase:
|
||||
def get_quote_date(self) :
|
||||
"""
|
||||
Returns a string representation of the date of the DateBase instance.
|
||||
|
||||
This representation is based off the default date display format
|
||||
determined by the locale's L{DateDisplay} instance. The date is
|
||||
enclosed in quotes if the L{Date} is not a valid date.
|
||||
|
||||
This representation is based off the default date display format
|
||||
determined by the locale's L{DateDisplay} instance. The date is
|
||||
enclosed in quotes if the L{Date} is not a valid date.
|
||||
|
||||
@return: Returns a string representing the DateBase date
|
||||
@rtype: str
|
||||
@ -698,10 +698,10 @@ class AttributeBase:
|
||||
# Ugly hack: the existing objects may have their attribute lists
|
||||
# called either attr_list or attribute_list.
|
||||
try:
|
||||
self.attribute_list = [ Attribute(attribute) \
|
||||
self.attribute_list = [ Attribute(attribute) \
|
||||
for attribute in source.attribute_list ]
|
||||
except:
|
||||
self.attribute_list = [ Attribute(attribute) \
|
||||
self.attribute_list = [ Attribute(attribute) \
|
||||
for attribute in source.attrlist ]
|
||||
else:
|
||||
self.attribute_list = []
|
||||
@ -1663,7 +1663,7 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
|
||||
check_list = [self.lds_seal,self.note]
|
||||
add_list = [item for item in check_list if item]
|
||||
return self.media_list + self.attribute_list + \
|
||||
self.source_list + add_list
|
||||
self.source_list + add_list
|
||||
|
||||
def get_sourcref_child_list(self):
|
||||
"""
|
||||
@ -3662,7 +3662,7 @@ class Witness(BaseObject,PrivacyBase):
|
||||
the person's name.
|
||||
"""
|
||||
def __init__(self,type=Event.NAME,val="",comment=""):
|
||||
PrivacyBase.__init__(self,source)
|
||||
PrivacyBase.__init__(self)
|
||||
self.set_type(type)
|
||||
self.set_value(val)
|
||||
self.set_comment(comment)
|
||||
|
@ -67,7 +67,7 @@ def runTool(database,active_person,callback,parent=None):
|
||||
|
||||
errs = checker.build_report(0)
|
||||
if errs:
|
||||
checker.report(0)
|
||||
Report(checker.text.getvalue(),parent)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
@ -82,6 +82,7 @@ class CheckIntegrity:
|
||||
def __init__(self,db,parent,trans):
|
||||
self.db = db
|
||||
self.trans = trans
|
||||
self.parent = parent
|
||||
self.bad_photo = []
|
||||
self.replaced_photo = []
|
||||
self.removed_photo = []
|
||||
@ -126,53 +127,37 @@ class CheckIntegrity:
|
||||
#-------------------------------------------------------------------------
|
||||
def remove_clicked():
|
||||
# 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)
|
||||
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_person(p,self.trans)
|
||||
|
||||
for handle in self.db.get_person_handles(sort_handles=False):
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
if person.has_media_reference(ObjectId):
|
||||
person.remove_media_references([ObjectId])
|
||||
self.db.commit_person(person,self.trans)
|
||||
|
||||
for handle in self.db.get_family_handles():
|
||||
family = self.db.get_family_from_handle(handle)
|
||||
if family.has_media_reference(ObjectId):
|
||||
family.remove_media_references([ObjectId])
|
||||
self.db.commit_family(family,self.trans)
|
||||
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
p = self.db.get_person_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_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 handle in self.db.get_event_handles():
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
if event.has_media_reference(ObjectId):
|
||||
event.remove_media_references([ObjectId])
|
||||
self.db.commit_event(event,self.trans)
|
||||
|
||||
for key in self.db.get_place_handles():
|
||||
p = self.db.get_place_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)
|
||||
for handle in self.db.get_source_handles():
|
||||
source = self.db.get_source_from_handle(handle)
|
||||
if source.has_media_reference(ObjectId):
|
||||
source.remove_media_references([ObjectId])
|
||||
self.db.commit_source(source,self.trans)
|
||||
|
||||
for handle in self.db.get_place_handles():
|
||||
place = self.db.get_place_from_handle(handle)
|
||||
if place.has_media_reference(ObjectId):
|
||||
place.remove_media_references([ObjectId])
|
||||
self.db.commit_place(p,self.trans)
|
||||
|
||||
self.removed_photo.append(ObjectId)
|
||||
self.db.remove_object(ObjectId,self.trans)
|
||||
|
||||
@ -185,15 +170,11 @@ class CheckIntegrity:
|
||||
self.bad_photo.append(ObjectId)
|
||||
|
||||
def fs_ok_clicked(obj):
|
||||
import shutil
|
||||
|
||||
name = fs_top.get_filename()
|
||||
if os.path.isfile(name):
|
||||
shutil.copyfile(name,photo_name)
|
||||
try:
|
||||
shutil.copystat(name,photo_name)
|
||||
except:
|
||||
pass
|
||||
obj = self.db.get_object_from_handle(ObjectId)
|
||||
obj.set_path(name)
|
||||
self.db.commit_media_object(obj,self.trans)
|
||||
self.replaced_photo.append(ObjectId)
|
||||
else:
|
||||
self.bad_photo.append(ObjectId)
|
||||
@ -218,11 +199,11 @@ class CheckIntegrity:
|
||||
else:
|
||||
if missmedia_action == 0:
|
||||
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. "
|
||||
"You may choose to either remove the reference from the database, "
|
||||
"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)
|
||||
missmedia_action = mmd.default_action
|
||||
elif missmedia_action == 1:
|
||||
@ -252,10 +233,10 @@ class CheckIntegrity:
|
||||
mother_handle = family.get_mother_handle()
|
||||
father_handle = family.get_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:
|
||||
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:
|
||||
continue
|
||||
@ -272,7 +253,7 @@ class CheckIntegrity:
|
||||
else:
|
||||
fgender = father.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:
|
||||
family.set_relationship(RelLib.Family.CIVIL_UNION)
|
||||
self.fam_rel.append(family_handle)
|
||||
@ -307,7 +288,8 @@ class CheckIntegrity:
|
||||
print "No errors were found: the database has passed internal checks."
|
||||
else:
|
||||
OkDialog(_("No errors were found"),
|
||||
_('The database has passed internal checks'))
|
||||
_('The database has passed internal checks'),
|
||||
self.parent.topWindow)
|
||||
return 0
|
||||
|
||||
self.text = cStringIO.StringIO()
|
||||
@ -382,24 +364,59 @@ class CheckIntegrity:
|
||||
|
||||
return errors
|
||||
|
||||
def report(self,cl=0):
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Display the results
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Report:
|
||||
def __init__(self,text,parent,cl=0):
|
||||
if cl:
|
||||
print self.text.getvalue()
|
||||
else:
|
||||
base = os.path.dirname(__file__)
|
||||
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,
|
||||
})
|
||||
title = _("Check Integrity")
|
||||
top = topDialog.get_widget("summary")
|
||||
textwindow = topDialog.get_widget("textwindow")
|
||||
print text
|
||||
return
|
||||
self.text = text
|
||||
self.parent = parent
|
||||
|
||||
Utils.set_titles(top,topDialog.get_widget("title"),title)
|
||||
textwindow.get_buffer().set_text(self.text.getvalue())
|
||||
self.text.close()
|
||||
top.show()
|
||||
self.win_key = self
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
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.top = gtk.glade.XML(self.glade_file,"verify_result","gramps")
|
||||
self.title = _('Database Verification Results')
|
||||
Utils.set_titles(self.top.get_widget('verify_result'),
|
||||
self.top.get_widget('title'),
|
||||
_('Database Verification Results'))
|
||||
self.title)
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : self.close_result,
|
||||
@ -527,7 +528,7 @@ class VerifyResults:
|
||||
|
||||
def add_result_to_menu(self):
|
||||
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.show()
|
||||
self.parent.winsmenu.append(self.result_parent_menu_item)
|
||||
|
@ -8,7 +8,7 @@
|
||||
<property name="title" translatable="yes"></property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</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_height">400</property>
|
||||
<property name="resizable">True</property>
|
||||
|
Loading…
Reference in New Issue
Block a user