new logging scheme

svn: r6080
This commit is contained in:
Don Allingham 2006-03-05 04:31:24 +00:00
parent 12aa0b0d73
commit fcdf07ccdd
30 changed files with 290 additions and 2333 deletions

View File

@ -1,4 +1,25 @@
2006-03-04 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: use new logging scheme
* src/GrampsDb/_ReadXML.py: use new logging scheme
* src/GrampsDb/_WriteGedcom.py: use new logging scheme
* src/GrampsDb/_WriteXML.py: use new logging scheme
* src/plugins/FilterEditor.py: use new logging scheme
* src/plugins/WriteCD.py: use new logging scheme
* src/plugins/ImportGeneWeb.py: use new logging scheme
* src/plugins/BookReport.py: use new logging scheme
* src/plugins/WritePkg.py: use new logging scheme
* src/plugins/ExportVCard.py: use new logging scheme
* src/plugins/Rebuild.py: use new logging scheme
* src/plugins/ImportvCard.py: use new logging scheme
* src/plugins/GraphViz.py: use new logging scheme
* src/plugins/Check.py: use new logging scheme
* src/plugins/NavWebPage.py: use new logging scheme
* src/plugins/ExportVCalendar.py: use new logging scheme
* src/plugins/ReadPkg.py: use new logging scheme
* src/plugins/WriteFtree.py: use new logging scheme
* src/plugins/WriteGeneWeb.py: use new logging scheme
* src/plugins/WebPage.py: removed
* src/DisplayTrace.py: removed
* src/Editors/EditEventRef.py: derive from EditReference
* src/const.py.in: change glade file names
* src/glade/rule.glade: moved to subdirectory

View File

@ -7,6 +7,7 @@ AC_PREREQ(2.57)
AC_INIT(gramps, 2.1.0, gramps-bugs@lists.sourceforge.net)
AC_CONFIG_SRCDIR(src/gramps.py)
AM_INIT_AUTOMAKE(1.6.3)
RELEASE=0.SVN$(svnversion -n .)
dnl RELEASE=1

View File

@ -1,124 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2005 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import cStringIO
import traceback
import sys
import os
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/GNOME modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import const
_release_files = [
"/etc/mandrake-release",
"/etc/redhat-release",
"/etc/fedora-release",
"/etc/turbolinux-release",
"/etc/debian_version",
"/etc/environment.corel",
"/etc/debian-release",
"/etc/SuSE-release",
"/etc/slackware-release",
"/etc/slackware-version",
"/etc/gentoo-release",
]
#-------------------------------------------------------------------------
#
# DisplayTrace
#
#-------------------------------------------------------------------------
class DisplayTrace:
def __init__(self):
data = sys.exc_info()
ver = sys.version_info
msg = cStringIO.StringIO()
msg.write(_('GRAMPS has encountered an internal error.\n'
'Please copy the message below and post a bug report\n'
'at http://sourceforge.net/projects/gramps or send an\n'
'email message to gramps-bugs@lists.sourceforge.net\n\n'))
msg.write("GRAMPS : %s\n" % const.version)
if os.environ.has_key('LANG'):
msg.write("LANG : %s\n" % os.environ['LANG'])
if os.environ.has_key('LANGUAGE'):
msg.write("LANGUAGE : %s\n" % os.environ['LANGUAGE'])
msg.write("Python : %s.%s.%s %s\n" % (ver[0],ver[1],ver[2],ver[3]))
msg.write("GTK : %s.%s.%s\n" % gtk.gtk_version)
msg.write('PyGTK : %d.%d.%d\n' % gtk.pygtk_version)
n = '/etc/lsb-release'
if os.path.isfile(n):
f = open(n)
for line in f.readlines():
(val,text) = line.split('=')
if val == "DISTRIB_DESCRIPTION":
msg.write("OS : %s\n" % text.replace('"',''))
f.close()
else:
for n in _release_files:
if os.path.isfile(n):
try:
f = open(n)
text = f.readline()
if n.find('debian') != -1:
text = "Debian %s" % text
msg.write("OS : %s\n" % text)
f.close()
break
except:
pass
traceback.print_exception(data[0],data[1],data[2],None,msg)
self.glade = gtk.glade.XML(const.pluginsFile,"plugstat","gramps")
self.top = self.glade.get_widget("plugstat")
window = self.glade.get_widget("text")
self.top.set_title("%s - GRAMPS" % _('Internal Error'))
window.get_buffer().set_text(msg.getvalue())
print msg.getvalue()
window.connect('delete_event',self.close)
self.glade.get_widget('button107').connect('clicked',self.close)
def close(self,obj):
self.top.destroy()

