diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index ee08a27..32efd1a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -27,6 +27,6 @@ jobs: sudo apt-get update -y && sudo apt-get install -y git python3-sphinx graphviz libenchant-2-2 && sudo apt-get install -y gcc libcups2-dev python3-dev python3-setuptools && - sudo pip install tox pycups + sudo pip install --ignore-installed tox pycups - name: Test doc build run: tox -e docs diff --git a/.github/workflows/pythonpackage-windows.yml b/.github/workflows/pythonpackage-windows.yml index 7da19a7..0929fb5 100644 --- a/.github/workflows/pythonpackage-windows.yml +++ b/.github/workflows/pythonpackage-windows.yml @@ -19,7 +19,7 @@ jobs: with: submodules: 'recursive' - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5.3.0 + uses: actions/setup-python@v5.4.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -44,7 +44,7 @@ jobs: env: ESCPOS_CAPABILITIES_FILE: D:\a\python-escpos\python-escpos\capabilities-data\dist\capabilities.json - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 1bf57a7..320063f 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -22,7 +22,7 @@ jobs: with: submodules: 'recursive' - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5.3.0 + uses: actions/setup-python@v5.4.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -54,7 +54,7 @@ jobs: env: ESCPOS_CAPABILITIES_FILE: /home/runner/work/python-escpos/python-escpos/capabilities-data/dist/capabilities.json - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: diff --git a/examples/docker-flask/requirements.txt b/examples/docker-flask/requirements.txt index 84b0be9..1a9b0ae 100644 --- a/examples/docker-flask/requirements.txt +++ b/examples/docker-flask/requirements.txt @@ -4,7 +4,7 @@ blinker==1.6.2 click==8.1.3 Flask==2.3.2 itsdangerous==2.1.2 -Jinja2==3.1.4 +Jinja2==3.1.5 MarkupSafe==2.1.2 Pillow==10.3.0 pycups==2.0.1 diff --git a/examples/software_columns.py b/examples/software_columns.py new file mode 100644 index 0000000..a89e1d4 --- /dev/null +++ b/examples/software_columns.py @@ -0,0 +1,25 @@ +""" Example for software_columns: Print text arranged into columns.""" + +from escpos import printer + +p = printer.Dummy(profile="TM-U220") + +font = "a" +p.set(font=font) + +# Default: Automatic column width given the characters per line of the printer. +text_list = ["col1", "col2", "col3"] +charsxline = p.profile.get_columns(font) +p.software_columns(text_list=text_list, widths=charsxline, align="center") + +# Tuning some columns: +text_list = ["col1", "col2", "col3"] +widths = [5, 20] # col1 = 5 chars width, col2 + col3 = 20 chars width +align = ["left", "center"] # col1 = left aligned, col2 + col3 = center aligned +p.software_columns(text_list=text_list, widths=widths, align=align) + +# Tuning them all: +text_list = ["col1", "col2", "col3"] +widths = [5, 20, 15] +align = ["left", "center", "right"] +p.software_columns(text_list=text_list, widths=widths, align=align)