def ControlPanel(self): # Controls and Layout panel = wx.Panel(self) from EditableControls import ComboBox, TextCtrl from Controls import Control from BeamProfile_window import BeamProfile flag = wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL border = 2 l = wx.ALIGN_LEFT r = wx.ALIGN_RIGHT cv = wx.ALIGN_CENTER_VERTICAL a = wx.ALL layout = wx.BoxSizer(wx.HORIZONTAL) left_panel = wx.BoxSizer(wx.VERTICAL) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Status") group.Add(text, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="FreezeInterventionPanel.Enabled", globals=globals(), label="Disabled/Enabled", size=(180, -1)) group.Add(control, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="FreezeInterventionPanel.Active", globals=globals(), label="Inactive/Active", size=(180, -1)) group.Add(control, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) layout.Add(left_panel, flag=flag, border=border) panel.SetSizer(layout) panel.Fit() return panel
def ControlPanel(self): from Controls import Control panel = wx.Panel(self) frame = wx.BoxSizer() panel.Sizer = frame layout = wx.BoxSizer(wx.VERTICAL) frame.Add(layout, flag=wx.EXPAND | wx.ALL, border=10, proportion=1) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".report", size=(420, 160), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) panel.Fit() return panel
def command_prompt(self): command = self.read(_("Enter command: ")).strip().lower() self.display() if command == "nav": Calc.warp_navigation(game) if command == "sub": Calc.sublight_navigation(game) elif command == "srs": game.enterprise.short_range_scan(game) elif command == "lrs": game.enterprise.long_range_scan(game) elif command == "pha": Control.phasers(game) elif command == "tor": Control.torpedos(game) elif command == "she": Control.shields(game) elif command == "com": Control.computer(game) elif command.startswith('qui') or command.startswith('exi'): return False else: self.show_strings(TrekStrings.HELM_CMDS) return True
def ControlPanel(self): # Controls and Layout panel = wx.Panel(self) from EditableControls import ComboBox, TextCtrl, Choice from Controls import Control from BeamProfile_window import BeamProfile flag = wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL border = 2 l = wx.ALIGN_LEFT r = wx.ALIGN_RIGHT cv = wx.ALIGN_CENTER_VERTICAL a = wx.ALL e = wx.EXPAND c = wx.ALIGN_CENTER frame = wx.BoxSizer() panel.SetSizer(frame) layout = wx.BoxSizer(wx.VERTICAL) frame.Add(layout, flag=e | a, border=10, proportion=1) layout_flag = wx.ALIGN_CENTRE | wx.ALL border = 0 width, height = 220, 25 control = Control( panel, type=wx.ComboBox, globals=globals(), locals=locals(), name=self.name + ".setup", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".recall", label="Recall", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".save", label="Save", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".trace_directory_size", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".emptying_trace_directory", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".acquiring_waveforms", label="Auto Save", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.CheckBox, globals=globals(), locals=locals(), name=self.name + ".auto_acquire", label="Auto Record Traces", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".trace_count", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".trigger_count", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".trace_count_offset", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".timing_jitter", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name=self.name + ".timing_offset", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".trace_count_synchronized", label="Synchronized", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.CheckBox, globals=globals(), locals=locals(), name=self.name + ".auto_synchronize", label="Auto Synchronize", size=(width, height), style=wx.ALIGN_CENTER_HORIZONTAL, ) layout.Add(control, flag=layout_flag, border=border) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name=self.name + ".trace_acquisition_running", label="Data Collection Running", size=(width, height), ) layout.Add(control, flag=layout_flag, border=border) panel.Fit() return panel
def __init__(self): wx.Frame.__init__(self, parent=None, title="SAXS-WAXS Control") # Icon from Icon import SetIcon SetIcon(self, "SAXS-WAXS Control") # Controls panel = wx.Panel(self) from EditableControls import ComboBox, TextCtrl from Controls import Control self.Environment = Control(panel, type=ComboBox, name="SAXS_WAXS_Control_Panel.Environment", globals=globals(), size=(80, -1), choices=["0 (NIH)", "1 (APS)", "2 (LCLS)"]) self.Home = Control(panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.Home", globals=globals(), size=(100, -1)) self.ProgramRunning = Control( panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.ProgramRunning", globals=globals(), size=(100, -1)) self.GotoSaved = Control(panel, type=wx.Button, name="SAXS_WAXS_Control_Panel.GotoSaved", globals=globals(), label="Go To Saved Position", size=(180, -1)) self.Save = Control(panel, type=wx.Button, name="SAXS_WAXS_Control_Panel.Save", globals=globals(), label="Save Current X,Y Positions", size=(180, -1)) self.Inserted = Control(panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.Inserted", globals=globals(), size=(150, -1)) self.Mode = Control(panel, type=wx.ComboBox, name="SAXS_WAXS_Control_Panel.Mode", globals=globals(), size=(100, -1), choices=SAXS_WAXS_control.modes) self.ShutterEnabled = Control( panel, type=wx.CheckBox, name="SAXS_WAXS_Control_Panel.ShutterEnabled", globals=globals(), size=(80, -1)) self.PumpEnabled = Control(panel, type=wx.CheckBox, name="SAXS_WAXS_Control_Panel.PumpEnabled", globals=globals(), size=(80, -1)) self.PumpStep = Control(panel, type=ComboBox, name="SAXS_WAXS_Control_Panel.PumpStep", globals=globals(), size=(80, -1), choices=SAXS_WAXS_control.pump_step_choices) self.PumpPosition = Control( panel, type=TextCtrl, name="SAXS_WAXS_Control_Panel.PumpPosition", globals=globals(), size=(70, -1)) self.PumpHomed = Control(panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.PumpHomed", globals=globals(), size=(140, -1)) choices = ["500", "600", "700", "800", "1000"] self.LoadSampleStep = Control( panel, type=ComboBox, name="SAXS_WAXS_Control_Panel.LoadSampleStep", globals=globals(), size=(70, -1), choices=choices) self.LoadSample = Control(panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.LoadSample", globals=globals(), label="Load Sample", size=(140, -1)) choices = ["-500", "-600", "-700", "-800", "-1000"] self.ExtractSampleStep = Control( panel, type=ComboBox, name="SAXS_WAXS_Control_Panel.ExtractSampleStep", globals=globals(), size=(70, -1), choices=choices) self.ExtractSample = Control( panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.ExtractSample", globals=globals(), label="Extract Sample", size=(140, -1)) choices = ["500", "600", "700", "800", "1000"] self.CirculateSampleStep = Control( panel, type=ComboBox, name="SAXS_WAXS_Control_Panel.CirculateSampleStep", globals=globals(), size=(70, -1), choices=choices) self.CirculateSample = Control( panel, type=wx.ToggleButton, name="SAXS_WAXS_Control_Panel.CirculateSample", globals=globals(), label="Circulate Sample", size=(140, -1)) self.PumpSpeed = Control(panel, type=TextCtrl, name="SAXS_WAXS_Control_Panel.PumpSpeed", globals=globals(), size=(70, -1)) # Layout flag = wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL border = 5 layout = wx.BoxSizer(wx.HORIZONTAL) left_panel = wx.BoxSizer(wx.VERTICAL) group = wx.BoxSizer(wx.HORIZONTAL) text = wx.StaticText(panel, label="Environment:") group.Add(text, flag=flag, border=border) group.Add(self.Environment, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Ensemble Operation") group.Add(text, flag=flag, border=border) group.Add(self.Home, flag=flag, border=border) group.Add(self.ProgramRunning, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Capillary Position") group.Add(text, flag=flag, border=border) group.Add(self.GotoSaved, flag=flag, border=border) group.Add(self.Save, flag=flag, border=border) group.Add(self.Inserted, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) layout.Add(left_panel, flag=flag, border=border) right_panel = wx.BoxSizer(wx.VERTICAL) group = wx.GridBagSizer(4, 2) l = wx.ALIGN_LEFT r = wx.ALIGN_RIGHT cv = wx.ALIGN_CENTER_VERTICAL a = wx.ALL text = wx.StaticText(panel, label="Mode: ") group.Add(text, (0, 0), flag=r | cv) group.Add(self.Mode, (0, 1), flag=l | cv) text = wx.StaticText(panel, label="X-ray ms shutter: ") group.Add(text, (1, 0), flag=r | cv) group.Add(self.ShutterEnabled, (1, 1), flag=l | cv) text = wx.StaticText(panel, label="Pump: ") group.Add(text, (2, 0), flag=r | cv) group.Add(self.PumpEnabled, (2, 1), flag=l | cv) text = wx.StaticText(panel, label="Pump Steps/Stroke: ") group.Add(text, (3, 0), flag=r | cv) group.Add(self.PumpStep, (3, 1), flag=l | cv) right_panel.Add(group, flag=flag, border=border) text = wx.StaticText(panel, label="Peristaltic Pump Operation [motor steps]") right_panel.Add(text, flag=flag, border=border) group = wx.GridBagSizer(1, 1) group.Add(self.PumpPosition, (0, 0), flag=r | cv | a, border=border) group.Add(self.PumpHomed, (0, 1), flag=l | cv | a, border=border) group.Add(self.LoadSampleStep, (1, 0), flag=r | cv | a, border=border) group.Add(self.LoadSample, (1, 1), flag=l | cv | a, border=border) group.Add(self.ExtractSampleStep, (2, 0), flag=r | cv | a, border=border) group.Add(self.ExtractSample, (2, 1), flag=l | cv | a, border=border) group.Add(self.CirculateSampleStep, (3, 0), flag=r | cv | a, border=border) group.Add(self.CirculateSample, (3, 1), flag=l | cv | a, border=border) group.Add(self.PumpSpeed, (4, 0), flag=r | cv | a, border=border) text = wx.StaticText(panel, label="Pump Speed [steps/s]", size=(140, -1)) group.Add(text, (4, 1), flag=l | cv | a, border=border) right_panel.Add(group, flag=flag, border=border) layout.Add(right_panel, flag=flag, border=border) panel.SetSizer(layout) panel.Fit() self.Fit() # Settings self.Environment.defaults = {"Value": "offline?", "Enabled": False} self.Environment.value = "SAXS_WAXS_control.environment" self.Environment.properties = { "Enabled": [ (True, "SAXS_WAXS_control.ensemble_online"), ], } self.Home.defaults = {"Label": "Home", "Enabled": False} self.Home.action = { False: "SAXS_WAXS_control.ensemble_homing = True", True: "SAXS_WAXS_control.ensemble_homing = True", } self.Home.properties = { "Value": [ (False, "SAXS_WAXS_control.ensemble_homed == False"), (True, "SAXS_WAXS_control.ensemble_homed == True"), ], "Enabled": [ (False, "SAXS_WAXS_control.ensemble_program_running == True"), (True, "SAXS_WAXS_control.ensemble_program_running == False"), ], "Label": [ ("Homing", "SAXS_WAXS_control.ensemble_homing == True"), ("Home", "SAXS_WAXS_control.ensemble_homed == False"), ("Homed", "SAXS_WAXS_control.ensemble_homed == True"), ], "BackgroundColour": [ ("yellow", "SAXS_WAXS_control.ensemble_homing == True"), ("green", "SAXS_WAXS_control.ensemble_homed == True"), ("red", "SAXS_WAXS_control.ensemble_homed == False"), ], } self.ProgramRunning.defaults = { "Label": "Start [Stop]", "Enabled": False } self.ProgramRunning.action = { False: "SAXS_WAXS_control.ensemble_program_running = False", True: "SAXS_WAXS_control.ensemble_program_running = True", } self.ProgramRunning.properties = { "Value": [ (False, "SAXS_WAXS_control.ensemble_program_running == False"), (True, "SAXS_WAXS_control.ensemble_program_running == True"), ], "Enabled": [ (False, "SAXS_WAXS_control.fault == True"), (True, "SAXS_WAXS_control.fault == False"), ], "Label": [ ("Fault", "SAXS_WAXS_control.fault == True"), ("Start", "SAXS_WAXS_control.ensemble_program_running == False"), ("Stop", "SAXS_WAXS_control.ensemble_program_running == True"), ], "BackgroundColour": [ ("green", "SAXS_WAXS_control.ensemble_program_running == True"), ("red", "SAXS_WAXS_control.ensemble_program_running == False"), ], } self.GotoSaved.action = { True: "SAXS_WAXS_control.inserted = True", } self.GotoSaved.defaults = {"Enabled": False} self.GotoSaved.properties = { "Enabled": [ (True, "1-SAXS_WAXS_control.inserted"), ], "BackgroundColour": [ ("red", "SAXS_WAXS_control.XY_enabled == False"), ], } self.Save.action = { True: "SAXS_WAXS_control.at_inserted_position = True", } self.Save.defaults = {"Enabled": False} self.Save.properties = { "Enabled": [ (True, "SAXS_WAXS_control.at_inserted_position == False"), ], } self.Inserted.action = { True: "SAXS_WAXS_control.inserted = True", False: "SAXS_WAXS_control.retracted = True", } self.Inserted.defaults = { "Enabled": False, "Label": "Inserted [Withdrawn]" } self.Inserted.properties = { "Value": [ (True, "SAXS_WAXS_control.inserted == True"), (False, "SAXS_WAXS_control.retracted == True"), ], "Enabled": [ (True, "SAXS_WAXS_control.XY_enabled"), ], "Label": [ ("Inserted", "SAXS_WAXS_control.inserted == True"), ("Retracted", "SAXS_WAXS_control.retracted == True"), ("Insert", "SAXS_WAXS_control.inserted == SAXS_WAXS_control.retracted"), ], "BackgroundColour": [ ("green", "SAXS_WAXS_control.inserted == True"), ("yellow", "SAXS_WAXS_control.retracted == True"), ("red", "SAXS_WAXS_control.inserted == SAXS_WAXS_control.retracted"), ], } self.Mode.defaults = {"Value": "offline", "Enabled": False} self.Mode.value = "SAXS_WAXS_control.mode" self.Mode.properties = { "Enabled": [ (True, "SAXS_WAXS_control.timing_system_running == True"), ], } self.ShutterEnabled.defaults = {"Enabled": False, "Label": "offline"} self.ShutterEnabled.action = { False: "SAXS_WAXS_control.ms_on = False", True: "SAXS_WAXS_control.ms_on = True", } self.ShutterEnabled.properties = { "Value": [ (False, "SAXS_WAXS_control.ms_on == False"), (True, "SAXS_WAXS_control.ms_on == True"), ], "Label": [ ("", "SAXS_WAXS_control.timing_system_running == True"), ("stopped", "SAXS_WAXS_control.timing_system_running == False"), ], "Enabled": [ (True, "SAXS_WAXS_control.timing_system_running == True"), ], } self.PumpEnabled.defaults = {"Enabled": False, "Label": "offline"} self.PumpEnabled.action = { False: "SAXS_WAXS_control.pump_on = False", True: "SAXS_WAXS_control.pump_on = True", } self.PumpEnabled.properties = { "Value": [ (False, "SAXS_WAXS_control.pump_on == False"), (True, "SAXS_WAXS_control.pump_on == True"), ], "Label": [ ("", "SAXS_WAXS_control.timing_system_running == True"), ("stopped", "SAXS_WAXS_control.timing_system_running == False"), ], "Enabled": [ (True, "SAXS_WAXS_control.timing_system_running == True"), ], } self.PumpStep.defaults = {"Value": "offline", "Enabled": False} self.PumpStep.value = "SAXS_WAXS_control.pump_step" self.PumpStep.properties = { "Enabled": [ (True, "SAXS_WAXS_control.ensemble_online"), ], } self.PumpPosition.defaults = {"Value": "offline", "Enabled": False} self.PumpPosition.value = "SAXS_WAXS_control.pump_position" self.PumpPosition.format = "%.1f" self.PumpPosition.properties = { "Enabled": [ (True, "SAXS_WAXS_control.ensemble_online"), ], } self.PumpHomed.defaults = {"Label": "Home", "Enabled": False} self.PumpHomed.action = { False: "SAXS_WAXS_control.pump_homed = True", True: "SAXS_WAXS_control.pump_homed = True", } self.PumpHomed.properties = { "Value": [ (True, "SAXS_WAXS_control.pump_homed == True"), ], "Enabled": [ (True, "SAXS_WAXS_control.pump_movable"), ], "Label": [ ("Home", "SAXS_WAXS_control.pump_homed == False"), ("Homed", "SAXS_WAXS_control.pump_homed == True"), ], "BackgroundColour": [ ("green", "SAXS_WAXS_control.pump_homed == True"), ("red", "SAXS_WAXS_control.pump_homed == False"), ], } self.LoadSampleStep.value = "SAXS_WAXS_control.load_step" self.ExtractSampleStep.value = "SAXS_WAXS_control.extract_step" self.CirculateSampleStep.value = "SAXS_WAXS_control.circulate_step" self.LoadSample.action = { False: "SAXS_WAXS_control.sample_loading = False", True: "SAXS_WAXS_control.sample_loading = True", } self.LoadSample.defaults = {"Enabled": False} self.LoadSample.properties = { "Value": [ (True, "SAXS_WAXS_control.sample_loading == True"), ], "Enabled": [ (True, "SAXS_WAXS_control.pump_movable"), ], "Label": [ ("Load Sample", "not SAXS_WAXS_control.sample_loading"), ("Cancel Load", "SAXS_WAXS_control.sample_loading"), ], "BackgroundColour": [ ("yellow", "SAXS_WAXS_control.sample_loading"), ("red", "SAXS_WAXS_control.pump_enabled == False"), ], } self.ExtractSample.action = { False: "SAXS_WAXS_control.sample_extracting = False", True: "SAXS_WAXS_control.sample_extracting = True", } self.ExtractSample.defaults = {"Enabled": False} self.ExtractSample.properties = { "Value": [ (True, "SAXS_WAXS_control.sample_extracting == True"), ], "Enabled": [ (True, "SAXS_WAXS_control.pump_movable"), ], "Label": [ ("Extract Sample", "not SAXS_WAXS_control.sample_extracting"), ("Cancel Extract", "SAXS_WAXS_control.sample_extracting"), ], "BackgroundColour": [ ("yellow", "SAXS_WAXS_control.sample_extracting == True"), ("red", "SAXS_WAXS_control.pump_enabled == False"), ], } self.CirculateSample.action = { False: "SAXS_WAXS_control.sample_circulating = False", True: "SAXS_WAXS_control.sample_circulating = True", } self.CirculateSample.defaults = {"Enabled": False} self.CirculateSample.properties = { "Value": [ (True, "SAXS_WAXS_control.sample_circulating == True"), ], "Enabled": [ (True, "SAXS_WAXS_control.pump_movable"), ], "Label": [ ("Circulate Sample", "not SAXS_WAXS_control.sample_circulating"), ("Cancel Circulate", "SAXS_WAXS_control.sample_circulating"), ], "BackgroundColour": [ ("yellow", "SAXS_WAXS_control.sample_circulating"), ("red", "SAXS_WAXS_control.pump_enabled == False"), ], } self.PumpSpeed.defaults = {"Value": "offline", "Enabled": False} self.PumpSpeed.value = "SAXS_WAXS_control.pump_speed" self.PumpSpeed.properties = { "Enabled": [ (True, "SAXS_WAXS_control.ensemble_online"), ], } self.Show()
def ControlPanel(self): # Controls and Layout panel = wx.Panel(self) from EditableControls import ComboBox, TextCtrl from Controls import Control from BeamProfile_window import BeamProfile flag = wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL border = 2 l = wx.ALIGN_LEFT r = wx.ALIGN_RIGHT cv = wx.ALIGN_CENTER_VERTICAL a = wx.ALL layout = wx.BoxSizer(wx.HORIZONTAL) left_panel = wx.BoxSizer(wx.VERTICAL) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="X-ray Detector:") group.Add(text, flag=flag, border=border) control = Control( panel, type=wx.ToggleButton, name="LaueCrystallographyControl.XRayDetectorInserted", globals=globals(), label="Retract/Insert", size=(180, -1)) group.Add(control, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Raster Scan Center:") group.Add(text, flag=flag, border=border) control = Control(panel, type=wx.Button, name="LaueCrystallographyControl.GotoSaved", globals=globals(), label="Go To Saved XYZ Position", size=(180, -1)) group.Add(control, flag=flag, border=border) control = Control(panel, type=wx.Button, name="LaueCrystallographyControl.Save", globals=globals(), label="Save Current XYZ Positions", size=(180, -1)) group.Add(control, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="LaueCrystallographyControl.Inserted", globals=globals(), label="Retract/Insert", size=(180, -1)) group.Add(control, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Raster Scan Controls:") group.Add(text, flag=flag, border=border) subgroup = wx.GridBagSizer(1, 1) text = wx.StaticText(panel, label="Step Size [um]") subgroup.Add(text, (0, 0), flag=l | cv | a, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.StepSize", globals=globals(), size=(70, -1)) subgroup.Add(control, (0, 1), flag=l | cv | a, border=border) text = wx.StaticText(panel, label="Vertical Range [um]") subgroup.Add(text, (1, 0), flag=l | cv | a, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.VerticalRange", globals=globals(), size=(70, -1)) subgroup.Add(control, (1, 1), flag=l | cv | a, border=border) text = wx.StaticText(panel, label="Horizontal Range [um]") subgroup.Add(text, (2, 0), flag=l | cv | a, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.HorizontalRange", globals=globals(), size=(70, -1)) subgroup.Add(control, (2, 1), flag=l | cv | a, border=border) group.Add(subgroup, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) border = 4 control = Control(panel, type=wx.ToggleButton, name="LaueCrystallographyControl.StartRasterScan", globals=globals(), label="Start Raster Scan", size=(180, -1)) left_panel.Add(control, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Crystal Coordinates:") group.Add(text, flag=flag, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.CrystalCoordinates", globals=globals(), size=(180, 120), style=wx.TE_MULTILINE) group.Add(control, flag=flag, border=border) left_panel.Add(group, flag=flag, border=border) layout.Add(left_panel, flag=flag, border=border) middle_panel = wx.BoxSizer(wx.VERTICAL) border = 5 group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Syringe Pump Operation:") group.Add(text, flag=flag, border=border) border = 0 control = Control(panel, type=wx.Button, name="LaueCrystallographyControl.Initialize", globals=globals(), label="Initialize", size=(120, -1)) group.Add(control, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="LaueCrystallographyControl.Flow", globals=globals(), label="Suspend/Resume", size=(120, -1)) group.Add(control, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="LaueCrystallographyControl.Inject", globals=globals(), label="Inject", size=(120, -1)) group.Add(control, flag=flag, border=border) middle_panel.Add(group, flag=flag, border=border) border = 3 group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Mother Liquor Syringe (250 uL)") group.Add(text, flag=flag, border=border) text = wx.StaticText(panel, label="Volume Expended (uL):") group.Add(text, flag=flag, border=border) subgroup = wx.GridBagSizer(1, 1) control = Control( panel, type=TextCtrl, name="LaueCrystallographyControl.MotherLiquorSyringeVolume", globals=globals(), size=(70, -1)) subgroup.Add(control, (0, 0), flag=l | cv | a, border=border) control = Control( panel, type=wx.ToggleButton, name="LaueCrystallographyControl.MotherLiquorSyringeRefill", globals=globals(), label="Refill", size=(70, -1)) subgroup.Add(control, (0, 1), flag=l | cv | a, border=border) control = Control( panel, type=ComboBox, name="LaueCrystallographyControl.MotherLiquorSyringeStepsize", globals=globals(), size=(70, -1)) subgroup.Add(control, (1, 0), flag=l | cv | a, border=border) control = Control( panel, type=wx.ToggleButton, name="LaueCrystallographyControl.MotherLiquorSyringeDispense", globals=globals(), label="Dispense", size=(70, -1)) subgroup.Add(control, (1, 1), flag=l | cv | a, border=border) group.Add(subgroup, flag=flag, border=border) middle_panel.Add(group, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Crystal Liquor Syringe (250 uL)") group.Add(text, flag=flag, border=border) text = wx.StaticText(panel, label="Volume Expended (uL):") group.Add(text, flag=flag, border=border) subgroup = wx.GridBagSizer(1, 1) control = Control( panel, type=TextCtrl, name="LaueCrystallographyControl.CrystalLiquorSyringeVolume", globals=globals(), size=(70, -1)) subgroup.Add(control, (0, 0), flag=l | cv | a, border=border) control = Control( panel, type=wx.ToggleButton, name="LaueCrystallographyControl.CrystalLiquorSyringeRefill", globals=globals(), label="Refill", size=(70, -1)) subgroup.Add(control, (0, 1), flag=l | cv | a, border=border) control = Control( panel, type=ComboBox, name="LaueCrystallographyControl.CrystalLiquorSyringeStepsize", globals=globals(), size=(70, -1)) subgroup.Add(control, (1, 0), flag=l | cv | a, border=border) control = Control( panel, type=wx.ToggleButton, name="LaueCrystallographyControl.CrystalLiquorSyringeDispense", globals=globals(), label="Dispense", size=(70, -1)) subgroup.Add(control, (1, 1), flag=l | cv | a, border=border) group.Add(subgroup, flag=flag, border=border) middle_panel.Add(group, flag=flag, border=border) layout.Add(middle_panel, flag=flag, border=border) group = wx.BoxSizer(wx.VERTICAL) text = wx.StaticText(panel, label="Pressure [atm]:") group.Add(text, flag=flag, border=border) subgroup = wx.GridBagSizer(1, 1) text = wx.StaticText(panel, label="Upstream") subgroup.Add(text, (0, 0), flag=l | cv | a, border=border) text = wx.StaticText(panel, label="Downstream") subgroup.Add(text, (0, 1), flag=l | cv | a, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.UpstreamPressure", globals=globals(), size=(70, -1)) subgroup.Add(control, (1, 0), flag=l | cv | a, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.DownstreamPressure", globals=globals(), size=(70, -1)) subgroup.Add(control, (1, 1), flag=l | cv | a, border=border) control = Control(panel, type=ComboBox, name="LaueCrystallographyControl.TweakStepsize", globals=globals(), size=(70, -1)) subgroup.Add(control, (2, 0), flag=l | cv | a, border=border) control = Control(panel, type=wx.Button, name="LaueCrystallographyControl.Tweak", globals=globals(), label="Tweak", size=(70, -1)) subgroup.Add(control, (2, 1), flag=l | cv | a, border=border) group.Add(subgroup, flag=flag, border=border) middle_panel.Add(group, flag=flag, border=border) right_panel = wx.BoxSizer(wx.VERTICAL) border = 5 text = wx.StaticText(panel, label="Microscope Image:") right_panel.Add(text, flag=flag, border=border) from CameraViewer import ImageWindow control = Control(panel, type=ImageWindow, name="LaueCrystallographyControl.Image", globals=globals(), size=(250, 300)) right_panel.Add(control, flag=flag, border=border) control = Control(panel, type=wx.ToggleButton, name="LaueCrystallographyControl.AcquireImage", globals=globals(), label="Acquire Image", size=(250, -1)) right_panel.Add(control, flag=flag, border=border) group = wx.BoxSizer(wx.HORIZONTAL) text = wx.StaticText(panel, label="Root name:") group.Add(text, flag=flag, border=border) control = Control(panel, type=TextCtrl, name="LaueCrystallographyControl.ImageRootName", globals=globals(), size=(170, -1)) group.Add(control, flag=flag, border=border) right_panel.Add(group, flag=flag, border=border) control = Control(panel, type=wx.Button, name="LaueCrystallographyControl.SaveImage", globals=globals(), label="Save Image", size=(250, -1)) right_panel.Add(control, flag=flag, border=border) layout.Add(right_panel, flag=flag, border=border) panel.SetSizer(layout) panel.Fit() return panel
def ControlPanel(self): from Controls import Control panel = wx.Panel(self) frame = wx.BoxSizer() panel.Sizer = frame layout = wx.BoxSizer(wx.VERTICAL) frame.Add(layout, flag=wx.EXPAND | wx.ALL, border=10, proportion=1) width = 160 control = Control( panel, type=wx.ComboBox, globals=globals(), locals=locals(), name=self.name + ".EPICS_Record", size=(width, -1), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) control = Control( panel, type=wx.TextCtrl, globals=globals(), locals=locals(), name=self.name + ".IP_Address", size=(width, -1), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) control = Control( panel, type=wx.ComboBox, globals=globals(), locals=locals(), name=self.name + ".Configuration", size=(width, -1), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) control = Control( panel, type=wx.Button, globals=globals(), locals=locals(), name=self.name + ".Load", size=(width, -1), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) control = Control( panel, type=wx.Button, globals=globals(), locals=locals(), name=self.name + ".Save", size=(width, -1), ) layout.Add(control, flag=wx.ALIGN_CENTRE | wx.ALL) panel.Fit() return panel
def ControlPanel(self): # Controls and Layout panel = wx.Panel(self) from EditableControls import ComboBox, TextCtrl, Choice from Controls import Control from DirectoryControl import DirectoryControl flag = wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL border = 2 l = wx.ALIGN_LEFT r = wx.ALIGN_RIGHT cv = wx.ALIGN_CENTER_VERTICAL a = wx.ALL e = wx.EXPAND frame = wx.BoxSizer() panel.SetSizer(frame) layout = wx.BoxSizer(wx.VERTICAL) frame.Add(layout, flag=wx.EXPAND | wx.ALL, border=10, proportion=1) layout_flag = wx.EXPAND group = wx.FlexGridSizer(cols=2) layout.Add(group, flag=layout_flag, border=border, proportion=1) label = wx.StaticText(panel, label="Method:") group.Add(label, flag=cv, border=0, proportion=1) subgroup = wx.BoxSizer(wx.HORIZONTAL) control = Control( panel, type=ComboBox, globals=globals(), locals=locals(), name="Collect_Panel.Method", size=(395, -1), ) subgroup.Add(control, flag=l | cv | a, border=0, proportion=1) control = Control( panel, type=wx.Button, globals=globals(), locals=locals(), name="Collect_Panel.Show_Methods", label="Methods...", ) subgroup.Add(control, flag=l | cv | a, border=0) group.Add(subgroup, flag=l | cv | a, border=border) label = wx.StaticText(panel, label="Time to Finish [s]:") group.Add(label, flag=cv, border=0, proportion=1) control = Control( panel, type=TextCtrl, globals=globals(), locals=locals(), name="Collect_Panel.Time_to_Finish", size=(350, -1), ) group.Add(control, flag=l | cv | a | e, border=border, proportion=1) group.AddSpacer(20) group.AddSpacer(20) label = wx.StaticText(panel, label="File:") group.Add(label, flag=cv, border=0, proportion=1) subgroup = wx.BoxSizer(wx.HORIZONTAL) control = Control( panel, type=TextCtrl, globals=globals(), locals=locals(), name="Collect_Panel.File", size=(200, -1), ) subgroup.Add(control, flag=l | cv | a, border=0) label = wx.StaticText(panel, label="Extension:") subgroup.Add(label, flag=cv, border=0) control = Control( panel, type=wx.TextCtrl, globals=globals(), locals=locals(), name="Collect_Panel.Extension", size=(60, -1), ) subgroup.Add(control, flag=l | cv | a, border=0) group.Add(subgroup, flag=l | cv | a, border=border) label = wx.StaticText(panel, label="Description:") group.Add(label, flag=cv, border=0, proportion=1) control = Control( panel, type=TextCtrl, globals=globals(), locals=locals(), name="Collect_Panel.Description", size=(480, -1), ) group.Add(control, flag=l | cv | a, border=border) label = wx.StaticText(panel, label="Logfile:") group.Add(label, flag=cv, border=0, proportion=1) control = Control( panel, type=TextCtrl, globals=globals(), locals=locals(), name="Collect_Panel.Logfile", size=(200, -1), ) group.Add(control, flag=l | cv | a, border=border) label = wx.StaticText(panel, label="Path:") group.Add(label, flag=cv, border=0, proportion=1) control = DirectoryControl( panel, globals=globals(), locals=locals(), name="Collect_Panel.Path", size=(390, -1), ) group.Add(control, flag=l | cv | a, border=border) indicator = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name="Collect_Panel.Info", size=(600, -1), label="-" * 100, ) layout.Add(indicator, flag=layout_flag, border=border, proportion=0) indicator = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name="Collect_Panel.Status", size=(600, -1), label="-" * 100, ) layout.Add(indicator, flag=layout_flag, border=border, proportion=0) indicator = Control( panel, type=wx.StaticText, globals=globals(), locals=locals(), name="Collect_Panel.Actual", size=(600, -1), label="-" * 100, ) layout.Add(indicator, flag=layout_flag, border=border, proportion=0) group = wx.BoxSizer(wx.HORIZONTAL) layout.Add(group, flag=layout_flag, border=border) width, height = 115, 27 flag = wx.EXPAND control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name="Collect_Panel.Generate_Packets", label="Generate Packets", size=(width, height), ) group.Add(control, flag=flag, border=border, proportion=1) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name="Collect_Panel.Collect_Dataset", label="Collect Dataset", size=(width, height), ) group.Add(control, flag=flag, border=border, proportion=1) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name="Collect_Panel.Erase_Dataset", label="Erase Dataset", size=(width, height), ) group.Add(control, flag=flag, border=border, proportion=1) control = Control( panel, type=wx.ToggleButton, globals=globals(), locals=locals(), name="Collect_Panel.Finish_Series", label="Finish Series", size=(width, height), ) group.Add(control, flag=flag, border=border, proportion=1) control = Control( panel, type=Choice, globals=globals(), locals=locals(), name="Collect_Panel.Finish_Series_Variable", size=(width, height), ) group.Add(control, flag=flag, border=border, proportion=1) panel.Fit() return panel