View File

@ -32,7 +32,6 @@ import re
import string
import const
import time
import logging
from gettext import gettext as _
@ -42,6 +41,13 @@ try:
except NameError:
from sets import Set as set
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".GedcomImport")
#-------------------------------------------------------------------------
#
@ -60,16 +66,16 @@ import Errors
import RelLib
import DateParser
import NameDisplay
import DisplayTrace
from ansel_utf8 import ansel_to_utf8
import Utils
import Mime
import _ConstXML
from ansel_utf8 import ansel_to_utf8
from bsddb import db
from _GedcomInfo import *
from _GedTokens import *
from QuestionDialog import ErrorDialog, WarningDialog
from _GrampsDbBase import EVENT_KEY
import _ConstXML
addr_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)\s*(.*)')
addr2_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)')
@ -104,8 +110,6 @@ def latin_to_utf8(s):
def nocnv(s):
return unicode(s)
log = logging.getLogger('.GEDCOM_import')
#-------------------------------------------------------------------------
#
# constants
@ -213,9 +217,6 @@ def import2(database, filename, callback, codeset, use_trans):
except IOError,msg:
ErrorDialog(_("%s could not be opened\n") % filename,str(msg))
return
except:
DisplayTrace.DisplayTrace()
return
if database.get_number_of_people() == 0:
use_trans = False
@ -236,9 +237,7 @@ def import2(database, filename, callback, codeset, use_trans):
'run the Check and Repair Database tool to fix the '
'problem.'))
return
except:
DisplayTrace.DisplayTrace()
return
#-------------------------------------------------------------------------
#

View File

@ -32,6 +32,14 @@ from xml.parsers.expat import ExpatError, ParserCreate
from gettext import gettext as _
import re
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ReadXML")
#-------------------------------------------------------------------------
#
# GTK+ Modules
@ -154,10 +162,6 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
import traceback
traceback.print_exc()
os._exit(1)
else:
import DisplayTrace
DisplayTrace.DisplayTrace()
return
xml_file.close()

View File

@ -32,6 +32,14 @@ import re
import shutil
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WriteGedcom")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -292,11 +300,7 @@ def fmtline(text,limit,level,endl):
#
#-------------------------------------------------------------------------
def writeData(database,person):
try:
GedcomWriter(database,person)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
GedcomWriter(database,person)
#-------------------------------------------------------------------------
#
@ -1351,9 +1355,6 @@ def exportData(database,filename,person,option_box,callback=None):
ret = gw.export_data(filename)
except Errors.DatabaseError,msg:
ErrorDialog(_("Export failed"),str(msg))
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
return ret
#-------------------------------------------------------------------------

View File

@ -36,6 +36,14 @@ import os
import codecs
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WriteXML")
#-------------------------------------------------------------------------
#
# load gtk libraries
@ -87,23 +95,9 @@ def exportData(database, filename, person, callback=None):
compress = _gzip_ok == 1
try:
g = XmlWriter(database,callback,0,compress)
t = time.time()
ret = g.write(filename)
print time.time()-t
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
ErrorDialog(_("Failure writing %s") % filename,
_("An attempt is being made to recover the original file"))
shutil.copyfile(filename + ".bak", filename)
try:
shutil.copystat(filename + ".bak", filename)
except:
pass
g = XmlWriter(database,callback,0,compress)
t = time.time()
ret = g.write(filename)
return ret
#-------------------------------------------------------------------------

