CUPS print options generator from PPD
Project description
🖨 Python CUPS print options generator from PPD
📥 Installation
📦 From pip:
python -m pip install -U pycups_po
🏗 From git:
git clone https://github.com/WhiteApfel/pycups_po.git
cd pycups_po
python setup.py install
🧑🏫 How to use
🐍 Example
import cups
from pycups_po import PrinterOptionsGenerator
from pycups_po.models import PrinterOption
conn = cups.Connection()
generator = PrinterOptionsGenerator(conn, "CT-S2000")
ops: list[PrinterOption] = generator.get_ppd_options()
for op in ops:
print(op)
with open("tr4500.py", "w+") as f:
f.write(generator.generate_options_dataclass(printer_name="TR-4500"))
You can specify name of printer when init PrinterOptionsGenerator
, then it will be used by default.
Or you can pass name to function.
📋 Dataclasses
@dataclass
class OptionValue:
value: str
pretty_value: str
content: str
@dataclass
class PrinterOption:
name: str
pretty_name: Optional[str]
type: Literal["PickOne"]
default_value: str
values: List[OptionValue]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycups_po-0.0.5.tar.gz
(9.0 kB
view hashes)
Built Distribution
pycups_po-0.0.5-py3-none-any.whl
(10.0 kB
view hashes)
Close
Hashes for pycups_po-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 984985a060a1c2f80973913e409c8b6f0b12ab0066de7fb59a1b302670d4205b |
|
MD5 | a317ee91f6a58d1d41ebcb120c3d466e |
|
BLAKE2b-256 | 89ed42eb8d219e35502ae826f4cfcb43df83e6ab27c920945e67e77dcf8abed2 |