From e53d7c6e35e8bb7aab42976f470957dde313ece5 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 27 Jun 2019 23:45:45 +0200 Subject: Generating MatchListChanged events on repeater add/remove --- jfr_playoff/gui/frames/__init__.py | 3 +-- jfr_playoff/gui/frames/match.py | 7 +++++++ jfr_playoff/gui/tabs.py | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py index 270bbbd..0165c71 100644 --- a/jfr_playoff/gui/frames/__init__.py +++ b/jfr_playoff/gui/frames/__init__.py @@ -139,8 +139,7 @@ class WidgetRepeater(tk.Frame): self.widgets[i].setValue(value[1] if typedWidget else value) for idx in range(len(values), len(self.widgets)): self._removeWidget(len(self.widgets)-1) - self.winfo_toplevel().event_generate( - '<>', when='tail') + class GuiFrame(tk.Frame): def __init__(self, *args, **kwargs): diff --git a/jfr_playoff/gui/frames/match.py b/jfr_playoff/gui/frames/match.py index 07942bd..a7d46b2 100644 --- a/jfr_playoff/gui/frames/match.py +++ b/jfr_playoff/gui/frames/match.py @@ -386,6 +386,11 @@ class MatchSettingsFrame(RepeatableFrame): SCORE_SOURCE_LINK = 1 SCORE_SOURCE_CUSTOM = 2 + def destroy(self, *args, **kwargs): + self.winfo_toplevel().event_generate( + '<>', when='tail') + RepeatableFrame.destroy(self, *args, **kwargs) + def _enablePanels(self, *args): for val, fields in self.scoreWidgets.iteritems(): for field in fields: @@ -661,6 +666,8 @@ class MatchPhaseFrame(ScrollableFrame): self.matches.setValue(objects) self.link.set(values['link'] if 'link' in values else '') self.name.set(values['title'] if 'title' in values else '') + self.winfo_toplevel().event_generate( + '<>', when='tail') __all__ = ['SwissesFrame', 'MatchPhaseFrame', 'MatchSettingsFrame'] diff --git a/jfr_playoff/gui/tabs.py b/jfr_playoff/gui/tabs.py index e61779c..873edc0 100644 --- a/jfr_playoff/gui/tabs.py +++ b/jfr_playoff/gui/tabs.py @@ -220,6 +220,8 @@ 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 + self.winfo_toplevel().event_generate( + '<>', when='tail') return newPhase def removePhase(self, phase=None): @@ -234,6 +236,8 @@ class MatchesTab(PlayoffTab): break if key_to_delete: self.phases.pop(key_to_delete) + self.winfo_toplevel().event_generate( + '<>', when='tail') def _renameTabs(self, *args): for idx, tab in self.phases.iteritems(): -- cgit v1.2.3