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
|
||||
*****
|
||||
:Last Reviewed: 2017-06-10
|
||||
|
||||
Define your printer
|
||||
-------------------
|
||||
|
@ -133,13 +134,13 @@ format. For windows it is probably at::
|
|||
|
||||
And for linux::
|
||||
|
||||
$HOME/.config/python-escpos/config.yaml
|
||||
$HOME/.config/python-escpos/config.yaml
|
||||
|
||||
If you aren't sure, run::
|
||||
|
||||
from escpos import config
|
||||
c = config.Config()
|
||||
c.load()
|
||||
from escpos import config
|
||||
c = config.Config()
|
||||
c.load()
|
||||
|
||||
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
|
||||
|
@ -147,9 +148,9 @@ the ``load()`` method.
|
|||
|
||||
To load the configured printer, run::
|
||||
|
||||
from escpos import config
|
||||
c = config.Config()
|
||||
printer = c.printer()
|
||||
from escpos import config
|
||||
c = config.Config()
|
||||
printer = c.printer()
|
||||
|
||||
|
||||
The printer section
|
||||
|
@ -157,23 +158,34 @@ The printer section
|
|||
|
||||
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`.
|
||||
|
||||
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::
|
||||
|
||||
printer:
|
||||
type: File
|
||||
devfile: /dev/someprinter
|
||||
printer:
|
||||
type: File
|
||||
devfile: /dev/someprinter
|
||||
|
||||
And for a network printer::
|
||||
|
||||
printer:
|
||||
type: network
|
||||
host: 127.0.0.1
|
||||
port: 9000
|
||||
printer:
|
||||
type: Network
|
||||
host: 127.0.0.1
|
||||
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
|
||||
-------------------
|
||||
|
|
Loading…
Reference in New Issue