File: list-bootswatch.py

package info (click to toggle)
bootstrap-flask 2.2.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 25,396 kB
  • sloc: python: 2,218; makefile: 24
file content (26 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""List Bootstrap themes RadioField."""

from os import listdir


def list(version):
    """List template file names."""
    print(f"To add to bootstrap{version}/app.py")
    print("    theme_name = RadioField(")
    print("        default='default',")
    print("        choices=[")
    print("            ('default', 'none'),")
    base = f'../flask_bootstrap/static/bootstrap{version}/css/bootswatch'
    name = ''
    for directory in sorted(listdir(base)):
        with open(f'{base}/{directory}/_bootswatch.scss') as scss:
            for line in scss:
                name = line.strip()[3:]
                break
        print(f"            ('{directory}', '{name}'),")
    print("        ]")
    print("    )")


for value in (4, 5):
    list(value)