Clarifiy and update usage.rst
relevant to #230 clarifies the config-file in the usage.rst
This commit is contained in:
parent
7c17141fb2
commit
4882c31531
|
@ -1,6 +1,7 @@
|
||||||
*****
|
*****
|
||||||
Usage
|
Usage
|
||||||
*****
|
*****
|
||||||
|
:Last Reviewed: 2017-06-10
|
||||||
|
|
||||||
Define your printer
|
Define your printer
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -133,13 +134,13 @@ format. For windows it is probably at::
|
||||||
|
|
||||||
And for linux::
|
And for linux::
|
||||||
|
|
||||||
$HOME/.config/python-escpos/config.yaml
|
$HOME/.config/python-escpos/config.yaml
|
||||||
|
|
||||||
If you aren't sure, run::
|
If you aren't sure, run::
|
||||||
|
|
||||||
from escpos import config
|
from escpos import config
|
||||||
c = config.Config()
|
c = config.Config()
|
||||||
c.load()
|
c.load()
|
||||||
|
|
||||||
If it can't find the configuration file in the default location, it will tell
|
If it can't find the configuration file in the default location, it will tell
|
||||||
you where it's looking. You can always pass a path, or a list of paths, to
|
you where it's looking. You can always pass a path, or a list of paths, to
|
||||||
|
@ -147,9 +148,9 @@ the ``load()`` method.
|
||||||
|
|
||||||
To load the configured printer, run::
|
To load the configured printer, run::
|
||||||
|
|
||||||
from escpos import config
|
from escpos import config
|
||||||
c = config.Config()
|
c = config.Config()
|
||||||
printer = c.printer()
|
printer = c.printer()
|
||||||
|
|
||||||
|
|
||||||
The printer section
|
The printer section
|
||||||
|
@ -157,23 +158,34 @@ The printer section
|
||||||
|
|
||||||
The ``printer`` configuration section defines a default printer to create.
|
The ``printer`` configuration section defines a default printer to create.
|
||||||
|
|
||||||
The only required paramter is ``type``. The value of this should be one of the
|
The only required paramter is ``type``. The value of this has to be one of the
|
||||||
printers defined in :doc:`/user/printers`.
|
printers defined in :doc:`/user/printers`.
|
||||||
|
|
||||||
The rest of the parameters are whatever you want to pass to the printer.
|
The rest of the given parameters will be passed on to the initialization of the printer class.
|
||||||
|
Use these to overwrite the default values as specified in :doc:`/user/printers`.
|
||||||
|
This implies that the parameters have to match the parameter-names of the respective printer class.
|
||||||
|
|
||||||
An example file printer::
|
An example file printer::
|
||||||
|
|
||||||
printer:
|
printer:
|
||||||
type: File
|
type: File
|
||||||
devfile: /dev/someprinter
|
devfile: /dev/someprinter
|
||||||
|
|
||||||
And for a network printer::
|
And for a network printer::
|
||||||
|
|
||||||
printer:
|
printer:
|
||||||
type: network
|
type: Network
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
|
An USB-printer could be defined by::
|
||||||
|
|
||||||
|
printer:
|
||||||
|
type: Usb
|
||||||
|
idVendor: 0x1234
|
||||||
|
idProduct: 0x5678
|
||||||
|
in_ep: 0x66
|
||||||
|
out_ep: 0x01
|
||||||
|
|
||||||
Printing text right
|
Printing text right
|
||||||
-------------------
|
-------------------
|
||||||
|
|
Loading…
Reference in New Issue