summaryrefslogtreecommitdiff
path: root/jfr_playoff/gui
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-06-02 21:55:25 +0200
committeremkael <emkael@tlen.pl>2019-06-02 21:55:25 +0200
commit0bbbab20198e7e0ff67b7b5adb48fa6ee8e9c3ba (patch)
treed57cd0fe72ed37a2f4bc91af1b7dab377f043895 /jfr_playoff/gui
parent3e43bafa407d1bda4e5e8f0adb24ec6a8a4d196b (diff)
Refactoring and exposing method for disabling panels
Diffstat (limited to 'jfr_playoff/gui')
-rw-r--r--jfr_playoff/gui/frames/__init__.py7
-rw-r--r--jfr_playoff/gui/frames/team.py11
2 files changed, 9 insertions, 9 deletions
diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py
index 7c4907f..82f2966 100644
--- a/jfr_playoff/gui/frames/__init__.py
+++ b/jfr_playoff/gui/frames/__init__.py
@@ -9,6 +9,13 @@ def getIntVal(widget, default=0):
except ValueError:
return default
+def setPanelState(frame, state):
+ for child in frame.winfo_children():
+ if isinstance(child, tk.Frame):
+ setPanelState(child, state)
+ else:
+ child.configure(state=state)
+
class WidgetRepeater(tk.Frame):
def __init__(self, master, widgetClass, headers=None, classParams=None,
*args, **kwargs):
diff --git a/jfr_playoff/gui/frames/team.py b/jfr_playoff/gui/frames/team.py
index e041510..b0ea3da 100644
--- a/jfr_playoff/gui/frames/team.py
+++ b/jfr_playoff/gui/frames/team.py
@@ -6,7 +6,7 @@ from tkinter import ttk
import tkMessageBox
from ..frames import RepeatableFrame, WidgetRepeater, RepeatableEntry
-from ..frames import getIntVal, ScrollableFrame
+from ..frames import getIntVal, setPanelState, ScrollableFrame
class ManualTeamRow(RepeatableFrame):
def renderContent(self):
@@ -182,18 +182,11 @@ class TeamSettingsFrame(ScrollableFrame):
FORMAT_FETCH = 0
FORMAT_MANUAL = 1
- def _setPanelState(self, frame, state):
- for child in frame.winfo_children():
- if isinstance(child, tk.Frame):
- self._setPanelState(child, state)
- else:
- child.configure(state=state)
-
def _enablePanels(self, *args):
panels = {self.FORMAT_FETCH: self.fetchSettingsFrame,
self.FORMAT_MANUAL: self.manualSettingsFrame}
for value, panel in panels.iteritems():
- self._setPanelState(
+ setPanelState(
frame=panel,
state=tk.NORMAL \
if self.teamFormat.get()==value else tk.DISABLED)