From 81b3c4897c48a443b8488724a2a0b23239ce2381 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 10 Apr 2023 23:13:02 +0200 Subject: fix changing season update --- gui/main_window.py | 3 ++- gui/tab_races.py | 2 +- gui/tab_teams.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gui/main_window.py b/gui/main_window.py index d6ad53d..536e7c4 100644 --- a/gui/main_window.py +++ b/gui/main_window.py @@ -11,7 +11,7 @@ class MainWindow(QMainWindow): cursor: mariadb.Cursor = None db: mariadb.Connection = None menu_bar: QMenuBar - calendar_id: int + calendar_id: int = 1 _tab_drivers: TabDrivers _tab_teams: TabTeams @@ -80,6 +80,7 @@ class MainWindow(QMainWindow): def switch_season(self): self.calendar_id = self.sender().property("id") + self._tab_teams.set_calendar_id(self.calendar_id) self._tab_races.set_calendar_id(self.calendar_id) def __init__(self, cursor: mariadb.Cursor, db: mariadb.Connection, parent=None): diff --git a/gui/tab_races.py b/gui/tab_races.py index 9112574..0175155 100644 --- a/gui/tab_races.py +++ b/gui/tab_races.py @@ -313,7 +313,7 @@ class ResultDetailsWidget(QWidget): self.setLayout(layout) class TabRaces(QWidget): - calendar_id: int = 0 + calendar_id: int = 1 parent: QMainWindow cursor: mariadb.Cursor selected_race_id: int = 1 diff --git a/gui/tab_teams.py b/gui/tab_teams.py index b4dfd73..cce4b3c 100644 --- a/gui/tab_teams.py +++ b/gui/tab_teams.py @@ -54,6 +54,10 @@ class TeamsModel(QAbstractTableModel): team.name, )[index.column()] + def set_calendar_id(self, calendar_id): + self.calendar_id = calendar_id + self.update() + class TeamBrowser(QTableView): model_table: TeamsModel model_proxy: QSortFilterProxyModel @@ -75,6 +79,9 @@ class TeamBrowser(QTableView): def set_parent_update(self, fn): self.parent_update_fn = fn + def set_calendar_id(self, calendar_id): + self.model_table.set_calendar_id(calendar_id) + def on_selection(self): if self.ignore_update: return rows = self.selectionModel().selectedRows() @@ -178,6 +185,7 @@ class TabTeams(QWidget): layout: SplitViewLayout cursor: mariadb.Cursor selected_team_id: int = 1 + calendar_id: int = 1 team_browser: TeamBrowser team_details: TeamDetailsWidget @@ -193,6 +201,10 @@ class TabTeams(QWidget): self.team_browser.update(False) self.team_details.set_team_id(self.selected_team_id) + def set_calendar_id(self, calendar_id): + self.calendar_id = calendar_id + self.team_browser.set_calendar_id(calendar_id) + def __init__(self, cursor, parent=None): super(TabTeams, self).__init__(parent) self.parent = parent -- cgit v1.2.3