From 2155aa0d21a28716a868e8b5231df75e3aa31020 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 7 Aug 2019 09:24:26 +0300 Subject: [PATCH] Move proportion width calcuation to display class --- graphs/gui/panel.py | 11 ++--------- gui/display.py | 4 ++++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/graphs/gui/panel.py b/graphs/gui/panel.py index d824a7062..b12baa2da 100644 --- a/graphs/gui/panel.py +++ b/graphs/gui/panel.py @@ -270,15 +270,8 @@ class GraphControlPanel(wx.Panel): self.targetList.refreshExtraColumns(view.tgtExtraCols) self.srcTgtSizer.Detach(self.sourceList) self.srcTgtSizer.Detach(self.targetList) - - def getProportion(wrapperList): - propWidth = 0 - for column in wrapperList.activeColumns: - propWidth += column.proportionWidth - return propWidth - - self.srcTgtSizer.Add(self.sourceList, getProportion(self.sourceList), wx.EXPAND | wx.ALL, 0) - self.srcTgtSizer.Add(self.targetList, getProportion(self.targetList), wx.EXPAND | wx.LEFT, 10) + self.srcTgtSizer.Add(self.sourceList, self.sourceList.getWidthProportion(), wx.EXPAND | wx.ALL, 0) + self.srcTgtSizer.Add(self.targetList, self.targetList.getWidthProportion(), wx.EXPAND | wx.LEFT, 10) self.Layout() def OnShowLegendChange(self, event): diff --git a/gui/display.py b/gui/display.py index 9b588b294..e59597827 100644 --- a/gui/display.py +++ b/gui/display.py @@ -296,3 +296,7 @@ class Display(wx.ListCtrl): rows.append(row) row = self.GetNextSelected(row) return rows + + def getWidthProportion(self): + propWidth = sum(c.proportionWidth for c in self.activeColumns) + return propWidth