aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-04-10 23:13:02 +0200
committerlonkaars <loek@pipeframe.xyz>2023-04-10 23:13:02 +0200
commit81b3c4897c48a443b8488724a2a0b23239ce2381 (patch)
tree502ecb302ebea2c08bd8938bb01f3ef1b6474988 /gui
parentb1d9a63e3fd0d14006f6ac2d4ee8c7788aeede8e (diff)
fix changing season update
Diffstat (limited to 'gui')
-rw-r--r--gui/main_window.py3
-rw-r--r--gui/tab_races.py2
-rw-r--r--gui/tab_teams.py12
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