Implement method which gathers values across control panel boxes

This commit is contained in:
DarkPhoenix
2019-06-26 16:50:54 +03:00
parent ee4a1f936b
commit 22ca78cb68
3 changed files with 28 additions and 7 deletions

View File

@@ -214,11 +214,31 @@ class GraphControlPanel(wx.Panel):
def OnDrawTimer(self, event):
event.Skip()
# self.graphFrame.clearCache()
# self.graphFrame.draw()
self.graphFrame.clearCache()
self.graphFrame.draw()
def getValues(self):
view = self.graphFrame.getView()
values = {}
# Vectors
srcVectorDef = view.srcVectorDef
if srcVectorDef is not None:
if not self.srcVector.IsDirectionOnly:
values[srcVectorDef.lengthHandle] = (self.srcVector.GetLength() * 100, srcVectorDef.lengthUnit)
values[srcVectorDef.angleHandle] = (self.srcVector.GetAngle(), srcVectorDef.angleUnit)
tgtVectorDef = view.tgtVectorDef
if tgtVectorDef is not None:
if not self.tgtVector.IsDirectionOnly:
values[tgtVectorDef.lengthHandle] = (self.tgtVector.GetLength() * 100, tgtVectorDef.lengthUnit)
values[tgtVectorDef.angleHandle] = (self.tgtVector.GetAngle(), srcVectorDef.angleUnit)
# Input boxes which were set up overwrite values if needed
for k, v in self.inputs.items():
inputHandle, inputUnit = k
inputBox = v[0]
if isinstance(inputBox, RangeBox):
values[inputHandle] = (inputBox.GetValueRange(), inputUnit)
elif isinstance(inputBox, ConstantBox):
values[inputHandle] = (inputBox.GetValueFloat(), inputUnit)
return values
@property