def render_power(self, event): if wx.Event.GetEventType(event) == 10084 or wx.Event.GetEventType( event) == 10161: if (self.power_rendered): self.canvas2.update_line(0, self.data.truncated_frequency, self.data.truncated_power, draw=True) else: self.canvas2 = PlotPanel(self.m_panel3, size=(self.m_panel3.GetSize())) if hasattr(self.data, 'truncated_frequency') and hasattr( self.data, 'truncated_power'): self.canvas2.plot(self.data.truncated_frequency, self.data.truncated_power, 'r') self.canvas2.oplot( self.data.truncated_frequency, np.full((len(self.data.truncated_frequency)), self.data.min)) self.power_rendered = True return # For slider else: p = backend.get_cutoff_value(self.data.min, self.data.slope, self.m_slider1.GetValue()) if (self.power_rendered): self.canvas2.update_line( 1, self.data.truncated_frequency, np.full((len(self.data.truncated_frequency)), p), draw=True) else: self.canvas2 = PlotPanel(self.m_panel3, size=(self.m_panel3.GetSize())) self.canvas2.plot(self.data.truncated_frequency, self.data.truncated_power, 'r') self.canvas2.oplot( self.data.truncated_frequency, np.full((len(self.data.truncated_frequency)), self.data.min)) self.power_rendered = True return
def __init__(self,parent,owner=None,_larch=None,size=(500, 100)): wx.Panel.__init__(self, parent) self.owner = owner vbox = wx.BoxSizer(wx.VERTICAL) self.plot1D = PlotPanel(self,size=size,messenger=self.owner.write_message) vbox.Add(self.plot1D,proportion=1,flag=wx.ALL|wx.EXPAND,border = 10) self.SetSizer(vbox) self.plot1D.cursor_callback = self.on_cursor
def __init__(self, parent): SectionPointDefsPanelBase.__init__(self, parent) # 用于存放 solve之后的值 self._args = dict() self.point_list = list() # 这是一个复连通的全局变量 self.MP = MultiConnectPoly() # 再来一个复合截面的全局变量 self.Comp = compoundSection() # 仅仅只是初始化了画布 self.plotpanel = PlotPanel(self.m_panel1, size=(300, 300), fontsize=5) self.plotpanel.BuildPanel()
def createPlotPanel(self): """xrd plot window""" pan = PlotPanel(self, fontsize=7, axisbg='#FEFEFE', output_title='test.xrd', messenger=self.write_message) pan.conf.grid_color='#E5E5C0' pan.conf.show_grid = False pan.conf.canvas.figure.set_facecolor('#FCFCFE') pan.conf.labelfont.set_size(6) pan.conf.labelfont.set_size(6) pan.onRightDown= partial(self.on_cursor, side='right') pan.add_cursor_mode('zoom', motion = self.ignoreEvent, leftup = self.ignoreEvent, leftdown = self.on_cursor, rightdown = partial(self.on_cursor, side='right')) return pan
def __init__(self, parent): SectionParamsDefsPanelBase.__init__(self, parent) # ÓÃÓÚ´æ·Å solveÖ®ºóµÄÖµ self._args = dict() self.plotpanel = PlotPanel(self.m_panel_canvas, size=(300, 300), fontsize=5) self.plotpanel.BuildPanel() # ĬÈϽØÃæÐÎ×´ self._section_type = u'Ö±½Ç¸Ö' # ½ØÃæ²ÎÊýµÚÒ»ÁÐÖ»¶Á for irow in range(self.m_grid_params_defs.GetNumberRows()): self.m_grid_params_defs.SetReadOnly(irow, 0, True) self.grid_value = { u'Ö±½Ç¸Ö': ['±ß¿í¶È1', '±ß¿í¶È2', '±ßºñ¶È1', '±ßºñ¶È2', 'ÄÚÔ²»¡°ë¾¶'], u'¹¤×Ö¸Ö': [ '¸ß¶È', 'ÍÈ¿í¶È', 'Ñüºñ¶È', 'ƽ¾ùÍȺñ¶È', 'ÄÚÔ²»¡°ë¾¶', '½Ç¶ËÔ²»¡°ë¾¶' ], u'²Û¸Ö': [ '¸ß¶È', 'ÍÈ¿í¶È', 'Ñüºñ¶È', 'ƽ¾ùÍȺñ¶È', 'ÄÚÔ²»¡°ë¾¶', '½Ç¶ËÔ²»¡°ë¾¶' ], #u'CÐ͸Ö': ['¸ß¶È', '±ß¿í¶È1', '±ßºñ¶È1', 'Ñüºñ¶È', '±ßºñ¶È2', '±ß¿í¶È2'], u'TÐ͸Ö': ['¸ß¶È', '±ß¿í¶È1', '±ß¿í¶È2', '±ßºñ¶È1', '±ßºñ¶È2'], u'ñÐ͸Ö': [ '¸ß¶È', '½Å±ß¿í¶È', 'Í·±ß¿í¶È', 'ÍÈÇã½Ç', '½Å±ßºñ¶È', 'ÍȺñ¶È', 'Í·ºñ¶È' ], u'JÐ͸Ö': [ '¸ß¶È', '±ß¿í¶È1', '±ß¿í¶È2', '±ß¿í¶È3', '±ßºñ¶È1', '±ßºñ¶È2', '±ßºñ¶È3' ] } for num in range(len(self.grid_value[self._section_type])): self.m_grid_params_defs.SetCellValue( num, 0, self.grid_value[self._section_type][num])
def __init__(self, *args, **kwds): # begin wxGlade: MainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.alarm_plt = PlotPanel(self) #self.timestamp_sld = wx.Slider(self, -1, 0, 0, 10) self.avg_hr_title_lbl = wx.StaticText(self, -1, "Current avg. HR:") self.avg_hr_lbl = wx.StaticText(self, -1, "nan") self.panel_1 = wx.Panel(self, -1) self.avg_acc_title_lbl = wx.StaticText(self, -1, "Current avg. Acceleration:") self.avg_acc_lbl = wx.StaticText(self, -1, "nan") self.panel_2 = wx.Panel(self, -1) self.anomaly_lvl_curr_title_lbl = wx.StaticText( self, -1, "Anomaly level: Current:") self.anomaly_lvl_curr_lbl = wx.StaticText(self, -1, "nan") self.panel_3 = wx.Panel(self, -1) self.anomaly_lvl_max_title_lbl = wx.StaticText( self, -1, " Max:") self.anomaly_lvl_max_lbl = wx.StaticText(self, -1, "nan") self.red_alarm_lbl = wx.Panel(self, -1) self.anomaly_lvl_min_title_lbl = wx.StaticText( self, -1, " Min:") self.anomaly_lvl_min_lbl = wx.StaticText(self, -1, "nan") self.yellow_alarm_lbl = wx.Panel(self, -1) self.anomaly_lvl_avg_title_lbl = wx.StaticText( self, -1, " Average:") self.anomaly_lvl_avg_lbl = wx.StaticText(self, -1, "nan") self.green_alarm_lbl = wx.Panel(self, -1) self.collect_btn = wx.Button(self, -1, "Collect data") self.__set_properties() self.__do_layout() #self.Bind(wx.EVT_COMMAND_SCROLL, self.timestamp_sld_scroll, self.timestamp_sld) self.Bind(wx.EVT_BUTTON, self.collect_btn_click, self.collect_btn) # end wxGlade self.timer_thread = Timer(target=self.timer_tick) self.proxy = DeviceProxy(MainFrame.monitor_address) self.alarms = set()
def render_output(self, event): if wx.Event.GetEventType(event) == 10084 or wx.Event.GetEventType( event) == 10161: self.m_panel4.Refresh() self.canvas3 = PlotPanel(self.m_panel4, size=(self.m_panel4.GetSize())) if hasattr(self.data, 'time') and hasattr(self.data, 'ifft'): self.canvas3.plot(self.data.time, self.data.ifft) return else: self.canvas3.update_line(0, self.data.time, self.data.ifft, draw=True) return
def render_input_sound(self, event): if wx.Event.GetEventType(event) == 10084 or wx.Event.GetEventType( event) == 10161: self.m_panel2.Refresh() self.canvas1 = PlotPanel(self.m_panel2, size=(self.m_panel2.GetSize())) if hasattr(self.data, 'time') and hasattr(self.data, 'input_sound'): self.canvas1.plot(self.data.time, self.data.input_sound) return else: self.canvas1.update_line(0, self.data.time, self.data.input_sound, draw=True) return
def InitUI(self): panelRoot = wx.Panel(self) panelRootSizer = wx.BoxSizer(wx.VERTICAL) topSplitter = wx.SplitterWindow(panelRoot, style=wx.SP_LIVE_UPDATE | wx.SP_3DSASH) topVerticalSplitter = wx.SplitterWindow(topSplitter, style=wx.SP_LIVE_UPDATE | wx.SP_3DSASH) ############################################# # TOP-LEFT PANEL (STATUS AND CONTROLS) # ############################################# panelTopLeft = wx.Panel(topVerticalSplitter) panelTopLeftSizer = wx.BoxSizer(wx.VERTICAL) # create gauges and set initial values self.voltageGauge = wx.Gauge(panelTopLeft, -1, MAX_VOLTAGE - MIN_VOLTAGE, (0, 0), (250, 25)) self.voltageGauge.SetValue(self.voltage - MIN_VOLTAGE) self.amperageGauge = wx.Gauge(panelTopLeft, -1, MAX_AMPERAGE - MIN_AMPERAGE, (0, 0), (250, 25)) self.amperageGauge.SetValue(self.amperage - MIN_AMPERAGE) self.rpmGauge = wx.Gauge(panelTopLeft, -1, MAX_RPM - MIN_RPM, (0, 0), (250, 25)) self.rpmGauge.SetValue(self.rpm - MIN_RPM) self.controllerTempGauge = wx.Gauge( panelTopLeft, -1, MAX_CONTROLLER_TEMP - MIN_CONTROLLER_TEMP, (0, 0), (250, 25)) self.controllerTempGauge.SetValue(self.controllerTemp - MIN_CONTROLLER_TEMP) # create labels self.voltageLabel = wx.StaticText( panelTopLeft, -1, "Voltage (" + str(self.voltage) + ")") self.amperagLabel = wx.StaticText( panelTopLeft, -1, "Amperage (" + str(self.amperage) + ")") self.rpmLabel = wx.StaticText(panelTopLeft, -1, "RPM (" + str(self.rpm) + ")") self.controllerTempLabel = wx.StaticText( panelTopLeft, -1, "Controller Temperature (" + str(self.controllerTemp) + ")") # Add voltage Gauge and label to BoxSizer panelTopLeftSizer.Add(self.voltageLabel, 0, wx.ALIGN_CENTRE_HORIZONTAL) panelTopLeftSizer.Add(self.voltageGauge, 1, wx.ALIGN_CENTRE_HORIZONTAL) # Add amperage Gauge and label to BoxSizer panelTopLeftSizer.Add(self.amperagLabel, 0, wx.ALIGN_CENTRE_HORIZONTAL) panelTopLeftSizer.Add(self.amperageGauge, 1, wx.ALIGN_CENTRE_HORIZONTAL) # Add RPM Gauge and label to BoxSizer panelTopLeftSizer.Add(self.rpmLabel, 0, wx.ALIGN_CENTRE_HORIZONTAL) panelTopLeftSizer.Add(self.rpmGauge, 1, wx.ALIGN_CENTRE_HORIZONTAL) # Add controller temp Gauge and label to BoxSizer panelTopLeftSizer.Add(self.controllerTempLabel, 0, wx.ALIGN_CENTRE_HORIZONTAL) panelTopLeftSizer.Add(self.controllerTempGauge, 1, wx.ALIGN_CENTRE_HORIZONTAL) # Add BoxSizer to panel panelTopLeft.SetSizer(panelTopLeftSizer) ################################ # TOP-RIGHT PANEL (GRAPH) # ################################ panelTopRight = wx.Panel(topVerticalSplitter) panelTopRightSizer = wx.BoxSizer(wx.VERTICAL) # create top button bar topButtonPanel = wx.Panel(panelTopRight, -1) topButtonSizer = wx.BoxSizer(wx.HORIZONTAL) goalVoltageLabel = wx.StaticText( topButtonPanel, -1, ' End Goal Voltage Value (V): ') self.goalEndVoltage = FloatCtrl(topButtonPanel, size=(100, -1), value=34.5, precision=1) endTimeLabel = wx.StaticText(topButtonPanel, -1, ' End Time (min): ') self.endTime = FloatCtrl(topButtonPanel, size=(100, -1), value=120, precision=0) plotGoalVoltageButton = wx.Button(topButtonPanel, -1, 'Plot Goal Voltage', size=(250, -1)) plotGoalVoltageButton.Bind(wx.EVT_BUTTON, self.OnPlotGoalVoltage) topButtonSizer.Add(goalVoltageLabel) topButtonSizer.Add(self.goalEndVoltage) topButtonSizer.Add(endTimeLabel) topButtonSizer.Add(self.endTime) topButtonSizer.Add(plotGoalVoltageButton) topButtonPanel.SetSizer(topButtonSizer) topButtonSizer.Fit(topButtonPanel) # create plot panel self.plotPanel = PlotPanel(panelTopRight) # create bottom button bar bottomButtonPanel = wx.Panel(panelTopRight, -1) bottomButtonSizer = wx.BoxSizer(wx.HORIZONTAL) exportButton = wx.Button(bottomButtonPanel, -1, 'Export Plot to CSV', size=(250, -1)) exportButton.Bind(wx.EVT_BUTTON, self.ExportPlotDataToCSV) resetButton = wx.Button(bottomButtonPanel, -1, 'Reset Graph', size=(250, -1)) resetButton.Bind(wx.EVT_BUTTON, self.ResetGraph) bottomButtonSizer.Add(exportButton, 1) bottomButtonSizer.Add(resetButton, 1) bottomButtonPanel.SetSizer(bottomButtonSizer) bottomButtonSizer.Fit(bottomButtonPanel) # Add panels to top right sizer panelTopRightSizer.Add(topButtonPanel, 0, wx.EXPAND | wx.ALL) panelTopRightSizer.Add(self.plotPanel, 1, wx.EXPAND | wx.ALL) panelTopRightSizer.Add(bottomButtonPanel, 0) # Add BoxSizer to panel panelTopRight.SetSizer(panelTopRightSizer) # add top panels to vertical splitter topVerticalSplitter.SplitVertically(panelTopLeft, panelTopRight) topVerticalSplitter.SetSashGravity(0.25) ############################################# # BOTTOM PANEL (LOG & TELEMETRY INPUT) # ############################################# panelBottom = wx.Panel(topSplitter) panelBottomSizer = wx.BoxSizer(wx.VERTICAL) self.logPane = LogPane(panelBottom) logPaneLabel = wx.StaticText( panelBottom, label="Telemetry Message Log (Last 100 messages shown):") logPaneLabel.SetFont( wx.Font(14, wx.FONTFAMILY_TELETYPE, wx.NORMAL, wx.BOLD)) panelBottomSizer.Add(logPaneLabel, 0, wx.ALIGN_TOP) panelBottomSizer.Add(self.logPane, 1, wx.EXPAND | wx.ALL) panelBottom.SetSizer(panelBottomSizer) topSplitter.SplitHorizontally(topVerticalSplitter, panelBottom) topSplitter.SetSashGravity(0.75) panelRootSizer.Add(topSplitter, 1, wx.EXPAND | wx.ALL) panelRoot.SetSizer(panelRootSizer)
def __init__(self, parent, filename=None, read_ok_cb=None, size=(725, 450), _larch=None): self.parent = parent self.filename = filename self.larch = _larch self.read_ok_cb = read_ok_cb self.colors = GUIColors() wx.Frame.__init__(self, parent, -1, size=size, style=FRAMESTYLE) splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetMinimumPaneSize(200) leftpanel = wx.Panel(splitter) ltop = wx.Panel(leftpanel) sel_none = Button(ltop, 'Select None', size=(100, 30), action=self.onSelNone) sel_all = Button(ltop, 'Select All', size=(100, 30), action=self.onSelAll) sel_imp = Button(ltop, 'Import Selected Groups', size=(200, 30), action=self.onOK) self.select_imported = sel_imp self.select_imported.Disable() self.grouplist = FileCheckList(leftpanel, select_action=self.onShowGroup) self.grouplist.SetBackgroundColour(wx.Colour(255, 255, 255)) tsizer = wx.GridBagSizer(2, 2) tsizer.Add(sel_all, (0, 0), (1, 1), LCEN, 0) tsizer.Add(sel_none, (0, 1), (1, 1), LCEN, 0) tsizer.Add(sel_imp, (1, 0), (1, 2), LCEN, 0) pack(ltop, tsizer) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ltop, 0, LCEN | wx.GROW, 1) sizer.Add(self.grouplist, 1, LCEN | wx.GROW | wx.ALL, 1) pack(leftpanel, sizer) # right hand side rightpanel = wx.Panel(splitter) self.SetTitle("Reading Athena Project '%s'" % self.filename) self.title = SimpleText(rightpanel, self.filename, font=Font(13), colour=self.colors.title, style=LCEN) self.plotpanel = PlotPanel(rightpanel, messenger=self.plot_messages) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.title, 0, LCEN, 2) sizer.Add(self.plotpanel, 0, LCEN, 2) pack(rightpanel, sizer) splitter.SplitVertically(leftpanel, rightpanel, 1) self.statusbar = self.CreateStatusBar(2, 0) self.statusbar.SetStatusWidths([-3, -1]) statusbar_fields = [self.filename, ""] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i) self.all = read_athena(self.filename, do_bkg=False, do_fft=False, with_journal=False, _larch=_larch) for item in dir(self.all): self.grouplist.Append(item) self.Show() self.Raise()
def __init__(self, parent, ID, **kws): kws["style"] = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL wx.Frame.__init__(self, parent, ID, '', wx.DefaultPosition, wx.Size(-1, -1), **kws) self.SetTitle("wxmplot StripChart Demo") self.tmin = 15.0 self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False)) menu = wx.Menu() ID_EXIT = wx.NewId() ID_TIMER = wx.NewId() menu_exit = menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = wx.MenuBar() menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnExit, menu_exit) self.Bind(wx.EVT_CLOSE, self.OnExit) sbar = self.CreateStatusBar(2, wx.CAPTION) sfont = sbar.GetFont() sfont.SetWeight(wx.BOLD) sfont.SetPointSize(11) sbar.SetFont(sfont) self.SetStatusWidths([-3, -1]) self.SetStatusText('', 0) mainsizer = wx.BoxSizer(wx.VERTICAL) btnpanel = wx.Panel(self, -1) btnsizer = wx.BoxSizer(wx.HORIZONTAL) b_on = wx.Button(btnpanel, -1, 'Start', size=(-1, -1)) b_off = wx.Button(btnpanel, -1, 'Stop', size=(-1, -1)) b_on.Bind(wx.EVT_BUTTON, self.onStartTimer) b_off.Bind(wx.EVT_BUTTON, self.onStopTimer) tlabel = wx.StaticText(btnpanel, -1, ' Time range:') self.time_range = FloatCtrl(btnpanel, size=(100, -1), value=abs(self.tmin), precision=1) btnsizer.Add(b_on, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) btnsizer.Add(b_off, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) btnsizer.Add( tlabel, 1, wx.GROW | wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) btnsizer.Add(self.time_range, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) btnpanel.SetSizer(btnsizer) btnsizer.Fit(btnpanel) self.plotpanel = PlotPanel(self, messenger=self.write_message) self.plotpanel.BuildPanel() self.plotpanel.set_xlabel('Time from Present (s)') mainsizer.Add(btnpanel, 0, wx.GROW | wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) mainsizer.Add( self.plotpanel, 1, wx.GROW | wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.LEFT, 0) self.SetSizer(mainsizer) mainsizer.Fit(self) self.Bind(wx.EVT_TIMER, self.onTimer) self.timer = wx.Timer(self) self.count = 0 self.Refresh() wx.CallAfter(self.onStartTimer)
def __init__(self, parent, filename=None, groupname=None, last_array_sel=None, read_ok_cb=None, edit_groupname=True, _larch=None): self.parent = parent self._larch = _larch self.path = filename group = self.initgroup = self.read_column_file(self.path) self.subframes = {} self.workgroup = Group(raw=group) for attr in ('path', 'filename', 'groupname', 'datatype', 'array_labels'): setattr(self.workgroup, attr, getattr(group, attr, None)) arr_labels = [l.lower() for l in self.initgroup.array_labels] if self.workgroup.datatype is None: self.workgroup.datatype = 'raw' if ('energ' in arr_labels[0] or 'energ' in arr_labels[1]): self.workgroup.datatype = 'xas' self.read_ok_cb = read_ok_cb self.array_sel = { 'xpop': '', 'xarr': None, 'ypop': '', 'yop': '/', 'yarr1': None, 'yarr2': None, 'use_deriv': False } if last_array_sel is not None: self.array_sel.update(last_array_sel) if self.array_sel['yarr2'] is None and 'i0' in arr_labels: self.array_sel['yarr2'] = 'i0' if self.array_sel['yarr1'] is None: if 'itrans' in arr_labels: self.array_sel['yarr1'] = 'itrans' elif 'i1' in arr_labels: self.array_sel['yarr1'] = 'i1' message = "Data Columns for %s" % group.filename wx.Frame.__init__(self, None, -1, 'Build Arrays from Data Columns for %s' % group.filename, style=FRAMESTYLE) self.SetFont(Font(10)) panel = wx.Panel(self) self.SetMinSize((600, 600)) self.colors = GUIColors() # title row title = SimpleText(panel, message, font=Font(13), colour=self.colors.title, style=LCEN) opts = dict(action=self.onUpdate, size=(120, -1)) yarr_labels = self.yarr_labels = arr_labels + ['1.0', '0.0', ''] xarr_labels = self.xarr_labels = arr_labels + ['_index'] self.xarr = Choice(panel, choices=xarr_labels, **opts) self.yarr1 = Choice(panel, choices=arr_labels, **opts) self.yarr2 = Choice(panel, choices=yarr_labels, **opts) self.yerr_arr = Choice(panel, choices=yarr_labels, **opts) self.yerr_arr.Disable() self.datatype = Choice(panel, choices=DATATYPES, **opts) self.datatype.SetStringSelection(self.workgroup.datatype) opts['size'] = (50, -1) self.yop = Choice(panel, choices=ARR_OPS, **opts) opts['size'] = (120, -1) self.use_deriv = Check(panel, label='use derivative', default=self.array_sel['use_deriv'], **opts) self.xpop = Choice(panel, choices=XPRE_OPS, **opts) self.ypop = Choice(panel, choices=YPRE_OPS, **opts) opts['action'] = self.onYerrChoice self.yerr_op = Choice(panel, choices=YERR_OPS, **opts) self.yerr_op.SetSelection(0) self.yerr_const = FloatCtrl(panel, value=1, precision=4, size=(90, -1)) ylab = SimpleText(panel, 'Y = ') xlab = SimpleText(panel, 'X = ') yerr_lab = SimpleText(panel, 'Yerror = ') self.xsuf = SimpleText(panel, '') self.ysuf = SimpleText(panel, '') self.xpop.SetStringSelection(self.array_sel['xpop']) self.ypop.SetStringSelection(self.array_sel['ypop']) self.yop.SetStringSelection(self.array_sel['yop']) if '(' in self.array_sel['ypop']: self.ysuf.SetLabel(')') ixsel, iysel, iy2sel = 0, 1, len(yarr_labels) - 1 if self.array_sel['xarr'] in xarr_labels: ixsel = xarr_labels.index(self.array_sel['xarr']) if self.array_sel['yarr1'] in arr_labels: iysel = arr_labels.index(self.array_sel['yarr1']) if self.array_sel['yarr2'] in yarr_labels: iy2sel = yarr_labels.index(self.array_sel['yarr2']) self.xarr.SetSelection(ixsel) self.yarr1.SetSelection(iysel) self.yarr2.SetSelection(iy2sel) bpanel = wx.Panel(panel) bsizer = wx.BoxSizer(wx.HORIZONTAL) _ok = Button(bpanel, 'OK', action=self.onOK) _cancel = Button(bpanel, 'Cancel', action=self.onCancel) _edit = Button(bpanel, 'Edit Array Names', action=self.onEditNames) bsizer.Add(_ok) bsizer.Add(_cancel) bsizer.Add(_edit) _ok.SetDefault() pack(bpanel, bsizer) sizer = wx.GridBagSizer(4, 8) sizer.Add(title, (0, 0), (1, 7), LCEN, 5) ir = 1 sizer.Add(xlab, (ir, 0), (1, 1), LCEN, 0) sizer.Add(self.xpop, (ir, 1), (1, 1), CEN, 0) sizer.Add(self.xarr, (ir, 2), (1, 1), CEN, 0) sizer.Add(self.xsuf, (ir, 3), (1, 1), CEN, 0) ir += 1 sizer.Add(ylab, (ir, 0), (1, 1), LCEN, 0) sizer.Add(self.ypop, (ir, 1), (1, 1), CEN, 0) sizer.Add(self.yarr1, (ir, 2), (1, 1), CEN, 0) sizer.Add(self.yop, (ir, 3), (1, 1), CEN, 0) sizer.Add(self.yarr2, (ir, 4), (1, 1), CEN, 0) sizer.Add(self.ysuf, (ir, 5), (1, 1), CEN, 0) sizer.Add(self.use_deriv, (ir, 6), (1, 1), LCEN, 0) ir += 1 sizer.Add(yerr_lab, (ir, 0), (1, 1), LCEN, 0) sizer.Add(self.yerr_op, (ir, 1), (1, 1), CEN, 0) sizer.Add(self.yerr_arr, (ir, 2), (1, 1), CEN, 0) sizer.Add(SimpleText(panel, 'Value:'), (ir, 3), (1, 1), CEN, 0) sizer.Add(self.yerr_const, (ir, 4), (1, 2), CEN, 0) ir += 1 sizer.Add(SimpleText(panel, 'Data Type:'), (ir, 0), (1, 1), LCEN, 0) sizer.Add(self.datatype, (ir, 1), (1, 2), LCEN, 0) ir += 1 self.wid_groupname = wx.TextCtrl(panel, value=group.groupname, size=(240, -1)) if not edit_groupname: self.wid_groupname.Disable() sizer.Add(SimpleText(panel, 'Group Name:'), (ir, 0), (1, 1), LCEN, 0) sizer.Add(self.wid_groupname, (ir, 1), (1, 2), LCEN, 0) ir += 1 sizer.Add(bpanel, (ir, 0), (1, 5), LCEN, 3) pack(panel, sizer) self.nb = fnb.FlatNotebook(self, -1, agwStyle=FNB_STYLE) self.nb.SetTabAreaColour(wx.Colour(248, 248, 240)) self.nb.SetActiveTabColour(wx.Colour(254, 254, 195)) self.nb.SetNonActiveTabTextColour(wx.Colour(40, 40, 180)) self.nb.SetActiveTabTextColour(wx.Colour(80, 0, 0)) self.plotpanel = PlotPanel(self, messenger=self.plot_messages) textpanel = wx.Panel(self) ftext = wx.TextCtrl(textpanel, style=wx.TE_MULTILINE | wx.TE_READONLY, size=(400, 250)) ftext.SetValue(group.text) ftext.SetFont(Font(10)) textsizer = wx.BoxSizer(wx.VERTICAL) textsizer.Add(ftext, 1, LCEN | wx.GROW, 1) pack(textpanel, textsizer) self.nb.AddPage(textpanel, ' Text of Data File ', True) self.nb.AddPage(self.plotpanel, ' Plot of Selected Arrays ', True) mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.Add(panel, 0, wx.GROW | wx.ALL, 2) mainsizer.Add(self.nb, 1, LCEN | wx.GROW, 2) pack(self, mainsizer) self.statusbar = self.CreateStatusBar(2, 0) self.statusbar.SetStatusWidths([-1, -1]) statusbar_fields = [group.filename, ""] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i) self.Show() self.Raise() self.onUpdate(self)
def createDetailsPanel(self, parent): mainpanel = wx.Panel(parent) mainsizer = wx.BoxSizer(wx.VERTICAL) panel = wx.Panel(mainpanel) sizer = wx.GridBagSizer(8, 7) self.title = SimpleText(panel, 'initializing...') ir = 0 sizer.Add(self.title, (ir, 0), (1, 6), LCEN, 2) # x-axis self.xarr = add_choice(panel, choices=[], action=self.onYchoice, size=(120, -1)) self.xop = add_choice(panel, choices=('', 'log'), action=self.onYchoice, size=(75, -1)) ir += 1 sizer.Add(SimpleText(panel, 'X = '), (ir, 0), (1, 1), CEN, 0) sizer.Add(self.xop, (ir, 1), (1, 1), CEN, 0) sizer.Add(SimpleText(panel, '('), (ir, 2), (1, 1), CEN, 0) sizer.Add(self.xarr, (ir, 3), (1, 1), RCEN, 0) sizer.Add(SimpleText(panel, ')'), (ir, 4), (1, 1), CEN, 0) self.yops = [[], []] self.yarr = [[], []] for opts, sel, siz in ((PRE_OPS, 0, 75), (ARR_OPS, 3, 50), (ARR_OPS, 3, 50)): w1 = add_choice(panel, choices=opts, action=self.onYchoice, size=(siz, -1)) w1.SetSelection(sel) self.yops[0].append(w1) w2 = add_choice(panel, choices=opts, action=self.onYchoice, size=(siz, -1)) w2.SetSelection(sel) self.yops[1].append(w2) opts = {'choices': [], 'size': (120, -1), 'action': self.onYchoice} for i in range(3): self.yarr[0].append(add_choice(panel, **opts)) self.yarr[1].append(add_choice(panel, **opts)) for i in range(2): ir += 1 label = 'Y%i = ' % (i + 1) sizer.Add(SimpleText(panel, label), (ir, 0), (1, 1), CEN, 0) sizer.Add(self.yops[i][0], (ir, 1), (1, 1), CEN, 0) sizer.Add(SimpleText(panel, '[('), (ir, 2), (1, 1), CEN, 0) sizer.Add(self.yarr[i][0], (ir, 3), (1, 1), CEN, 0) sizer.Add(self.yops[i][1], (ir, 4), (1, 1), CEN, 0) sizer.Add(self.yarr[i][1], (ir, 5), (1, 1), CEN, 0) sizer.Add(SimpleText(panel, ')'), (ir, 6), (1, 1), LCEN, 0) sizer.Add(self.yops[i][2], (ir, 7), (1, 1), CEN, 0) sizer.Add(self.yarr[i][2], (ir, 8), (1, 1), CEN, 0) sizer.Add(SimpleText(panel, ']'), (ir, 9), (1, 1), LCEN, 0) ir += 1 # sizer.Add(SimpleText(panel, ' New Plot: '), (ir, 0), (1, 3), LCEN, 0) # sizer.Add(SimpleText(panel, ' Over Plot: '), (ir+1, 0), (1, 3), LCEN, 0) for jr, ic, dc, opt, ttl in ((0, 0, 4, 'win old', 'New Plot, This Window'), (0, 4, 2, 'win new', 'New Plot, New Window'), (1, 0, 4, 'over left', 'Over Plot, Left Axis'), (1, 4, 2, 'over right', 'Over Plot, Right Axis')): sizer.Add( add_button(panel, ttl, size=(165, -1), action=Closure(self.onPlot, opt=opt)), (ir + jr, ic), (1, dc), LCEN, 2) ir += 2 self.dtcorr = check(panel, default=True, label='correct deadtime?') sizer.Add(self.dtcorr, (ir, 0), (1, 3), LCEN, 0) ir += 1 sizer.Add(SimpleText(panel, ''), (ir, 0), (1, 3), LCEN, 0) pack(panel, sizer) # self.nb = flat_nb.FlatNotebook(mainpanel, -1, agwStyle=FNB_STYLE) # # self.nb.SetTabAreaColour(wx.Colour(248,248,240)) # self.nb.SetActiveTabColour(wx.Colour(254,254,195)) # # self.nb.SetNonActiveTabTextColour(wx.Colour(40,40,180)) # self.nb.SetActiveTabTextColour(wx.Colour(80,0,0)) # # self.xas_panel = self.CreateXASPanel(self.nb) # mainpanel) # self.fit_panel = self.CreateFitPanel(self.nb) # mainpanel) # # self.nb.AddPage(self.fit_panel, ' General Analysis ', True) # self.nb.AddPage(self.xas_panel, ' XAS Processing ', True) mainsizer.Add(panel, 0, LCEN | wx.EXPAND, 2) self.plotpanel = PlotPanel(mainpanel, size=(500, 670)) self.plotpanel.messenger = self.write_message bgcol = panel.GetBackgroundColour() bgcol = (bgcol[0] / 255., bgcol[1] / 255., bgcol[2] / 255.) self.plotpanel.canvas.figure.set_facecolor(bgcol) mainsizer.Add(self.plotpanel, 1, wx.GROW | wx.ALL, 1) # mainsizer.Add(self.nb, 1, LCEN|wx.EXPAND, 2) pack(mainpanel, mainsizer) return mainpanel