home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / t / the_writer < prev    next >
Text File  |  1996-11-14  |  5KB  |  82 lines

  1. <TITLE>The Writer Interface -- Python library reference</TITLE>
  2. Next: <A HREF="../w/writer_implementations" TYPE="Next">Writer Implementations</A>  
  3. Prev: <A HREF="../f/formatter_implementations" TYPE="Prev">Formatter Implementations</A>  
  4. Up: <A HREF="../f/formatter" TYPE="Up">formatter</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H2>10.10.3. The Writer Interface</H2>
  7. Interfaces to create writers are dependent on the specific writer
  8. class being instantiated.  The interfaces described below are the
  9. required interfaces which all writers must support once initialized.
  10. Note that while most applications can use the <CODE>AbstractFormatter</CODE>
  11. class as a formatter, the writer must typically be provided by the
  12. application.
  13. <P>
  14. <DL><DT><B>new_alignment</B> (<VAR>align</VAR>) -- Method on writer object<DD>
  15. Set the alignment style.  The <CODE>align</CODE> value can be any object,
  16. but by convention is a string or <CODE>None</CODE>, where <CODE>None</CODE>
  17. indicates that the writer's ``preferred'' alignment should be used.
  18. Conventional <CODE>align</CODE> values are <CODE>'left'</CODE>, <CODE>'center'</CODE>,
  19. <CODE>'right'</CODE>, and <CODE>'justify'</CODE>.
  20. </DL>
  21. <DL><DT><B>new_font</B> (<VAR>font</VAR>) -- Method on writer object<DD>
  22. Set the font style.  The value of <CODE>font</CODE> will be <CODE>None</CODE>,
  23. indicating that the device's default font should be used, or a tuple
  24. of the form (<VAR>size</VAR>, <VAR>italic</VAR>, <VAR>bold</VAR>, <VAR>teletype</VAR>).
  25. Size will be a string indicating the size of font that should be used;
  26. specific strings and their interpretation must be defined by the
  27. application.  The <VAR>italic</VAR>, <VAR>bold</VAR>, and <VAR>teletype</VAR> values
  28. are boolean indicators specifying which of those font attributes
  29. should be used.
  30. </DL>
  31. <DL><DT><B>new_margin</B> (<VAR>margin</VAR>, <VAR>level</VAR>) -- Method on writer object<DD>
  32. Set the margin level to the integer <CODE>level</CODE> and the logical tag
  33. to <CODE>margin</CODE>.  Interpretation of the logical tag is at the
  34. writer's discretion; the only restriction on the value of the logical
  35. tag is that it not be a false value for non-zero values of
  36. <CODE>level</CODE>.
  37. </DL>
  38. <DL><DT><B>new_spacing</B> (<VAR>spacing</VAR>) -- Method on writer object<DD>
  39. Set the spacing style to <CODE>spacing</CODE>.
  40. </DL>
  41. <DL><DT><B>new_styles</B> (<VAR>styles</VAR>) -- Method on writer object<DD>
  42. Set additional styles.  The <CODE>styles</CODE> value is a tuple of
  43. arbitrary values; the value <CODE>AS_IS</CODE> should be ignored.  The
  44. <CODE>styles</CODE> tuple may be interpreted either as a set or as a stack
  45. depending on the requirements of the application and writer
  46. implementation.
  47. </DL>
  48. <DL><DT><B>send_line_break</B> () -- Method on writer object<DD>
  49. Break the current line.
  50. </DL>
  51. <DL><DT><B>send_paragraph</B> (<VAR>blankline</VAR>) -- Method on writer object<DD>
  52. Produce a paragraph separation of at least <CODE>blankline</CODE> blank
  53. lines, or the equivelent.  The <CODE>blankline</CODE> value will be an
  54. integer.
  55. </DL>
  56. <DL><DT><B>send_hor_rule</B> (*<VAR>args</VAR>, **<VAR>kw</VAR>) -- Method on writer object<DD>
  57. Display a horizontal rule on the output device.  The arguments to this
  58. method are entirely application- and writer-specific, and should be
  59. interpreted with care.  The method implementation may assume that a
  60. line break has already been issued via <CODE>send_line_break()</CODE>.
  61. </DL>
  62. <DL><DT><B>send_flowing_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
  63. Output character data which may be word-wrapped and re-flowed as
  64. needed.  Within any sequence of calls to this method, the writer may
  65. assume that spans of multiple whitespace characters have been
  66. collapsed to single space characters.
  67. </DL>
  68. <DL><DT><B>send_literal_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
  69. Output character data which has already been formatted
  70. for display.  Generally, this should be interpreted to mean that line
  71. breaks indicated by newline characters should be preserved and no new
  72. line breaks should be introduced.  The data may contain embedded
  73. newline and tab characters, unlike data provided to the
  74. <CODE>send_formatted_data()</CODE> interface.
  75. </DL>
  76. <DL><DT><B>send_label_data</B> (<VAR>data</VAR>) -- Method on writer object<DD>
  77. Set <CODE>data</CODE> to the left of the current left margin, if possible.
  78. The value of <CODE>data</CODE> is not restricted; treatment of non-string
  79. values is entirely application- and writer-dependent.  This method
  80. will only be called at the beginning of a line.
  81. </DL>
  82.