View File

@ -109,10 +109,9 @@ license = os.path.join(root_dir,"COPYING")
glade_dir = os.path.join(root_dir,"glade")
gladeFile = os.path.join(glade_dir,"gramps.glade")
person_glade = os.path.join(glade_dir,"edit_person.glade")
pluginsFile = os.path.join(root_dir,"plugins.glade")
mergeFile = os.path.join(root_dir,"mergedata.glade")
merge2File = os.path.join(root_dir,"merge.glade")
filterFile = os.path.join(root_dir,"rule.glade")
plugins_glade = os.path.join(glade_dir,"plugins.glade")
merge_glade = os.path.join(glade_dir,"mergedata.glade")
rule_glade = os.path.join(glade_dir,"rule.glade")
pluginsDir = os.path.join(root_dir,"plugins")

View File

@ -47,6 +47,14 @@ _TB = 'Times-Bold'
_TI = 'Times-Italic'
_TBI = 'Times-BoldItalic'
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".PdfDoc")
#------------------------------------------------------------------------
#
# ReportLab python/PDF modules
@ -183,9 +191,6 @@ class PdfDoc(BaseDoc.BaseDoc):
except IOError,msg:
errmsg = "%s\n%s" % (_("Could not create %s") % self.filename, msg)
raise Errors.ReportError(errmsg)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
if self.print_req:
apptype = 'application/pdf'

View File

@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="source_editor">
<property name="visible">True</property>

View File

@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="define_filter">
<property name="visible">True</property>

View File

@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="scratch_pad">
<property name="visible">True</property>

View File

@ -141,14 +141,7 @@ def setup_logging():
def run():
try:
setup_logging()
except:
# If logging can't be started fall back on
# old exception display
import DisplayTrace
DisplayTrace.DisplayTrace()
setup_logging()
try:
import gnome

View File

@ -31,6 +31,14 @@
import os
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".BookReport")
#-------------------------------------------------------------------------
#
# SAX interface
@ -1088,27 +1096,23 @@ def cl_report(database,name,category,options_str_dict):
this_style_name,style_sheet.get_style(this_style_name))
# write report
try:
doc = clr.format(selected_style,clr.paper,clr.template_name,clr.orien)
rptlist = []
newpage = 0
for item in book.get_item_list():
item.option_class.set_document(doc)
item.option_class.set_newpage(newpage)
report_class = item.get_write_item()
obj = Report.write_book_item(database,clr.person,
report_class,item.option_class)
rptlist.append(obj)
newpage = 1
doc.open(clr.option_class.get_output())
doc.init()
for item in rptlist:
item.begin_report()
item.write_report()
doc.close()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
doc = clr.format(selected_style,clr.paper,clr.template_name,clr.orien)
rptlist = []
newpage = 0
for item in book.get_item_list():
item.option_class.set_document(doc)
item.option_class.set_newpage(newpage)
report_class = item.get_write_item()
obj = Report.write_book_item(database,clr.person,
report_class,item.option_class)
rptlist.append(obj)
newpage = 1
doc.open(clr.option_class.get_output())
doc.init()
for item in rptlist:
item.begin_report()
item.write_report()
doc.close()
#------------------------------------------------------------------------
#

View File

