set default value of the season as the one of the last added anime

This commit is contained in:
Bernd 2025-07-24 20:55:58 +05:00
parent df9085f479
commit 25df9c5a9a
4 changed files with 12 additions and 7 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ anime_tracker.log
todo.txt
*.csv
anime_backlog.db.bk
*.db-wal
*.db-shm

Binary file not shown.

Binary file not shown.

View File

@ -150,6 +150,7 @@ class AnimeTracker(QMainWindow):
def __init__(self):
super().__init__()
self.settings = QSettings("xAI", "AnimeBacklogTracker")
self.last_used_season = self.settings.value("lastUsedSeason", "winter")
self.setWindowTitle("Anime Backlog Tracker")
self.resize(800, 600)
self.backend = AnimeBackend()
@ -317,11 +318,10 @@ class AnimeTracker(QMainWindow):
name_label.setFont(name_font)
if url:
name_escaped = html.escape(name)
name_label.setText(f'<a href="{url}" style="color: #0000FF; text-decoration: none;">{name_escaped}</a>')
name_label.setText(f' <a href="{url}" style="color: #0000FF; text-decoration: none;">{name_escaped}</a>')
name_label.setOpenExternalLinks(True)
else:
name_label.setText(html.escape(name))
name_label.setStyleSheet("padding-left: 10px;")
table.setCellWidget(row, col, name_label)
col += 1
# Type
@ -371,7 +371,7 @@ class AnimeTracker(QMainWindow):
item.setBackground(color)
widget = table.cellWidget(r, c)
if widget:
widget.setStyleSheet(f"background-color: {color.name()};")
widget.setStyleSheet(f"padding-left: 2px;background-color: {color.name()};")
pre_layout.addWidget(table)
pre_tab.setWidget(pre_content)
tab_text = "Pre-2010"
@ -453,11 +453,10 @@ class AnimeTracker(QMainWindow):
name_label.setFont(name_font)
if url:
name_escaped = html.escape(name)
name_label.setText(f'<a href="{url}" style="color: #0000FF; text-decoration: none;">{name_escaped}</a>')
name_label.setText(f' <a href="{url}" style="color: #0000FF; text-decoration: none;">{name_escaped}</a>')
name_label.setOpenExternalLinks(True)
else:
name_label.setText(html.escape(name))
name_label.setStyleSheet("padding-left: 10px;")
table.setCellWidget(row, col, name_label)
col += 1
# Type
@ -507,7 +506,7 @@ class AnimeTracker(QMainWindow):
item.setBackground(color)
widget = table.cellWidget(r, c)
if widget:
widget.setStyleSheet(f"background-color: {color.name()};")
widget.setStyleSheet(f"padding-left: 2px; background-color: {color.name()};")
layout.addWidget(table)
total_entries += len(entries)
comp_entries += sum(1 for e in entries if e[4] == 'completed')
@ -574,10 +573,13 @@ class AnimeTracker(QMainWindow):
parts = tab_text.split(' (')
default_year = int(parts[0])
default_season = ''
dialog = AnimeDialog(self, None, default_year, default_season)
dialog = AnimeDialog(self, None, default_year, self.last_used_season)
if dialog.exec_() == QDialog.Accepted:
current_id = self.get_current_tab_identifier()
data = dialog.get_data()
if data['season']:
self.last_used_season = data['season']
self.settings.setValue("lastUsedSeason", self.last_used_season)
if not data['name']:
QMessageBox.warning(self, "Error", "Anime name cannot be empty.")
return
@ -591,6 +593,7 @@ class AnimeTracker(QMainWindow):
current_id = self.get_current_tab_identifier()
dialog = AnimeDialog(self, entry)
if dialog.exec_() == QDialog.Accepted:
current_id = self.get_current_tab_identifier()
data = dialog.get_data()
if not data['name']:
QMessageBox.warning(self, "Error", "Anime name cannot be empty.")