Add checkbox which controls if data from capsim is used or not

This commit is contained in:
DarkPhoenix
2019-08-19 13:28:50 +03:00
parent 6e3b536d83
commit 65e7607221
2 changed files with 8 additions and 1 deletions

View File

@@ -18,7 +18,7 @@
# =============================================================================
from graphs.data.base import FitGraph, Input, XDef, YDef
from graphs.data.base import FitGraph, XDef, YDef, Input, InputCheckbox
from .getter import CapAmount2CapAmountGetter, CapAmount2CapRegenGetter, Time2CapAmountGetter, Time2CapRegenGetter
@@ -42,6 +42,8 @@ class FitCapRegenGraph(FitGraph):
(('capAmount', '%'), None)]),
Input(handle='capAmountT0', unit='%', label='Starting cap amount', iconID=1668, defaultValue=0, defaultRange=(0, 100), conditions=[
(('time', 's'), None)])]
checkboxes = [InputCheckbox(handle='useCapsim', label='Use capacitor simulator', defaultValue=True, conditions=[
(('time', 's'), ('capAmount', 'GJ'))])]
srcExtraCols = ('CapAmount', 'CapTime')
# Calculation stuff

View File

@@ -256,6 +256,8 @@ class GraphControlPanel(wx.Panel):
self._miscInputBoxes.append(inputBox)
def __addInputCheckbox(self, checkboxDef, handledHandles):
if not self.__checkInputConditions(checkboxDef):
return
handledHandles.add(checkboxDef.handle)
fieldCheckbox = wx.CheckBox(self, wx.ID_ANY, checkboxDef.label, wx.DefaultPosition, wx.DefaultSize, 0)
fieldCheckbox.SetValue(self._storedConsts.get((checkboxDef.handle, None), checkboxDef.defaultValue))
@@ -323,7 +325,10 @@ class GraphControlPanel(wx.Panel):
def OnYTypeUpdate(self, event):
event.Skip()
self._updateInputs()
self.graphFrame.resetXMark()
self.graphFrame.Layout()
self.graphFrame.UpdateWindowSize()
self.graphFrame.draw()
def OnXTypeUpdate(self, event):