From 2efa8b15abd451c31b377ff3de975ade8d24516c Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 21 Jun 2019 18:13:07 +0200 Subject: Position/team selection buttons and frames made reusable and extendable --- jfr_playoff/gui/frames/visual.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'jfr_playoff/gui/frames/visual.py') diff --git a/jfr_playoff/gui/frames/visual.py b/jfr_playoff/gui/frames/visual.py index 6ef7bf6..eea87f0 100644 --- a/jfr_playoff/gui/frames/visual.py +++ b/jfr_playoff/gui/frames/visual.py @@ -6,7 +6,8 @@ import tkColorChooser as tkcc from ..frames import GuiFrame, RepeatableFrame, ScrollableFrame from ..frames import WidgetRepeater -from ..frames.team import TeamSelectionButton, TeamSelectionFrame +from ..frames import SelectionFrame +from ..frames.team import TeamSelectionButton class VisualSettingsFrame(GuiFrame): def renderContent(self): @@ -232,22 +233,22 @@ class LineStylesFrame(GuiFrame): (ttk.Label(self, text='Kolory linii')).grid( row=0, column=0, columnspan=2, sticky=tk.W) -class FinalPositionsSelectionFrame(TeamSelectionFrame): +class PositionsSelectionFrame(SelectionFrame): COLUMN_COUNT=10 def __init__(self, *args, **kwargs): - TeamSelectionFrame.__init__(self, *args, **kwargs) + SelectionFrame.__init__(self, *args, **kwargs) self.winfo_toplevel().geometry( '%dx%d' % ( self.COLUMN_COUNT * 40, - (len(self.teams) / self.COLUMN_COUNT + 2) * 25 + 30 + (len(self.options) / self.COLUMN_COUNT + 2) * 25 + 30 )) def renderHeader(self, container): (ttk.Label(container, text=self.title)).grid( row=0, column=0, columnspan=self.COLUMN_COUNT, sticky=tk.W) - def renderTeam(self, container, team, idx): + def renderOption(self, container, option, idx): (ttk.Checkbutton( container, text=str(idx+1), variable=self.values[idx] @@ -266,7 +267,7 @@ class PositionStyleFrame(RepeatableFrame): (ttk.Label(self, text='Pozycje końcowe:')).grid(row=0, column=2) self.positionBtn = TeamSelectionButton( self, prompt='Wybierz pozycje końcowe:', - dialogclass=FinalPositionsSelectionFrame, + dialogclass=PositionsSelectionFrame, callback=self._setPositions) self.positionBtn.grid(row=0, column=3) (ttk.Label(self, text='Opis w legendzie:')).grid(row=0, column=4) -- cgit v1.2.3