# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Mon May 18 09:43:57 2009

import wx
from validations import numberValidator
from extraFunctions import *
# begin wxGlade: dependencies
import wx.grid
# end wxGlade
from validations import numberValidator
from help_texts import help_cylinder
from help_texts import help_fuel
from help_texts import help_combustion
from help_texts import help_injection
from Plots import Plots
# begin wxGlade: extracode

# end wxGlade

class formCylinder(wx.Dialog):
    data = {}
    fuel = {}
    combustion = {}
    injection = {}
    edit = -1
    position = (0,0)
    def __init__(self,*args, **kwds):
        # begin wxGlade: formCylinder.__init_
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.FULL_REPAINT_ON_RESIZE
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_buttons = wx.Panel(self, -1)
        self.panel_configure = wx.Panel(self, -1)
        self.configure_notebook = wx.Notebook(self.panel_configure, -1)
        self.notebook_state = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.notebook_combustion = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.notebook_injection = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.notebook_fuel = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.notebook_general = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.notebook_post = wx.ScrolledWindow(self.configure_notebook, -1, style=wx.TAB_TRAVERSAL)
        self.label_0 = wx.StaticText(self.notebook_general, -1, "Number of Zones:")
        self.data['nnod'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_3 = wx.StaticText(self.notebook_general, -1, "Degrees of Freedom:")
        self.data['ndof'] = wx.TextCtrl(self.notebook_general, -1, "", style=wx.TE_READONLY)
        self.label_4 = wx.StaticText(self.notebook_general, -1, "Bore [mm]:")
        self.data['Bore'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_5 = wx.StaticText(self.notebook_general, -1, "Stroke [mm]:")
        self.data['crank_radius'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_21 = wx.StaticText(self.notebook_general, -1, "Con-rod Length [mm]:")
        self.data['rod_length'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_6 = wx.StaticText(self.notebook_general, -1, "Compression Ratio:")
        self.data['Vol_clearance'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_7 = wx.StaticText(self.notebook_general, -1, "Head Chamber Area [cm^2]:")
        self.data['head_chamber_area'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_8 = wx.StaticText(self.notebook_general, -1, "Piston Area [cm^2]:")
        self.data['piston_area'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_9 = wx.StaticText(self.notebook_general, -1, "Delta Crank Angle [deg]:")
        self.data['delta_ca'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_28b = wx.StaticText(self.notebook_general, -1, "Wall Temperature:")
        self.data['type_temperature'] = wx.RadioBox(self.notebook_general, -1, "", choices=["Homogeneous", "No Homogeneous"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.label_11 = wx.StaticText(self.notebook_general, -1, "Temperatures:")
        self.data['twall'] = wx.grid.Grid(self.notebook_general, -1, size=(1, 1))
        self.label_12 = wx.StaticText(self.notebook_general, -1, "Heat Transfer Model:")
        self.data['model_ht'] = wx.RadioBox(self.notebook_general, -1, "", choices=["Annand", "Woschni 1", "Woschni 2", "Taylor"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.label_13 = wx.StaticText(self.notebook_general, -1, "Factor ht:")
        self.data['factor_ht'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.label_18 = wx.StaticText(self.notebook_general, -1, "Mass Cyl.:")
        self.data['mass_C'] = wx.grid.Grid(self.notebook_general, -1, size=(1, 1))
        self.label_10 = wx.StaticText(self.notebook_general, -1, "Type Ignition:")
        self.data['type_ig'] = wx.RadioBox(self.notebook_general, -1, "", choices=["spark-ignition", "compression-ignition"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.panel_19 = wx.Panel(self.notebook_general, -1)
        self.panel_20 = wx.Panel(self.notebook_general, -1)
        self.data['nve'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.data['nvi'] = wx.TextCtrl(self.notebook_general, -1, "")
       #self.panel_18 = wx.Panel(self.notebook_general, -1)
       #self.panel_10 = wx.Panel(self.notebook_general, -1)
        self.data['scavenge'] = wx.CheckBox(self.notebook_general, -1, "Scavenge")
        self.panel_11 = wx.Panel(self.notebook_general, -1)
        self.label_15 = wx.StaticText(self.notebook_general, -1, "Scavenge Type:")
        self.data['scavenge_type'] = wx.RadioBox(self.notebook_general, -1, "", choices=["uniflow", "scre", "yam1", "yam6", "cd", "qubcr"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        # self.label_16 = wx.StaticText(self.notebook_general, -1, "Scavenge Ratio (by Vol.):")
        # self.data['SRv'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.data['full_implicit'] = wx.CheckBox(self.notebook_general, -1, "Full Implicit")
        self.panel_12 = wx.Panel(self.notebook_general, -1)
        self.label_19 = wx.StaticText(self.notebook_general, -1, "Crevice Data:")
        self.data['data_crevice'] = wx.grid.Grid(self.notebook_general, -1, size=(1, 1))
        self.label_20 = wx.StaticText(self.notebook_general, -1, "Crevice State:")
        self.data['U_crevice'] = wx.grid.Grid(self.notebook_general, -1, size=(1, 1))
        self.label_22 = wx.StaticText(self.notebook_fuel, -1, "Heating Value [MJ/kg]:")
        self.label_27b = wx.StaticText(self.notebook_general, -1, "Species Model:")
        self.data['species_model'] = wx.RadioBox(self.notebook_general, -1, "", choices=["<none>", "single component"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)

        self.fuel['Q_fuel'] = wx.TextCtrl(self.notebook_fuel, -1, "")
        self.label_23 = wx.StaticText(self.notebook_fuel, -1, "H/C Ratio:")
        self.fuel['y'] = wx.TextCtrl(self.notebook_fuel, -1, "")
        self.label_24 = wx.StaticText(self.notebook_fuel, -1, "Hvap Fuel [kJ/kg]:")
        self.fuel['hvap_fuel'] = wx.TextCtrl(self.notebook_fuel, -1, "")
        self.label_25 = wx.StaticText(self.notebook_injection, -1, "Pulse:")
        self.injection['pulse'] = wx.RadioBox(self.notebook_injection, -1, "", choices=["squared sin", "squared wave", "user-defined"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.label_26 = wx.StaticText(self.notebook_injection, -1, "Mass Injected per Cycle [g]:")
        self.injection['m_inj'] = wx.TextCtrl(self.notebook_injection, -1, "")
        self.label_27 = wx.StaticText(self.notebook_injection, -1, "Duration of Injection [deg]:")
        self.injection['dtheta_inj'] = wx.TextCtrl(self.notebook_injection, -1, "")
        self.label_28 = wx.StaticText(self.notebook_injection, -1, "Temperature of Fuel [K]:")
        self.injection['T_fuel'] = wx.TextCtrl(self.notebook_injection, -1, "")
        self.label_29 = wx.StaticText(self.notebook_injection, -1, "Start of Injection [deg]:")
        self.injection['theta_inj_ini'] = wx.TextCtrl(self.notebook_injection, -1, "")
        self.label_30 = wx.StaticText(self.notebook_injection, -1, "Ignition Delay [deg]:")
        self.injection['theta_id'] = wx.TextCtrl(self.notebook_injection, -1, "")
        self.label_31 = wx.StaticText(self.notebook_injection, -1, "Ignition Delay Model:")
        self.injection['ignition_delay_model'] = wx.RadioBox(self.notebook_injection, -1, "", choices=["L-W", "H-H", "user-defined"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.label_33 = wx.StaticText(self.notebook_injection, -1, "Mass Injection Rate:")
        self.button_3 = wx.Button(self.notebook_injection, -1, "load")
        self.button_3b = wx.Button(self.notebook_injection, -1, "plot")
        self.injection['mfdot_array'] = wx.grid.Grid(self.notebook_injection, -1, size=(1, 1))
        self.panel_22 = wx.Panel(self.notebook_injection, -1)
        self.panel_23 = wx.Panel(self.notebook_injection, -1)
        self.label_34 = wx.StaticText(self.notebook_combustion, -1, "Start of Combustion [deg]: ")
        self.combustion['theta_ig_0'] = wx.TextCtrl(self.notebook_combustion, -1, "")
        self.label_35 = wx.StaticText(self.notebook_combustion, -1, "Duration of Combustion [deg]: ")
        self.combustion['dtheta_comb'] = wx.TextCtrl(self.notebook_combustion, -1, "")
        self.label_36 = wx.StaticText(self.notebook_combustion, -1, "Equivalence Ratio [(F/A)/(F/A)s]:")
        self.combustion['phi'] = wx.TextCtrl(self.notebook_combustion, -1, "")
        self.label_38 = wx.StaticText(self.notebook_combustion, -1, "Comb. Efficiency Parameter:")
        self.combustion['a_wiebe'] = wx.TextCtrl(self.notebook_combustion, -1, "")
        self.label_39 = wx.StaticText(self.notebook_combustion, -1, "Shape Parameter:")
        self.combustion['m_wiebe'] = wx.TextCtrl(self.notebook_combustion, -1, "")
        self.label_40 = wx.StaticText(self.notebook_combustion, -1, "Combustion Model:")
        self.combustion['combustion_model'] = wx.RadioBox(self.notebook_combustion, -1, "", choices=["user-defined", "Wiebe", "Wiebe-3", "Watson", "<none>"], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
        self.panel_26 = wx.Panel(self.notebook_combustion, -1)
        self.panel_24 = wx.Panel(self.notebook_combustion, -1)
        self.panel_25 = wx.Panel(self.notebook_combustion, -1)
        self.label_41 = wx.StaticText(self.notebook_combustion, -1, "Burned Mass Fraction Rate:")
        self.button_2 = wx.Button(self.notebook_combustion, -1, "load")
        self.button_2b = wx.Button(self.notebook_combustion, -1, "plot")
        self.combustion['xbdot_array'] = wx.grid.Grid(self.notebook_combustion, -1, size=(1, 1))
        self.panel_21 = wx.Panel(self.notebook_combustion, -1)
        self.panel_28 = wx.Panel(self.notebook_combustion, -1)
        self.data['state_ini'] = wx.grid.Grid(self.notebook_state, -1, size=(1, 1))
        self.data['ownState'] = wx.CheckBox(self.notebook_post, -1, "Save Own State")
        self.data['extras'] = wx.CheckBox(self.notebook_post, -1, "Calculate Extras (performance characteristics)")
        self.data['histo'] = wx.TextCtrl(self.notebook_post, -1, "")
        self.data['label'] = wx.TextCtrl(self.notebook_general, -1, "")
        self.button_4 = wx.Button(self.notebook_state, -1, "...")
        self.panel_27 = wx.Panel(self.notebook_state, -1)
        self.accept = wx.Button(self.panel_buttons, wx.ID_OK, "")
        self.cancel = wx.Button(self.panel_buttons, wx.ID_CANCEL, "")
        self.help = wx.ContextHelpButton(self.panel_buttons)

        self.__set_properties()
        self.setContextualHelp()
        self.__do_layout()
        self.onTypeIg("")

        self.Bind(wx.EVT_TEXT, self.onChangeNodes, self.data['nnod'])
        self.Bind(wx.EVT_TEXT, self.onChangeNdof, self.data['ndof'])
        self.Bind(wx.EVT_RADIOBOX, self.onTypeIg, self.data['type_ig'])
        self.Bind(wx.EVT_CHECKBOX, self.onHasScavenge, self.data['scavenge'])
        self.Bind(wx.EVT_RADIOBOX, self.onPulse, self.injection['pulse'])
        self.Bind(wx.EVT_RADIOBOX, self.onIgnitionDelayModel, self.injection['ignition_delay_model'])
        self.Bind(wx.EVT_BUTTON, self.onLoadmfdot, self.button_3)
        self.Bind(wx.EVT_BUTTON, self.onPlotmfdot, self.button_3b)
        self.Bind(wx.EVT_RADIOBOX, self.onCombustionModel, self.combustion['combustion_model'])
        self.Bind(wx.EVT_RADIOBOX, self.onSpeciesModel, self.data['species_model'])
        self.Bind(wx.EVT_RADIOBOX, self.onTypeTemperature, self.data['type_temperature'])
        self.Bind(wx.EVT_BUTTON, self.onLoadxbdot, self.button_2)
        self.Bind(wx.EVT_BUTTON, self.onPlotxbdot, self.button_2b)
        self.Bind(wx.EVT_BUTTON, self.onLoadState, self.button_4)
        self.Bind(wx.EVT_BUTTON, self.ConfigureAccept, self.accept)

        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: formCylinder.__set_properties
        self.SetTitle("Form Cylinder")
        self.SetSize(wx.DLG_UNIT(self, wx.Size(476, 692)))
        self.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_0.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['nnod'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['nnod'].SetValidator(numberValidator())
        self.label_3.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['ndof'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['ndof'].SetValidator(numberValidator())
        self.label_4.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['Bore'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['Bore'].SetValidator(numberValidator())
        self.label_5.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['crank_radius'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['crank_radius'].SetValidator(numberValidator())
        self.label_21.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['rod_length'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['rod_length'].SetValidator(numberValidator())
        self.label_6.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['Vol_clearance'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['Vol_clearance'].SetValidator(numberValidator())
        self.label_7.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['head_chamber_area'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['head_chamber_area'].SetValidator(numberValidator())
        self.label_8.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['piston_area'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['piston_area'].SetValidator(numberValidator())
        self.label_9.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['delta_ca'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['delta_ca'].SetValidator(numberValidator())
        self.label_11.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['twall'].CreateGrid(1, 1)
        self.data['twall'].SetRowLabelSize(55)
        self.data['twall'].SetColLabelSize(18)
        self.data['twall'].EnableDragColSize(0)
        self.data['twall'].EnableDragRowSize(0)
        self.data['twall'].EnableDragGridSize(0)
        self.data['twall'].SetColLabelValue(0, "K")
        self.data['twall'].SetRowLabelValue(0, "Wall: ")
        self.data['twall'].SetMinSize(wx.DLG_UNIT(self.data['U_crevice'], wx.Size(75, 50)))
        self.data['twall'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['twall'].SetDefaultRowSize(18)
        self.data['twall'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_12.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['model_ht'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['model_ht'].SetSelection(0)
        self.label_13.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['factor_ht'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['factor_ht'].SetValidator(numberValidator())
        self.label_18.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['mass_C'].CreateGrid(6, 1)
        self.data['mass_C'].SetRowLabelSize(25)
        self.data['mass_C'].SetColLabelSize(18)
        self.data['mass_C'].EnableDragColSize(0)
        self.data['mass_C'].EnableDragRowSize(0)
        self.data['mass_C'].EnableDragGridSize(0)
        self.data['mass_C'].SetColLabelValue(0, "Data")
        self.data['mass_C'].SetMinSize(wx.DLG_UNIT(self.data['mass_C'], wx.Size(80, 60)))
        self.data['mass_C'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['mass_C'].SetDefaultRowSize(18)
        self.data['mass_C'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_10.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['type_ig'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['type_ig'].SetSelection(0)
        self.data['nve'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['nve'].Hide()
        self.data['nve'].SetValidator(numberValidator())
        self.data['nvi'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['nvi'].Hide()
        self.data['nvi'].SetValidator(numberValidator())
        self.data['scavenge'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_15.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['scavenge_type'].Enable(False)
        self.data['scavenge_type'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['scavenge_type'].SetSelection(0)
        # self.label_16.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        # self.data['SRv'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        # self.data['SRv'].SetValidator(numberValidator())
        self.data['full_implicit'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['full_implicit'].SetValue(1)
        self.label_19.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['data_crevice'].CreateGrid(2, 1)
        self.data['data_crevice'].SetRowLabelSize(25)
        self.data['data_crevice'].SetColLabelSize(18)
        self.data['data_crevice'].EnableDragColSize(0)
        self.data['data_crevice'].EnableDragRowSize(0)
        self.data['data_crevice'].EnableDragGridSize(0)
        self.data['data_crevice'].SetColLabelValue(0, "Value")
        self.data['data_crevice'].SetMinSize(wx.DLG_UNIT(self.data['data_crevice'], wx.Size(75, 50)))
        self.data['data_crevice'].Enable(False)
        self.data['data_crevice'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['data_crevice'].SetDefaultRowSize(18)
        self.data['data_crevice'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_20.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['U_crevice'].CreateGrid(2, 1)
        self.data['U_crevice'].SetRowLabelSize(25)
        self.data['U_crevice'].SetColLabelSize(18)
        self.data['U_crevice'].EnableDragColSize(0)
        self.data['U_crevice'].EnableDragRowSize(0)
        self.data['U_crevice'].EnableDragGridSize(0)
        self.data['U_crevice'].SetColLabelValue(0, "Data")
        self.data['U_crevice'].SetMinSize(wx.DLG_UNIT(self.data['U_crevice'], wx.Size(75, 50)))
        self.data['U_crevice'].Enable(False)
        self.data['U_crevice'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['U_crevice'].SetDefaultRowSize(18)
        self.data['U_crevice'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.label_28b.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['type_temperature'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.notebook_general.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.notebook_general.SetScrollRate(10, 10)
        self.label_22.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['Q_fuel'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['Q_fuel'].SetValidator(numberValidator())
        self.label_23.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['y'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['y'].SetValidator(numberValidator())
        self.label_24.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['hvap_fuel'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.fuel['hvap_fuel'].SetValidator(numberValidator())
        self.notebook_fuel.SetScrollRate(10, 10)
        self.label_25.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['pulse'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['pulse'].SetSelection(1)
        self.label_26.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['m_inj'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['m_inj'].SetValidator(numberValidator())
        self.label_27.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['dtheta_inj'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['dtheta_inj'].SetValidator(numberValidator())
        self.label_28.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['T_fuel'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['T_fuel'].SetValidator(numberValidator())
        self.label_29.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['theta_inj_ini'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['theta_inj_ini'].SetValidator(numberValidator())
        self.label_30.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['theta_id'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['theta_id'].SetValidator(numberValidator())
        self.label_31.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['ignition_delay_model'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['ignition_delay_model'].SetSelection(1)
        self.label_33.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.button_3.SetMinSize(wx.DLG_UNIT(self.button_3, wx.Size(20, 13)))
        self.button_3.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.button_3b.SetMinSize(wx.DLG_UNIT(self.button_3b, wx.Size(20, 13)))
        self.button_3b.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['mfdot_array'].CreateGrid(30, 2)
        self.injection['mfdot_array'].SetRowLabelSize(25)
        self.injection['mfdot_array'].SetColLabelSize(18)
        self.injection['mfdot_array'].EnableDragColSize(0)
        self.injection['mfdot_array'].EnableDragRowSize(0)
        self.injection['mfdot_array'].EnableDragGridSize(0)
        self.injection['mfdot_array'].SetColLabelValue(0, "open")
        self.injection['mfdot_array'].SetColLabelValue(1, "Value")
        self.injection['mfdot_array'].SetMinSize(wx.DLG_UNIT(self.injection['mfdot_array'], wx.Size(120, 200)))
        self.injection['mfdot_array'].Enable(False)
        self.injection['theta_id'].Enable(False)
        self.injection['mfdot_array'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.injection['mfdot_array'].SetDefaultRowSize(18)
        self.injection['mfdot_array'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.notebook_injection.SetScrollRate(10, 10)
        self.label_34.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['theta_ig_0'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['theta_ig_0'].SetValidator(numberValidator())
        self.label_35.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['dtheta_comb'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['dtheta_comb'].SetValidator(numberValidator())
        self.label_36.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['phi'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['phi'].SetValidator(numberValidator())
        self.label_38.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['a_wiebe'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['a_wiebe'].SetValidator(numberValidator())
        self.label_39.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['m_wiebe'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['m_wiebe'].SetValidator(numberValidator())
        self.label_40.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['combustion_model'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['combustion_model'].SetSelection(1)
        self.label_41.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.button_2.SetMinSize(wx.DLG_UNIT(self.button_2, wx.Size(20, 13)))
        self.button_2.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.button_2b.SetMinSize(wx.DLG_UNIT(self.button_2b, wx.Size(20, 13)))
        self.button_2b.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['xbdot_array'].CreateGrid(30, 2)
        self.combustion['xbdot_array'].SetRowLabelSize(25)
        self.combustion['xbdot_array'].SetColLabelSize(25)
        self.combustion['xbdot_array'].EnableDragColSize(0)
        self.combustion['xbdot_array'].EnableDragRowSize(0)
        self.combustion['xbdot_array'].EnableDragGridSize(0)
        self.combustion['xbdot_array'].SetColLabelValue(0, "open")
        self.combustion['xbdot_array'].SetColLabelValue(1, "Value")
        self.combustion['xbdot_array'].SetMinSize(wx.DLG_UNIT(self.combustion['xbdot_array'], wx.Size(120, 200)))
        self.combustion['xbdot_array'].Enable(False)
        self.combustion['xbdot_array'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.combustion['xbdot_array'].SetDefaultRowSize(18)
        self.combustion['xbdot_array'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.notebook_combustion.SetScrollRate(10, 10)
        self.data['state_ini'].CreateGrid(1, 3)
        self.data['state_ini'].SetRowLabelSize(25)
        self.data['state_ini'].SetColLabelSize(15)
        self.data['state_ini'].EnableDragColSize(0)
        self.data['state_ini'].EnableDragRowSize(0)
        self.data['state_ini'].EnableDragGridSize(0)
        self.data['state_ini'].SetColLabelValue(0, "Density")
        self.data['state_ini'].SetColLabelValue(1, "Pressure")
        self.data['state_ini'].SetColLabelValue(2, "Temperature")
        self.data['state_ini'].SetMinSize(wx.DLG_UNIT(self.data['state_ini'], wx.Size(160, 80)))
        self.data['state_ini'].SetDefaultCellFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['state_ini'].SetDefaultRowSize(18)
        self.data['state_ini'].SetLabelFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['ownState'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['extras'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['label'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['histo'].Hide()
        self.label_27b.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.data['species_model'].SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.button_4.SetMinSize(wx.DLG_UNIT(self.button_4, wx.Size(16, 11)))
        self.notebook_state.SetScrollRate(10, 10)
        self.configure_notebook.SetMinSize(wx.DLG_UNIT(self.configure_notebook, wx.Size(354, 300)))
        self.configure_notebook.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
        self.panel_configure.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.accept.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        self.cancel.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: formCylinder.__do_layout
        configure_background = wx.BoxSizer(wx.VERTICAL)
        sizer_buttons = wx.GridSizer(1, 3, 0, 0)
        configure_sizer = wx.BoxSizer(wx.HORIZONTAL)
        grid_sizer_22 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_38 = wx.FlexGridSizer(1, 2, 0, 0)
        grid_sizer_19 = wx.FlexGridSizer(1, 2, 0, 20)
        grid_sizer_21 = wx.FlexGridSizer(2, 2, 0, 0)
        grid_sizer_30 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_43 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_20 = wx.FlexGridSizer(9, 2, 5, 5)
        grid_sizer_16 = wx.FlexGridSizer(1, 2, 0, 20)
        grid_sizer_18 = wx.FlexGridSizer(2, 2, 0, 0)
        grid_sizer_31 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_29 = wx.FlexGridSizer(2, 1, 0, 0)
        grid_sizer_injection = wx.FlexGridSizer(8, 2, 4, 3)
        grid_sizer_15 = wx.FlexGridSizer(3, 2, 4, 4)
        grid_sizer_1 = wx.FlexGridSizer(1, 2, 0, 6)
        grid_sizer_13 = wx.FlexGridSizer(8, 2, 0, 0)
        grid_sizer_12 = wx.FlexGridSizer(18, 2, 1, 0)
        grid_sizer_111 = wx.FlexGridSizer(2, 1, 0, 0)

        label_26a = wx.StaticText(self.notebook_general, -1, "Label: ")
        label_26a.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
        grid_sizer_12.Add(label_26a, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['label'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_0, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['nnod'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['ndof'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['Bore'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['crank_radius'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_21, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['rod_length'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_6, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['Vol_clearance'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_7, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['head_chamber_area'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['piston_area'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_9, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['delta_ca'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_28b, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['type_temperature'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_11, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['twall'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_12, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['model_ht'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_13, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['factor_ht'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.label_18, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['mass_C'], 0, wx.EXPAND|wx.SHAPED, 0)

        grid_sizer_12.Add(self.panel_19, 1, wx.EXPAND, 0)
        grid_sizer_12.Add(self.panel_20, 1, wx.EXPAND, 0)
        grid_sizer_12.Add(self.data['nve'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_12.Add(self.data['nvi'], 0, wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_1.Add(grid_sizer_12, 1, wx.EXPAND, 0)
        grid_sizer_13.Add(self.label_10, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['type_ig'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['scavenge'], 0, 0, 0)
        grid_sizer_13.Add(self.panel_11, 1, wx.EXPAND, 0)
        grid_sizer_13.Add(self.label_15, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['scavenge_type'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        # grid_sizer_13.Add(self.label_16, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        # grid_sizer_13.Add(self.data['SRv'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['full_implicit'], 0, 0, 0)
        grid_sizer_13.Add(self.panel_12, 1, wx.EXPAND, 0)
        grid_sizer_13.Add(self.label_19, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['data_crevice'], 0, wx.EXPAND|wx.SHAPED, 0)
        grid_sizer_13.Add(self.label_20, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['U_crevice'], 0, wx.EXPAND|wx.SHAPED, 0)
        grid_sizer_13.Add(self.label_27b, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_13.Add(self.data['species_model'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_1.Add(grid_sizer_13, 1, wx.EXPAND, 0)
        self.notebook_general.SetSizer(grid_sizer_1)
        grid_sizer_15.Add(self.label_22, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_15.Add(self.fuel['Q_fuel'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_15.Add(self.label_23, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_15.Add(self.fuel['y'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_15.Add(self.label_24, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_15.Add(self.fuel['hvap_fuel'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        self.notebook_fuel.SetSizer(grid_sizer_15)
        grid_sizer_injection.Add(self.label_25, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['pulse'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_26, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['m_inj'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_27, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['dtheta_inj'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_28, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['T_fuel'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_29, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['theta_inj_ini'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_31, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['ignition_delay_model'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.label_30, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_injection.Add(self.injection['theta_id'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        msg = wx.StaticText(self.notebook_injection, -1, "\nAVAILABLE ONLY FOR DIESEL ENGINES")
        grid_sizer_injection.Add(msg, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_16.Add(grid_sizer_injection, 1, wx.EXPAND, 0)
        grid_sizer_31.Add(self.label_33, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_29.Add(self.button_3, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_29.Add(self.button_3b, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_31.Add(grid_sizer_29, 1, wx.EXPAND, 0)
        grid_sizer_18.Add(grid_sizer_31, 1, wx.EXPAND, 0)
        grid_sizer_18.Add(self.injection['mfdot_array'], 0, wx.EXPAND|wx.SHAPED, 0)
        grid_sizer_18.Add(self.panel_22, 1, wx.EXPAND, 0)
        grid_sizer_18.Add(self.panel_23, 1, wx.EXPAND, 0)
        grid_sizer_16.Add(grid_sizer_18, 1, wx.EXPAND, 0)
        self.notebook_injection.SetSizer(grid_sizer_16)
        grid_sizer_20.Add(self.label_34, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['theta_ig_0'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.label_35, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['dtheta_comb'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.label_36, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['phi'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.label_38, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['a_wiebe'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.label_39, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['m_wiebe'], 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.label_40, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_20.Add(self.combustion['combustion_model'], 0, 0, 0)
        grid_sizer_20.Add(self.panel_26, 1, wx.EXPAND, 0)
        grid_sizer_20.Add(self.panel_24, 1, wx.EXPAND, 0)
        grid_sizer_20.Add(self.panel_25, 1, wx.EXPAND, 0)
        grid_sizer_19.Add(grid_sizer_20, 1, wx.EXPAND, 0)
        grid_sizer_30.Add(self.label_41, 0, 0, 0)
        grid_sizer_43.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_43.Add(self.button_2b, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_30.Add(grid_sizer_43, 1, wx.EXPAND, 0)
        grid_sizer_21.Add(grid_sizer_30, 1, wx.EXPAND, 0)
        grid_sizer_21.Add(self.combustion['xbdot_array'], 0, wx.EXPAND|wx.SHAPED, 0)
        grid_sizer_21.Add(self.panel_21, 1, wx.EXPAND, 0)
        grid_sizer_21.Add(self.panel_28, 1, wx.EXPAND, 0)
        grid_sizer_19.Add(grid_sizer_21, 0, wx.SHAPED, 0)
        self.notebook_combustion.SetSizer(grid_sizer_19)
        grid_sizer_38.Add(self.data['state_ini'], 1, wx.EXPAND, 0)
        grid_sizer_38.Add(self.button_4, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
        grid_sizer_22.Add(grid_sizer_38, 1, wx.EXPAND, 0)
        grid_sizer_22.Add(self.panel_27, 1, wx.EXPAND, 0)
        self.notebook_state.SetSizer(grid_sizer_22)

        grid_sizer_111.Add(self.data['ownState'], 0, 0, 0)
        grid_sizer_111.Add(self.data['extras'], 0, 0, 0)
        self.notebook_post.SetSizer(grid_sizer_111)

        self.configure_notebook.AddPage(self.notebook_general, "General")
        self.configure_notebook.AddPage(self.notebook_fuel, "Fuel")
        self.configure_notebook.AddPage(self.notebook_injection, "Injection")
        self.configure_notebook.AddPage(self.notebook_combustion, "Combustion")
        self.configure_notebook.AddPage(self.notebook_state, "State")
        self.configure_notebook.AddPage(self.notebook_post, "Post Process")
        configure_sizer.Add(self.configure_notebook, 1, wx.EXPAND, 0)
        self.panel_configure.SetSizer(configure_sizer)
        configure_background.Add(self.panel_configure, 1, wx.EXPAND, 0)
        sizer_buttons.Add(self.accept, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
        sizer_buttons.Add(self.help, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL, 0)
        sizer_buttons.Add(self.cancel, 0, wx.ALIGN_CENTER_VERTICAL| wx.ALIGN_LEFT, 0)
        self.panel_buttons.SetSizer(sizer_buttons)
        configure_background.Add(self.panel_buttons, 0, wx.EXPAND, 0)
        self.SetSizer(configure_background)
        self.Layout()
        # end wxGlade

    def OnCylinderAccept(self, event): # wxGlade: formCylinder.<event_handler>
        can_out=1
        for key in self.data:
            if (self.data[key].GetValidator()):
                if(not(self.data[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        for key in self.combustion:
            if self.data[key].GetValidator():
                if not(self.data[key].GetValidator().Validate(self,'number')):
                    can_out=0
        for key in self.fuel:
            if (self.data[key].GetValidator()):
                if(not(self.data[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        for key in self.injection:
            if (self.data[key].GetValidator()):
                if(not(self.data[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        self.onTypeIg("") #para reafirmar los disabled
        if(can_out==1):
            self.EndModal(wx.ID_OK)
        else:
            wx.MessageBox("Some fields have some error (empty or no-digit value)!", "Error")

    def OnCylinderCancel(self, event): # wxGlade: formCylinder.<event_handler>
        self.Close()

    def onChangeNodes(self, event): # wxGlade: formCylinder.<event_handler>
        try:
           nodes = int(self.data['nnod'].GetValue())
           nstate = self.data['state_ini'].GetNumberRows()
           if(nodes>nstate):
                self.data['state_ini'].AppendRows(nodes-nstate)
           else:
                if(nodes<nstate):
                    self.data['state_ini'].DeleteRows(nstate-(nstate-nodes), nstate-nodes)
        except ValueError:
		   	nodes = None

    def onChangeNdof(self, event): # wxGlade: formCylinder.<event_handler>
        try:
            ndof = int(self.data['ndof'].GetValue())
            nstate = self.data['state_ini'].GetNumberCols()
            #for i in range(ndof):
            #    self.data['state_ini'].SetColLabelValue(i,"ndof %d" % (i+1))
            if(ndof>nstate):
                self.data['state_ini'].AppendCols(ndof-nstate)
            else:
                if(ndof<nstate):
                    self.data['state_ini'].DeleteCols(nstate-(nstate-ndof), nstate-ndof)
            self.setLabels()
        except ValueError:
           	ndof = None

    def ConfigureAccept(self, event): # wxGlade: formCylinder.<event_handler>
        can_out=1
        for key in self.data:
            if (self.data[key].GetValidator()):
                if(not(self.data[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        no_check_comb = []
        if self.data['type_ig'].GetSelection()==0: 
            if self.combustion['combustion_model'].GetSelection()==0:
                no_check_comb = ['a_wiebe','m_wiebe']
        elif self.data['type_ig'].GetSelection()==1:
            no_check_comb = ['phi']
        for key in self.combustion:
            if self.combustion[key].GetValidator() and not(key in no_check_comb):
                if(not(self.combustion[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        for key in self.fuel:
            if (self.fuel[key].GetValidator()):
                if(not(self.fuel[key].GetValidator().Validate(self,'number'))):
                    can_out=0
        if self.data['type_ig'].GetSelection()==1:
            no_check_inj = []
            if self.injection['ignition_delay_model'].GetSelection()!=2:
                no_check_inj = ['theta_id']
            for key in self.injection:
                if self.injection[key].GetValidator() and not(key in no_check_inj):
                    if(not(self.injection[key].GetValidator().Validate(self,'number'))):
                        can_out=0
        
        if(can_out==1):
            self.EndModal(wx.ID_OK)
        else:
            wx.MessageBox("Some fields have some error (empty or no-digit value)!", "Error")

    def onTypeIg(self, event): # wxGlade: formCylinder.<event_handler>
        type_ig = self.data['type_ig'].GetSelection()
        if type_ig == 0:
            for key in self.injection:
                self.injection[key].Enable(0)
            self.combustion['phi'].Enable(1)
            self.combustion['combustion_model'].EnableItem(2, False)
            self.combustion['combustion_model'].EnableItem(3, False)
        else:
            self.combustion['phi'].Enable(0)
            self.combustion['combustion_model'].EnableItem(2, True)
            self.combustion['combustion_model'].EnableItem(3, True)
            for key in self.injection:
                self.injection[key].Enable(1)


    def onHasScavenge(self, event): # wxGlade: formCylinder.<event_handler>
        scav = self.data['scavenge'].GetValue()
        if scav == 1:
            self.data['scavenge_type'].Enable(1)
            # self.data['SRv'].Enable(1)
        else:
            self.data['scavenge_type'].Enable(0)
            # self.data['SRv'].Enable(0)

    def onPulse(self, event): # wxGlade: formCylinder.<event_handler>
        pulse = self.injection['pulse'].GetSelection()
        if pulse == 2:
            self.injection['mfdot_array'].Enable(1)
        else:
            self.injection['mfdot_array'].Enable(0)

    def onCombustionModel(self, event): # wxGlade: formCylinder.<event_handler>
        cm = self.combustion['combustion_model'].GetSelection()
        if cm == 0:
            self.combustion['xbdot_array'].Enable(1)
        if cm == 1 or cm == 2:
            self.combustion['a_wiebe'].Enable(1)
            self.combustion['m_wiebe'].Enable(1)
        else:
            self.combustion['a_wiebe'].Enable(0)
            self.combustion['m_wiebe'].Enable(0)

    def onLoadmfdot(self, event): # wxGlade: formCylinder.<event_handler>
        if self.injection['mfdot_array'].IsEnabled():
            dlg = wx.FileDialog(self, message="Open a Data File", defaultDir="./loads",defaultFile="", wildcard="*.txt", style=wx.FD_OPEN)
            if dlg.ShowModal() == wx.ID_OK:
                namefile = dlg.GetPath()
                data = loadData(namefile,"n",2)
                if(data==-1):
                    wx.MessageBox("Incorrect data", "Error")
                else:	
                    setGrid(data,self.injection['mfdot_array'])
            dlg.Destroy()
            self.setLabels()
        else:
            wx.MessageBox("You must active 'user-defined'", "Error") 

    def onLoadxbdot(self, event): # wxGlade: formCylinder.<event_handler>
        if self.combustion['xbdot_array'].IsEnabled():
            dlg = wx.FileDialog(self, message="Open a Data File", defaultDir="./loads",defaultFile="", wildcard="*.txt", style=wx.FD_OPEN)
            if dlg.ShowModal() == wx.ID_OK:
                namefile = dlg.GetPath()
                data = loadData(namefile,"n",2)
                if(data==-1):
                    wx.MessageBox("Incorrect data", "Error")
                else:	
                    setGrid(data,self.combustion['xbdot_array'])
            dlg.Destroy()
            self.setLabels()
        else:
            wx.MessageBox("You must active 'user-defined'", "Error") 

    def onIgnitionDelayModel(self, event): # wxGlade: formCylinder.<event_handler>
		idm = self.injection['ignition_delay_model'].GetSelection()
		if idm == 2:
			self.injection['theta_id'].Enable(1)
		else:
			self.injection['theta_id'].Enable(0)

    def onLoadState(self, event): # wxGlade: formCylinder.<event_handler>
        try:
            ndof = int(self.data['ndof'].GetValue())
            nodes = int(self.data['nnod'].GetValue())
            if self.data['state_ini'].IsEnabled():
                dlg = wx.FileDialog(self, message="Open a Data File", defaultDir="./loads",defaultFile="", wildcard="*.txt", style=wx.FD_OPEN)
                if dlg.ShowModal() == wx.ID_OK:
                    namefile = dlg.GetPath()
                    data = loadData(namefile,nodes,ndof)
                    if(data==-1):
                        wx.MessageBox("Incorrect data", "Error")
                    else:	
                        setGrid(data,self.data['state_ini'])
                dlg.Destroy()
            else:
                wx.MessageBox("You must active 'user-defined'", "Error") 
       	except ValueError:
            wx.MessageBox("You must complete number of nodes and degress of freedom first", "Error")

    def onPlotmfdot(self, event): # wxGlade: formCylinder.<event_handler>
        if not(self.injection['mfdot_array'].IsEnabled()):
            wx.MessageBox("Plot not available", "Error") 
        else:
            points = data2tuple(self.injection['mfdot_array'])
            if points:
                formPlot = Plots(None,-1, "")
                formPlot.plotData(points,"Mass Injection Rate")
                formPlot.ShowModal()
                formPlot.Destroy()
                
    def onPlotxbdot(self, event): # wxGlade: formCylinder.<event_handler>
        if not(self.combustion['xbdot_array'].IsEnabled()):
            wx.MessageBox("Plot not available", "Error") 
        else:
            points = data2tuple(self.combustion['xbdot_array'])
            if points:
                formPlot = Plots(None,-1, "")
                formPlot.plotData(points,"Burned Mass Rate")
                formPlot.ShowModal()
                formPlot.Destroy()
                
    def setLabels(self):
		self.data['state_ini'].SetColLabelValue(0, "Density")
		self.data['state_ini'].SetColLabelValue(1, "Pressure")
		self.data['state_ini'].SetColLabelValue(2, "Temperature")
		if int(self.data['ndof'].GetValue()) > 3:
			self.data['state_ini'].SetColLabelValue(3, "Species 1")
			self.data['state_ini'].SetColLabelValue(4, "Species 2")
			self.data['state_ini'].SetColLabelValue(5, "Species 3")
		self.combustion['xbdot_array'].SetColLabelValue(0, "Angle [deg]")
		self.combustion['xbdot_array'].SetColLabelValue(1, "Value [1/s]")
		self.injection['mfdot_array'].SetColLabelValue(0, "Angle [deg]")
		self.injection['mfdot_array'].SetColLabelValue(1, "Value [kg/s]")
		self.data['U_crevice'].SetColLabelValue(0, "Data")
		self.data['data_crevice'].SetColLabelValue(0, "Value")
		if self.data['type_temperature'].GetSelection() == 0:
			self.data['twall'].SetRowLabelValue(0, "Wall: ")
		else:
			self.data['twall'].SetRowLabelValue(0, "Piston: ")
			self.data['twall'].SetRowLabelValue(1, "Intake: ")
			self.data['twall'].SetRowLabelValue(2, "Exhaust: ")
			self.data['twall'].SetRowLabelValue(3, "Liners: ")

    def onSpeciesModel(self,event):
		sm = self.data['species_model'].GetSelection()
		if sm==1:
			self.data['ndof'].SetValue('6')
		elif sm == 0:
			self.data['ndof'].SetValue('3')
		self.onChangeNdof("")

    def onTypeTemperature(self,event):
		tt = self.data['type_temperature'].GetSelection()
		rows = self.data['twall'].GetNumberRows()
		if tt==0:
			if rows>1:
				self.data['twall'].DeleteRows(1,rows-1)
			self.data['twall'].SetRowLabelValue(0, "Wall: ")
		elif tt == 1:
			if rows<4:
				self.data['twall'].AppendRows(4-rows)
			self.data['twall'].SetRowLabelValue(0, "Piston: ")
			self.data['twall'].SetRowLabelValue(1, "Intake: ")
			self.data['twall'].SetRowLabelValue(2, "Exhaust: ")
			self.data['twall'].SetRowLabelValue(3, "Liners: ")


    def setContextualHelp(self):
		for key in self.data:
			self.data[key].SetHelpText(help_cylinder[key])
		for key in self.fuel:
			self.fuel[key].SetHelpText(help_fuel[key])
		for key in self.injection:
			self.injection[key].SetHelpText(help_injection[key])
		for key in self.combustion:
			self.combustion[key].SetHelpText(help_combustion[key])



# end of class formCylinder


