diff --git a/ChangeLog b/ChangeLog index 2514b6661..f602aea9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-01-09 Richard Taylor + * 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 * src/GrampsLogger/_ErrorReportAssistant.py: corrected wording, minor layout changes. diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 613d18ab0..b286e0cb5 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -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): """ diff --git a/src/DbPrompter.py b/src/DbPrompter.py index 8c45fcedf..bb8496e44 100644 --- a/src/DbPrompter.py +++ b/src/DbPrompter.py @@ -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 diff --git a/src/DisplayModels.py b/src/DisplayModels.py index 59fa83ec7..90ba2fd64 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -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 diff --git a/src/EditPlace.py b/src/EditPlace.py index bbab6e029..b0eb33e6d 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -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 diff --git a/src/EditSource.py b/src/EditSource.py index 997916cae..0d0bc8770 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -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 diff --git a/src/FamilyView.py b/src/FamilyView.py index 24c6c3814..76202ba9c 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -24,7 +24,6 @@ import pango #------------------------------------------------------------------------- import RelLib import PageView -import DisplayTrace import NameDisplay import Utils import DateHandler diff --git a/src/GrampsLogger/_ErrorReportAssistant.py b/src/GrampsLogger/_ErrorReportAssistant.py index 1a242c145..e73b15963 100644 --- a/src/GrampsLogger/_ErrorReportAssistant.py +++ b/src/GrampsLogger/_ErrorReportAssistant.py @@ -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( diff --git a/src/MapView.py b/src/MapView.py index 27bc75677..30f0d528e 100644 --- a/src/MapView.py +++ b/src/MapView.py @@ -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): diff --git a/src/Report.py b/src/Report.py index 33c66e2eb..b45153da6 100644 --- a/src/Report.py +++ b/src/Report.py @@ -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) diff --git a/src/StyleEditor.py b/src/StyleEditor.py index c57045627..13c9a3a98 100644 --- a/src/StyleEditor.py +++ b/src/StyleEditor.py @@ -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: diff --git a/src/Tool.py b/src/Tool.py index dc92ad41b..f8b774e6f 100644 --- a/src/Tool.py +++ b/src/Tool.py @@ -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) #------------------------------------------------------------------------- # diff --git a/src/ViewManager.py b/src/ViewManager.py index 867ba64b8..aa1b745ef 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -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 diff --git a/src/gramps_main.py b/src/gramps_main.py index d3257afe7..ec53398ce 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -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):