DOC show inheritance of printer-objects in documentation

This commit is contained in:
Patrick Kanzler 2016-03-08 20:06:19 +01:00
parent d96dcd8e7e
commit 4cfc4fd564
2 changed files with 26 additions and 0 deletions

View File

@ -35,6 +35,8 @@ extensions = [
'sphinx.ext.coverage', 'sphinx.ext.coverage',
'sphinx.ext.viewcode', 'sphinx.ext.viewcode',
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram',
] ]
# enable todos # enable todos

View File

@ -20,6 +20,12 @@ class Usb(Escpos):
""" USB printer """ USB printer
This class describes a printer that natively speaks USB. This class describes a printer that natively speaks USB.
inheritance:
.. inheritance-diagram:: escpos.printer.Usb
:parts: 1
""" """
def __init__(self, idVendor, idProduct, interface=0, in_ep=0x82, out_ep=0x01, *args, **kwargs): def __init__(self, idVendor, idProduct, interface=0, in_ep=0x82, out_ep=0x01, *args, **kwargs):
@ -82,6 +88,12 @@ class Serial(Escpos):
""" Serial printer """ Serial printer
This class describes a printer that is connected by serial interface. This class describes a printer that is connected by serial interface.
inheritance:
.. inheritance-diagram:: escpos.printer.Serial
:parts: 1
""" """
def __init__(self, devfile="/dev/ttyS0", baudrate=9600, bytesize=8, timeout=1, def __init__(self, devfile="/dev/ttyS0", baudrate=9600, bytesize=8, timeout=1,
@ -150,6 +162,12 @@ class Network(Escpos):
Then you should be able to attach to port ``4242`` with this class. Then you should be able to attach to port ``4242`` with this class.
Otherwise the normal usecase would be to have a printer with ethernet interface. This type of printer should Otherwise the normal usecase would be to have a printer with ethernet interface. This type of printer should
work the same with this class. For the address of the printer check its manuals. work the same with this class. For the address of the printer check its manuals.
inheritance:
.. inheritance-diagram:: escpos.printer.Network
:parts: 1
""" """
def __init__(self, host, port=9100, timeout=60, *args, **kwargs): def __init__(self, host, port=9100, timeout=60, *args, **kwargs):
@ -192,6 +210,12 @@ class File(Escpos):
This class is used for parallel port printer or other printers that are directly attached to the filesystem. This class is used for parallel port printer or other printers that are directly attached to the filesystem.
Note that you should stay away from using USB-to-Parallel-Adapter since they are unreliable Note that you should stay away from using USB-to-Parallel-Adapter since they are unreliable
and produce arbitrary errors. and produce arbitrary errors.
inheritance:
.. inheritance-diagram:: escpos.printer.File
:parts: 1
""" """
def __init__(self, devfile="/dev/usb/lp0", *args, **kwargs): def __init__(self, devfile="/dev/usb/lp0", *args, **kwargs):