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:
Zsolt Foldvari 2007-09-16 10:56:01 +00:00
parent b5d073c25c
commit cd1d69fe12
2 changed files with 40 additions and 36 deletions

View File

@ -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> 2007-09-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/ReportBase/_ReportDialog.py: Cleanup. * src/ReportBase/_ReportDialog.py: Cleanup.
* src/glade/paper_settings.glade: Remove frames. * src/glade/paper_settings.glade: Remove frames.

View File

@ -190,20 +190,20 @@ class PaperSize:
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class PaperStyle: 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,
""" lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54):
def __init__(self, size, orientation): """Create a new paper style.
"""
Creates a new paper style.
@param size: size of the new style @param size: size of the new style
@type size: PaperSize @type size: PaperSize
@param orientation: page orientation @param orientation: page orientation
@type orientation: PAPER_PORTRAIT or PAPER_LANDSCAPE @type orientation: PAPER_PORTRAIT or PAPER_LANDSCAPE
"""
"""
self.__orientation = orientation self.__orientation = orientation
if orientation == PAPER_PORTRAIT: if orientation == PAPER_PORTRAIT:
self.__size = PaperSize(size.get_name(), self.__size = PaperSize(size.get_name(),
size.get_height(), size.get_height(),
@ -212,77 +212,78 @@ class PaperStyle:
self.__size = PaperSize(size.get_name(), self.__size = PaperSize(size.get_name(),
size.get_width(), size.get_width(),
size.get_height()) size.get_height())
self.__lmargin = lmargin
self.__tmargin = 2.54 self.__rmargin = rmargin
self.__bmargin = 2.54 self.__tmargin = tmargin
self.__lmargin = 2.54 self.__bmargin = bmargin
self.__rmargin = 2.54
def get_size(self): def get_size(self):
""" """Return the size of the paper.
returns the size of the paper.
@returns: object indicating the paper size @returns: object indicating the paper size
@rtype: PaperSize @rtype: PaperSize
""" """
return self.__size return self.__size
def get_orientation(self): def get_orientation(self):
""" """Return the orientation of the page.
returns the orientation of the page.
@returns: PAPER_PORTRIAT or PAPER_LANDSCAPE @returns: PAPER_PORTRIAT or PAPER_LANDSCAPE
@rtype: int @rtype: int
""" """
return self.__orientation return self.__orientation
def get_usable_width(self): def get_usable_width(self):
""" """Return the width of the page area in centimeters.
Returns the width of the page area in centimeters. The value is
the page width less the margins. The value is the page width less the margins.
""" """
return self.__size.get_width() - (self.__rmargin + self.__lmargin) return self.__size.get_width() - (self.__rmargin + self.__lmargin)
def get_usable_height(self): def get_usable_height(self):
""" """Return the height of the page area in centimeters.
Returns the height of the page area in centimeters. The value is
the page height less the margins. The value is the page height less the margins.
""" """
return self.__size.get_height() - (self.__tmargin + self.__bmargin) return self.__size.get_height() - (self.__tmargin + self.__bmargin)
def get_right_margin(self): def get_right_margin(self):
""" """Return the right margin.
Returns the right margin.
@returns: Right margin in centimeters @returns: Right margin in centimeters
@rtype: float @rtype: float
""" """
return self.__rmargin return self.__rmargin
def get_left_margin(self): def get_left_margin(self):
""" """Return the left margin.
Returns the left margin.
@returns: Left margin in centimeters @returns: Left margin in centimeters
@rtype: float @rtype: float
""" """
return self.__lmargin return self.__lmargin
def get_top_margin(self): def get_top_margin(self):
""" """Return the top margin.
Returns the top margin.
@returns: Top margin in centimeters @returns: Top margin in centimeters
@rtype: float @rtype: float
""" """
return self.__tmargin return self.__tmargin
def get_bottom_margin(self): def get_bottom_margin(self):
""" """Return the bottom margin.
Returns the bottom margin.
@returns: Bottom margin in centimeters @returns: Bottom margin in centimeters
@rtype: float @rtype: float
""" """
return self.__bmargin return self.__bmargin