summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/tabs.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-06-27 20:45:32 +0200
committeremkael <emkael@tlen.pl>2019-06-27 20:45:32 +0200
commit210dd60556319759ef8bf94bc0ecbd92df796ed0 (patch)
treedc26576e8ae943a0a7209f6cde2bdffac00737c6 /jfr_playoff/gui/tabs.py
parent017da8cdd6fa8cdf94aa214e513f087b57a2f087 (diff)
Setting valeus for match/phase settings
Diffstat (limited to 'jfr_playoff/gui/tabs.py')
-rw-r--r--jfr_playoff/gui/tabs.py24
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):