@ -32,6 +32,14 @@ import cStringIO
import sets
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".CheckRepair")
#-------------------------------------------------------------------------
#
# gtk modules
@ -136,50 +144,46 @@ class Check(Tool.Tool):
# def runTool(database,active_person,callback,parent=None):
cli = int(parent == None)
try:
if db.readonly:
# TODO: split plugin in a check and repair part to support
# checking of a read only database
return
if db.readonly:
# TODO: split plugin in a check and repair part to support
# checking of a read only database
return
# The low-level repair is bypassing the transaction mechanism.
# As such, we run it before starting the transaction.
# We only do this for the BSDDB backend.
if db.__class__.__name__ == 'GrampsBSDDB':
low_level(db)
# The low-level repair is bypassing the transaction mechanism.
# As such, we run it before starting the transaction.
# We only do this for the BSDDB backend.
if db.__class__.__name__ == 'GrampsBSDDB':
low_level(db)
trans = db.transaction_begin("",batch=True)
db.disable_signals()
checker = CheckIntegrity(db,parent,trans)
checker.fix_encoding()
checker.cleanup_missing_photos(cli)
trans = db.transaction_begin("",batch=True)
db.disable_signals()
checker = CheckIntegrity(db,parent,trans)
checker.fix_encoding()
checker.cleanup_missing_photos(cli)
prev_total = -1
total = 0
prev_total = -1
total = 0
while prev_total != total:
prev_total = total
while prev_total != total:
prev_total = total
checker.check_for_broken_family_links()
checker.check_parent_relationships()
checker.cleanup_empty_families(cli)
checker.cleanup_duplicate_spouses()
checker.check_for_broken_family_links()
checker.check_parent_relationships()
checker.cleanup_empty_families(cli)
checker.cleanup_duplicate_spouses()
total = checker.family_errors()
total = checker.family_errors()
checker.check_events()
checker.check_place_references()
checker.check_source_references()
db.transaction_commit(trans, _("Check Integrity"))
db.enable_signals()
db.request_rebuild()
checker.check_events()
checker.check_place_references()
checker.check_source_references()
db.transaction_commit(trans, _("Check Integrity"))
db.enable_signals()
db.request_rebuild()
errs = checker.build_report(cli)
if errs:
Report(checker.text.getvalue(),parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
errs = checker.build_report(cli)
if errs:
Report(checker.text.getvalue(),parent)
#-------------------------------------------------------------------------
#

View File

@ -38,6 +38,14 @@ from time import localtime
import gtk
import gtk.glade
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ExportVCal")
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -301,12 +309,8 @@ class CalendarWriter:
#-------------------------------------------------------------------------
def exportData(database,filename,person,option_box):
ret = 0
try:
cw = CalendarWriter(database,person,0,filename,option_box)
ret = cw.export_data(filename)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
cw = CalendarWriter(database,person,0,filename,option_box)
ret = cw.export_data(filename)
return ret
#-------------------------------------------------------------------------

View File

@ -29,6 +29,14 @@
#-------------------------------------------------------------------------
import os
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ExportVCard")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -220,12 +228,8 @@ class CardWriter:
#-------------------------------------------------------------------------
def exportData(database,filename,person,option_box):
ret = 0
try:
cw = CardWriter(database,person,0,filename,option_box)
ret = cw.export_data(filename)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
cw = CardWriter(database,person,0,filename,option_box)
ret = cw.export_data(filename)
return ret
#-------------------------------------------------------------------------

View File

@ -32,6 +32,14 @@ __author__ = "Don Allingham"
import os
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".FilterEdit")
#-------------------------------------------------------------------------
#
# GTK/GNOME
@ -854,10 +862,6 @@ class EditRule:
self.window.destroy()
except KeyError:
pass
except:
import DisplayTrace
self.window.destroy()
DisplayTrace.DisplayTrace()
#-------------------------------------------------------------------------
#

View File

@ -32,6 +32,14 @@ import os
from gettext import gettext as _
from time import asctime
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".GraphViz")
#------------------------------------------------------------------------
#
# GNOME/gtk
@ -894,17 +902,14 @@ class EmptyDoc:
#------------------------------------------------------------------------
def cl_report(database,name,category,options_str_dict):
clr = Report.CommandLineReport(database,name,category,GraphVizOptions,options_str_dict)
clr = Report.CommandLineReport(database,name,category,GraphVizOptions,
options_str_dict)
# Exit here if show option was given
if clr.show:
return
try:
GraphViz(database,clr.person,clr.option_class)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
GraphViz(database,clr.person,clr.option_class)
#------------------------------------------------------------------------
#

