diff --git a/ChangeLog b/ChangeLog index 483d5f1e1..07d8f3a74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-05-07 Don Allingham + * 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 * 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, diff --git a/src/BaseDoc.py b/src/BaseDoc.py index ef2b1e6c8..8cc655c5d 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -572,6 +572,7 @@ class ParagraphStyle: self.pad = source.pad self.bgcolor = source.bgcolor self.description = source.description + self.tabs = source.tabs else: self.font = FontStyle() self.rmargin = 0 @@ -588,6 +589,7 @@ class ParagraphStyle: self.pad = 0 self.bgcolor = (255, 255, 255) self.description = "" + self.tabs = [] def set_description(self, text): """ @@ -822,6 +824,13 @@ class ParagraphStyle: "returns the space below paragraph in centimeters" 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 diff --git a/src/ReportBase/_SimpleDoc.py b/src/ReportBase/_SimpleDoc.py index b7e82cbfd..e3a23381a 100644 --- a/src/ReportBase/_SimpleDoc.py +++ b/src/ReportBase/_SimpleDoc.py @@ -85,6 +85,7 @@ def make_basic_stylesheet(): fstyle.set_bold(True) pstyle.set_font(fstyle) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) + pstyle.set_tabs([4, 8, 12, 16]) sheet.add_paragraph_style('Header1', pstyle) pstyle = BaseDoc.ParagraphStyle() @@ -94,6 +95,7 @@ def make_basic_stylesheet(): fstyle.set_bold(True) pstyle.set_font(fstyle) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) + pstyle.set_tabs([4, 8, 12, 16]) sheet.add_paragraph_style('Header2', pstyle) pstyle = BaseDoc.ParagraphStyle() @@ -104,7 +106,10 @@ def make_basic_stylesheet(): fstyle.set_italic(True) pstyle.set_font(fstyle) pstyle.set_alignment(BaseDoc.PARA_ALIGN_LEFT) + pstyle.set_tabs([4, 8, 12, 16]) 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 diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py index 8c45bbb9d..e3b410c2c 100644 --- a/src/docgen/TextBufDoc.py +++ b/src/docgen/TextBufDoc.py @@ -128,6 +128,15 @@ class TextBufDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc): tag.set_property("pixels-below-lines", pixels(style.get_bottom_margin())) 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.buffer = gtk.TextBuffer(self.tag_table) return