summaryrefslogtreecommitdiff
path: root/jfr_playoff
diff options
context:
space:
mode:
Diffstat (limited to 'jfr_playoff')
-rw-r--r--jfr_playoff/gui/frames/__init__.py2
-rw-r--r--jfr_playoff/gui/frames/network.py7
-rw-r--r--jfr_playoff/gui/frames/visual.py15
3 files changed, 7 insertions, 17 deletions
diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py
index 623b5bd..dba30a5 100644
--- a/jfr_playoff/gui/frames/__init__.py
+++ b/jfr_playoff/gui/frames/__init__.py
@@ -117,6 +117,8 @@ class WidgetRepeater(tk.Frame):
if i >= len(self.widgets):
self._addWidget()
self.widgets[i].setValue(value[i])
+ for idx in range(len(value), len(self.widgets)):
+ self._removeWidget(idx)
class GuiFrame(tk.Frame):
def __init__(self, *args, **kwargs):
diff --git a/jfr_playoff/gui/frames/network.py b/jfr_playoff/gui/frames/network.py
index 946bdf5..50c77dd 100644
--- a/jfr_playoff/gui/frames/network.py
+++ b/jfr_playoff/gui/frames/network.py
@@ -169,11 +169,6 @@ class RemoteConfigurationFrame(ScrollableFrame):
self.repeater.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
def setValues(self, values):
- for idx, value in enumerate(values):
- if idx >= len(self.repeater.widgets):
- self.repeater._addWidget()
- self.repeater.widgets[idx].setValue(value)
- for idx in range(len(values), len(self.repeater.widgets)):
- self.repeater._removeWidget(idx)
+ self.repeater.setValue(values)
__all__ = ['MySQLConfigurationFrame', 'GoniecConfigurationFrame', 'RemoteConfigurationFrame']
diff --git a/jfr_playoff/gui/frames/visual.py b/jfr_playoff/gui/frames/visual.py
index 0e2828b..ecc6e03 100644
--- a/jfr_playoff/gui/frames/visual.py
+++ b/jfr_playoff/gui/frames/visual.py
@@ -248,17 +248,15 @@ class BoxPositionsFrame(ScrollableFrame):
def setValues(self, values):
values = sorted(list(values.iteritems()), key=lambda v: int(v[0]))
+ values_to_set = []
for idx, val in enumerate(values):
value = [val[0]]
if isinstance(val[1], list):
value += val[1]
else:
value.append(val[1])
- if idx >= len(self.positions.widgets):
- self.positions._addWidget()
- self.positions.widgets[idx].setValue(value)
- for idx in range(len(values), len(self.positions.widgets)):
- self.positions._removeWidget(idx)
+ values_to_set.append(value)
+ self.positions.setValue(values_to_set)
class LineStyle(GuiFrame):
def _selectColour(self):
@@ -396,11 +394,6 @@ class PositionStylesFrame(ScrollableFrame):
self.styles.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
def setValues(self, values):
- for idx, value in enumerate(values):
- if idx >= len(self.styles.widgets):
- self.styles._addWidget()
- self.styles.widgets[idx].setValue(value)
- for idx in range(len(values), len(self.styles.widgets)):
- self.styles._removeWidget(idx)
+ self.styles.setValue(values)
__all__ = ['VisualSettingsFrame', 'BoxPositionsFrame', 'LineStylesFrame', 'PositionStylesFrame']