View File

@ -31,6 +31,14 @@ import re
import time
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ImportGeneWeb")
#-------------------------------------------------------------------------
#
# GTK/GNOME Modules
@ -80,11 +88,6 @@ def importData(database, filename, cb=None):
except IOError,msg:
ErrorDialog(_("%s could not be opened\n") % filename,str(msg))
return
except:
ErrorDialog(_("%s could not be opened\n") % filename)
import DisplayTrace
DisplayTrace.DisplayTrace()
return
try:
status = g.parse_geneweb_file()
@ -92,11 +95,6 @@ def importData(database, filename, cb=None):
errmsg = _("%s could not be opened\n") % filename
ErrorDialog(errmsg,str(msg))
return
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
return
#-------------------------------------------------------------------------
# For a description of the file format see

View File

@ -31,6 +31,14 @@ import re
import time
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ImportVCard")
#-------------------------------------------------------------------------
#
# GTK/GNOME Modules
@ -61,11 +69,6 @@ def importData(database, filename, cb=None):
except IOError,msg:
ErrorDialog(_("%s could not be opened\n") % filename,str(msg))
return
except:
ErrorDialog(_("%s could not be opened\n") % filename)
import DisplayTrace
DisplayTrace.DisplayTrace()
return
try:
status = g.parse_vCard_file()
@ -73,11 +76,6 @@ def importData(database, filename, cb=None):
errmsg = _("%s could not be opened\n") % filename
ErrorDialog(errmsg,str(msg))
return
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
return
#-------------------------------------------------------------------------
#

View File

@ -46,7 +46,6 @@ pkgdata_PYTHON = \
Summary.py\
TimeLine.py\
Verify.py\
WebPage.py\
WriteFtree.py\
WritePkg.py\
WriteCD.py\

View File

@ -35,11 +35,23 @@ import time
import locale
import shutil
import codecs
import sets
import tarfile
from gettext import gettext as _
from cStringIO import StringIO
try:
set()
except:
from sets import Set as set
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------
#
# GNOME/gtk
@ -2148,7 +2160,7 @@ class WebReport(Report.Report):
ind_list = self.database.get_person_handles(sort_handles=False)
self.progress.set_pass(_('Filtering'),1)
ind_list = self.filter.apply(self.database,ind_list)
restrict_list = sets.Set()
restrict_list = set()
# if private records need to be filtered out, strip out any person
# that has the private flag set.
@ -2722,7 +2734,7 @@ class WebReportDialog(Report.ReportDialog):
ErrorDialog(m1,m2)
def sort_people(db,handle_list):
flist = sets.Set(handle_list)
flist = set(handle_list)
sname_sub = {}
sortnames = {}
@ -2764,18 +2776,15 @@ def sort_people(db,handle_list):
#------------------------------------------------------------------------
def cl_report(database,name,category,options_str_dict):
clr = Report.CommandLineReport(database,name,category,WebReportOptions,options_str_dict)
clr = Report.CommandLineReport(database,name,category,WebReportOptions,
options_str_dict)
# Exit here if show option was given
if clr.show:
return
try:
MyReport = WebReport(database,clr.person,clr.option_class)
MyReport.write_report()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
MyReport = WebReport(database,clr.person,clr.option_class)
MyReport.write_report()
#------------------------------------------------------------------------
#

View File

@ -32,6 +32,14 @@ import os
import tarfile
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".ReadPkg")
#-------------------------------------------------------------------------
#
# GNOME/GTK+ modules
@ -86,12 +94,8 @@ def impData(database, name,cb=None,cl=0):
imp_db_name = os.path.join(tmpdir_path,const.xmlFile)
try:
importer = gramps_db_reader_factory(const.app_gramps_xml)
importer(database,imp_db_name,cb)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
importer = gramps_db_reader_factory(const.app_gramps_xml)
importer(database,imp_db_name,cb)
# Clean up tempdir after ourselves
# THIS HAS BEEN CHANGED, because now we want to keep images

