Re-enable warp graph and adapt it to new framework
This commit is contained in:
@@ -7,5 +7,5 @@ from gui.builtinGraphs import ( # noqa: E402,F401
|
||||
# fitCapRegenVsCapPerc,
|
||||
# fitCapAmountVsTime,
|
||||
# fitMobilityVsTime,
|
||||
# fitWarpTimeVsDistance
|
||||
fitWarpTimeVsDistance
|
||||
)
|
||||
|
||||
@@ -18,27 +18,33 @@
|
||||
# =============================================================================
|
||||
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from eos.graph.fitWarpTimeVsDistance import FitWarpTimeVsDistanceGraph as EosGraph
|
||||
from .base import Graph, XDef, YDef
|
||||
from .base import Graph, XDef, YDef, Input
|
||||
|
||||
|
||||
class FitWarpTimeVsDistanceGraph(Graph):
|
||||
|
||||
name = 'Warp Time vs Distance'
|
||||
name = 'Warp Time'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.eosGraph = EosGraph()
|
||||
|
||||
@property
|
||||
def xDef(self):
|
||||
return XDef(inputDefault='0-50', inputLabel='Distance (AU)', inputIconID=1391, axisLabel='Warp distance, AU')
|
||||
def xDefs(self):
|
||||
return [
|
||||
XDef(handle='distance', unit='AU', label='Distance', mainInput=('distance', 'AU')),
|
||||
XDef(handle='distance', unit='km', label='Distance', mainInput=('distance', 'km'))]
|
||||
|
||||
@property
|
||||
def yDefs(self):
|
||||
return OrderedDict([('time', YDef(switchLabel='Warp time', axisLabel='Warp time, s', eosGraph='eosGraph'))])
|
||||
return [YDef(handle='time', unit='s', label='Warp time', eosGraph='eosGraph')]
|
||||
|
||||
@property
|
||||
def inputs(self):
|
||||
return [
|
||||
Input(handle='distance', unit='AU', label='Distance', iconID=1391, defaultValue=50, defaultRange=(0, 50), mainOnly=False),
|
||||
Input(handle='distance', unit='km', label='Distance', iconID=1391, defaultValue=10000, defaultRange=(150, 5000), mainOnly=False)]
|
||||
|
||||
|
||||
FitWarpTimeVsDistanceGraph.register()
|
||||
|
||||
@@ -111,9 +111,11 @@ class GraphControlPanel(wx.Panel):
|
||||
for yDef in view.yDefs:
|
||||
self.ySubSelection.Append(self._formatLabel(yDef), (yDef.handle, yDef.unit))
|
||||
self.ySubSelection.SetSelection(0)
|
||||
self.ySubSelection.Enable(len(view.yDefs) > 1)
|
||||
for xDef in view.xDefs:
|
||||
self.xSubSelection.Append(self._formatLabel(xDef), (xDef.handle, xDef.unit))
|
||||
self.xSubSelection.SetSelection(0)
|
||||
self.xSubSelection.Enable(len(view.xDefs) > 1)
|
||||
|
||||
# Vectors
|
||||
self._setVectorDefaults()
|
||||
@@ -136,14 +138,15 @@ class GraphControlPanel(wx.Panel):
|
||||
self.targetList.Show(view.hasTargets)
|
||||
|
||||
# Inputs
|
||||
self._updateInputs()
|
||||
self._updateInputs(storeInputs=False)
|
||||
|
||||
if layout:
|
||||
self.graphFrame.Layout()
|
||||
self.graphFrame.UpdateWindowSize()
|
||||
|
||||
def _updateInputs(self):
|
||||
self._storeCurrentValues()
|
||||
def _updateInputs(self, storeInputs=True):
|
||||
if storeInputs:
|
||||
self._storeCurrentValues()
|
||||
# Clean up old inputs
|
||||
for children in self._inputs.values():
|
||||
for child in children:
|
||||
@@ -287,7 +290,7 @@ class GraphControlPanel(wx.Panel):
|
||||
self._storedConsts[(handle, unit)] = value
|
||||
|
||||
def _clearStoredValues(self):
|
||||
self._storedRanges.clear()
|
||||
self._storedConsts.clear()
|
||||
self._storedRanges.clear()
|
||||
|
||||
def _setVectorDefaults(self):
|
||||
|
||||
Reference in New Issue
Block a user