* 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
This commit is contained in:
Brian Matherly 2007-02-19 04:13:41 +00:00
parent cd68d34841
commit f53f1abc21
5 changed files with 33 additions and 41 deletions

View File

@ -1,3 +1,9 @@
2007-02-18 Brian Matherly <brian@gramps-project.org>
* 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 <brian@gramps-project.org> 2007-02-18 Brian Matherly <brian@gramps-project.org>
* src/plugins/AncestorChart2.py: Use a dict instead of an array to use less * src/plugins/AncestorChart2.py: Use a dict instead of an array to use less
memory. memory.

View File

@ -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 Defines the dimensions of a sheet of paper. All dimensions are in
centimeters. centimeters.
@ -180,7 +180,6 @@ class PaperStyle:
@param width: page width in centimeters @param width: page width in centimeters
""" """
self.name = name self.name = name
self.orientation = PAPER_PORTRAIT
self.height = height self.height = height
self.width = width self.width = width
@ -188,19 +187,6 @@ class PaperStyle:
"Returns the name of the paper style" "Returns the name of the paper style"
return self.name 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): def get_height(self):
"Returns the page height in cm" "Returns the page height in cm"
return self.height return self.height
@ -1195,7 +1181,7 @@ class BaseDoc:
only through a derived class. only through a derived class.
@param styles: StyleSheet containing the paragraph styles used. @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 the paper. If set to None, then the document is not a page
oriented document (e.g. HTML) oriented document (e.g. HTML)
@param template: Format template for document generators that are @param template: Format template for document generators that are

View File

@ -165,7 +165,7 @@ class PageSizeParser(handler.ContentHandler):
name = attrs['name'] name = attrs['name']
height = Utils.gfloat(attrs['height']) height = Utils.gfloat(attrs['height'])
width = Utils.gfloat(attrs['width']) 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 = make_parser()
parser.setContentHandler(PageSizeParser(paper_sizes)) parser.setContentHandler(PageSizeParser(paper_sizes))
parser.parse(const.papersize) 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): except (IOError,OSError,SAXParseException):
paper_sizes = [ paper_sizes = [
BaseDoc.PaperStyle("Letter",27.94,21.59), BaseDoc.PaperSize("Letter",27.94,21.59),
BaseDoc.PaperStyle("Legal",35.56,21.59), BaseDoc.PaperSize("Legal",35.56,21.59),
BaseDoc.PaperStyle("A0",118.9,84.1), BaseDoc.PaperSize("A0",118.9,84.1),
BaseDoc.PaperStyle("A1",84.1,59.4), BaseDoc.PaperSize("A1",84.1,59.4),
BaseDoc.PaperStyle("A2",59.4,42.0), BaseDoc.PaperSize("A2",59.4,42.0),
BaseDoc.PaperStyle("A3",42.0,29.7), BaseDoc.PaperSize("A3",42.0,29.7),
BaseDoc.PaperStyle("A4",29.7,21.0), BaseDoc.PaperSize("A4",29.7,21.0),
BaseDoc.PaperStyle("A5",21.0,14.8), BaseDoc.PaperSize("A5",21.0,14.8),
BaseDoc.PaperStyle("B0",141.4,100.0), BaseDoc.PaperSize("B0",141.4,100.0),
BaseDoc.PaperStyle("B1",100.0,70.7), BaseDoc.PaperSize("B1",100.0,70.7),
BaseDoc.PaperStyle("B2",70.7,50.0), BaseDoc.PaperSize("B2",70.7,50.0),
BaseDoc.PaperStyle("B3",50.0,35.3), BaseDoc.PaperSize("B3",50.0,35.3),
BaseDoc.PaperStyle("B4",35.3,25.0), BaseDoc.PaperSize("B4",35.3,25.0),
BaseDoc.PaperStyle("B5",25.0,17.6), BaseDoc.PaperSize("B5",25.0,17.6),
BaseDoc.PaperStyle("B6",17.6,12.5), BaseDoc.PaperSize("B6",17.6,12.5),
BaseDoc.PaperStyle("B",43.18,27.94), BaseDoc.PaperSize("B",43.18,27.94),
BaseDoc.PaperStyle("C",56.1,43.18), BaseDoc.PaperSize("C",56.1,43.18),
BaseDoc.PaperStyle("D",86.36, 56.1), BaseDoc.PaperSize("D",86.36, 56.1),
BaseDoc.PaperStyle("E",111.76,86.36), BaseDoc.PaperSize("E",111.76,86.36),
BaseDoc.PaperStyle(_("Custom Size"),-1,-1) BaseDoc.PaperSize(_("Custom Size"),-1,-1)
] ]

View File

@ -97,7 +97,7 @@ _bottom = [
class HtmlDoc(BaseDoc.BaseDoc): class HtmlDoc(BaseDoc.BaseDoc):
def __init__(self,styles,type,template,orientation): 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.year = time.localtime(time.time())[0]
self.ext = '.html' self.ext = '.html'
self.meta = "" self.meta = ""

View File

@ -197,7 +197,7 @@ class Calendar(Report):
self.doc.start_page() self.doc.start_page()
width = self.doc.get_usable_width() width = self.doc.get_usable_width()
height = self.doc.get_usable_height() 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.draw_rectangle("CAL-Border", 0, 0, width, height)
self.doc.draw_bar("CAL-Title", 0, 0, width, header) self.doc.draw_bar("CAL-Title", 0, 0, width, header)
self.doc.draw_line("CAL-Border", 0, header, width, header) self.doc.draw_line("CAL-Border", 0, header, width, header)