* 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  <zfoldvar@users.sourceforge.net>


svn: r8093
This commit is contained in:
Zsolt Foldvari 2007-02-12 22:33:03 +00:00
parent 4f390df00d
commit 4cd6d41f79
6 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2007-02-12 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* 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 <zfoldvar@users.sourceforge.net>
* src/MarkupText.py: improvements
* src/RelLib/_Note.py (get): try to remove tags only if note is

View File

@ -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

View File

@ -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

View File

@ -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(),

View File

@ -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?"

View File

@ -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)