Package sabx10 :: Package pdf_gen :: Module instruction_pdf :: Class InstructionPdfGenerator
[hide private]
[frames] | no frames]

Class InstructionPdfGenerator

source code

object --+
         |
        InstructionPdfGenerator

Instance Methods [hide private]
 
__init__(self, title, out_dir, out_base)
Save the title, out_dir, and out_base, then setup the style sheet and column widths.
source code
(Paragraph,Paragraph,Paragraph,Paragraph)
_create_titles(self)
Create the column headers for the output table.
source code
list of (string,string,Paragraph,string)
_massage_table_data(self, table_data)
Turn the titles and generic table data into objects recognized and properly formatted by Reportlab.
source code
 
process_ride(self, index, distance, table_data)
Take table data for a ride and turn it into a PDF file containing the table.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, title, out_dir, out_base)
(Constructor)

source code 

Save the title, out_dir, and out_base, then setup the style sheet and column widths.

Parameters:
  • title (string) - base title for the PDF file
  • out_dir (string) - directory to write the PDF files to
  • out_base (string) - file name base for PDF files
Overrides: object.__init__

_create_titles(self)

source code 

Create the column headers for the output table.

Returns: (Paragraph,Paragraph,Paragraph,Paragraph)
tuple of Paragraphs containing ("Landmark", "Distance", "Description", "Length")

_massage_table_data(self, table_data)

source code 

Turn the titles and generic table data into objects recognized and properly formatted by Reportlab. Basically, turn the description field from a regular string into a Paragraph so it'll be wrapped properly.

Parameters:
  • table_data (list of (string,string,string,string)) - data to format
Returns: list of (string,string,Paragraph,string)
new list with processed data

process_ride(self, index, distance, table_data)

source code 

Take table data for a ride and turn it into a PDF file containing the table.

Parameters:
  • index (int) - index of ride
  • distance (float) - length of ride
  • table_data (list of (string,string,string,string)) - list of (landmark, distance, description, length)