From f53f1abc2180331325a23e702d172270913def78 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Mon, 19 Feb 2007 04:13:41 +0000 Subject: [PATCH] * src/ReportBase/_PaperMenu.py: rename PaperStyle to PaperSize * src/docgen/HtmlDoc.py: rename PaperStyle to PaperSize * src/BaseDoc.py: rename PaperStyle to PaperSize * src/plugins/Calendar.py: don't use tmargin svn: r8166 --- ChangeLog | 6 +++++ src/BaseDoc.py | 20 +++------------- src/ReportBase/_PaperMenu.py | 44 ++++++++++++++++++------------------ src/docgen/HtmlDoc.py | 2 +- src/plugins/Calendar.py | 2 +- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cd3c66f2..a88b6706b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-02-18 Brian Matherly + * src/ReportBase/_PaperMenu.py: rename PaperStyle to PaperSize + * src/docgen/HtmlDoc.py: rename PaperStyle to PaperSize + * src/BaseDoc.py: rename PaperStyle to PaperSize + * src/plugins/Calendar.py: don't use tmargin + 2007-02-18 Brian Matherly * src/plugins/AncestorChart2.py: Use a dict instead of an array to use less memory. diff --git a/src/BaseDoc.py b/src/BaseDoc.py index 2552d1efc..14140cf68 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -163,10 +163,10 @@ def cnv2color(text): #------------------------------------------------------------------------ # -# PaperStyle +# PaperSize # #------------------------------------------------------------------------ -class PaperStyle: +class PaperSize: """ Defines the dimensions of a sheet of paper. All dimensions are in centimeters. @@ -180,7 +180,6 @@ class PaperStyle: @param width: page width in centimeters """ self.name = name - self.orientation = PAPER_PORTRAIT self.height = height self.width = width @@ -188,19 +187,6 @@ class PaperStyle: "Returns the name of the paper style" return self.name - def get_orientation(self): - "Returns the page orientation (PAPER_PORTRAIT or PAPER_LANDSCAPE)" - return self.orientation - - def set_orientation(self, val): - """ - Sets the page orientation. - - @param val: new orientation, should be either PAPER_PORTRAIT or - PAPER_LANDSCAPE - """ - self.orientation = val - def get_height(self): "Returns the page height in cm" return self.height @@ -1195,7 +1181,7 @@ class BaseDoc: only through a derived class. @param styles: StyleSheet containing the paragraph styles used. - @param paper_type: PaperStyle instance containing information about + @param paper_type: PaperSize instance containing information about the paper. If set to None, then the document is not a page oriented document (e.g. HTML) @param template: Format template for document generators that are diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py index b0be8f0a0..6af7a3338 100644 --- a/src/ReportBase/_PaperMenu.py +++ b/src/ReportBase/_PaperMenu.py @@ -165,7 +165,7 @@ class PageSizeParser(handler.ContentHandler): name = attrs['name'] height = Utils.gfloat(attrs['height']) width = Utils.gfloat(attrs['width']) - self.paper_list.append(BaseDoc.PaperStyle(name,height,width)) + self.paper_list.append(BaseDoc.PaperSize(name,height,width)) #------------------------------------------------------------------------- # @@ -176,27 +176,27 @@ try: parser = make_parser() parser.setContentHandler(PageSizeParser(paper_sizes)) parser.parse(const.papersize) - paper_sizes.append(BaseDoc.PaperStyle(_("Custom Size"),-1,-1)) + paper_sizes.append(BaseDoc.PaperSize(_("Custom Size"),-1,-1)) except (IOError,OSError,SAXParseException): paper_sizes = [ - BaseDoc.PaperStyle("Letter",27.94,21.59), - BaseDoc.PaperStyle("Legal",35.56,21.59), - BaseDoc.PaperStyle("A0",118.9,84.1), - BaseDoc.PaperStyle("A1",84.1,59.4), - BaseDoc.PaperStyle("A2",59.4,42.0), - BaseDoc.PaperStyle("A3",42.0,29.7), - BaseDoc.PaperStyle("A4",29.7,21.0), - BaseDoc.PaperStyle("A5",21.0,14.8), - BaseDoc.PaperStyle("B0",141.4,100.0), - BaseDoc.PaperStyle("B1",100.0,70.7), - BaseDoc.PaperStyle("B2",70.7,50.0), - BaseDoc.PaperStyle("B3",50.0,35.3), - BaseDoc.PaperStyle("B4",35.3,25.0), - BaseDoc.PaperStyle("B5",25.0,17.6), - BaseDoc.PaperStyle("B6",17.6,12.5), - BaseDoc.PaperStyle("B",43.18,27.94), - BaseDoc.PaperStyle("C",56.1,43.18), - BaseDoc.PaperStyle("D",86.36, 56.1), - BaseDoc.PaperStyle("E",111.76,86.36), - BaseDoc.PaperStyle(_("Custom Size"),-1,-1) + BaseDoc.PaperSize("Letter",27.94,21.59), + BaseDoc.PaperSize("Legal",35.56,21.59), + BaseDoc.PaperSize("A0",118.9,84.1), + BaseDoc.PaperSize("A1",84.1,59.4), + BaseDoc.PaperSize("A2",59.4,42.0), + BaseDoc.PaperSize("A3",42.0,29.7), + BaseDoc.PaperSize("A4",29.7,21.0), + BaseDoc.PaperSize("A5",21.0,14.8), + BaseDoc.PaperSize("B0",141.4,100.0), + BaseDoc.PaperSize("B1",100.0,70.7), + BaseDoc.PaperSize("B2",70.7,50.0), + BaseDoc.PaperSize("B3",50.0,35.3), + BaseDoc.PaperSize("B4",35.3,25.0), + BaseDoc.PaperSize("B5",25.0,17.6), + BaseDoc.PaperSize("B6",17.6,12.5), + BaseDoc.PaperSize("B",43.18,27.94), + BaseDoc.PaperSize("C",56.1,43.18), + BaseDoc.PaperSize("D",86.36, 56.1), + BaseDoc.PaperSize("E",111.76,86.36), + BaseDoc.PaperSize(_("Custom Size"),-1,-1) ] diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 4629c2bc2..0a7a434a5 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -97,7 +97,7 @@ _bottom = [ class HtmlDoc(BaseDoc.BaseDoc): def __init__(self,styles,type,template,orientation): - BaseDoc.BaseDoc.__init__(self,styles,BaseDoc.PaperStyle("",0,0),template,None) + BaseDoc.BaseDoc.__init__(self,styles,BaseDoc.PaperSize("",0,0),template,None) self.year = time.localtime(time.time())[0] self.ext = '.html' self.meta = "" diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index 3f67f2209..a22a79437 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -197,7 +197,7 @@ class Calendar(Report): self.doc.start_page() width = self.doc.get_usable_width() height = self.doc.get_usable_height() - header = self.doc.tmargin + header = 2.54 # one inch self.draw_rectangle("CAL-Border", 0, 0, width, height) self.doc.draw_bar("CAL-Title", 0, 0, width, header) self.doc.draw_line("CAL-Border", 0, header, width, header)