Finishing command line options

svn: r1564
This commit is contained in:
Alex Roitman
2003-05-21 18:06:41 +00:00
parent a2c9b080b4
commit 41f848f53c
5 changed files with 144 additions and 80 deletions

View File

@@ -41,7 +41,7 @@ def runTool(database,active_person,callback):
try:
checker = CheckIntegrity(database)
checker.check_for_broken_family_links()
checker.cleanup_missing_photos()
checker.cleanup_missing_photos(0)
checker.check_parent_relationships()
checker.cleanup_empty_families(0)
errs = checker.build_report(0)
@@ -94,7 +94,7 @@ class CheckIntegrity:
Utils.modified()
self.broken_links.append((child,family))
def cleanup_missing_photos(self):
def cleanup_missing_photos(self,cl=0):
#-------------------------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
@@ -160,13 +160,18 @@ class CheckIntegrity:
for ObjectId in ObjectMap.keys():
photo_name = ObjectMap[ObjectId].getPath()
if not os.path.isfile(photo_name):
MissingMediaDialog(_("Media object could not be found"),
_("%(file_name)s is 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 },
remove_clicked, leave_clicked, select_clicked)
if cl:
print "Warning: media file %s was not found." \
% os.path.basename(photo_name)
self.bad_photo.append(ObjectMap[ObjectId])
else:
MissingMediaDialog(_("Media object could not be found"),
_("%(file_name)s is 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 },
remove_clicked, leave_clicked, select_clicked)
def cleanup_empty_families(self,automatic):
for key in self.db.getFamilyMap().keys():

View File

@@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2000-2003 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,22 +48,10 @@ from gnome.ui import *
#------------------------------------------------------------------------
#
#
# Build the text of the report
#
#------------------------------------------------------------------------
def report(database,person):
base = os.path.dirname(__file__)
glade_file = "%s/summary.glade" % base
topDialog = gtk.glade.XML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
})
Utils.set_titles(topDialog.get_widget('summary'),
topDialog.get_widget('title'),
_('Database summary'))
def build_report(database,person):
personList = database.getPersonMap().values()
familyList = database.getFamilyMap().values()
@@ -132,6 +120,30 @@ def report(database,person):
for p in notfound:
text = text + "%s\n" % p
return text
#------------------------------------------------------------------------
#
# Output report in a window
#
#------------------------------------------------------------------------
def report(database,person):
text = build_report(database,person)
base = os.path.dirname(__file__)
glade_file = "%s/summary.glade" % base
topDialog = gtk.glade.XML(glade_file,"summary")
topDialog.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
})
Utils.set_titles(topDialog.get_widget('summary'),
topDialog.get_widget('title'),
_('Database summary'))
top = topDialog.get_widget("summary")
textwindow = topDialog.get_widget("textwindow")
textwindow.get_buffer().set_text(text)

View File

@@ -143,6 +143,10 @@ class PackageWriter:
self.copy_file(oldfile,'burn:///%s/%s' % (base,root))
if obj.getMimeType()[0:5] == "image":
self.make_thumbnail(base,root,obj.getPath())
else:
print "Warning: media file %s was not found," % root,\
"so it was ignored."
# Write XML now
g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE )
gfile = WriteXML.XmlWriter(self.db,None,1)