From 69c0e0733b6c254e798bfd75569d80d220eb4a15 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jun 2019 20:44:23 +0200 Subject: SelectionButton/Frame with custom value mappings --- jfr_playoff/gui/frames/match.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'jfr_playoff/gui/frames/match.py') diff --git a/jfr_playoff/gui/frames/match.py b/jfr_playoff/gui/frames/match.py index aa06b8b..6487e23 100644 --- a/jfr_playoff/gui/frames/match.py +++ b/jfr_playoff/gui/frames/match.py @@ -192,13 +192,17 @@ class MatchSelectionButton(SelectionButton): class MatchSelectionFrame(SelectionFrame): def renderOption(self, container, option, idx): - (ttk.Label(container, text='[%d]' % (idx+1))).grid( - row=idx+1, column=0) + (ttk.Label( + container, text='[%d]' % (self._mapValue(idx, option)))).grid( + row=idx+1, column=0) (ttk.Checkbutton( container, text=option.label, - variable=self.values[idx] + variable=self.values[self._mapValue(idx, option)] )).grid(row=idx+1, column=1, sticky=tk.W) + def _mapValue(self, idx, value): + return self.options[idx].getMatchID() + class BracketMatchSettingsFrame(GuiFrame): SOURCE_TEAM=0 -- cgit v1.2.3