2007-05-07 Don Allingham <don@gramps-project.org>

* src/ReportBase/_SimpleDoc.py: add support for tabs
	* src/BaseDoc.py: add support for tabs	
	* src/docgen/TextBufDoc.py: add support for tabs



svn: r8443
This commit is contained in:
Don Allingham 2007-05-08 02:56:33 +00:00
parent c5916814e8
commit 87764d64c0
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2007-05-07 Don Allingham <don@gramps-project.org>
* src/ReportBase/_SimpleDoc.py: add support for tabs
* src/BaseDoc.py: add support for tabs
* src/docgen/TextBufDoc.py: add support for tabs
2007-05-07 Benny Malengier <bm@cage.ugent.be> 2007-05-07 Benny Malengier <bm@cage.ugent.be>
* src/GrampsDb/_GrampsBSDDB.py: upgrade of grdb now sets correct notetype, and * src/GrampsDb/_GrampsBSDDB.py: upgrade of grdb now sets correct notetype, and
inherits the public/private setting of the parent object it is created from, inherits the public/private setting of the parent object it is created from,

View File

@ -572,6 +572,7 @@ class ParagraphStyle:
self.pad = source.pad self.pad = source.pad
self.bgcolor = source.bgcolor self.bgcolor = source.bgcolor
self.description = source.description self.description = source.description
self.tabs = source.tabs
else: else:
self.font = FontStyle() self.font = FontStyle()
self.rmargin = 0 self.rmargin = 0
@ -588,6 +589,7 @@ class ParagraphStyle:
self.pad = 0 self.pad = 0
self.bgcolor = (255, 255, 255) self.bgcolor = (255, 255, 255)
self.description = "" self.description = ""
self.tabs = []
def set_description(self, text): def set_description(self, text):
""" """
@ -822,6 +824,13 @@ class ParagraphStyle:
"returns the space below paragraph in centimeters" "returns the space below paragraph in centimeters"
return self.bmargin return self.bmargin
def set_tabs(self, tab_stops):
assert(type(tab_stops) == type([]))
self.tabs = tab_stops
def get_tabs(self):
return self.tabs
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# StyleSheetList # StyleSheetList

View File

@ -85,6 +85,7 @@ def make_basic_stylesheet():
fstyle.set_bold(True) fstyle.set_bold(True)
pstyle.set_font(fstyle) pstyle.set_font(fstyle)
pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
pstyle.set_tabs([4, 8, 12, 16])
sheet.add_paragraph_style('Header1', pstyle) sheet.add_paragraph_style('Header1', pstyle)
pstyle = BaseDoc.ParagraphStyle() pstyle = BaseDoc.ParagraphStyle()
@ -94,6 +95,7 @@ def make_basic_stylesheet():
fstyle.set_bold(True) fstyle.set_bold(True)
pstyle.set_font(fstyle) pstyle.set_font(fstyle)
pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
pstyle.set_tabs([4, 8, 12, 16])
sheet.add_paragraph_style('Header2', pstyle) sheet.add_paragraph_style('Header2', pstyle)
pstyle = BaseDoc.ParagraphStyle() pstyle = BaseDoc.ParagraphStyle()
@ -104,7 +106,10 @@ def make_basic_stylesheet():
fstyle.set_italic(True) fstyle.set_italic(True)
pstyle.set_font(fstyle) pstyle.set_font(fstyle)
pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
pstyle.set_tabs([4, 8, 12, 16])
sheet.add_paragraph_style('Header3', pstyle) sheet.add_paragraph_style('Header3', pstyle)
sheet.add_paragraph_style('Normal', BaseDoc.ParagraphStyle()) pstyle = BaseDoc.ParagraphStyle()
pstyle.set_tabs([4, 8, 12, 16])
sheet.add_paragraph_style('Normal', pstyle)
return sheet return sheet

View File

@ -128,6 +128,15 @@ class TextBufDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc):
tag.set_property("pixels-below-lines", pixels(style.get_bottom_margin())) tag.set_property("pixels-below-lines", pixels(style.get_bottom_margin()))
tag.set_property("wrap-mode", gtk.WRAP_WORD) tag.set_property("wrap-mode", gtk.WRAP_WORD)
new_tabs = style.get_tabs()
tab_array = pango.TabArray(len(new_tabs)+1,True)
index = 0
for tab in [ pixels(x) for x in new_tabs ]:
tab_array.set_tab(index, pango.TAB_LEFT, tab)
index += 1
tag.set_property("tabs", tab_array)
self.tag_table.add(tag) self.tag_table.add(tag)
self.buffer = gtk.TextBuffer(self.tag_table) self.buffer = gtk.TextBuffer(self.tag_table)
return return