def _render_subsystems(self): subsystems = cw.ENGLabelFrame(self.left_frame, text="Subsystems", style=style) subsystems.pack(side=tk.TOP, fill=tk.BOTH, expand=True) widgets['INS'] = cw.Indicator(subsystems, text='INS', style=style) widgets['RADAR'] = cw.Indicator(subsystems, text='RAD', style=style) widgets['LOS'] = cw.Indicator(subsystems, text='LOS', style=style) widgets['GNC'] = cw.Indicator(subsystems, text='GNC', style=style) widgets['a_ATMO'] = cw.Alert(subsystems, text='IN ATMO', style=style) widgets['CHUTE'] = cw.OneTimeButton(subsystems, text='CHUTE', style=style) widgets['a_SRBTIME'] = cw.Alert(subsystems, text='120s', invis=True, style=style) widgets['SRB'] = cw.OneTimeButton(subsystems, text='SRB', style=style) widgets['INS'].grid(row=0, column=0) widgets['RADAR'].grid(row=1, column=0) widgets['LOS'].grid(row=2, column=0) widgets['GNC'].grid(row=3, column=0) widgets['a_ATMO'].grid(row=0, column=1) widgets['CHUTE'].grid(row=1, column=1) widgets['SRB'].grid(row=2, column=1) widgets['a_SRBTIME'].grid(row=3, column=1) subsystems.grid_columnconfigure(0, weight=1, minsize=50) subsystems.grid_columnconfigure(1, weight=1, minsize=60)
def _render_master(self): master = cw.ENGLabelFrame(self.left_frame, text="Master", style=style) master.pack(side=tk.TOP, fill=tk.BOTH, expand=True) widgets['master_freeze'] = cw.Indicator(master, text='Freeze\nControls', style=style) widgets['master_freeze'].configure(width=60, height=60) widgets['a_master'] = cw.Alert(master, text='MASTER\nALARM', font=style.large, style=style) widgets['a_master'].configure(width=100, height=100) widgets['a_asteroid'] = cw.Alert(master, text='ASTEROID', style=style) widgets['a_radiation'] = cw.Alert(master, text='RADIATION', style=style) widgets['a_hab_gnomes'] = cw.Alert(master, text='HAB\nGNOMES', style=style) widgets['master_freeze'].grid(row=0, column=0) widgets['a_master'].grid(row=0, column=1, rowspan=2) widgets['a_asteroid'].grid(row=2, column=0, padx=5, pady=5) widgets['a_radiation'].grid(row=2, column=1, padx=5, pady=5) widgets['a_hab_gnomes'].grid(row=3, column=0, pady=5)
def _render_engines(self): engines = cw.ENGLabelFrame(self.left_frame, text="Engines", style=style) engines.pack(side=tk.TOP, fill=tk.BOTH, expand=True) widgets['h_INJ1'] = cw.Indicator(engines, text="INJ-1", style=style) widgets['h_INJ2'] = cw.Indicator(engines, text="INJ-2", style=style) widgets["fuel"] = cw.ENGLabel(engines, text='FUEL', value=0, unit='kg', style=style) widgets['h_br'] = cw.ENGLabel(engines, text='BURN RATE', value=0, unit='kg/hr', style=style) widgets['h_INJ1'].grid(row=0, column=0) widgets['h_INJ1'].set_redrawer( lambda injector_widget, state: injector_widget.update( state.components[strings.INJ1].connected)) widgets['h_INJ2'].grid(row=1, column=0) widgets['fuel'].grid(row=0, column=1, sticky=tk.W) widgets['h_br'].grid(row=1, column=1, sticky=tk.W) # Engines > Fuel Management fuelmanager = cw.ENGLabelFrame(engines, text="", style=style) fuelmanager.grid(row=2, column=0, columnspan=2, pady=5) widgets['a_fuel_connected'] = cw.Alert(fuelmanager, text='TETHERED', style=style) widgets['h_load'] = cw.Indicator(fuelmanager, text="LOAD", style=style) widgets['h_dump'] = cw.Indicator(fuelmanager, text="DUMP", style=style) widgets['a_fuel_connected'].grid(row=0, column=0, padx=10) widgets['h_dump'].grid(row=0, column=1) widgets['h_load'].grid(row=0, column=2)
def _render_hab_reactors(self): hreactor = cw.ENGLabelFrame(self.right_frame_bot, text="Habitat Reactor", style=style) hreactor.pack(side=tk.LEFT, fill=tk.BOTH, expand=False) widgets['hr_INJ-1'] = cw.Indicator(hreactor, text="R-INJ-1", style=style) widgets['hr_INJ-2'] = cw.Indicator(hreactor, text="R-INJ-2", style=style) widgets['hr_heater'] = cw.Indicator(hreactor, text="HEAT", style=style) widgets["hr_curr"] = cw.ENGLabel(hreactor, text='CURR', value=0, unit='A', style=style) widgets['hr_temp'] = cw.ENGLabel(hreactor, text='TEMP', value=81, unit='*C', style=style) widgets['a_hr_overtemp'] = cw.Alert(hreactor, text="OVERTEMP", style=style) widgets['hr_INJ-1'].grid(row=0, column=0, padx=10) widgets['hr_INJ-2'].grid(row=1, column=0) widgets['hr_heater'].grid(row=2, column=0) widgets["hr_curr"].grid(row=0, column=1, sticky=tk.W) widgets['hr_temp'].grid(row=1, column=1, sticky=tk.W) widgets['a_hr_overtemp'].grid(row=2, column=1) graph_frame = tk.Frame(hreactor) graph_width = 400 hr_graph = tk.Canvas(graph_frame, width=graph_width, height=200) graph_frame.grid(row=0, column=2, rowspan=3, padx=10, pady=10) hr_graph.pack(side=tk.TOP, fill=tk.BOTH, expand=True) hreactor.grid_columnconfigure(0, weight=1, minsize=60) hreactor.grid_columnconfigure(1, weight=1, minsize=70) hreactor.grid_columnconfigure(2, weight=3, minsize=graph_width)
def _render_reactor_confinement(self): hrconfinement = cw.ENGLabelFrame(self.right_frame_bot, text="Reactor Confinement", style=style) hrconfinement.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) widgets['hr_RCON-1'] = cw.Indicator(hrconfinement, text="RCON-1", style=style) widgets['hr_RCON-2'] = cw.Indicator(hrconfinement, text="RCON-2", style=style) widgets["hr_RCON-1_temp"] = cw.ENGLabel(hrconfinement, text='TEMP', value=84, unit='*C', style=style) widgets['hr_RCON-2_temp'] = cw.ENGLabel(hrconfinement, text='TEMP', value=80, unit='*C', style=style) widgets['hr_BATT'] = cw.ENGLabel(hrconfinement, text='BATT', value=2000, unit='As', style=style) widgets['a_hr_lowBatt'] = cw.Alert(hrconfinement, text='LOW BATT', style=style) widgets['hr_RCON-1'].grid(row=0, column=0) widgets['hr_RCON-2'].grid(row=1, column=0) widgets["hr_RCON-1_temp"].grid(row=0, column=1) widgets['hr_RCON-2_temp'].grid(row=1, column=1) widgets['hr_BATT'].grid(row=2, column=0, columnspan=2, pady=10) widgets['a_hr_lowBatt'].grid(row=3, column=0, columnspan=2) hrconfinement.grid_columnconfigure(0, weight=1, minsize=60) hrconfinement.grid_columnconfigure(1, weight=1, minsize=70)
def _render_coolants(self): loops = cw.ENGLabelFrame(self.left_frame, text="", style=style) loops.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) for cl in range(2): prefix = 'hl{}_'.format(cl + 1) loop = cw.ENGLabelFrame(loops, text='Coolant Loop {}'.format(cl + 1), style=style) loop.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) widgets[prefix + 'pump'] = cw.ENGLabel(loop, text='PUMP', value=0, unit='%', style=style) widgets[prefix + 'pump_sldr'] = cw.ENGScale(loop, widgets[prefix + 'pump'], style=style) widgets[prefix + 'temp'] = cw.ENGLabel(loop, text='TEMP', value=47, unit='*C', style=style) widgets[prefix + 'pump'].grid(row=0, column=0) widgets[prefix + 'pump_sldr'].grid(row=0, column=1, rowspan=2, columnspan=2) widgets[prefix + 'temp'].grid(row=1, column=0, pady=5) for i in range(2): for j in range(3): indicator_num = i * 3 + j + 1 rad_label = f'R{indicator_num}' widgets[prefix + rad_label] = cw.Indicator( loop, text=rad_label, style=style, command_on_press=Request( ident=Request.TOGGLE_RADIATOR, radiator_to_toggle=indicator_num - 1)) widgets[prefix + rad_label].grid(row=i + 2, column=j, sticky=tk.E) widgets[prefix + rad_label].set_redrawer( lambda widget, state, n=indicator_num: widget.update( state.radiators[n - 1].functioning))
def _render_radiators(self): radiators = cw.ENGLabelFrame(self.left_frame, text="Radiators", style=style) radiators.pack(side=tk.LEFT, fill=tk.BOTH, expand=False) for i in range(6): rad = 'R{}'.format(i + 1) widgets['r_' + rad + '_isol'] = cw.Indicator( radiators, text=ISOLATED, width=10, bg=style.ind_off, command=lambda v=(i + 1): rad_isol(v)) if i < 3: widgets['r_' + rad] = cw.ENGLabel(radiators, text=rad, value=STOWED, style=style) widgets['r_' + rad + '_stow'] = cw.Indicator( radiators, text=STOWED, width=10, bg=style.ind_off, command=lambda v=(i + 1): rad_stow(v)) else: widgets['r_' + rad] = cw.ENGLabel(radiators, text=rad, value=ISOLATED, style=style) widgets['r_' + rad].grid(row=i, column=0, padx=15) widgets['r_' + rad + '_isol'].grid(row=i % 3, column=int(1 + i / 3), padx=5, pady=5) if i < 3: widgets['r_' + rad + '_stow'].grid(row=i, column=3, padx=5) all_buttons = cw.ENGLabelFrame(radiators, text='', style=style) all_buttons.grid(row=3, column=2, rowspan=3, ipadx=5, ipady=5) # widgets['r_stow_all'] = tk.Button( # all_buttons, text='STOW-A', width=8, height=2, bg=style.ind_off, # command=lambda: [rad_stow(v+1) for v in range(3)]) # widgets['r_isol_all'] = tk.Button( # all_buttons, text='ISOL-A', width=8, height=2, bg=style.ind_off, # command=lambda: [rad_isol(v+1) for v in range(6)]) # # widgets['r_stow_all'].pack(pady=5) # widgets['r_isol_all'].pack() def rad_isol(v): # TODO: move this code to the physics server, where it belongs. if widgets['r_R{}'.format(v)] != BROKEN: widgets['r_R{}'.format(v)].value = ISOLATED widgets['r_R{}'.format(v)].update() for m in [1, 2]: widgets['hl{}_R{}'.format(m, v)].value = 1 widgets['hl{}_R{}'.format(m, v)].press() else: pass def rad_stow(v): if widgets['r_R{}'.format(v)] != BROKEN: widgets['r_R{}'.format(v)].value = STOWED widgets['r_R{}'.format(v)].update() for m in [1, 2]: widgets['hl{}_R{}'.format(m, v)].value = 1 widgets['hl{}_R{}'.format(m, v)].press() else: pass