def AddCheckBox(self, label, default=False): c = wx.CheckBox(self.panel, label=label) c.SetValue(default) self.AddControl(c, label, default) c.Bind(wx.EVT_CHECKBOX, self.OnValue) self.row.Add(c, 0, wx.LEFT, 20)
def createWidgets(self): #create the panels for the tabs PanelAssembly = wx.Panel(self.nb) boxAssembly = wx.BoxSizer(wx.VERTICAL) PanelAssembly.SetAutoLayout(True) PanelAssembly.SetSizer(boxAssembly) PanelAssembly.Layout() PanelEngine = wx.Panel(self.nb) boxEngine = wx.BoxSizer(wx.VERTICAL) PanelEngine.SetAutoLayout(True) PanelEngine.SetSizer(boxEngine) PanelEngine.Layout() PanelTakeoff = wx.Panel(self.nb) boxTakeoff = wx.BoxSizer(wx.VERTICAL) PanelTakeoff.SetAutoLayout(True) PanelTakeoff.SetSizer(boxTakeoff) PanelTakeoff.Layout() PanelCruise = wx.Panel(self.nb) boxCruise = wx.BoxSizer(wx.VERTICAL) PanelCruise.SetAutoLayout(True) PanelCruise.SetSizer(boxCruise) PanelCruise.Layout() PanelDrop = wx.Panel(self.nb) boxDrop = wx.BoxSizer(wx.VERTICAL) PanelDrop.SetAutoLayout(True) PanelDrop.SetSizer(boxDrop) PanelDrop.Layout() PanelLanding = wx.Panel(self.nb) boxLanding = wx.BoxSizer(wx.VERTICAL) PanelLanding.SetAutoLayout(True) PanelLanding.SetSizer(boxLanding) PanelLanding.Layout() PanelShutdown = wx.Panel(self.nb) boxShutdown = wx.BoxSizer(wx.VERTICAL) PanelShutdown.SetAutoLayout(True) PanelShutdown.SetSizer(boxShutdown) PanelShutdown.Layout() #add the data to the individual tabs '''before assembly checklist''' for key in self.beforeAssemblyList: if self.beforeAssemblyList[key] == 0: disCheckBox = wx.CheckBox(PanelAssembly, wx.ID_ANY, key) disCheckBox.Enable(False) boxAssembly.Add(disCheckBox) if self.beforeAssemblyList[key] == 2: boxAssembly.Add(wx.CheckBox(PanelAssembly, wx.ID_ANY, key)) self.AssemblyButton = wx.Button(PanelAssembly, wx.ID_ANY, "Close final hatches") boxAssembly.Add(self.AssemblyButton) '''before Engine Start checklist''' for key in self.beforeEngineList: if self.beforeEngineList[key] == 0: disCheckBox = wx.CheckBox(PanelEngine, wx.ID_ANY, key) disCheckBox.Enable(False) boxEngine.Add(disCheckBox) if self.beforeEngineList[key] == 2: boxEngine.Add(wx.CheckBox(PanelEngine, wx.ID_ANY, key)) self.EngineButton = wx.Button(PanelEngine, wx.ID_ANY, "Ready for Engine start") boxEngine.Add(self.EngineButton) '''before takeoff checklist''' for key in self.beforeTakeoffList: if self.beforeTakeoffList[key] == 0: disCheckBox = wx.CheckBox(PanelTakeoff, wx.ID_ANY, key) disCheckBox.Enable(False) boxTakeoff.Add(disCheckBox) if self.beforeTakeoffList[key] == 2: boxTakeoff.Add(wx.CheckBox(PanelTakeoff, wx.ID_ANY, key)) self.TakeoffButton = wx.Button(PanelTakeoff, wx.ID_ANY, "Ready for Takeoff") boxTakeoff.Add(self.TakeoffButton) '''before cruise/AUTO checklist''' for key in self.beforeCruiseList: if self.beforeCruiseList[key] == 0: disCheckBox = wx.CheckBox(PanelCruise, wx.ID_ANY, key) disCheckBox.Enable(False) boxCruise.Add(disCheckBox) if self.beforeCruiseList[key] == 2: boxCruise.Add(wx.CheckBox(PanelCruise, wx.ID_ANY, key)) self.CruiseButton = wx.Button(PanelCruise, wx.ID_ANY, "Ready for Cruise/AUTO") boxCruise.Add(self.CruiseButton) '''before bottle drop checklist''' for key in self.bottleDropList: if self.bottleDropList[key] == 0: disCheckBox = wx.CheckBox(PanelDrop, wx.ID_ANY, key) disCheckBox.Enable(False) boxDrop.Add(disCheckBox) if self.bottleDropList[key] == 2: boxDrop.Add(wx.CheckBox(PanelDrop, wx.ID_ANY, key)) self.DropButton = wx.Button(PanelDrop, wx.ID_ANY, "Ready for Bottle Drop") boxDrop.Add(self.DropButton) '''before landing checklist''' for key in self.beforeLandingList: if self.beforeLandingList[key] == 0: disCheckBox = wx.CheckBox(PanelLanding, wx.ID_ANY, key) disCheckBox.Enable(False) boxLanding.Add(disCheckBox) if self.beforeLandingList[key] == 2: boxLanding.Add(wx.CheckBox(PanelLanding, wx.ID_ANY, key)) self.LandingButton = wx.Button(PanelLanding, wx.ID_ANY, "Ready for Landing") boxLanding.Add(self.LandingButton) '''before shutdown checklist''' for key in self.beforeShutdownList: if self.beforeShutdownList[key] == 0: disCheckBox = wx.CheckBox(PanelShutdown, wx.ID_ANY, key) disCheckBox.Enable(False) boxShutdown.Add(disCheckBox) if self.beforeShutdownList[key] == 2: boxShutdown.Add(wx.CheckBox(PanelShutdown, wx.ID_ANY, key)) self.ShutdownButton = wx.Button(PanelShutdown, wx.ID_ANY, "Ready for Shutdown") boxShutdown.Add(self.ShutdownButton) #and add in the tabs self.nb.AddPage(PanelAssembly, "1. During Assembly") self.nb.AddPage(PanelEngine, "2. Before Engine Start") self.nb.AddPage(PanelTakeoff, "3. Before Takeoff") self.nb.AddPage(PanelCruise, "4. Before Cruise/AUTO") self.nb.AddPage(PanelDrop, "5. Before Bottle Drop") self.nb.AddPage(PanelLanding, "6. Before Landing") self.nb.AddPage(PanelShutdown, "7. Before Shutdown")