Plugins
Package with routines to access the plugins (Python modules) stored in the current subdirectory.
Usage:
plugins(args_for_names_function)
get_functions(plugin_name)(args_for_plugin_function)
call_functions(plugin_name, args_for_plugin_function)
ESC & ESC/P2 converter
Watchdog for /ps directory that is able to convert new files into pdfs
Conversions are made thanks to Escapy.
As soon as a file is closed, a pdf is created.
Expected config:
misc: emulation + endlesstext: epson/auto + no
esc: preferred_backend: escapy
- class libreprinter.plugins.lp_escapy_converter.EscapyEventHandler(settings: SectionProxy | dict, *args, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplements
on_closed()event.Watched directory:
raw: *.raw
- Attribute:
- param settings:
Escapy Section of the current ConfigParser.
- type settings:
configparser.SectionProxy | dict
- Class attribute:
- param FILES_REGEX:
Patterns to detect raw files.
- type FILES_REGEX:
list[str]
Data & PDF to Printer
Watchdog for /pdf directory that is able to sent new files to a printer
Send new pdfs files on a printer configured in Cups.
Expected settings: output_printer set and not *stream as endlesstext setting; i.e. output_printer is defined; and it is not an infinite stream.
In other terms, a pdf is sent to printer if:
endlesstext setting is no, plain-jobs, strip-escp2-jobs,
and output_printer setting is not no
- TODO: only “no” for endless config because strip wrongly builds empty pdf files
=> not any of (“plain-jobs”, “strip-escp2-jobs”, “no”)
- class libreprinter.plugins.lp_jobs_to_printer_watchdog.PdfEventHandler(*args, printer_name=None, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplements
on_closed()event.Watched directories:
pdf: *.pdf
- Attribute:
- param printer_name:
Name of the CUPS printer which will receive files as jobs.
- type printer_name:
str
- Class attribute:
- param FILES_REGEX:
Patterns to detect pdf files.
- type FILES_REGEX:
list[str]
- libreprinter.plugins.lp_jobs_to_printer_watchdog.setup_pdf_watchdog(config)[source]
Initialise a watchdog on /pdf directory in configured output_path.
Any pdf file created in these directories will be sent to the printer configured via output_printer.
- Returns:
Observer that is currently watching directories.
- Return type:
watchdog.Observer
PCL to PDF
Watchdog for /pcl directory that is able to convert new files into pdfs
The conversion is made thanks to the pcl_converter_path setting pointing to the GhostPCL binary.
- class libreprinter.plugins.lp_pcl_to_pdf_watchdog.PclEventHandler(converter_path, *args, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplements
on_closed()event.Watched directory:
pcl: *.pcl
- Attribute:
- param converter_path:
Path to GhostPCL binary.
- type converter_path:
str
- Class attribute:
- param FILES_REGEX:
Patterns to detect pcl files.
- type FILES_REGEX:
list[str]
- libreprinter.plugins.lp_pcl_to_pdf_watchdog.setup_pcl_watchdog(config)[source]
Initialise a watchdog on /pcl directory in configured output_path.
Any pcl file created in this directories will be converted in /pdf by the ghostpcl binary whose path is indicated in the variable pcl_converter_path.
- Returns:
Observer that is currently watching directories.
- Return type:
watchdog.Observer
HPGL to PDF
Watchdog for /hpgl directory that is able to convert new files into pdfs
Conversions are made thanks to Hp2xx & Ghostscript.
As soon as a hpgl file is created, a pdf is created.
Expected config (emulation + endlesstext):
hpgl + no
- class libreprinter.plugins.lp_hpgl_converter.HpglEventHandler(hp2xx_path, *args, hp2xx_settings='', **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplements
on_closed()event.Watched directory:
hpgl: *.hpgl
- Attributes:
- param hp2xx_path:
Path to the Hp2xx binary.
- param hp2xx_settings:
Command line settings for Hp2xx binary.
- type hp2xx_path:
str
- type hp2xx_settings:
str
- Class attribute:
- param FILES_REGEX:
Patterns to detect txt files.
- type FILES_REGEX:
list[str]
PostScript to PDF
Watchdog for /ps directory that is able to convert new files into pdfs
Conversions from PostScript are made thanks to Ghostscript.
As soon as a file is closed, a pdf is created.
Expected config (emulation + endlesstext):
postscript + no
- class libreprinter.plugins.lp_ps_converter.PostscriptEventHandler(*args, gs_settings=None, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplements
on_closed()event.Watched directory:
ps: *.ps
- Attribute:
- param gs_settings:
Command line settings for Ghostscript binary.
- type gs_settings:
list[str] or None
- Class attribute:
- param FILES_REGEX:
Patterns to detect PostScript files.
- type FILES_REGEX:
list[str]
Text to PDF
Watchdog for /txt_jobs directory that is able to convert new files into pdfs
Conversions are made thanks to Enscript & Ghostscript.
As soon as a txt file is created, a pdf is created.
Expected config (emulation + endlesstext):
epson + plain-jobs
epson + strip-escp2-jobs
text + no
Yes the following config targets also: epson + no, text + plain-jobs but in the first case there will be no text file, and in the 2nd case there will be a text file due to text (plain-jobs is only for epson emulations).
So… The plugin is not compatible with hp emulation, nor with *stream in endlesstext setting.
- class libreprinter.plugins.lp_txt_converter.TxtEventHandler(settings: SectionProxy | dict, *args, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class only reimplement
on_closed()event.Watched directory:
txt_jobs: *.txt
- Attributes:
- param settings:
Escapy Section of the current ConfigParser.
- type settings:
configparser.SectionProxy | dict
- Class attribute:
- param FILES_REGEX:
Patterns to detect txt files.
- type FILES_REGEX:
list[str]
Seiko Qt-2100 Timegrapher to PDF & CSV
Watchdog for /raw directory that is able to parse & convert new files into CSV and/or into pdfs
Conversions are made thanks to Seiko-converter.
As soon as a raw file is modified or closed, a pdf is created. This allows to always have the latest data available even with long gate modes configured on the QT-2100 device.
- class libreprinter.plugins.lp_seiko_qt2100_converter.SeikoEventHandler(*args, seiko_settings=None, **kwargs)[source]
Watch a directory via a parent Observer and emit events accordingly
This class reimplements
on_closed + :meth:`on_modified()events.Watched directory:
raw: *.raw
- Attributes:
- param seiko_settings:
Settings of the seiko-qt2100 section from the config file.
- param last_timestamp:
Keep the timestamp of the last modified file event. Used to reduce overhead.
- type seiko_settings:
dict
- type last_timestamp:
float
- Class attribute:
- param FILES_REGEX:
Patterns to detect files.
- type FILES_REGEX:
list[str]