-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.py
More file actions
30 lines (23 loc) · 775 Bytes
/
basic.py
File metadata and controls
30 lines (23 loc) · 775 Bytes
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
27
28
29
30
"""Basic TCA Theme Demo"""
import sys
from pathlib import Path
from pprint import pprint
from tca import get_themes_dir, load_themes_from_dir
if __name__ == "__main__":
if len(sys.argv) < 2:
theme_dir = get_themes_dir()
else:
theme_dir = Path(sys.argv[1])
if not theme_dir.is_dir():
print(f"Error: '{theme_dir}' is not a directory")
sys.exit(1)
print(f"Loading themes from: {theme_dir}")
themes = load_themes_from_dir(theme_dir)
if not themes:
print(f"Error: No themes found in {theme_dir}")
sys.exit(1)
themes.sort(key=lambda x: x[1].meta.name)
print(f"Found {len(themes)} themes:")
for path, theme in themes:
print(f"{theme.meta.name} in {path.name}")
pprint(themes[0])