View File

@ -31,6 +31,14 @@ import os
import cStringIO
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".Rebuild")
#-------------------------------------------------------------------------
#
# gtk modules
@ -59,32 +67,28 @@ class Rebuild(Tool.Tool):
def __init__(self,db,person,options_class,name,callback=None,parent=None):
Tool.Tool.__init__(self,db,person,options_class,name)
try:
if db.readonly:
# TODO: split plugin in a check and repair part to support
# checking of a read only database
return
if db.readonly:
# TODO: split plugin in a check and repair part to support
# checking of a read only database
return
db.disable_signals()
if parent:
progress = Utils.ProgressMeter(
db.disable_signals()
if parent:
progress = Utils.ProgressMeter(
_('Rebuilding Secondary Indices'))
# Six indices to rebuild, and the first step is removing
# old ones
total = 7
progress.set_pass('',total)
db.rebuild_secondary(progress.step)
progress.close()
OkDialog(_("Secondary indices rebuilt"),
_('All secondary indices have been rebuilt.'))
else:
print "Rebuilding Secondary Indices..."
db.rebuild_secondary(self.empty)
print "All secondary indices have been rebuilt."
db.enable_signals()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
# Six indices to rebuild, and the first step is removing
# old ones
total = 7
progress.set_pass('',total)
db.rebuild_secondary(progress.step)
progress.close()
OkDialog(_("Secondary indices rebuilt"),
_('All secondary indices have been rebuilt.'))
else:
print "Rebuilding Secondary Indices..."
db.rebuild_secondary(self.empty)
print "All secondary indices have been rebuilt."
db.enable_signals()
def empty(self):
pass

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,14 @@ import os
from cStringIO import StringIO
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WriteCD")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -66,12 +74,8 @@ _title_string = _("Export to CD")
#-------------------------------------------------------------------------
def writeData(database,filename,person,option_box=None):
ret = 0
try:
writer = PackageWriter(database,filename)
ret = writer.export()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
writer = PackageWriter(database,filename)
ret = writer.export()
return ret
#-------------------------------------------------------------------------

View File

@ -31,6 +31,14 @@ import os
from cStringIO import StringIO
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WriteFtree")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -56,12 +64,8 @@ from QuestionDialog import ErrorDialog
#-------------------------------------------------------------------------
def writeData(database,filename,person,option_box):
ret = 0
try:
writer = FtreeWriter(database,person,0,filename,option_box)
ret = writer.export_data()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
writer = FtreeWriter(database,person,0,filename,option_box)
ret = writer.export_data()
return ret
class FtreeWriterOptionBox:

View File

@ -38,6 +38,14 @@ from gettext import gettext as _
import gtk
import gtk.glade
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WriteGeneWeb")
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -580,12 +588,8 @@ class GeneWebWriter:
#-------------------------------------------------------------------------
def exportData(database,filename,person,option_box):
ret = 0
try:
gw = GeneWebWriter(database,person,0,filename,option_box)
ret = gw.export_data()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
gw = GeneWebWriter(database,person,0,filename,option_box)
ret = gw.export_data()
return ret
#-------------------------------------------------------------------------

View File

@ -33,6 +33,14 @@ import tarfile
from cStringIO import StringIO
from gettext import gettext as _
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
log = logging.getLogger(".WritePkg")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -57,13 +65,8 @@ from QuestionDialog import MissingMediaDialog
#-------------------------------------------------------------------------
def writeData(database,filename,person,callback=None):
ret = 0
try:
writer = PackageWriter(database,filename,callback)
ret = writer.export()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
writer = PackageWriter(database,filename,callback)
ret = writer.export()
return ret
#-------------------------------------------------------------------------