python-escpos/src/escpos/codepages.py

25 lines
536 B
Python
Raw Normal View History

from .capabilities import CAPABILITIES
class CodePageManager:
"""Holds information about all the code pages (as defined
in escpos-printer-db).
"""
def __init__(self, data):
self.data = data
def get_all(self):
return self.data.values()
2017-01-29 23:10:14 +00:00
@staticmethod
def get_encoding_name(encoding):
# TODO resolve the encoding alias
return encoding.upper()
def get_encoding(self, encoding):
return self.data[encoding]
2017-01-30 01:29:08 +00:00
2017-01-29 23:10:14 +00:00
CodePages = CodePageManager(CAPABILITIES['encodings'])