home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
p
/
python
/
pyhtmldoc
/
t
/
the_writer
< prev
next >
Wrap
Text File
|
1996-11-14
|
5KB
|
82 lines
<TITLE>The Writer Interface -- Python library reference</TITLE>
Next: <A HREF="../w/writer_implementations" TYPE="Next">Writer Implementations</A>
Prev: <A HREF="../f/formatter_implementations" TYPE="Prev">Formatter Implementations</A>
Up: <A HREF="../f/formatter" TYPE="Up">formatter</A>
Top: <A HREF="../t/top" TYPE="Top">Top</A>
<H2>10.10.3. The Writer Interface</H2>
Interfaces to create writers are dependent on the specific writer
class being instantiated. The interfaces described below are the
required interfaces which all writers must support once initialized.
Note that while most applications can use the <CODE>AbstractFormatter</CODE>
class as a formatter, the writer must typically be provided by the
application.
<P>
<DL><DT><B>new_alignment</B> (<VAR>align</VAR>) -- Method on writer object<DD>
Set the alignment style. The <CODE>align</CODE> value can be any object,
but by convention is a string or <CODE>None</CODE>, where <CODE>None</CODE>
indicates that the writer's ``preferred'' alignment should be used.
Conventional <CODE>align</CODE> values are <CODE>'left'</CODE>, <CODE>'center'</CODE>,
<CODE>'right'</CODE>, and <CODE>'justify'</CODE>.
</DL>
<DL><DT><B>new_font</B> (<VAR>font</VAR>) -- Method on writer object<DD>
Set the font style. The value of <CODE>font</CODE> will be <CODE>None</CODE>,
indicating that the device's default font should be used, or a tuple
of the form (<VAR>size</VAR>, <VAR>italic</VAR>, <VAR>bold</VAR>, <VAR>teletype</VAR>).
Size will be a string indicating the size of font that should be used;
specific strings and their interpretation must be defined by the
application. The <VAR>italic</VAR>, <VAR>bold</VAR>, and <VAR>teletype</VAR> values
are boolean indicators specifying which of those font attributes
should be used.
</DL>
<DL><DT><B>new_margin</B> (<VAR>margin</VAR>, <VAR>level</VAR>) -- Method on writer object<DD>
Set the margin level to the integer <CODE>level</CODE> and the logical tag
to <CODE>margin</CODE>. Interpretation of the logical tag is at the
writer's discretion; the only restriction on the value of the logical
tag is that it not be a false value for non-zero values of
<CODE>level</CODE>.
</DL>
<DL><DT><B>new_spacing</B> (<VAR>spacing</VAR>) -- Method on writer object<DD>
Set the spacing style to <CODE>spacing</CODE>.
</DL>
<DL><DT><B>new_styles</B> (<VAR>styles</VAR>) -- Method on writer object<DD>
Set additional styles. The <CODE>styles</CODE> value is a tuple of
arbitrary values; the value <CODE>AS_IS</CODE> should be ignored. The
<CODE>styles</CODE> tuple may be interpreted either as a set or as a stack
depending on the requirements of the application and writer
implementation.
</DL>
<DL><DT><B>send_line_break</B> () -- Method on writer object<DD>
Break the current line.
</DL>
<DL><DT><B>send_paragraph</B> (<VAR>blankline</VAR>) -- Method on writer object<DD>
Produce a paragraph separation of at least <CODE>blankline</CODE> blank
lines, or the equivelent. The <CODE>blankline</CODE> value will be an
integer.
</DL>
<DL><DT><B>send_hor_rule</B> (*<VAR>args</VAR>, **<VAR>kw</VAR>) -- Method on writer object<DD>
Display a horizontal rule on the output device. The arguments to this
method are entirely application- and writer-specific, and should be
interpreted with care. The method implementation may assume that a
line break has already been issued via <CODE>send_line_break()</CODE>.
</DL>
<DL><DT><B>send_flowing_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
Output character data which may be word-wrapped and re-flowed as
needed. Within any sequence of calls to this method, the writer may
assume that spans of multiple whitespace characters have been
collapsed to single space characters.
</DL>
<DL><DT><B>send_literal_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
Output character data which has already been formatted
for display. Generally, this should be interpreted to mean that line
breaks indicated by newline characters should be preserved and no new
line breaks should be introduced. The data may contain embedded
newline and tab characters, unlike data provided to the
<CODE>send_formatted_data()</CODE> interface.
</DL>
<DL><DT><B>send_label_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
Set <CODE>data</CODE> to the left of the current left margin, if possible.
The value of <CODE>data</CODE> is not restricted; treatment of non-string
values is entirely application- and writer-dependent. This method
will only be called at the beginning of a line.
</DL>