diff options
Diffstat (limited to 'jfr_playoff/gui/tabs.py')
-rw-r--r-- | jfr_playoff/gui/tabs.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/jfr_playoff/gui/tabs.py b/jfr_playoff/gui/tabs.py index 5b9efc9..0e29b7a 100644 --- a/jfr_playoff/gui/tabs.py +++ b/jfr_playoff/gui/tabs.py @@ -220,9 +220,11 @@ class MatchesTab(PlayoffTab): newPhase = max(self.phases.keys()) + 1 if len(self.phases) else 1 self.phaseFrame.add(phase, text='Faza #%d' % (newPhase)) self.phases[newPhase] = phase + return newPhase - def removePhase(self): - selected = self.phaseFrame.select() + def removePhase(self, phase=None): + selected = self.phaseFrame.select() if phase is None \ + else self.phases[phase] if selected: self.phaseFrame.forget(selected) key_to_delete = None @@ -261,10 +263,24 @@ class MatchesTab(PlayoffTab): def getMatches(self): matches = [] for phase in self.phases.values(): - matches += [w for w in phase.matches.widgets - if isinstance(w, MatchSettingsFrame)] + matches += [w for w in phase.matches.widgets + if isinstance(w, MatchSettingsFrame)] return matches + def setValues(self, config): + phases = config['phases'] if 'phases' in config else [] + for idx in self.phases: + self.removePhase(idx) + for phase in phases: + newPhase = self.addPhase() + self.phases[newPhase].setValues(phase) + for phase in self.phases.values(): + for match in phase.matches.widgets: + if isinstance(match, MatchSettingsFrame) \ + and match.getMatchID == 0: + match.matchID.set( + self.winfo_toplevel().getNewMatchID(match)) + class SwissesTab(PlayoffTab): @property def title(self): |