def __init__(self, parent): self.panelDVH = wxmpl.PlotPanel(parent, -1, size=(6, 4.50), dpi=68, crosshairs=False, autoscaleUnzoom=False) self.Replot()
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) panelBox = wx.GridBagSizer() inLabel = wx.StaticText(self, -1, style=wx.ALIGN_RIGHT, label="Chemical Formula or Pepide Sequence: ") inLabel.SetToolTip(wx.ToolTip(toolTip)) self.inField = wx.TextCtrl(self, -1, value="", size=(300, -1), style=wx.TE_PROCESS_ENTER) self.goButton = wx.Button(self, -1, 'Calculate') self.Bind(wx.EVT_BUTTON, self.on_click, id=self.goButton.GetId()) self.Bind(wx.EVT_TEXT_ENTER, self.on_click, id=self.inField.GetId()) panelBox.Add(inLabel, (0, 1), flag=wx.ALIGN_CENTER | wx.ALL, border=3) panelBox.Add(self.inField, (0, 2), flag=wx.ALIGN_CENTER | wx.ALL, border=3) panelBox.Add(self.goButton, (0, 3), flag=wx.ALIGN_CENTER | wx.ALL, border=10) graphRim = wx.Panel(self, -1, style=wx.SUNKEN_BORDER) graphBox = wx.BoxSizer() self.graphPanel = wxmpl.PlotPanel(graphRim, -1) graphBox.Add(self.graphPanel, 1, wx.EXPAND, 0) graphRim.SetSizerAndFit(graphBox) self.outputListBox = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_DONTWRAP | wx.TE_RIGHT) self.outputListBox.SetSize((10, -1)) panelBox.Add(self.outputListBox, (2, 0), flag=wx.EXPAND) panelBox.Add(graphRim, (2, 1), flag=wx.EXPAND, span=wx.GBSpan(1, 4)) panelBox.AddGrowableRow(2) panelBox.AddGrowableCol(3) overBox = wx.BoxSizer() overBox.Add(panelBox, 1, wx.ALL | wx.EXPAND, 20) self.SetSizerAndFit(overBox)
def __init__(self, parent, id, title, **kwds): wx.Frame.__init__(self, parent, id, title, **kwds) self.points = [] self.selectionPoints = [] self.plotPanel = wxmpl.PlotPanel(self, -1) self.regionButton = wx.ToggleButton(self, -1, 'Pick Region') self.pointButton = wx.ToggleButton(self, -1, 'Pick Point') wx.EVT_TOGGLEBUTTON(self, self.regionButton.GetId(), self._on_regionButton) wxmpl.EVT_POINT(self, self.plotPanel.GetId(), self._on_point) wxmpl.EVT_SELECTION(self, self.plotPanel.GetId(), self._on_selection) self._layout() self._replot()
def FinishTest(self): # Load the visualization panel vis_panel = self.res2.LoadPanel(self.parent, 'vis_panel') plot_panel = xrc.XRCCTRL(vis_panel, 'plot_panel') # Configure the plot panel self.plot = wxmpl.PlotPanel(plot_panel, -1) assert (self.plot.director) self.plot.set_crosshairs(False) self.plot.set_selection(False) self.plot.set_zoom(False) NestPanel(plot_panel, self.plot) # Nest the visualization panel, removing the current panel NestPanel(self.parent, vis_panel) # Bind the fail button and on idle events vis_panel.Bind(wx.EVT_BUTTON, self.VisDone, id=xrc.XRCID('done_button')) # Plot the values and line of best fit fig = self.plot.get_figure() axes1 = fig.add_subplot(211) axes1.clear() axes2 = fig.add_subplot(212) axes2.clear() axes1.plot(numpy.array(self.data_dict['position']), numpy.array(self.data_dict['effort']), 'r--') axes2.plot(numpy.array(self.data_dict['position']), numpy.array(self.data_dict['velocity']), 'b--') # Adjust the size of the axes using size of the window (this is somewhat hackish) #sz = self.plot.GetSize() #xrng = 1.0 #yrng = 2.0*float(sz[1])/sz[0] * xrng; #axes.axis([-xrng,xrng,0,yrng]) #axes.grid() print 'About to draw' self.plot.draw() print 'About to show' self.plot.Show()
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) fastaLabel = wx.StaticText(self, -1, "FASTA File") self.fastaChooser = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER) self.fastaButton = wx.Button(self, -1, "Browse") regexLabel = wx.StaticText(self, -1, "FASTA Label Parser") self.regexEntry = wx.TextCtrl(self, -1, "") fileLabel = wx.StaticText(self, -1, "Results File") self.fileChooser = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER) self.browseButton = wx.Button(self, -1, "Browse") self.protList = wx.grid.Grid(self, -1) self.protGraph = wxmpl.PlotPanel(self, -1, size=(-1, 0.5)) self.sequenceDisplay = wxmpl.PlotPanel(self, -1) scoreCutLabel = wx.StaticText(self, -1, "Score cutoff") self.scoreCutCtrl = wx.TextCtrl(self, -1, '0', size=(35, -1), style=wx.TE_CENTRE | wx.TE_PROCESS_ENTER) accessionCtrlLabel = wx.StaticText(self, -1, "Accession ") self.prevAccession = wx.Button(self, -1, "<", size=(20, -1)) self.accessionCounter = wx.TextCtrl(self, -1, '0', size=(35, -1), style=wx.TE_READONLY | wx.TE_CENTRE) self.nextAccession = wx.Button(self, -1, ">", size=(20, -1)) gbs = wx.GridBagSizer(15, 7) gbs.Add(fastaLabel, (0, 0), flag=wx.ALIGN_RIGHT) gbs.Add(self.fastaChooser, (0, 1), (1, 4), flag=wx.EXPAND) gbs.Add(self.fastaButton, (0, 5), flag=wx.ALIGN_LEFT) gbs.Add(regexLabel, (0, 6), flag=wx.ALIGN_RIGHT) gbs.Add(self.regexEntry, (0, 7), flag=wx.EXPAND) gbs.Add(fileLabel, (1, 0), flag=wx.ALIGN_RIGHT) gbs.Add(self.fileChooser, (1, 1), (1, 6), flag=wx.EXPAND) gbs.Add(self.browseButton, (1, 7), flag=wx.ALIGN_LEFT) gbs.Add(self.protGraph, (2, 3), (1, 7), flag=wx.EXPAND) gbs.Add(self.protList, (2, 0), (6, 3), flag=wx.EXPAND) gbs.Add(self.sequenceDisplay, (3, 3), (5, 7), flag=wx.EXPAND) gbs.Add(scoreCutLabel, (8, 0), flag=wx.CENTER) gbs.Add(self.scoreCutCtrl, (8, 1), flag=wx.ALIGN_LEFT) accessionBox = wx.BoxSizer(wx.HORIZONTAL) accessionBox.Add(accessionCtrlLabel, flag=wx.CENTER) accessionBox.Add(self.prevAccession, flag=wx.ALIGN_RIGHT) accessionBox.Add(self.accessionCounter, flag=wx.CENTER) accessionBox.Add(self.nextAccession, flag=wx.ALIGN_LEFT) gbs.Add(accessionBox, (8, 4)) gbs.AddGrowableCol(2) gbs.AddGrowableCol(3) gbs.AddGrowableCol(4) gbs.AddGrowableRow(5) self.fastaFilename = None self.filenames = [''] self.sequence = None self.psms = None self.protList.CreateGrid(100, 2) self.protList.SetRowLabelSize(1) self.protList.SetColLabelValue(0, "GI") self.protList.SetColLabelValue(1, "Description") self.protList.SetMaxSize((-1, 500)) self.protList.SetMinSize( (10, 10)) # Here's the key to making wx.Grids behave appropriately. overBox = wx.BoxSizer() overBox.Add(gbs, 1, wx.ALL | wx.EXPAND, 20) self.SetSizerAndFit(overBox) self.Bind(wx.EVT_TEXT_ENTER, self.openFile, self.fileChooser) self.Bind(wx.EVT_BUTTON, self.browseForFasta, self.fastaButton) self.Bind(wx.EVT_BUTTON, self.browseForFile, self.browseButton) self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.readProtein, self.protList) self.Bind(wx.EVT_SIZE, self.resizeHandler) self.Bind(wx.EVT_TEXT_ENTER, self.scoreFilter, self.scoreCutCtrl) self.Bind(wx.EVT_BUTTON, self.prevAccessionPressed, self.prevAccession) self.Bind(wx.EVT_BUTTON, self.nextAccessionPressed, self.nextAccession) #self.sequenceDisplay.SetFont(timesNewPeptide) deviceContext = wx.ScreenDC() deviceContext.SetFont(timesNewPeptide) self.textBlockWidth, _ = deviceContext.GetTextExtent("PEPTIDESTR ") self.seqBlocksPerRow = None self.resizeHandler(None) self.subAccession = 0 self.scoreCutoff = 0
def __init__(self, parent=None, title="mzPlot", size=(600,450)): wx.Frame.__init__(self, parent, -1, title, size=size) self.xy_data = None self.last_anno = None self.tooltip_str = '%%3.1f, %%3d' # default tooltip string #Icon self.SetIcon(wx.Icon(os.path.join(install_dir, 'images', 'icons', 'multiplierz.ico'), wx.BITMAP_TYPE_ICO)) #add menu bar menu_bar = wx.MenuBar() #Edit Menu edit_menu = wx.Menu() change_title = edit_menu.Append(-1, 'Change &Title\tCtrl+T', 'Change Plot Title') self.Bind(wx.EVT_MENU, self.on_title, change_title) x_label = edit_menu.Append(-1, 'Change &X Axis Label\tCtrl+X', 'Change X Axis Label') self.Bind(wx.EVT_MENU, self.on_xlabel, x_label) y_label = edit_menu.Append(-1, 'Change &Y Axis Label\tCtrl+Y', 'Change Y Axis Label') self.Bind(wx.EVT_MENU, self.on_ylabel, y_label) menu_bar.Append(edit_menu, "&Edit") save_menu = wx.Menu() save_image = save_menu.Append(-1, '&Save Image\tCtrl+S', 'Save Plot as Image') self.Bind(wx.EVT_MENU, self.on_save, save_image) menu_bar.Append(save_menu, "&Save") resize_menu = wx.Menu() resize_800 = resize_menu.Append(-1, "800x600\tAlt+1", "Resize Plot to 800x600") self.Bind(wx.EVT_MENU, lambda e: self.on_resize((800,600)), resize_800) resize_1200 = resize_menu.Append(-1, "1200x900\tAlt+2", "Resize Plot to 1200x900") self.Bind(wx.EVT_MENU, lambda e: self.on_resize((1200,900)), resize_1200) resize_1400 = resize_menu.Append(-1, "1400x1050\tAlt+3", "Resize Plot to 1400x1050") self.Bind(wx.EVT_MENU, lambda e: self.on_resize((1400,1050)), resize_1400) menu_bar.Append(resize_menu, "&Resize") self.SetMenuBar(menu_bar) self.plot_panel = wxmpl.PlotPanel(self, -1, (1.6, 1.2)) self.plot_panel.mpl_connect('button_release_event', self.on_click) self.figure = self.plot_panel.get_figure() a = self.figure.add_axes([0.125, 0.1, 0.775, 0.8]) a.set_title(title) self.plot_panel.draw() box = wx.BoxSizer() box.Add(self.plot_panel, 1, wx.EXPAND, 0) self.SetSizerAndFit(box) self.SetSize(size)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) gbs = wx.GridBagSizer(15, 7) fileLabel = wx.StaticText(self, -1, "Data File", style = wx.TE_READONLY) self.fileChooser = wx.TextCtrl(self, -1, "") self.browseButton = wx.Button(self, -1, "Browse") gbs.Add(fileLabel, (0, 0), flag = wx.ALIGN_RIGHT) gbs.Add(self.fileChooser, (0, 1), (1, 5), flag = wx.EXPAND) gbs.Add(self.browseButton, (0, 6), flag = wx.ALIGN_RIGHT) self.Bind(wx.EVT_BUTTON, self.selectFile, id = self.browseButton.GetId()) self.mannModeC = wx.CheckBox(self, -1, "Mann\nAlgorithm") self.mannModeC.SetValue(False) mzRangeL = wx.StaticText(self, -1, "M/Z\nRange", style = wx.ALIGN_RIGHT) self.mzRangeC = wx.TextCtrl(self, -1, "300-2000", style = wx.ALIGN_RIGHT) mzRangeL.SetToolTip(wx.ToolTip(mzRangeTip)) massRangeL = wx.StaticText(self, -1, "Mass Range") self.massRangeC = wx.TextCtrl(self, -1, "10000-100000", style = wx.ALIGN_RIGHT) maxSpecL = wx.StaticText(self, -1, "Maximum\nSpecies", style = wx.ALIGN_RIGHT) self.maxSpecC = wx.TextCtrl(self, -1, "5", style = wx.ALIGN_RIGHT) maxSpecL.SetToolTip(wx.ToolTip(maxSpecCountTip)) removalAreaL = wx.StaticText(self, -1, "Peak Removal\nWidth", style = wx.ALIGN_RIGHT) self.removalAreaC = wx.TextCtrl(self, -1, "2", style = wx.ALIGN_RIGHT) minimumPeaksL = wx.StaticText(self, -1, "Peaks Required", style = wx.ALIGN_RIGHT) self.minimumPeaksC = wx.TextCtrl(self, -1, "8", style = wx.ALIGN_RIGHT) peakIterL = wx.StaticText(self, -1, "Peak-Finding\nIterations", style = wx.ALIGN_RIGHT) self.peakIterC = wx.TextCtrl(self, -1, "2", style = wx.ALIGN_RIGHT) timeWindowL = wx.StaticText(self, -1, "RT Window", style = wx.ALIGN_RIGHT) self.timeWindowC = wx.TextCtrl(self, -1, "Auto", style = wx.ALIGN_RIGHT) self.Bind(wx.EVT_TEXT, self.changeTimeWindow, id = self.timeWindowC.GetId()) recalSlopeL = wx.StaticText(self, -1, "Recalibration\nSlope", style = wx.ALIGN_RIGHT) self.recalSlopeC = wx.TextCtrl(self, -1, "0", style = wx.ALIGN_RIGHT) recalIntercL = wx.StaticText(self, -1, "Recalibration\nIntercept", style = wx.ALIGN_RIGHT) self.recalIntercC = wx.TextCtrl(self, -1, "0", style = wx.ALIGN_RIGHT) smoothWindowL = wx.StaticText(self, -1, "Smoothing Width", style = wx.ALIGN_RIGHT) self.smoothWindowC = wx.TextCtrl(self, -1, "0", style = wx.ALIGN_RIGHT) i = 0 #for label in [maxChargeL, mzTolL, snThreshL, mzRangeL, maxSpecL]: for label in [mzRangeL, massRangeL, maxSpecL, removalAreaL, minimumPeaksL, peakIterL, timeWindowL, recalSlopeL, recalIntercL, smoothWindowL]: gbs.Add(label, (i+1, 0), flag = wx.ALIGN_RIGHT) i += 1 i = 0 #for control in [self.maxChargeC, self.mzTolC, self.snThreshC, #self.mzRangeC, self.maxSpecC]: for control in [self.mzRangeC, self.massRangeC, self.maxSpecC, self.removalAreaC, self.minimumPeaksC, self.peakIterC, self.timeWindowC, self.recalSlopeC, self.recalIntercC, self.smoothWindowC]: gbs.Add(control, (i+1, 1)) i += 1 gbs.Add(self.mannModeC, (11, 0), (1, 1), flag = wx.ALIGN_RIGHT) self.goButton = wx.Button(self, -1, "Run") self.saveButton = wx.Button(self, -1, "Save Image") self.outButton = wx.Button(self, -1, "Export Settings \nto mzTransform") self.Bind(wx.EVT_BUTTON, self.deconvolute, id = self.goButton.GetId()) self.Bind(wx.EVT_BUTTON, self.saveImage, id = self.saveButton.GetId()) self.Bind(wx.EVT_BUTTON, self.toMZTransform, id = self.outButton.GetId()) gbs.Add(self.goButton, (11, 1), (1, 1), flag = wx.ALIGN_CENTER) gbs.Add(self.saveButton, (12, 0), (1, 1), flag = wx.ALIGN_CENTER) gbs.Add(self.outButton, (12, 1), (1, 1), flag = wx.ALIGN_CENTER) self.graph = wxmpl.PlotPanel(self, -1) gbs.Add(self.graph, (1,2), (12, 5), flag = wx.EXPAND) gbs.AddGrowableCol(3) gbs.AddGrowableRow(10) overBox = wx.BoxSizer() overBox.Add(gbs, 1, wx.ALL|wx.EXPAND, 20) self.SetSizerAndFit(overBox) #self.graph.Bind(wxmpl.EVT_POINT, self.onMannClick, id = self.graph.GetId()) #wxmpl.EVT_POINT(self, self.graph.GetId(), self.onMannClick) self.knownSpectrum = None self.filename = None self.displayingType = None self.texts = [] self.window = None self.usedLabelLetters = [] self.canvasCallback = None
def __create_objects(self): # Menu Bar self.frame_1_menubar = wx.MenuBar() # File menu self.file_menu = wx.Menu() self.import_file = wx.MenuItem(self.file_menu, -1, "Import", "Import timeseries from data file") self.file_menu.AppendItem(self.import_file) self.frame_1_menubar.Append(self.file_menu, "File") # Help Menu self.help_menu = wx.Menu() self.help_book = wx.MenuItem(self.help_menu, -1, "Help Index", "How to use this software.") self.about = wx.MenuItem(self.help_menu, -1, "About", "About this software.") self.help_menu.AppendItem(self.about) self.frame_1_menubar.Append(self.help_menu, "Help") # Set Menu Bar self.SetMenuBar(self.frame_1_menubar) # Menu Bar end # Status Bar self.frame_1_statusbar = self.CreateStatusBar(1, 0) # Status Bar end # Tool Bar self.frame_1_toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.TB_3DBUTTONS) self.SetToolBar(self.frame_1_toolbar) self.frame_1_toolbar.AddLabelTool( wx.NewId(), "new", wx.Bitmap("stock_new.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.frame_1_toolbar.AddLabelTool( wx.NewId(), "open", wx.Bitmap("stock_open.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.frame_1_toolbar.AddLabelTool( wx.NewId(), "save", wx.Bitmap("stock_save.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.frame_1_toolbar.AddLabelTool( wx.NewId(), "exit", wx.Bitmap("stock_exit.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") # Tool Bar end # Top level sizers self.sizer_1 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_3 = wx.BoxSizer(wx.VERTICAL) # Splitter self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_3DSASH | wx.SP_3DBORDER) # TS panel widgets self.sizer_ts = wx.BoxSizer(wx.VERTICAL) self.sizer_control_ts = wx.BoxSizer(wx.HORIZONTAL) self.ts_control_panel = wx.Panel(self.splitter, -1) self.list_box_1 = wx.ListBox(self.ts_control_panel, -1, choices=[], style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB) self.ts_plot_button = wx.Button(self.ts_control_panel, -1, 'Plot Timeseries') self.ts_remove_button = wx.Button(self.ts_control_panel, -1, 'Remove') # Notebook self.notebook_1 = wx.Notebook(self.splitter, -1, style=wx.NB_LEFT) self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_4 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_5 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_6 = wx.Panel(self.notebook_1, -1) # Text results panel self.results_panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) self.results_panel_text = wx.StaticText(self.results_panel, -1, label="Numerical Results Here") # Graphing panel self.plot_panel = wxmpl.PlotPanel(self, -1) # Analysis widgets self.analysis_sizer = wx.BoxSizer(wx.VERTICAL) self.stat_button = wx.Button(self.notebook_1_pane_1, -1, 'Statistics') self.hist_button = wx.Button(self.notebook_1_pane_1, -1, 'Histogram') self.weibull_button = wx.Button(self.notebook_1_pane_1, -1, 'Weibull Params') self.corr_button = wx.Button(self.notebook_1_pane_1, -1, 'Correlate') self.corr_panel = wx.Panel(self.notebook_1_pane_1, -1, style=wx.RAISED_BORDER) self.corr_panel_btn = wx.Button(self.notebook_1_pane_1, -1, '>>', name='corr') self.corr_sizer = wx.BoxSizer(wx.HORIZONTAL) self.rad_autocorr = wx.RadioButton(self.corr_panel, -1, 'Auto', style=wx.RB_GROUP) self.rad_crosscorr = wx.RadioButton(self.corr_panel, -1, 'Cross') self.corr_lag_int = intctrl.IntCtrl(self.corr_panel, -1, value=15, min=0) self.lag_label = wx.StaticText(self.corr_panel, -1, 'No. lags') self.block_button = wx.Button(self.notebook_1_pane_1, -1, 'Block Average') self.block_panel = wx.Panel(self.notebook_1_pane_1, -1, style=wx.RAISED_BORDER) self.block_panel_btn = wx.Button(self.notebook_1_pane_1, -1, '>>', name='block') self.block_sizer = wx.BoxSizer(wx.HORIZONTAL) self.block_new_freq = wx.Choice(self.block_panel, -1, choices=[ 'YEARLY', 'QUARTERLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY', 'MINUTELY' ]) self.psd_button = wx.Button(self.notebook_1_pane_1, -1, 'Power Spectral Density') # End Analysis widgets # Synthesis widgets self.synthesis_sizer = wx.BoxSizer(wx.VERTICAL) self.arma_button = wx.Button(self.notebook_1_pane_2, -1, 'ARMA') self.arma_panel = wx.Panel(self.notebook_1_pane_2, -1, style=wx.RAISED_BORDER) self.arma_panel_btn = wx.Button(self.notebook_1_pane_2, -1, '>>', name='arma') self.arma_sizer = wx.BoxSizer(wx.HORIZONTAL) self.mean_lbl = wx.StaticText(self.arma_panel, -1, 'Mean:') self.stdev_lbl = wx.StaticText(self.arma_panel, -1, 'STDEV:') self.npoints_lbl = wx.StaticText(self.arma_panel, -1, 'No. points:') self.autocorr_lbl = wx.StaticText(self.arma_panel, -1, 'Autocorr:') self.mean_ctrl = wx.TextCtrl(self.arma_panel, -1, '') self.stdev_ctrl = wx.TextCtrl(self.arma_panel, -1, '') self.npoints_ctrl = wx.TextCtrl(self.arma_panel, -1, '') self.autocorr_ctrl = wx.TextCtrl(self.arma_panel, -1, '')