Add extra argument to axis selection updater

This commit is contained in:
DarkPhoenix
2019-08-16 08:51:58 +03:00
parent f3551ce570
commit 477c43884a
3 changed files with 18 additions and 14 deletions

View File

@@ -90,6 +90,7 @@ class FitGraph(metaclass=ABCMeta):
srcVectorDef = None
tgtVectorDef = None
hasTargets = False
usesHpEffectivity = False
def getPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, src, tgt=None):
cacheKey = self._makeCacheKey(src=src, tgt=tgt)

View File

@@ -133,16 +133,8 @@ class GraphControlPanel(wx.Panel):
self.Freeze()
self._clearStoredValues()
view = self.graphFrame.getView()
self.ySubSelection.Clear()
self.xSubSelection.Clear()
for yDef in view.yDefs:
self.ySubSelection.Append(self.formatLabel(yDef, selector=True), yDef)
self.ySubSelection.SetSelection(0)
self.ySubSelection.Enable(len(view.yDefs) > 1)
for xDef in view.xDefs:
self.xSubSelection.Append(self.formatLabel(xDef, selector=True), xDef)
self.xSubSelection.SetSelection(0)
self.xSubSelection.Enable(len(view.xDefs) > 1)
self.refreshAxeLabels()
# Vectors
self._setVectorDefaults()
@@ -256,15 +248,26 @@ class GraphControlPanel(wx.Panel):
continue
addInputField(inputDef, handledHandles)
def refreshAxeLabels(self):
# Currently we need to refresh only Y for dps graph
selectedY = self.ySubSelection.GetSelection()
def refreshAxeLabels(self, restoreSelection=False):
view = self.graphFrame.getView()
if restoreSelection:
selectedY = self.ySubSelection.GetSelection()
selectedX = self.xSubSelection.GetSelection()
else:
selectedY = selectedX = 0
self.ySubSelection.Clear()
for yDef in view.yDefs:
self.ySubSelection.Append(self.formatLabel(yDef, selector=True), yDef)
self.ySubSelection.Enable(len(view.yDefs) > 1)
self.ySubSelection.SetSelection(selectedY)
self.xSubSelection.Clear()
for xDef in view.xDefs:
self.xSubSelection.Append(self.formatLabel(xDef, selector=True), xDef)
self.xSubSelection.Enable(len(view.xDefs) > 1)
self.xSubSelection.SetSelection(selectedX)
def refreshColumns(self, layout=True):
view = self.graphFrame.getView()
self.sourceList.refreshExtraColumns(view.srcExtraCols)

View File

@@ -164,7 +164,7 @@ class GraphFrame(AuxiliaryFrame):
event.Skip()
self.ctrlPanel.Freeze()
if getattr(event, 'refreshAxeLabels', False):
self.ctrlPanel.refreshAxeLabels()
self.ctrlPanel.refreshAxeLabels(restoreSelection=True)
if getattr(event, 'refreshColumns', False):
self.ctrlPanel.refreshColumns()
self.ctrlPanel.Thaw()