2007-09-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/BaseDoc.py (PaperStyle): Allow custom margin setting in __init__. svn: r8980
This commit is contained in:
parent
b5d073c25c
commit
cd1d69fe12
@ -1,3 +1,6 @@
|
||||
2007-09-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||
* src/BaseDoc.py (PaperStyle): Allow custom margin setting in __init__.
|
||||
|
||||
2007-09-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
|
||||
* src/ReportBase/_ReportDialog.py: Cleanup.
|
||||
* src/glade/paper_settings.glade: Remove frames.
|
||||
|
@ -190,99 +190,100 @@ class PaperSize:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class PaperStyle:
|
||||
"""Define the various options for a sheet of paper.
|
||||
"""
|
||||
Defines the various options for a sheet of paper.
|
||||
"""
|
||||
def __init__(self, size, orientation):
|
||||
"""
|
||||
Creates a new paper style.
|
||||
def __init__(self, size, orientation,
|
||||
lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54):
|
||||
"""Create a new paper style.
|
||||
|
||||
@param size: size of the new style
|
||||
@type size: PaperSize
|
||||
@param orientation: page orientation
|
||||
@type orientation: PAPER_PORTRAIT or PAPER_LANDSCAPE
|
||||
|
||||
"""
|
||||
|
||||
self.__orientation = orientation
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
self.__size = PaperSize( size.get_name(),
|
||||
size.get_height(),
|
||||
size.get_width() )
|
||||
else:
|
||||
self.__size = PaperSize( size.get_name(),
|
||||
size.get_width(),
|
||||
size.get_height() )
|
||||
|
||||
self.__tmargin = 2.54
|
||||
self.__bmargin = 2.54
|
||||
self.__lmargin = 2.54
|
||||
self.__rmargin = 2.54
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
self.__size = PaperSize(size.get_name(),
|
||||
size.get_height(),
|
||||
size.get_width())
|
||||
else:
|
||||
self.__size = PaperSize(size.get_name(),
|
||||
size.get_width(),
|
||||
size.get_height())
|
||||
self.__lmargin = lmargin
|
||||
self.__rmargin = rmargin
|
||||
self.__tmargin = tmargin
|
||||
self.__bmargin = bmargin
|
||||
|
||||
def get_size(self):
|
||||
"""
|
||||
returns the size of the paper.
|
||||
"""Return the size of the paper.
|
||||
|
||||
@returns: object indicating the paper size
|
||||
@rtype: PaperSize
|
||||
|
||||
"""
|
||||
return self.__size
|
||||
|
||||
def get_orientation(self):
|
||||
"""
|
||||
returns the orientation of the page.
|
||||
"""Return the orientation of the page.
|
||||
|
||||
@returns: PAPER_PORTRIAT or PAPER_LANDSCAPE
|
||||
@rtype: int
|
||||
|
||||
"""
|
||||
return self.__orientation
|
||||
|
||||
def get_usable_width(self):
|
||||
"""
|
||||
Returns the width of the page area in centimeters. The value is
|
||||
the page width less the margins.
|
||||
"""Return the width of the page area in centimeters.
|
||||
|
||||
The value is the page width less the margins.
|
||||
|
||||
"""
|
||||
return self.__size.get_width() - (self.__rmargin + self.__lmargin)
|
||||
|
||||
def get_usable_height(self):
|
||||
"""
|
||||
Returns the height of the page area in centimeters. The value is
|
||||
the page height less the margins.
|
||||
"""Return the height of the page area in centimeters.
|
||||
|
||||
The value is the page height less the margins.
|
||||
|
||||
"""
|
||||
return self.__size.get_height() - (self.__tmargin + self.__bmargin)
|
||||
|
||||
def get_right_margin(self):
|
||||
"""
|
||||
Returns the right margin.
|
||||
"""Return the right margin.
|
||||
|
||||
@returns: Right margin in centimeters
|
||||
@rtype: float
|
||||
|
||||
"""
|
||||
return self.__rmargin
|
||||
|
||||
def get_left_margin(self):
|
||||
"""
|
||||
Returns the left margin.
|
||||
"""Return the left margin.
|
||||
|
||||
@returns: Left margin in centimeters
|
||||
@rtype: float
|
||||
|
||||
"""
|
||||
return self.__lmargin
|
||||
|
||||
def get_top_margin(self):
|
||||
"""
|
||||
Returns the top margin.
|
||||
"""Return the top margin.
|
||||
|
||||
@returns: Top margin in centimeters
|
||||
@rtype: float
|
||||
|
||||
"""
|
||||
return self.__tmargin
|
||||
|
||||
def get_bottom_margin(self):
|
||||
"""
|
||||
Returns the bottom margin.
|
||||
"""Return the bottom margin.
|
||||
|
||||
@returns: Bottom margin in centimeters
|
||||
@rtype: float
|
||||
|
||||
"""
|
||||
return self.__bmargin
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user