From: Benny M. <ben...@gm...> - 2011-10-19 13:23:51
|
Is this not already possible playing with the indent of the paragraph in the style editor? Eg indent -0.5. Anyway, changing start_paragraph is not ok, as that is the document API, so ODFdoc should leave it alone. You should add something to style instead if this cannot be globally changed. Serge, as main ODF author, what do you think? Is that tab there the correct way of handling this? I assume the idea is that 1 and 100 have a tab, so the text starts at the same position? Benny 2011/10/19 Doug Blank <dou...@gm...> > On Wed, Oct 19, 2011 at 7:35 AM, Matt Keenan <mat...@gm...> > wrote: > > Hi, > > > > Attempting to write a custom Descendant Report with my preferred > > output to date being ODF. > > > > However I'm seeing an issue where alignment is somewhat out because > > ODF start_paragraph method by default puts a tab white space after > > the leader (typically numbering system), if the leader is present. > > > > I'd like some means of overriding this tab to be a simple space > > instead., the two most obvious means to achieve this are : > > > > 1. Change the default behaviour in > > plugins/docgen/ODFDoc.py:start_paragraph() to simply print space > > instead of TAB > > > > - self.cntnt.write(leader + '<text:tab/>') > > + self.cntnt.write(leader + '<text: />') > > > > This would change the default behaviour for all ODF documents > > produced, which admittedly I feel would most likely not > > suit everybody. > > > > > > 2. Provided a new optional paramater to the start_paragraph() method, > > allowing for the custom provision of a leader_suffix > > e.g. > > > > Index: plugins/docgen/ODFDoc.py > > =================================================================== > > --- plugins/docgen/ODFDoc.py (revision 18351) > > +++ plugins/docgen/ODFDoc.py (working copy) > > @@ -1473,7 +1473,7 @@ > > """ > > self.cntnt.write('</text:p>\n') > > > > - def start_paragraph(self, style_name, leader=None): > > + def start_paragraph(self, style_name, leader=None, > leader_suffix=None): > > """ > > open a new paragraph > > """ > > @@ -1493,7 +1493,10 @@ > > ' text:outline-level="%s">' % str(self.level) > > ) > > if leader is not None: > > - self.cntnt.write(leader + '<text:tab/>') > > + if leader_suffix is not None: > > + self.cntnt.write(leader + '<text:%s/>' % > > (str(leader_suffix))) > > + else: > > + self.cntnt.write(leader + '<text:tab/>') > > self.new_cell = 0 > > > > > > In testing this works nicely for me, however changing this just ind > > ODFDoc.py would not be right, ideally it would have > > to be added everywhere in gramps where start_paragraph() is defined, > > which in trunk is currently : > > > > gen/plug/docgen/textdoc.py > > plugins/docgen/HtmlDoc.py > > plugins/docgen/AsciiDoc.py > > plugins/docgen/ODFDoc.py > > plugins/docgen/RTFDoc.py > > plugins/docgen/LaTeXDoc.py > > plugins/lib/libcairodoc.py > > docgen/TextBufDoc.py > > > > Wanted to ping the devel list to see if there is a better solution to > > my conundrum... > > > > thoughts ? > > Yes, I think that an override for a particular paragraph is > appropriate. It could also be an override that could change any > element of the style. For example, some pseudo code: > > def start_paragraph(self, style_name, **kwargs): > style = styles.get_draw_style(style_name) > for key in kwargs: > setattr(style, key, kwargs[key]) > > I have no idea if leader, nor leader_suffix are part of the style. But > if they were/are, and we add a kwargs option, then one could override > any aspect of the start_*() or write_*() methods. > > If you want to change the paragraph start for all paragraphs, though, > it seems that this should just be a style element that you change > once. > > I have no idea of the internals of this... just thinking out loud, and > hoping that we don't have to keep adding additional arguments to > override different aspects of each start/write. > > -Doug > > > Matt > > > > -- > > HH Golf Society > > www.hh-gs.com > > > > IFLAF > > www.iflaf.com > > > > > ------------------------------------------------------------------------------ > > All the data continuously generated in your IT infrastructure contains a > > definitive record of customers, application performance, security > > threats, fraudulent activity and more. Splunk takes this data and makes > > sense of it. Business sense. IT sense. Common sense. > > http://p.sf.net/sfu/splunk-d2d-oct > > _______________________________________________ > > Gramps-devel mailing list > > Gra...@li... > > https://lists.sourceforge.net/lists/listinfo/gramps-devel > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > |