2007-02-21 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/MarkupText.py: raise error in case of parsing failure. * src/const.py.in: add argument support for debug switch. * src/ArgHandler.py (parse_arg): handle debug switch argument. svn: r8207
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2007-02-21 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||||
|
* src/MarkupText.py: raise error in case of parsing failure.
|
||||||
|
* src/const.py.in: add argument support for debug switch.
|
||||||
|
* src/ArgHandler.py (parse_arg): handle debug switch argument.
|
||||||
|
|
||||||
2007-02-20 Alex Roitman <shura@gramps-project.org>
|
2007-02-20 Alex Roitman <shura@gramps-project.org>
|
||||||
* data/grampsxml.dtd: Update DTD.
|
* data/grampsxml.dtd: Update DTD.
|
||||||
* data/grampsxml.rng: Update schema.
|
* data/grampsxml.rng: Update schema.
|
||||||
|
@@ -256,7 +256,7 @@ class ArgHandler:
|
|||||||
options_str = options[opt_ix+1][1]
|
options_str = options[opt_ix+1][1]
|
||||||
self.actions.append((action,options_str))
|
self.actions.append((action,options_str))
|
||||||
elif o in ('-d', '--debug'):
|
elif o in ('-d', '--debug'):
|
||||||
l = logging.getLogger()
|
l = logging.getLogger(v)
|
||||||
l.setLevel(logging.DEBUG)
|
l.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
@@ -253,7 +253,8 @@ class MarkupBuffer(gtk.TextBuffer):
|
|||||||
It implements MarkupParser and MarkupWriter on the input/output interface.
|
It implements MarkupParser and MarkupWriter on the input/output interface.
|
||||||
Also translates Gramps XML markup language to gtk.TextTag's and vice versa.
|
Also translates Gramps XML markup language to gtk.TextTag's and vice versa.
|
||||||
|
|
||||||
Based on 'gourmet-0.13.3', http://grecipe-manager.sourceforge.net/
|
Based on 'gourmet-0.13.3' L{http://grecipe-manager.sourceforge.net}
|
||||||
|
Pango markup format is replaces by custom Gramps XML format.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
texttag_to_xml = {
|
texttag_to_xml = {
|
||||||
@@ -276,7 +277,7 @@ class MarkupBuffer(gtk.TextBuffer):
|
|||||||
gtk.TextBuffer.__init__(self)
|
gtk.TextBuffer.__init__(self)
|
||||||
|
|
||||||
def set_text(self, xmltext):
|
def set_text(self, xmltext):
|
||||||
"""Set the content of the buffer with markup tags"""
|
"""Set the content of the buffer with markup tags."""
|
||||||
try:
|
try:
|
||||||
parseString(xmltext, self.parser)
|
parseString(xmltext, self.parser)
|
||||||
text = self.parser.content
|
text = self.parser.content
|
||||||
@@ -303,7 +304,7 @@ class MarkupBuffer(gtk.TextBuffer):
|
|||||||
self.apply_tag(tag, start_iter, end_iter)
|
self.apply_tag(tag, start_iter, end_iter)
|
||||||
|
|
||||||
def get_tag_from_element(self, name):
|
def get_tag_from_element(self, name):
|
||||||
"""Convert xml element to gtk.TextTag"""
|
"""Convert xml element to gtk.TextTag."""
|
||||||
if not self.xml_to_texttag.has_key(name):
|
if not self.xml_to_texttag.has_key(name):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -431,7 +432,8 @@ class EditorBuffer(MarkupBuffer):
|
|||||||
normal_button is a widget whose clicked signal will make us normal
|
normal_button is a widget whose clicked signal will make us normal
|
||||||
toggle_widget_alist is a list that looks like this: [(widget, tag_name),]
|
toggle_widget_alist is a list that looks like this: [(widget, tag_name),]
|
||||||
|
|
||||||
Based on 'gourmet-0.13.3', http://grecipe-manager.sourceforge.net/
|
Based on 'gourmet-0.13.3' L{http://grecipe-manager.sourceforge.net}
|
||||||
|
Pango markup format is replaces by custom Gramps XML format.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__gtype_name__ = 'EditorBuffer'
|
__gtype_name__ = 'EditorBuffer'
|
||||||
@@ -502,14 +504,14 @@ class EditorBuffer(MarkupBuffer):
|
|||||||
try:
|
try:
|
||||||
parseString("<gramps>%s</gramps>" % xmlstring, self.parser)
|
parseString("<gramps>%s</gramps>" % xmlstring, self.parser)
|
||||||
except:
|
except:
|
||||||
# raise Error
|
log.error('"%s" is not a valid Gramps XML format.' % xmlstring)
|
||||||
log.debug("set: " % self.parser.content)
|
|
||||||
|
|
||||||
(start, end), name, attrs = self.parser.elements[0]
|
(start, end), name, attrs = self.parser.elements[0]
|
||||||
|
|
||||||
return self.setup_widget(widg, name)
|
return self.setup_widget(widg, name)
|
||||||
|
|
||||||
def setup_widget(self, widg, name):
|
def setup_widget(self, widg, name):
|
||||||
|
"""Setup widget from Gramps tag name."""
|
||||||
tag = self.get_tag_from_element(name)
|
tag = self.get_tag_from_element(name)
|
||||||
self.tag_widgets[tag] = widg
|
self.tag_widgets[tag] = widg
|
||||||
return widg.connect('toggled', self._toggle, tag)
|
return widg.connect('toggled', self._toggle, tag)
|
||||||
|
@@ -182,13 +182,13 @@ xmlFile = "data.gramps"
|
|||||||
|
|
||||||
# (longName, shortName, type , default, flags, descrip , argDescrip)
|
# (longName, shortName, type , default, flags, descrip , argDescrip)
|
||||||
popt_table = [
|
popt_table = [
|
||||||
("open", 'O', str, None, 0, "Open file", "FILENAME"),
|
("open", 'O', str, None, 0, "Open file", "FILENAME"),
|
||||||
("import", 'i', str, None, 0, "Import file", "FILENAME"),
|
("import", 'i', str, None, 0, "Import file", "FILENAME"),
|
||||||
("output", 'o', str, None, 0, "Write file", "FILENAME"),
|
("output", 'o', str, None, 0, "Write file", "FILENAME"),
|
||||||
("format", 'f', str, None, 0, 'Specify format', "FORMAT"),
|
("format", 'f', str, None, 0, 'Specify format', "FORMAT"),
|
||||||
("action", 'a', str, None, 0, 'Specify action', "ACTION"),
|
("action", 'a', str, None, 0, 'Specify action', "ACTION"),
|
||||||
("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"),
|
("options", 'p', str, None, 0, 'Specify options', "OPTIONS_STRING"),
|
||||||
("debug", 'd', None, None, 0, 'Enable debug logs', ""),
|
("debug", 'd', str, None, 0, 'Enable debug logs', "LOGGER_NAME"),
|
||||||
]
|
]
|
||||||
|
|
||||||
longopts = [
|
longopts = [
|
||||||
@@ -226,8 +226,8 @@ longopts = [
|
|||||||
"format=",
|
"format=",
|
||||||
"action=",
|
"action=",
|
||||||
"options=",
|
"options=",
|
||||||
"debug",
|
"debug=",
|
||||||
]
|
]
|
||||||
|
|
||||||
shortopts = "O:i:o:f:a:p:d?"
|
shortopts = "O:i:o:f:a:p:d:?"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user