BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
Source.Worker.printer Namespace Reference

Classes

class  EPrinter
 Supported printers. More...
class  Printer
 Class create bons and printout. More...

Functions

bool is_ip_address (str s)
 Checks if a string is a network address.

Variables

dict D_PRINTER
float F_PRINTER_PRINT_DELAY = 0.75
float F_PRINTER_SLEEP_TIME = 0.2
 log = logging.getLogger(__title__)
str S_PRINT_ERROR_FILE = "FailedPrints.csv"

Detailed Description


Function Documentation

◆ is_ip_address()

bool is_ip_address ( str s)

Checks if a string is a network address.

Parameters
s: string to check
Returns
status if is ip address

Definition at line 61 of file printer.py.

61def is_ip_address(s: str) -> bool:
62 """!
63 @brief Checks if a string is a network address.
64 @param s : string to check
65 @return status if is ip address
66 """
67 return re.fullmatch(r'(\d{1,3}\.){3}\d{1,3}(:\d+)?', s) is not None # IPv4 with optional port
68
69

Variable Documentation

◆ D_PRINTER

dict D_PRINTER
Initial value:
1= {
2 EPrinter.EPSON: {EPaper.WIDTH_58_MM.name: 34,
3 EPaper.WIDTH_80_MM.name: 48},
4 EPrinter.PROLIFIC: {EPaper.WIDTH_58_MM.name: 30,
5 EPaper.WIDTH_80_MM.name: 44},
6 EPrinter.DEFAULT: {EPaper.WIDTH_58_MM.name: 30, # max length of 58 mm paper
7 EPaper.WIDTH_80_MM.name: 44} # auto line break or max length of 80mm paper
8}

Definition at line 47 of file printer.py.

◆ F_PRINTER_PRINT_DELAY

float F_PRINTER_PRINT_DELAY = 0.75

Definition at line 57 of file printer.py.

◆ F_PRINTER_SLEEP_TIME

float F_PRINTER_SLEEP_TIME = 0.2

Definition at line 56 of file printer.py.

◆ log

log = logging.getLogger(__title__)

Definition at line 35 of file printer.py.

◆ S_PRINT_ERROR_FILE

str S_PRINT_ERROR_FILE = "FailedPrints.csv"

Definition at line 58 of file printer.py.