1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-09-13 09:09:58 +00:00

Port to current version of escpos-printer-db.

This commit is contained in:
Michael Elsdörfer
2016-08-30 17:05:31 +02:00
parent 40be69347c
commit 2f89f3fe3a
7 changed files with 216 additions and 277 deletions

View File

@@ -7,8 +7,9 @@ import yaml
# Load external printer database
with open(path.join(path.dirname(__file__), 'capabilities.json')) as f:
CAPABILITIES = yaml.load(f)
PROFILES = CAPABILITIES['profiles']
ENCODINGS = CAPABILITIES['encodings']
class NotSupported(Exception):
@@ -51,6 +52,12 @@ class BaseProfile(object):
"""
return self.features.get(feature)
def get_code_pages(self):
"""Return the support code pages as a {name: index} dict.
"""
return {v.lower(): k for k, v in self.codePages.items()}
def get_profile(name=None, **kwargs):
"""Get the profile by name; if no name is given, return the