From c3b141b01a54b9869f067bff4695d300446f8005 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 14 Jan 2020 01:41:25 +0100 Subject: Fixing team pre-selection in GUI --- jfr_playoff/gui/frames/match.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'jfr_playoff/gui') diff --git a/jfr_playoff/gui/frames/match.py b/jfr_playoff/gui/frames/match.py index 4b1f5a6..ad630d0 100644 --- a/jfr_playoff/gui/frames/match.py +++ b/jfr_playoff/gui/frames/match.py @@ -449,11 +449,10 @@ class BracketMatchSettingsFrame(GuiFrame): def getSelectedTeam(self): if self.selected.get(): - try: - return self.bracketWidgets[7].getValues().index( - self.selectedIndex.get()) - except ValueError: - return -1 + for idx, val in enumerate(self.bracketWidgets[7].getValues()): + if str(self.selectedIndex.get()) == str(val): + return idx - 1 + return -1 else: return -1 @@ -770,16 +769,6 @@ class MatchSettingsFrame(RepeatableFrame): return config - if 'selected_teams' in value \ - and isinstance(value['selected_teams'], list): - for idx, val in enumerate(value['selected_teams']): - if idx < 2: - self.bracketSettings[idx].setSelectedTeam(val) - else: - for idx in range(0, 2): - self.bracketSettings[idx].setSelectedTeam(-1) - - class MatchSeparator(RepeatableFrame): def renderContent(self): -- cgit v1.2.3