Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina7479 committed Jul 15, 2014
1 parent a6423f8 commit 7d83db6
Showing 1 changed file with 15 additions and 50 deletions.
65 changes: 15 additions & 50 deletions pypdflite/pdfdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class PDFDocument(object):

""" The Document object is the base class that
is used to add and manage the content of the
pdf file.
Expand Down Expand Up @@ -70,9 +69,7 @@ def _set_defaults(self):

def _set_color_scheme(self, draw_color=None, fill_color=None, text_color=None):
""" Default color object is black letters
& black lines.
"""
& black lines."""
if draw_color is None:
draw_color = PDFColor()
draw_color._set_type('d')
Expand Down Expand Up @@ -106,11 +103,8 @@ def set_draw_color(self, color):
raise ValueError("Not a PDFColor instance")

def _set_default_font(self):
""" Internal method to set the
initial default font. Change
the font using set_font method.
"""
""" Internal method to set the initial default font. Change
the font using set_font method."""
self.font = PDFFont(self.session)
self.font._set_index()
self.fonts.append(self.font)
Expand All @@ -123,11 +117,8 @@ def get_color():
# Public methods, main interface
# Pages
def add_page(self, page=None):
""" May generate and add a PDFPage
separately, or use this to generate
a default page.
"""
""" May generate and add a PDFPage separately, or use this to generate
a default page."""
if page is None:
self.page = PDFPage(self.orientation_default, self.layout_default, self.margins)
else:
Expand Down Expand Up @@ -185,15 +176,8 @@ def set_cursor(self, x=None, y=None):

# Font
def set_font(self, family=None, style='', size=None, font=None):
""" Set the document font object, size given in points.
If family, style, and/or size is given, generates
a new Font object, checks to see if it is already
in use, and selects it.
May also use the font keyword to add an already
instantiated PDFFont object.
"""
""" Set the document font object, size given in points. If family, style, and/or size is given, generates
a new Font object, checks to see if it is already in use, and selects it. """
if font:
testfont = font
elif isinstance(family, PDFFont):
Expand Down Expand Up @@ -233,9 +217,7 @@ def set_font(self, family=None, style='', size=None, font=None):

def get_font(self):
""" Get the current font object. Useful for storing
in variables, and switching between styles.
"""
in variables, and switching between styles. """
return self.font

def set_font_size(self, size):
Expand All @@ -253,15 +235,8 @@ def print_available_fonts(self):

# Writing
def add_text(self, text, cursor=None):
""" Input text, short or long. Writes in order, within the
pre-defined page boundaries. Use add_newline as a return
character. Sequential add_text commands will print without
additional whitespace.
Currently all "left-justified", although that may change in
future version.
"""
""" Input text, short or long. Writes in order, within the defined page boundaries. Sequential add_text commands will print without
additional whitespace. """
if cursor is None:
cursor = self.page.cursor

Expand All @@ -286,8 +261,7 @@ def double_space(self, multiplier=1):

def add_newline(self, number=1):
""" Starts over again at the new line. If number is specified,
it will leave multiple lines.
"""
it will leave multiple lines."""
if isinstance(number, int):
try:
self.page._add_newline(self.font, number, self.double_spacing)
Expand Down Expand Up @@ -551,7 +525,6 @@ def add_multi_bar_chart(self, data, cursor, width, height, title=None, axis_titl
self.set_draw_color(save_draw_color)
self.set_fill_color(save_fill_color)


def add_pie_chart(self, data, cursor, width, height, title=None, data_type="raw", fill_colors=None, labels=False, background_style='S', border_size=1, background_border_color=None, background_fill_color=None, padding=0.1, legend=None):
""" Data type may be "raw" or "percent" """
save_draw_color = self.draw_color
Expand Down Expand Up @@ -652,9 +625,7 @@ def _get_image(self, image_name):

def _output_pages(self):
""" Called by the PDFLite object to prompt creating
the page objects.
"""
the page objects."""
if self.orientation_changes is None:
self._get_orientation_changes()
else:
Expand Down Expand Up @@ -722,9 +693,7 @@ def _add_page_number(self, page, number_of_pages):

def _get_orientation_changes(self):
""" Returns a list of the pages that have
orientation changes.
"""
orientation changes."""
self.orientation_changes = []
for page in self.pages:
if page.orientation_change is True:
Expand All @@ -747,9 +716,7 @@ def _register_new_font(self, font):

def _output_fonts(self):
""" Called by the PDFLite object to prompt creating
the font objects.
"""
the font objects."""
self.session._save_object_number()
self._output_encoding_diffs()
self._output_font_files()
Expand Down Expand Up @@ -778,9 +745,7 @@ def _register_new_image(self, image):

def _output_images(self):
""" Creates reference images, that can be
drawn throughout the document.
"""
drawn throughout the document."""
for image in self.images:
obj = self.session._add_object()
image._set_number(obj.id)
Expand Down

0 comments on commit 7d83db6

Please sign in to comment.