replace DisplayTrace with logger

svn: r5702
This commit is contained in:
Richard Taylor 2006-01-09 11:28:44 +00:00
parent d123f6ef77
commit 09292cbc15
14 changed files with 67 additions and 41 deletions

View File

@ -1,3 +1,18 @@
2006-01-09 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ChooseParents.py: replaced DisplayTrace with new logger
* src/DbPrompter.py: replaced DisplayTrace with new logger
* src/DisplayModels.py: replaced DisplayTrace with new logger
* src/EditPlace.py: replaced DisplayTrace with new logger
* src/EditSource.py: replaced DisplayTrace with new logger
* src/FamilyView.py: replaced DisplayTrace with new logger
* src/MapView.py: replaced DisplayTrace with new logger
* src/Report.py: replaced DisplayTrace with new logger
* src/StyleEditor.py: replaced DisplayTrace with new logger
* src/Tool.py: replaced DisplayTrace with new logger
* src/ViewManager.py: replaced DisplayTrace with new logger
* src/gramps_main.py: replaced DisplayTrace with new logger
* src/GrampsLogger/_ErrorReportAssistant.py: added a newline
2006-01-09 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/GrampsLogger/_ErrorReportAssistant.py: corrected wording, minor layout
changes.

View File

@ -36,6 +36,14 @@ __version__ = "$Revision$"
from gettext import gettext as _
import gc
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
@ -653,8 +661,7 @@ class ChooseParents:
import EditPerson
EditPerson.EditPerson(self, person,self.db,self.add_new_parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to add parent",exc_info=True)
def change_family_type(self,family,mother_rel,father_rel,trans):
"""

View File

@ -241,8 +241,7 @@ class ExistingDbPrompter:
_("Could not open file: %s") % filename, msg[1])
return False
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to open native database file.", exc_info=True)
return False
# The above native formats did not work, so we need to

View File

@ -27,6 +27,8 @@
import time
from gettext import gettext as _
import locale
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -46,7 +48,6 @@ import DateHandler
import RelLib
import Utils
import ToolTips
import DisplayTrace
import GrampsLocale
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
@ -340,7 +341,7 @@ class SourceModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_source_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.",exc_info=True)
return t
#-------------------------------------------------------------------------
@ -449,7 +450,7 @@ class PlaceModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_place_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.", exc_info=True)
return t
#-------------------------------------------------------------------------
@ -538,7 +539,7 @@ class FamilyModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_family_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.", exc_info=True)
return t
@ -617,7 +618,7 @@ class MediaModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_object_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.", exc_info=True)
return t
#-------------------------------------------------------------------------
@ -701,7 +702,7 @@ class EventModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_event_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.", exc_info=True)
return t
@ -818,5 +819,5 @@ class RepositoryModel(BaseModel):
try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_repository_from_handle(data[0]))
except:
DisplayTrace.DisplayTrace()
log.error("Failed to create tooltip.", exc_info=True)
return t

View File

@ -30,7 +30,8 @@ import gc
from gettext import gettext as _
import sys
log = sys.stderr.write
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -615,8 +616,8 @@ class EditPlace(DisplayState.ManagedWindow):
# that has been added to the database or that Place has started
# to be referenced by a different primary object. Print a warning
# to remind us that this code need updating.
log("WARNING: Unhandled Primary object type returned from "
"find_backlink_handles(): %s \n" % str(cls_name))
log.warning("Unhandled Primary object type returned from "
"find_backlink_handles(): %s \n" % str(cls_name))
if gtk.events_pending():
return True

View File

@ -29,7 +29,8 @@ from gettext import gettext as _
import gc
import sys
log = sys.stderr.write
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -515,8 +516,8 @@ class EditSource(DisplayState.ManagedWindow):
# If we get here it means there is a new Primary object type
# that has been added to the database. Print a warning
# to remind us that this code need updating.
log("WARNING: Unhandled Primary object type returned from "
"find_backlink_handles()\n")
log.warning("Unhandled Primary object type returned from "
"find_backlink_handles()\n")
if gtk.events_pending():
return True

View File

@ -24,7 +24,6 @@ import pango
#-------------------------------------------------------------------------
import RelLib
import PageView
import DisplayTrace
import NameDisplay
import Utils
import DateHandler

View File

@ -468,7 +468,7 @@ class ErrorReportAssistant:
self._user_information_text_buffer.get_start_iter(),
self._user_information_text_buffer.get_end_iter()) +
"\n\nError Details: \n" +
"\n\n\nError Details: \n" +
"===================\n\n" +
self._error_details_text_buffer.get_text(

View File

@ -28,6 +28,9 @@
from gettext import gettext as _
import gc
import re
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -45,7 +48,6 @@ import gtk.gdk
#-------------------------------------------------------------------------
import RelLib
import PageView
import DisplayTrace
glob_loc_data = [ # (Name, longitude, latitude)
("_Center", 0,0),
@ -456,7 +458,7 @@ class MapView(PageView.PageView):
#d = self.parse_nima_countryfile("/tmp/gm.txt")
d = d + self.get_markers_from_database( self.dbstate.db)
except:
DisplayTrace.DisplayTrace()
log.error("Failed to rebuild places.", exc_info=True)
self.place_list_view.change_data( d)
def entry_select_cb(self,treeview):

View File

@ -34,6 +34,10 @@ __version__ = "$Revision$"
import os
from gettext import gettext as _
from types import ClassType, InstanceType
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -549,8 +553,7 @@ class BareReportDialog:
try:
self.options.parse_user_options(self)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to parse user options.", exc_info=True)
def add_option(self,label_text,widget,tooltip=None):
@ -1896,8 +1899,7 @@ def report(database,person,report_class,options_class,translated_name,name,categ
except Errors.DatabaseError,msg:
ErrorDialog(_("Report could not be created"),str(msg))
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to run report.", exc_info=True)
dialog.window.destroy()
# Book item generic task
@ -1915,8 +1917,7 @@ def write_book_item(database,person,report_class,options_class):
(m1,m2) = msg.messages()
ErrorDialog(m1,m2)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to write book item.", exc_info=True)
return None
# Command-line generic task
@ -1938,5 +1939,4 @@ def cl_report(database,name,category,report_class,options_class,options_str_dict
MyReport.write_report()
MyReport.end_report()
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to write report.", exc_info=True)

View File

@ -33,6 +33,9 @@ __version__ = "$Revision$"
#
#------------------------------------------------------------------------
from gettext import gettext as _
import logging
log = logging.getLogger(".")
#------------------------------------------------------------------------
#
@ -131,8 +134,7 @@ class StyleListDisplay:
from QuestionDialog import ErrorDialog
ErrorDialog(_("Error saving stylesheet"),str(msg))
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to save stylesheet",exc_info=True)
def on_button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:

View File

@ -32,6 +32,8 @@ __version__ = "$Revision$"
#-------------------------------------------------------------------------
from types import ClassType, InstanceType
from gettext import gettext as _
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -215,8 +217,7 @@ def gui_tool(database,person,tool_class,options_class,translated_name,
try:
tool_class(database,person,options_class,name,callback,parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to start tool.", exc_info=True)
# Command-line generic task
def cli_tool(database,name,category,tool_class,options_class,options_str_dict):
@ -232,8 +233,7 @@ def cli_tool(database,name,category,tool_class,options_class,options_str_dict):
try:
tool_class(database,clt.person,clt.option_class,name)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to start tool.", exc_info=True)
#-------------------------------------------------------------------------
#

View File

@ -29,6 +29,8 @@ from gettext import gettext as _
from bsddb import db
import os
from cStringIO import StringIO
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -50,7 +52,6 @@ import GrampsKeys
import GrampsDb
import GrampsCfg
import Errors
import DisplayTrace
import Utils
import QuestionDialog
import PageView
@ -569,8 +570,7 @@ class ViewManager:
_("Could not open file: %s") % filename, msg[1])
return False
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
log.error("Failed to open native.", exc_info=True)
return False
# The above native formats did not work, so we need to
@ -738,7 +738,7 @@ class ViewManager:
_('%s could not be opened.' % filename) + '\n' + msg[1])
return False
except Exception:
DisplayTrace.DisplayTrace()
log.error("Failed to open database.", exc_info=True)
return False
# Undo/Redo always start with standard labels and insensitive state

View File

@ -50,7 +50,6 @@ import EventView
import SourceView
import MediaView
import ArgHandler
import DisplayTrace
import GrampsKeys
import GrampsCfg
import const
@ -128,7 +127,7 @@ class Gramps:
gtk.main_quit()
return
except:
DisplayTrace.DisplayTrace()
log.error("Error reading configuration.", exc_info=True)
return
if not mime_type_is_defined(const.app_gramps):