MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / SaturationTableDialog

Class SaturationTableDialog

wrappers/Python/CoolProp/GUI/CoolPropGUI.py:183–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183class SaturationTableDialog(wx.Dialog):
184 def __init__(self, parent):
185 wx.Dialog.__init__(self, parent)
186
187 self.FluidLabel = wx.StaticText(self, label="Fluid")
188 self.FluidCombo = wx.ComboBox(self)
189 self.FluidCombo.AppendItems(sorted(CP.__fluids__))
190 self.FluidCombo.SetEditable(False)
191 self.TtripleLabel = wx.StaticText(self, label="Critical Temperature [K]")
192 self.TtripleValue = wx.TextCtrl(self)
193 self.TtripleValue.Enable(False)
194 self.TcritLabel = wx.StaticText(self, label="Critical Temperature [K]")
195 self.TcritValue = wx.TextCtrl(self)
196 self.TcritValue.Enable(False)
197 self.NvalsLabel = wx.StaticText(self, label="Number of values")
198 self.NvalsValue = wx.TextCtrl(self)
199 self.TminLabel = wx.StaticText(self, label="Minimum Temperature [K]")
200 self.TminValue = wx.TextCtrl(self)
201 self.TmaxLabel = wx.StaticText(self, label="Maximum Temperature [K]")
202 self.TmaxValue = wx.TextCtrl(self)
203
204 self.Accept = wx.Button(self, label="Accept")
205
206 sizer = wx.FlexGridSizer(cols=2)
207 sizer.AddMany([self.FluidLabel, self.FluidCombo,
208 self.TtripleLabel, self.TtripleValue,
209 self.TcritLabel, self.TcritValue])
210 sizer.AddSpacer(10)
211 sizer.AddSpacer(10)
212 sizer.AddMany([self.NvalsLabel, self.NvalsValue,
213 self.TminLabel, self.TminValue,
214 self.TmaxLabel, self.TmaxValue])
215 sizer.Add(self.Accept)
216
217 self.Bind(wx.EVT_COMBOBOX, self.OnSelectFluid)
218 self.Bind(wx.EVT_BUTTON, self.OnAccept)
219
220 self.SetSizer(sizer)
221 sizer.Layout()
222 self.Fit()
223
224 # Bind a key-press event to all objects to get Esc
225 children = self.GetChildren()
226 for child in children:
227 child.Bind(wx.EVT_KEY_UP, self.OnKeyPress)
228
229 def OnKeyPress(self, event=None):
230 """ cancel if Escape key is pressed """
231 event.Skip()
232 if event.GetKeyCode() == wx.WXK_ESCAPE:
233 self.EndModal(wx.ID_CANCEL)
234
235 def get_values(self):
236 Fluid = str(self.FluidCombo.GetStringSelection())
237 if Fluid:
238 N = float(self.NvalsValue.GetValue())
239 Tmin = float(self.TminValue.GetValue())
240 Tmax = float(self.TmaxValue.GetValue())

Callers 1

OnSelectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected