2016-08-30 15:05:31 +00:00
|
|
|
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):
|
2016-09-11 11:03:55 +00:00
|
|
|
# TODO resolve the encoding alias
|
|
|
|
return encoding.upper()
|
2016-08-30 15:05:31 +00:00
|
|
|
|
|
|
|
def get_encoding(self, encoding):
|
2016-09-11 11:03:55 +00:00
|
|
|
return self.data[encoding]
|
2016-08-30 15:05:31 +00:00
|
|
|
|
2017-01-29 23:10:14 +00:00
|
|
|
CodePages = CodePageManager(CAPABILITIES['encodings'])
|