creating hyperlinks for seasons
This commit is contained in:
parent
3e8329e4b8
commit
c091c3b699
13
frontend.py
13
frontend.py
@ -413,11 +413,19 @@ class AnimeTracker(QMainWindow):
|
|||||||
if entries:
|
if entries:
|
||||||
# Season title
|
# Season title
|
||||||
s_name = season.capitalize() if season else 'Other'
|
s_name = season.capitalize() if season else 'Other'
|
||||||
label = QLabel(s_name)
|
label = QLabel()
|
||||||
season_font = QFont()
|
season_font = QFont()
|
||||||
season_font.setPointSize(int(12 * self.table_scale))
|
season_font.setPointSize(int(12 * self.table_scale))
|
||||||
season_font.setBold(True)
|
season_font.setBold(True)
|
||||||
label.setFont(season_font)
|
label.setFont(season_font)
|
||||||
|
if season: # Only create links for actual seasons, not 'Other'
|
||||||
|
mal_url = f"https://myanimelist.net/anime/season/{year}/{season}"
|
||||||
|
label.setText(f'<a href="{mal_url}" style="color: #0000FF; text-decoration: none; font-weight: bold;">{s_name}</a>')
|
||||||
|
label.setTextFormat(Qt.RichText)
|
||||||
|
label.setOpenExternalLinks(True) # This makes the link clickable and open in browser
|
||||||
|
else:
|
||||||
|
label.setText(s_name) # No link for 'Other' section
|
||||||
|
|
||||||
layout.addWidget(label)
|
layout.addWidget(label)
|
||||||
|
|
||||||
# Season's stats
|
# Season's stats
|
||||||
@ -716,6 +724,9 @@ class AnimeTracker(QMainWindow):
|
|||||||
self.tab_widget.setCurrentIndex(current - 1)
|
self.tab_widget.setCurrentIndex(current - 1)
|
||||||
elif key == Qt.Key_R:
|
elif key == Qt.Key_R:
|
||||||
self.random_pick()
|
self.random_pick()
|
||||||
|
elif key == Qt.Key_Q:
|
||||||
|
self.close()
|
||||||
|
|
||||||
elif modifiers == Qt.ControlModifier:
|
elif modifiers == Qt.ControlModifier:
|
||||||
if key == Qt.Key_Plus or key == Qt.Key_Equal:
|
if key == Qt.Key_Plus or key == Qt.Key_Equal:
|
||||||
current_id = self.get_current_tab_identifier()
|
current_id = self.get_current_tab_identifier()
|
||||||
|
Loading…
Reference in New Issue
Block a user