summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui/tabs.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-06-21 21:22:05 +0200
committeremkael <emkael@tlen.pl>2019-06-21 21:22:05 +0200
commit5cdfee5a5e402a0213ae0bca3aa9290a0263402c (patch)
tree80f433d36e2975699d868870417da24648a563b6 /jfr_playoff/gui/tabs.py
parent93c30ff638bb29eb609884ba8f4e85392dec3d6a (diff)
Renaming phase tab labels dynamically
Diffstat (limited to 'jfr_playoff/gui/tabs.py')
-rw-r--r--jfr_playoff/gui/tabs.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/jfr_playoff/gui/tabs.py b/jfr_playoff/gui/tabs.py
index ed06237..9d41f91 100644
--- a/jfr_playoff/gui/tabs.py
+++ b/jfr_playoff/gui/tabs.py
@@ -185,6 +185,12 @@ class MatchesTab(PlayoffTab):
if key_to_delete:
self.phases.pop(key_to_delete)
+ def _renameTabs(self, *args):
+ for idx, tab in self.phases.iteritems():
+ title = tab.name.get().strip()
+ self.phaseFrame.tab(
+ tab, text=title if len(title) else 'Faza #%d' % (idx))
+
def renderContent(self, container):
container.columnconfigure(1, weight=1)
container.rowconfigure(2, weight=1)
@@ -201,6 +207,9 @@ class MatchesTab(PlayoffTab):
self.phaseFrame.grid(
row=2, column=0, columnspan=2, sticky=tk.W+tk.E+tk.N+tk.S)
+ self.winfo_toplevel().bind(
+ '<<PhaseRenamed>>', self._renameTabs, add='+')
+
def getMatches(self):
matches = []
for phase in self.phases.values():