summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/frames/match.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-06-21 18:13:07 +0200
committeremkael <emkael@tlen.pl>2019-06-21 18:13:07 +0200
commit2efa8b15abd451c31b377ff3de975ade8d24516c (patch)
tree23c19dc6d78d5e060793fcf9a88c0e1c5f588faa /jfr_playoff/gui/frames/match.py
parenteb6a945a122446d605f147289592ce21f9f7e92f (diff)
Position/team selection buttons and frames made reusable and extendable
Diffstat (limited to 'jfr_playoff/gui/frames/match.py')
-rw-r--r--jfr_playoff/gui/frames/match.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/jfr_playoff/gui/frames/match.py b/jfr_playoff/gui/frames/match.py
index 9c7dfc7..922e4cf 100644
--- a/jfr_playoff/gui/frames/match.py
+++ b/jfr_playoff/gui/frames/match.py
@@ -6,7 +6,9 @@ from tkinter import ttk
from ..frames import GuiFrame, RepeatableFrame, ScrollableFrame
from ..frames import WidgetRepeater, RepeatableEntry, getIntVal
-from ..frames.team import DBSelectionField
+from ..frames import SelectionFrame, SelectionButton
+from ..frames.team import DBSelectionField, TeamList, TeamSelectionButton
+from ..frames.visual import PositionsSelectionFrame
class SwissSettingsFrame(RepeatableFrame):
SOURCE_LINK = 0
@@ -139,3 +141,31 @@ class SwissesFrame(ScrollableFrame):
self.swisses.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
__all__ = ['SwissesFrame']
+
+class MatchSelectionButton(SelectionButton):
+ @property
+ def defaultPrompt(self):
+ return 'Wybierz mecze:'
+
+ @property
+ def title(self):
+ return 'Wybór meczów'
+
+ @property
+ def errorMessage(self):
+ return 'W turnieju nie zdefiniowano żadnych meczów'
+
+ def getOptions(self):
+ return self.winfo_toplevel().getMatches()
+
+
+class MatchSelectionFrame(SelectionFrame):
+ def renderOption(self, container, option, idx):
+ (ttk.Label(container, text='[%d]' % (idx+1))).grid(
+ row=idx+1, column=0)
+ (ttk.Checkbutton(
+ container, text='Mecz nr %d' % (option.getMatchID()),
+ variable=self.values[idx]
+ )).grid(row=idx+1, column=1, sticky=tk.W)
+
+