def __init__(self, parent): wx.Dialog.__init__(self, parent, wx.ID_ANY) self.sizer = wx.BoxSizer(wx.VERTICAL) self.tc_sizer = wx.BoxSizer(wx.HORIZONTAL) self.ButtonSizer = wx.BoxSizer(wx.HORIZONTAL) self.user_dir_tc = simple_label_tc(self, "Stored under", "public", "string") self.tc_sizer.Add(self.user_dir_tc, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.database_tc = simple_label_tc(self, "Database", "iter", "string") self.tc_sizer.Add(self.database_tc, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.shot_tc = simple_label_tc(self, "shot", 0, "integer") self.tc_sizer.Add(self.shot_tc, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.run_tc = simple_label_tc(self, "run", 0, "integer") self.tc_sizer.Add(self.run_tc, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.LoadButton = wx.Button(self, wx.ID_ANY, 'Load') self.Bind(wx.EVT_BUTTON, self.OnLoad, self.LoadButton) self.DiscardButton = wx.Button(self, wx.ID_ANY, 'Discard') self.Bind(wx.EVT_BUTTON, self.EvtClose, self.DiscardButton) self.ButtonSizer.Add(self.LoadButton, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.ButtonSizer.Add(self.DiscardButton, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.sizer.Add(self.tc_sizer, 0, wx.ALL | \ wx.ALIGN_CENTER_HORIZONTAL, 5) self.sizer.Add(self.ButtonSizer, 0, wx.ALL | \ wx.ALIGN_CENTER_HORIZONTAL, 5) self.SetSizer(self.sizer) self.SetClientSize(self.GetEffectiveMinSize())
def __init__(self, parent, Diag_obj): wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.SUNKEN_BORDER) self.Diag = Diag_obj self.grid_sizer = wx.GridSizer(0, 4, 0, 0) self.art_data_beamline = 1 self.art_data_base_freq_140 = True self.art_data_pol_coeff_X = 1.0 self.art_data_pol_launch = 0.0 self.art_data_tor_launch = 0.0 self.widget_dict = {} self.selected_channel = 0 for attribute in Diag_obj.properties: if(Diag_obj.data_types_dict[attribute] != "bool"): scale = None if(attribute in Diag_obj.scale_dict): scale = Diag_obj.scale_dict[attribute] self.widget_dict[attribute] = simple_label_tc(self, Diag_obj.descriptions_dict[attribute], \ getattr(Diag_obj, attribute), \ Diag_obj.data_types_dict[attribute], \ scale=scale) else: self.widget_dict[attribute] = simple_label_cb(self, Diag_obj.descriptions_dict[attribute], \ getattr(Diag_obj, attribute)) self.grid_sizer.Add(self.widget_dict[attribute], 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.SetSizer(self.grid_sizer)
def __init__(self, parent, eq_data_3D, working_dir): wx.Dialog.__init__(self, parent, wx.ID_ANY) self.eq_data_3D = eq_data_3D.copy() self.working_dir = working_dir self.sizer = wx.BoxSizer(wx.VERTICAL) self.grid = wx.GridSizer(0,4,0,0) self.widgets = {} for key in eq_data_3D.keys(): if(type(eq_data_3D[key]) == bool): self.widgets[key] = simple_label_cb(self,key.replace("_", " "), eq_data_3D[key]) else: self.widgets[key] = simple_label_tc(self,key.replace("_", " "), eq_data_3D[key], None) self.grid.Add(self.widgets[key], 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.sizer.Add(self.grid, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.ButtonSizer = wx.BoxSizer(wx.HORIZONTAL) self.FinishButton = wx.Button(self, wx.ID_ANY, 'Accept') self.Bind(wx.EVT_BUTTON, self.EvtAccept, self.FinishButton) self.DiscardButton = wx.Button(self, wx.ID_ANY, 'Discard') self.Bind(wx.EVT_BUTTON, self.EvtClose, self.DiscardButton) self.select_equ_file_button = wx.Button(self, wx.ID_ANY, "Select equilibrium file") self.select_equ_file_button.Bind(wx.EVT_BUTTON, self.OnSelectEquFile) self.sizer.Add(self.select_equ_file_button, 1, wx.EXPAND | wx.ALL, 5) self.select_vessel_file_button = wx.Button(self, wx.ID_ANY, "Select vessel file") self.select_vessel_file_button.Bind(wx.EVT_BUTTON, self.OnSelectVesselFile) self.sizer.Add(self.select_vessel_file_button, 1, wx.EXPAND | wx.ALL, 5) self.ButtonSizer.Add(self.DiscardButton, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.ButtonSizer.Add(self.FinishButton, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.sizer.Add(self.ButtonSizer, 0, wx.ALL | \ wx.ALIGN_CENTER_HORIZONTAL, 5) self.SetSizer(self.sizer) self.SetClientSize(self.GetEffectiveMinSize())
def __init__(self, parent, figure_width=12.0, figure_height=8.5): wx.Panel.__init__(self, parent, wx.ID_ANY) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.ctrl_sizer = wx.BoxSizer(wx.HORIZONTAL) self.fig = plt.figure(figsize=(figure_width, figure_height), tight_layout=True, frameon=False) self.fig.clf() self.linestyles = ["-", "--", ":", "-."] self.markers = ["^", "v", "+", "d", "o"] self.cmap = plt.cm.ScalarMappable(plt.Normalize(0, 1), "rainbow") self.canvas = FigureCanvas(self, -1, self.fig) self.axlist = [] self.canvas.mpl_connect('motion_notify_event', self.UpdateCoords) self.Bind(EVT_DONE_PLOTTING, self.OnDonePlotting) self.plot_toolbar = NavigationToolbar2Wx(self.canvas) fw, th = self.plot_toolbar.GetSize().Get() self.plot_toolbar.SetSize(wx.Size(fw, th)) self.plot_toolbar.Realize() self.ctrl_sizer.Add(self.plot_toolbar, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.lower_lim_tc = simple_label_tc(self, "lower limit", 0.0, "real") self.upper_lim_tc = simple_label_tc(self, "upper limit", 0.0, "real") self.axis_choice = wx.Choice(self, wx.ID_ANY) self.axis_choice.Append("x") self.axis_choice.Append("y1") self.axis_choice.Append("y2") self.axis_choice.Select(0) self.set_lim_button = wx.Button(self, wx.ID_ANY, "Set axis limits") self.set_lim_button.Bind(wx.EVT_BUTTON, self.OnSetLim) self.auto_lim_button = wx.Button(self, wx.ID_ANY, "Auto limits") self.auto_lim_button.Bind(wx.EVT_BUTTON, self.OnAutoLim) self.ctrl_sizer.Add(self.lower_lim_tc, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.ctrl_sizer.Add(self.upper_lim_tc, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.ctrl_sizer.Add(self.axis_choice, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.ctrl_sizer.Add(self.set_lim_button, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.ctrl_sizer.Add(self.auto_lim_button, 0, wx.ALL | \ wx.ALIGN_CENTER_VERTICAL , 5) self.sizer.Add(self.ctrl_sizer, 0, wx.ALL | wx.LEFT, 5) self.sizer.Add(self.canvas, 0, wx.ALL | \ wx.LEFT, 5)
def __init__(self, parent, Diag_obj): wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.SUNKEN_BORDER) self.Diag = Diag_obj self.grid_sizer = wx.GridSizer(0, 4, 0, 0) self.art_data_beamline = 1 self.art_data_base_freq_140 = True self.art_data_pol_coeff_X = 1.0 self.art_data_pol_launch = 0.0 self.art_data_tor_launch = 0.0 self.widget_dict = {} self.selected_channel = 0 self.NewValues = False N_ch = getattr(Diag_obj, "N_ch") self.widget_dict["N_ch"] = simple_label_tc(self, Diag_obj.descriptions_dict["N_ch"], \ getattr(Diag_obj, "N_ch"), \ Diag_obj.data_types_dict["N_ch"]) self.grid_sizer.Add(self.widget_dict["N_ch"], 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.channel_ctrl_sizer = wx.BoxSizer(wx.VERTICAL) self.channel_select_ch = wx.Choice(self, wx.ID_ANY) self.channel_select_ch.AppendItems(np.array(range(1, N_ch + 1), dtype="|U3").tolist()) self.channel_select_ch.SetSelection(self.selected_channel) self.channel_select_ch.Bind(wx.EVT_CHOICE, self.OnNewChannelSelected) self.channel_ctrl_sizer.Add(self.channel_select_ch, 0, wx.EXPAND | wx.ALL, 5) self.update_N_ch_Button = wx.Button(self, label='Update Channel Number') self.update_N_ch_Button.Bind(wx.EVT_BUTTON, self.OnUpdateNch) self.channel_ctrl_sizer.Add(self.update_N_ch_Button, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) self.grid_sizer.Add(self.channel_ctrl_sizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) for attribute in Diag_obj.properties: if(attribute == "N_ch"): continue if(Diag_obj.data_types_dict[attribute] != "bool"): scale = None if(attribute in Diag_obj.scale_dict): scale = Diag_obj.scale_dict[attribute] self.widget_dict[attribute] = simple_label_tc(self, Diag_obj.descriptions_dict[attribute], \ getattr(Diag_obj, attribute)[self.selected_channel], \ Diag_obj.data_types_dict[attribute], \ scale=scale) else: self.widget_dict[attribute] = simple_label_cb(self, Diag_obj.descriptions_dict[attribute], \ getattr(Diag_obj, attribute)) self.grid_sizer.Add(self.widget_dict[attribute], 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.SetSizer(self.grid_sizer)
def __init__(self, parent, Config, border=1, maxwidth=max_var_in_row, \ parentmode=False, style=wx.TAB_TRAVERSAL | wx.NO_BORDER): wx.Panel.__init__(self, parent, wx.ID_ANY, style=style) self.Bind(EVT_UPDATE_CONFIG, self.OnConfigLoaded) self.name = "ECRad settings" columns = 8 self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.grid_list = [] self.labels = [] self.lines = [] self.widgets = {} for key in Config.main_keys: self.lines.append(wx.StaticLine(self, wx.ID_ANY)) self.sizer.Add(self.lines[-1], 0, wx.ALL | wx.EXPAND, 5) self.labels.append( wx.StaticText(self, wx.ID_ANY, key + " Settings")) self.sizer.Add(self.labels[-1], 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.lines.append(wx.StaticLine(self, wx.ID_ANY)) self.sizer.Add(self.lines[-1], 0, wx.ALL | wx.EXPAND, 5) self.grid_list.append(wx.GridSizer(0, columns, 0, 0)) for sub_key in Config.sub_keys[key]: if (Config.types[sub_key] == "b"): self.widgets[sub_key] = simple_label_cb( self, Config.nice_labels[sub_key], Config[key][sub_key]) else: self.widgets[sub_key] = simple_label_tc( self, Config.nice_labels[sub_key], Config[key][sub_key], None) self.grid_list[-1].Add(self.widgets[sub_key], 0, wx.ALL | wx.LEFT | wx.TOP, 5) self.sizer.Add(self.grid_list[-1], 0, wx.ALL | wx.LEFT, 5) self.widgets["use_ext_rays"].SetToolTip( "Load ECRad results in the Scenario panel to enable") self.widgets["use_ext_rays"].Disable()
def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY) self.parent = parent self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(self.sizer) self.controlplotsizer = wx.BoxSizer(wx.VERTICAL) self.Results = None self.smoothing_time = 1.e-3 self.FigureControlPanel = FigureBook(self) self.Bind(EVT_UPDATE_DATA, self.OnUpdate) self.Bind(EVT_OTHER_RESULTS_LOADED, self.OnOtherResultsLoaded) self.controlgrid = wx.BoxSizer(wx.HORIZONTAL) self.controlgrid2 = wx.BoxSizer(wx.HORIZONTAL) self.lb_widgets = {} self.multiple = {} self.time_sizer = wx.BoxSizer(wx.VERTICAL) self.time_label = wx.StaticText(self, wx.ID_ANY, "time [s]") self.lb_widgets["time"] = wx.ListBox(self, wx.ID_ANY, size=(60, 100), style=wx.LB_MULTIPLE) self.time_sizer.Add(self.time_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.time_sizer.Add(self.lb_widgets["time"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.controlgrid.Add(self.time_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.multiple["time"] = True self.ch_sizer = wx.BoxSizer(wx.VERTICAL) self.ch_label = wx.StaticText(self, wx.ID_ANY, "ch. # | cold res. | warm .res") self.lb_widgets["ch"] = wx.ListBox(self, wx.ID_ANY, size=(120, 100), style=wx.LB_MULTIPLE) self.ch_sizer.Add(self.ch_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.ch_sizer.Add(self.lb_widgets["ch"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.controlgrid.Add(self.ch_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.multiple["ch"] = True self.mode_sizer = wx.BoxSizer(wx.VERTICAL) self.mode_label = wx.StaticText(self, wx.ID_ANY, "mode") self.lb_widgets["mode"] = wx.ListBox(self, wx.ID_ANY, size=(30, 100), style=wx.LB_MULTIPLE) self.mode_sizer.Add(self.mode_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.mode_sizer.Add(self.lb_widgets["mode"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.controlgrid.Add(self.mode_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.multiple["mode"] = True self.ray_sizer = wx.BoxSizer(wx.VERTICAL) self.ray_label = wx.StaticText(self, wx.ID_ANY, "ray #") self.lb_widgets["ray"] = wx.ListBox(self, wx.ID_ANY, size=(30, 100), style=wx.LB_MULTIPLE) self.ray_sizer.Add(self.ray_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.ray_sizer.Add(self.lb_widgets["ray"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.controlgrid.Add(self.ray_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.multiple["ray"] = True self.x_group_sizer = wx.BoxSizer(wx.VERTICAL) self.x_group_label = wx.StaticText(self, wx.ID_ANY, "x group") self.lb_widgets["x_group"] = wx.ListBox(self, wx.ID_ANY, size=(120, 100), style=wx.LB_SINGLE) self.x_group_sizer.Add(self.x_group_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.x_group_sizer.Add(self.lb_widgets["x_group"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.lb_widgets["x_group"].Bind(wx.EVT_LISTBOX, self.OnXGroupSelected) self.multiple["x_group"] = False self.controlgrid.Add(self.x_group_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.x_quant_sizer = wx.BoxSizer(wx.VERTICAL) self.x_quant_label = wx.StaticText(self, wx.ID_ANY, "x quantity") self.lb_widgets["x_quant"] = wx.ListBox(self, wx.ID_ANY, size=(120, 100), style=wx.LB_SINGLE) self.x_quant_sizer.Add(self.x_quant_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.x_quant_sizer.Add(self.lb_widgets["x_quant"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.controlgrid.Add(self.x_quant_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.multiple["x_quant"] = False self.y_group_sizer = wx.BoxSizer(wx.VERTICAL) self.y_group_label = wx.StaticText(self, wx.ID_ANY, "y group") self.lb_widgets["y_group"] = wx.ListBox(self, wx.ID_ANY, size=(120, 100), style=wx.LB_SINGLE) self.y_group_sizer.Add(self.y_group_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.y_group_sizer.Add(self.lb_widgets["y_group"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.lb_widgets["y_group"].Bind(wx.EVT_LISTBOX, self.OnYGroupSelected) self.multiple["y_group"] = False self.controlgrid.Add(self.y_group_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.y_quant_sizer = wx.BoxSizer(wx.VERTICAL) self.y_quant_label = wx.StaticText(self, wx.ID_ANY, "y quantity") self.lb_widgets["y_quant"] = wx.ListBox(self, wx.ID_ANY, size=(120, 100), style=wx.LB_MULTIPLE) self.y_quant_sizer.Add(self.y_quant_label, 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.y_quant_sizer.Add(self.lb_widgets["y_quant"], 0, wx.ALIGN_CENTRE_HORIZONTAL | wx.ALL, 5) self.lb_widgets["y_quant"].Bind(wx.EVT_LISTBOX, self.OnYQuantSelected) self.multiple["y_quant"] = True self.controlgrid.Add(self.y_quant_sizer, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.eq_aspect_ratio_cb = simple_label_cb(self, "Equal aspect ratio", False) self.figure_width_tc = simple_label_tc(self, "Figure width", 12.0, "real") self.figure_height_tc = simple_label_tc(self, "Figure height", 8.5, "real") self.AddPlotButton = wx.Button(self, wx.ID_ANY, 'Add plot') self.AddPlotButton.Bind(wx.EVT_BUTTON, self.OnPlot) self.ClearButton = wx.Button(self, wx.ID_ANY, 'Clear plots') self.Bind(wx.EVT_BUTTON, self.OnClear, self.ClearButton) self.controlgrid2.Add(self.eq_aspect_ratio_cb, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.controlgrid2.Add(self.figure_width_tc, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.controlgrid2.Add(self.figure_height_tc, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.controlgrid2.Add(self.AddPlotButton, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.controlgrid2.Add(self.ClearButton, 0, wx.ALIGN_BOTTOM | wx.ALL, 5) self.controlplotsizer.Add(self.controlgrid, 0, \ wx.LEFT | wx.ALL , 10) self.controlplotsizer.Add(self.controlgrid2, 0, \ wx.LEFT | wx.ALL , 10) self.controlplotsizer.Add(self.FigureControlPanel, 1, wx.ALL | wx.EXPAND, 10) self.aux_data_box_sizer = wx.BoxSizer(wx.VERTICAL) self.load_other_results_button = wx.Button(self, wx.ID_ANY, "Load other results") self.load_other_results_button.Bind(wx.EVT_BUTTON, self.OnLoadOtherResults) self.aux_data_box_sizer.Add(self.load_other_results_button, 0, wx.ALL | wx.EXPAND, 5) self.other_result_text = wx.StaticText( self, wx.ID_ANY, "Select result(s) for comparison") self.aux_data_box_sizer.Add(self.other_result_text, 0, wx.ALL | wx.TOP, 5) self.other_result_box = wx.ListBox(self, wx.ID_ANY, style=wx.LB_MULTIPLE, size=(100, 200)) self.aux_data_box_sizer.Add(self.other_result_box, 0, wx.ALL | wx.EXPAND, 5) self.clear_other_results_button = wx.Button(self, wx.ID_ANY, "Clear other results") self.clear_other_results_button.Bind(wx.EVT_BUTTON, self.OnClearOtherResults) self.aux_data_box_sizer.Add(self.clear_other_results_button, 0, wx.ALL | wx.EXPAND, 5) self.scenario_quant_text = wx.StaticText( self, wx.ID_ANY, "Add scenario quantity to plot") self.aux_data_box_sizer.Add(self.scenario_quant_text, 0, wx.ALL | wx.TOP, 5) self.scenario_quant_box = wx.ListBox(self, wx.ID_ANY, style=wx.LB_MULTIPLE, size=(100, 200)) self.aux_data_box_sizer.Add(self.scenario_quant_box, 0, wx.ALL | wx.EXPAND, 5) self.scenario_quant_box.Bind(wx.EVT_LISTBOX, self.OnScenarioQuantSelected) self.sizer.Add(self.controlplotsizer, 1, wx.ALL | wx.EXPAND, 10) self.sizer.Add(self.aux_data_box_sizer, 0, wx.ALL | wx.TOP, 10) self.FigureControlPanel.Show(True) self.cur_selected_index = 0 self.compare_data = {}