adding readme and season stats

This commit is contained in:
Bernd 2025-07-26 14:03:18 +05:00
parent 1741024090
commit 3e8329e4b8
2 changed files with 30 additions and 1 deletions

View File

@ -154,7 +154,6 @@ class AnimeTracker(QMainWindow):
self.setWindowTitle("Anime Backlog Tracker") self.setWindowTitle("Anime Backlog Tracker")
# Add application icon # Add application icon
icon_path = os.path.join(os.path.dirname(__file__), './icons/anime-app-icon.png') icon_path = os.path.join(os.path.dirname(__file__), './icons/anime-app-icon.png')
print("icon_path = " + icon_path)
if os.path.exists(icon_path): if os.path.exists(icon_path):
self.setWindowIcon(QIcon(icon_path)) self.setWindowIcon(QIcon(icon_path))
self.resize(800, 600) self.resize(800, 600)
@ -402,7 +401,17 @@ class AnimeTracker(QMainWindow):
comp_entries = 0 comp_entries = 0
for season in ['winter', 'spring', 'summer', 'fall', '']: for season in ['winter', 'spring', 'summer', 'fall', '']:
entries = self.backend.get_entries_for_season(year, season) entries = self.backend.get_entries_for_season(year, season)
# Database schema order:
# 0: id
# 1: name
# 2: year
# 3: season
# 4: status
# 5: type
# 6: comment
# 7: url
if entries: if entries:
# Season title
s_name = season.capitalize() if season else 'Other' s_name = season.capitalize() if season else 'Other'
label = QLabel(s_name) label = QLabel(s_name)
season_font = QFont() season_font = QFont()
@ -410,6 +419,18 @@ class AnimeTracker(QMainWindow):
season_font.setBold(True) season_font.setBold(True)
label.setFont(season_font) label.setFont(season_font)
layout.addWidget(label) layout.addWidget(label)
# Season's stats
total_anime = len(entries)
completed_anime = sum(1 for entry in entries if entry[4] == 'completed')
completion_percentage = (completed_anime / total_anime * 100) if total_anime > 0 else 0
s_stat = QLabel(f"Completed: <b>{completed_anime}/{total_anime} ({completion_percentage:.0f}%)</b>")
s_stat_font = QFont()
s_stat_font.setPointSize(int(10 * self.table_scale)) # Slightly smaller than season label
# s_stat_font.setItalic(True) # Optional: make it italic to differentiate
s_stat.setFont(s_stat_font)
layout.addWidget(s_stat)
table = CustomTableWidget(self, is_pre=False) table = CustomTableWidget(self, is_pre=False)
table.is_pre = False table.is_pre = False
self.tables.append(table) self.tables.append(table)

8
readme.md Normal file
View File

@ -0,0 +1,8 @@
# How to build this app:
`python -m venv anime_env`
`source anime_env/bin/activate`
`pip install pyinstaller`
`pyinstaller build.spec --clean`
# How to run this app without building:
`python frontend.py`