diff --git a/ChangeLog b/ChangeLog index 3a9ae3f86..a378f8447 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-12 Zsolt Foldvari + * src/MarkupText.py: cleanup + * src/DisplayTabs/_NoteTab.py (build_interface): debug log + * src/const.py.in: add new command line arg '-d,--debug' + * src/gramps.py (setup_logging): change root logger default level + to WARNING + * src/ArgHandler.py (parse_arg): handle command line arg: debug + 2007-02-12 Zsolt Foldvari * src/MarkupText.py: improvements * src/RelLib/_Note.py (get): try to remove tags only if note is diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 6733fbd80..c0c78b24e 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -42,6 +42,7 @@ import os import sys import getopt from gettext import gettext as _ +import logging #------------------------------------------------------------------------- # @@ -254,6 +255,9 @@ class ArgHandler: and options[opt_ix+1][0] in ( '-p', '--options' ): options_str = options[opt_ix+1][1] self.actions.append((action,options_str)) + elif o in ('-d', '--debug'): + l = logging.getLogger() + l.setLevel(logging.DEBUG) #------------------------------------------------------------------------- # Determine the need for GUI diff --git a/src/DisplayTabs/_NoteTab.py b/src/DisplayTabs/_NoteTab.py index 3c039fdd3..1b6265e73 100644 --- a/src/DisplayTabs/_NoteTab.py +++ b/src/DisplayTabs/_NoteTab.py @@ -134,7 +134,7 @@ class NoteTab(GrampsTab): if self.note_obj: self.empty = False self.buf.set_text(self.note_obj.get(markup=True)) - #log.debug("Text: %s" % self.buf.get_text()) + log.debug("Text: %s" % self.buf.get_text()) else: self.empty = True diff --git a/src/MarkupText.py b/src/MarkupText.py index 20d5973a5..af609b764 100644 --- a/src/MarkupText.py +++ b/src/MarkupText.py @@ -47,13 +47,7 @@ log = logging.getLogger(".MarkupText") # #------------------------------------------------------------------------- import gtk -import pango -#------------------------------------------------------------------------- -# -# Constants -# -#------------------------------------------------------------------------- class MarkupParser(ContentHandler): """A simple ContentHandler class to parse Gramps markup'ed text. @@ -83,7 +77,7 @@ class MarkupParser(ContentHandler): if name == 'gramps': self._open_document = True else: - raise SAXParseException('Root tag missing') + raise SAXParseException('Root element missing') else: self._open_elements.append({'name': name, 'attrs': attrs.copy(), diff --git a/src/const.py.in b/src/const.py.in index 0d4d9b13e..322bc938e 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -182,12 +182,13 @@ xmlFile = "data.gramps" # (longName, shortName, type , default, flags, descrip , argDescrip) popt_table = [ - ("open", 'O', str, None, 0, "Open file", "FILENAME"), - ("import", 'i', str, None, 0, "Import file", "FILENAME"), - ("output", 'o', str, None, 0, "Write file", "FILENAME"), - ("format", 'f', str, None, 0, 'Specify format', "FORMAT"), - ("action", 'a', str, None, 0, 'Specify action', "ACTION"), - ("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"), + ("open", 'O', str, None, 0, "Open file", "FILENAME"), + ("import", 'i', str, None, 0, "Import file", "FILENAME"), + ("output", 'o', str, None, 0, "Write file", "FILENAME"), + ("format", 'f', str, None, 0, 'Specify format', "FORMAT"), + ("action", 'a', str, None, 0, 'Specify action', "ACTION"), + ("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"), + ("debug", 'd', None, None, 0, 'Enable debug logs', ""), ] longopts = [ @@ -225,7 +226,8 @@ longopts = [ "format=", "action=", "options=", + "debug", ] -shortopts = "O:i:o:f:a:p:?" +shortopts = "O:i:o:f:a:p:d?" diff --git a/src/gramps.py b/src/gramps.py index 00cbe16e0..c9592d834 100644 --- a/src/gramps.py +++ b/src/gramps.py @@ -130,7 +130,7 @@ def setup_logging(): # Setup the base level logger, this one gets # everything. l = logging.getLogger() - l.setLevel(logging.DEBUG) + l.setLevel(logging.WARNING) l.addHandler(rh) l.addHandler(gtkh) l.addHandler(stderrh)