def makeReferencesPanel(self): """Make references selection panel.""" # init panel ctrlPanel = mwx.bgrPanel(self, -1, images.lib["bgrControlbar"], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make controls references_label = wx.StaticText(ctrlPanel, -1, "References:") references_label.SetFont(wx.SMALL_FONT) choices = libs.references.keys() choices.sort() choices.insert(0, "Reference lists") self.references_choice = wx.Choice(ctrlPanel, -1, choices=choices, size=(250, mwx.SMALL_CHOICE_HEIGHT)) self.references_choice.Select(0) self.references_choice.Bind(wx.EVT_CHOICE, self.onReferencesSelected) tolerance_label = wx.StaticText(ctrlPanel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl( ctrlPanel, -1, str(config.calibration["tolerance"]), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator("floatPos"), ) self.tolerance_value.SetFont(wx.SMALL_FONT) self.toleranceUnits_label = wx.StaticText(ctrlPanel, -1, config.calibration["units"]) self.toleranceUnits_label.SetFont(wx.SMALL_FONT) self.statCalibration_check = wx.CheckBox(ctrlPanel, -1, "Statistical only") self.statCalibration_check.SetFont(wx.SMALL_FONT) self.statCalibration_check.Bind(wx.EVT_CHECKBOX, self.onStatCalibration) self.makeReferencesList() # pack controls sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(references_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.references_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.toleranceUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.statCalibration_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) controls = wx.BoxSizer(wx.VERTICAL) controls.Add(sizer, 1, wx.EXPAND) controls.Fit(ctrlPanel) ctrlPanel.SetSizer(controls) # pack main mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(ctrlPanel, 0, wx.EXPAND, 0) mainSizer.Add(self.referencesList, 1, wx.EXPAND | wx.ALL, mwx.LISTCTRL_NO_SPACE) return mainSizer
def makeGUI(self): """Make GUI elements.""" staticSizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, ""), wx.VERTICAL) # make elements threshold_label = wx.StaticText(self, -1, "Minimal value:") self.threshold_value = wx.TextCtrl(self, -1, "", size=(150, -1), validator=mwx.validator('floatPos')) self.threshold_value.Bind(wx.EVT_TEXT, self.onChange) thresholdType_label = wx.StaticText(self, -1, "Threshold type:") choices=['m/z', 'a.i.', 'Intensity', 'Relative Intensity', 's/n'] self.thresholdType_choice = wx.Choice(self, -1, choices=choices, size=(150, mwx.CHOICE_HEIGHT)) self.thresholdType_choice.Select(0) cancel_butt = wx.Button(self, wx.ID_CANCEL, "Cancel") delete_butt = wx.Button(self, wx.ID_OK, "Delete") delete_butt.Bind(wx.EVT_BUTTON, self.onDelete) delete_butt.SetDefault() # pack elements grid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) grid.Add(threshold_label, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.threshold_value, (0,1)) grid.Add(thresholdType_label, (1,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.thresholdType_choice, (1,1)) staticSizer.Add(grid, 0, wx.ALL, 5) buttSizer = wx.BoxSizer(wx.HORIZONTAL) buttSizer.Add(cancel_butt, 0, wx.RIGHT, 15) buttSizer.Add(delete_butt, 0) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(staticSizer, 0, wx.CENTER|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(buttSizer, 0, wx.CENTER|wx.LEFT|wx.RIGHT|wx.BOTTOM, mwx.PANEL_SPACE_MAIN) return mainSizer
def makeControlbar(self): """Make controlbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib["bgrControlbar"], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make elements self.collapse_butt = wx.BitmapButton( panel, -1, images.lib["arrowsDown"], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE ) self.collapse_butt.Bind(wx.EVT_BUTTON, self.onCollapse) fitTo_label = wx.StaticText(panel, -1, "Fit to:") fitTo_label.SetFont(wx.SMALL_FONT) self.fitToPeaklist_radio = wx.RadioButton(panel, -1, "Peak list", style=wx.RB_GROUP) self.fitToPeaklist_radio.SetFont(wx.SMALL_FONT) self.fitToSpectrum_radio = wx.RadioButton(panel, -1, "Spectrum") self.fitToSpectrum_radio.SetFont(wx.SMALL_FONT) self.fitToPeaklist_radio.SetValue(True) if config.envelopeFit["fit"] == "spectrum": self.fitToSpectrum_radio.SetValue(True) fwhm_label = wx.StaticText(panel, -1, "Default FWHM:") fwhm_label.SetFont(wx.SMALL_FONT) self.fwhm_value = wx.TextCtrl( panel, -1, str(config.envelopeFit["fwhm"]), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator("floatPos"), ) self.fwhm_value.SetFont(wx.SMALL_FONT) self.forceFwhm_check = wx.CheckBox(panel, -1, "Force") self.forceFwhm_check.SetFont(wx.SMALL_FONT) self.forceFwhm_check.SetValue(config.envelopeFit["forceFwhm"]) relThreshold_label = wx.StaticText(panel, -1, "Rel. int. threshold:") relThreshold_label.SetFont(wx.SMALL_FONT) relThresholdUnits_label = wx.StaticText(panel, -1, "%") relThresholdUnits_label.SetFont(wx.SMALL_FONT) self.relThreshold_value = wx.TextCtrl( panel, -1, str(config.envelopeFit["relThreshold"] * 100), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator("floatPos"), ) self.relThreshold_value.SetFont(wx.SMALL_FONT) self.autoAlign_check = wx.CheckBox(panel, -1, "Auto align") self.autoAlign_check.SetFont(wx.SMALL_FONT) self.autoAlign_check.SetValue(config.envelopeFit["autoAlign"]) self.average_label = wx.StaticText(panel, -1, "", size=(100, -1)) self.average_label.SetFont(wx.SMALL_FONT) self.updateAverageLabel() # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(self.collapse_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(fitTo_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.fitToPeaklist_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.fitToSpectrum_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(fwhm_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.fwhm_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.forceFwhm_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(relThreshold_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.relThreshold_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(relThresholdUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.autoAlign_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.average_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeIonseriesPanel(self): """Make controls for ionseries.""" # init panel ctrlPanel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make controls ionseriesAgent_label = wx.StaticText(ctrlPanel, -1, "Agent:") ionseriesAgent_label.SetFont(wx.SMALL_FONT) self.ionseriesAgentFormula_value = wx.TextCtrl( ctrlPanel, -1, config.massCalculator['ionseriesAgent'], size=(60, mwx.SMALL_TEXTCTRL_HEIGHT)) self.ionseriesAgentFormula_value.SetFont(wx.SMALL_FONT) self.ionseriesAgentFormula_value.Bind(wx.EVT_TEXT, self.onCompoundChanged) ionseriesAgentCharge_label = wx.StaticText(ctrlPanel, -1, "Agent charge:") ionseriesAgentCharge_label.SetFont(wx.SMALL_FONT) self.ionseriesAgentCharge_value = wx.TextCtrl( ctrlPanel, -1, str(config.massCalculator['ionseriesAgentCharge']), size=(40, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('int')) self.ionseriesAgentCharge_value.SetFont(wx.SMALL_FONT) self.ionseriesAgentCharge_value.Bind(wx.EVT_TEXT, self.onCompoundChanged) ionseriesPolarity_label = wx.StaticText(ctrlPanel, -1, "Polarity:") ionseriesPolarity_label.SetFont(wx.SMALL_FONT) self.ionseriesPositive_radio = wx.RadioButton(ctrlPanel, -1, "Positive", style=wx.RB_GROUP) self.ionseriesPositive_radio.SetFont(wx.SMALL_FONT) self.ionseriesPositive_radio.Bind(wx.EVT_RADIOBUTTON, self.onCompoundChanged) self.ionseriesNegative_radio = wx.RadioButton(ctrlPanel, -1, "Negative") self.ionseriesNegative_radio.SetFont(wx.SMALL_FONT) self.ionseriesNegative_radio.Bind(wx.EVT_RADIOBUTTON, self.onCompoundChanged) if config.massCalculator['ionseriesPolarity'] == -1: self.ionseriesNegative_radio.SetValue(True) else: self.ionseriesPositive_radio.SetValue(True) # pack controls controls = wx.BoxSizer(wx.HORIZONTAL) controls.AddSpacer(mwx.CONTROLBAR_LSPACE) controls.Add(ionseriesAgent_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) controls.Add(self.ionseriesAgentFormula_value, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(20) controls.Add(ionseriesAgentCharge_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) controls.Add(self.ionseriesAgentCharge_value, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(20) controls.Add(ionseriesPolarity_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) controls.Add(self.ionseriesPositive_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) controls.Add(self.ionseriesNegative_radio, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(mwx.CONTROLBAR_RSPACE) controls.Fit(ctrlPanel) ctrlPanel.SetSizer(controls) # make ions list self.makeIonsList() # pack main mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(ctrlPanel, 0, wx.EXPAND) mainSizer.Add(self.ionsList, 1, wx.EXPAND | wx.ALL, mwx.LISTCTRL_NO_SPACE) return mainSizer
def makeReferencesPanel(self): """Make references selection panel.""" # init panel ctrlPanel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make controls references_label = wx.StaticText(ctrlPanel, -1, "References:") references_label.SetFont(wx.SMALL_FONT) choices = libs.references.keys() choices.sort() choices.insert(0, 'Reference lists') self.references_choice = wx.Choice(ctrlPanel, -1, choices=choices, size=(250, mwx.SMALL_CHOICE_HEIGHT)) self.references_choice.Select(0) self.references_choice.Bind(wx.EVT_CHOICE, self.onReferencesSelected) tolerance_label = wx.StaticText(ctrlPanel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl( ctrlPanel, -1, str(config.calibration['tolerance']), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) self.tolerance_value.SetFont(wx.SMALL_FONT) self.toleranceUnits_label = wx.StaticText(ctrlPanel, -1, config.calibration['units']) self.toleranceUnits_label.SetFont(wx.SMALL_FONT) self.statCalibration_check = wx.CheckBox(ctrlPanel, -1, "Statistical only") self.statCalibration_check.SetFont(wx.SMALL_FONT) self.statCalibration_check.Bind(wx.EVT_CHECKBOX, self.onStatCalibration) self.makeReferencesList() # pack controls sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(references_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.references_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.toleranceUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.statCalibration_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) controls = wx.BoxSizer(wx.VERTICAL) controls.Add(sizer, 1, wx.EXPAND) controls.Fit(ctrlPanel) ctrlPanel.SetSizer(controls) # pack main mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(ctrlPanel, 0, wx.EXPAND, 0) mainSizer.Add(self.referencesList, 1, wx.EXPAND | wx.ALL, mwx.LISTCTRL_NO_SPACE) return mainSizer
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbar'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements peakShape_label = wx.StaticText(panel, -1, "Peak shape:") peakShape_label.SetFont(wx.SMALL_FONT) self.peakShape_choice = wx.Choice(panel, -1, choices=['Symmetrical', 'Asymmetrical'], size=(125, mwx.CHOICE_HEIGHT)) self.peakShape_choice.Select(0) if config.spectrumGenerator['peakShape'] == 'gausslorentzian': self.peakShape_choice.Select(1) fwhm_label = wx.StaticText(panel, -1, "Default FWHM:") fwhm_label.SetFont(wx.SMALL_FONT) self.fwhm_value = wx.TextCtrl(panel, -1, str(config.spectrumGenerator['fwhm']), size=(60, -1), validator=mwx.validator('floatPos')) self.forceFwhm_check = wx.CheckBox(panel, -1, "Force") self.forceFwhm_check.SetFont(wx.SMALL_FONT) self.forceFwhm_check.SetValue(config.spectrumGenerator['forceFwhm']) points_label = wx.StaticText(panel, -1, "Points/peak:") points_label.SetFont(wx.SMALL_FONT) self.points_value = wx.TextCtrl(panel, -1, str(config.spectrumGenerator['points']), size=(60, -1), validator=mwx.validator('intPos')) noise_label = wx.StaticText(panel, -1, "Noise width:") noise_label.SetFont(wx.SMALL_FONT) self.noise_value = wx.TextCtrl(panel, -1, str(config.spectrumGenerator['noise']), size=(80, -1), validator=mwx.validator('floatPos')) self.generate_butt = wx.Button(panel, -1, "Generate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.generate_butt.Bind(wx.EVT_BUTTON, self.onGenerate) self.apply_butt = wx.Button(panel, -1, "Apply", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.apply_butt.Bind(wx.EVT_BUTTON, self.onApply) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(peakShape_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.peakShape_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(fwhm_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.fwhm_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.forceFwhm_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(points_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.points_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(noise_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.noise_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.AddStretchSpacer() sizer.Add(self.generate_butt, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 10) sizer.Add(self.apply_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeImagePanel(self): """Image export panel.""" panel = wx.Panel(self, -1) # make elements imageWidth_label = wx.StaticText(panel, -1, "Width:") self.imageWidth_value = wx.TextCtrl(panel, -1, str(config.export['imageWidth']), size=(140, -1), validator=mwx.validator('floatPos')) imageHeight_label = wx.StaticText(panel, -1, "Height:") self.imageHeight_value = wx.TextCtrl(panel, -1, str(config.export['imageHeight']), size=(140, -1), validator=mwx.validator('floatPos')) self.imageUnits_choice = wx.Choice(panel, -1, choices=['cm', 'in', 'px'], size=(60, mwx.CHOICE_HEIGHT)) self.imageUnits_choice.SetStringSelection(config.export['imageUnits']) imageFormat_label = wx.StaticText(panel, -1, "Format:") self.imageFormat_choice = wx.Choice(panel, -1, choices=['PNG', 'TIFF', 'JPEG'], size=(140, mwx.CHOICE_HEIGHT)) self.imageFormat_choice.SetStringSelection(config.export['imageFormat']) imageResolution_label = wx.StaticText(panel, -1, "Resolution:") imageResolutionUnits_label = wx.StaticText(panel, -1, "dpi") choices = ['72', '150', '200', '300', '600'] self.imageResolution_choice = wx.Choice(panel, -1, choices=choices, size=(140, mwx.CHOICE_HEIGHT)) self.imageResolution_choice.Select(0) if str(config.export['imageResolution']) in choices: self.imageResolution_choice.Select(choices.index(str(config.export['imageResolution']))) self.imageResolution_choice.Bind(wx.EVT_CHOICE, self.onImageResolutionChanged) imageFontsScale_label = wx.StaticText(panel, -1, "Font scale:") self.imageFontsScale_slider = wx.Slider(panel, -1, config.export['imageFontsScale'], 1, 10, size=(140, -1), style=mwx.SLIDER_STYLE) self.imageFontsScale_slider.SetTickFreq(1,1) imageDrawingsScale_label = wx.StaticText(panel, -1, "Line scale:") self.imageDrawingsScale_slider = wx.Slider(panel, -1, config.export['imageDrawingsScale'], 1, 10, size=(140, -1), style=mwx.SLIDER_STYLE) self.imageDrawingsScale_slider.SetTickFreq(1,1) # pack elements grid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) grid.Add(imageWidth_label, (0,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageWidth_value, (0,1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(self.imageUnits_choice, (0,2), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT) grid.Add(imageHeight_label, (1,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageHeight_value, (1,1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageResolution_label, (2,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageResolution_choice, (2,1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageResolutionUnits_label, (2,2), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT) grid.Add(imageFontsScale_label, (3,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageFontsScale_slider, (3,1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageDrawingsScale_label, (4,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageDrawingsScale_slider, (4,1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageFormat_label, (5,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.imageFormat_choice, (5,1), flag=wx.ALIGN_CENTER_VERTICAL) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(grid, 0, wx.ALIGN_CENTER|wx.ALL, mwx.PANEL_SPACE_MAIN) # fit layout mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbar'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements formula_label = wx.StaticText(panel, -1, "Formula:") formula_label.SetFont(wx.SMALL_FONT) self.formula_value = mwx.formulaCtrl(panel, -1, "", size=(220, -1)) charge_label = wx.StaticText(panel, -1, "Charge:") charge_label.SetFont(wx.SMALL_FONT) self.charge_value = wx.TextCtrl(panel, -1, str(config.envelopeFit['charge']), size=(35, -1), validator=mwx.validator('int')) exchange_label = wx.StaticText(panel, -1, "Exchange:") exchange_label.SetFont(wx.SMALL_FONT) self.exchangeLoss_value = mwx.formulaCtrl(panel, -1, str(config.envelopeFit['loss']), size=(60, -1)) exchangeVs_label = wx.StaticText(panel, -1, " vs.") exchangeVs_label.SetFont(wx.SMALL_FONT) self.exchangeGain_value = mwx.formulaCtrl(panel, -1, str(config.envelopeFit['gain']), size=(60, -1)) scale_label = wx.StaticText(panel, -1, "Range:") scale_label.SetFont(wx.SMALL_FONT) scaleDash_label = wx.StaticText(panel, -1, "-") scaleDash_label.SetFont(wx.SMALL_FONT) self.scaleMin_value = wx.TextCtrl(panel, -1, str(config.envelopeFit['scaleMin']), size=(35, -1), validator=mwx.validator('intPos')) self.scaleMax_value = wx.TextCtrl(panel, -1, str(config.envelopeFit['scaleMax']), size=(35, -1), validator=mwx.validator('intPos')) self.calculate_butt = wx.Button(panel, -1, "Calculate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.calculate_butt.Bind(wx.EVT_BUTTON, self.onCalculate) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(formula_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.formula_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(charge_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.charge_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(exchange_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.exchangeLoss_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(exchangeVs_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.exchangeGain_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(scale_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.scaleMin_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(scaleDash_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.scaleMax_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.calculate_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbar'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make buttons self.errors_butt = wx.BitmapButton(panel, ID_matchErrors, images.lib['matchErrorsOff'], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE) self.errors_butt.SetToolTip(wx.ToolTip("Error plot")) self.errors_butt.Bind(wx.EVT_BUTTON, self.onToolSelected) self.summary_butt = wx.BitmapButton(panel, ID_matchSummary, images.lib['matchSummaryOff'], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE) self.summary_butt.SetToolTip(wx.ToolTip("Match summary")) self.summary_butt.Bind(wx.EVT_BUTTON, self.onToolSelected) # make match fields tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl(panel, -1, str(config.match['tolerance']), size=(60, -1), validator=mwx.validator('floatPos')) self.unitsDa_radio = wx.RadioButton(panel, -1, "Da", style=wx.RB_GROUP) self.unitsDa_radio.SetFont(wx.SMALL_FONT) self.unitsDa_radio.SetValue(True) self.unitsDa_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio = wx.RadioButton(panel, -1, "ppm") self.unitsPpm_radio.SetFont(wx.SMALL_FONT) self.unitsPpm_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio.SetValue((config.match['units'] == 'ppm')) self.ignoreCharge_check = wx.CheckBox(panel, -1, "Ignore charge") self.ignoreCharge_check.SetFont(wx.SMALL_FONT) self.ignoreCharge_check.SetValue(config.match['ignoreCharge']) if self.currentModule == 'massfilter': self.ignoreCharge_check.Disable() self.match_butt = wx.Button(panel, -1, "Match", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.match_butt.Bind(wx.EVT_BUTTON, self.onMatch) self.calibrate_butt = wx.Button(panel, -1, "Calibrate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.calibrate_butt.Bind(wx.EVT_BUTTON, self.onCalibrate) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.TOOLBAR_LSPACE) sizer.Add(self.errors_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.summary_butt, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, mwx.BUTTON_SIZE_CORRECTION) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(self.unitsDa_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.unitsPpm_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ignoreCharge_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.match_butt, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) sizer.Add(self.calibrate_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.TOOLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeSpectrumPanel(self): """Spectrum info panel.""" panel = wx.Panel(self, -1) # make elements scanNumber_label = wx.StaticText(panel, -1, "Scan ID:") self.scanNumber_value = wx.TextCtrl(panel, -1, "", size=(180, -1), validator=mwx.validator('intPos')) self.scanNumber_value.Bind(wx.EVT_TEXT, self.onSave) retentionTime_label = wx.StaticText(panel, -1, "Retention time:") self.retentionTime_value = wx.TextCtrl(panel, -1, "", size=(180, -1), validator=mwx.validator('floatPos')) self.retentionTime_value.Bind(wx.EVT_TEXT, self.onSave) msLevel_label = wx.StaticText(panel, -1, "MS level:") self.msLevel_value = wx.TextCtrl(panel, -1, "", size=(180, -1), validator=mwx.validator('intPos')) self.msLevel_value.Bind(wx.EVT_TEXT, self.onSave) precursorMZ_label = wx.StaticText(panel, -1, "Precursor m/z:") self.precursorMZ_value = wx.TextCtrl(panel, -1, "", size=(180, -1), validator=mwx.validator('floatPos')) self.precursorMZ_value.Bind(wx.EVT_TEXT, self.onSave) precursorCharge_label = wx.StaticText(panel, -1, "Precursor charge:") self.precursorCharge_value = wx.TextCtrl(panel, -1, "", size=(180, -1), validator=mwx.validator('int')) self.precursorCharge_value.Bind(wx.EVT_TEXT, self.onSave) polarity_label = wx.StaticText(panel, -1, "Polarity:") self.polarity_choice = wx.Choice(panel, -1, choices=['Unknown', 'Positive', 'Negative'], size=(180, mwx.SMALL_CHOICE_HEIGHT)) self.polarity_choice.Bind(wx.EVT_CHOICE, self.onSave) points_label = wx.StaticText(panel, -1, "Spectrum points:") self.points_value = wx.TextCtrl(panel, -1, "", size=(180, -1)) self.points_value.Enable(False) peaklist_label = wx.StaticText(panel, -1, "Peak list:") self.peaklist_value = wx.TextCtrl(panel, -1, "", size=(180, -1)) self.peaklist_value.Enable(False) # pack elements grid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) grid.Add(scanNumber_label, (0,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.scanNumber_value, (0,1)) grid.Add(retentionTime_label, (1,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.retentionTime_value, (1,1)) grid.Add(msLevel_label, (2,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.msLevel_value, (2,1)) grid.Add(precursorMZ_label, (3,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.precursorMZ_value, (3,1)) grid.Add(precursorCharge_label, (4,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.precursorCharge_value, (4,1)) grid.Add(polarity_label, (5,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.polarity_choice, (5,1)) grid.Add(points_label, (6,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.points_value, (6,1)) grid.Add(peaklist_label, (7,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) grid.Add(self.peaklist_value, (7,1)) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(grid, 0, wx.ALIGN_CENTER|wx.ALL, mwx.PANEL_SPACE_MAIN) # fit layout mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeEditor(self): """Make panel for peak editing.""" # init panel panel = mwx.bgrPanel(self, -1, images.lib['bgrPeakEditor']) # make elements peakMz_label = wx.StaticText(panel, -1, "m/z:") self.peakMz_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) peakMz_label.SetFont(wx.SMALL_FONT) self.peakMz_value.SetFont(wx.SMALL_FONT) peakAi_label = wx.StaticText(panel, -1, "a.i.:") self.peakAi_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) peakAi_label.SetFont(wx.SMALL_FONT) self.peakAi_value.SetFont(wx.SMALL_FONT) peakBase_label = wx.StaticText(panel, -1, "base:") self.peakBase_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) peakBase_label.SetFont(wx.SMALL_FONT) self.peakBase_value.SetFont(wx.SMALL_FONT) peakSN_label = wx.StaticText(panel, -1, "s/n:") self.peakSN_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) peakSN_label.SetFont(wx.SMALL_FONT) self.peakSN_value.SetFont(wx.SMALL_FONT) peakCharge_label = wx.StaticText(panel, -1, "charge:") self.peakCharge_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('int')) peakCharge_label.SetFont(wx.SMALL_FONT) self.peakCharge_value.SetFont(wx.SMALL_FONT) peakFwhm_label = wx.StaticText(panel, -1, "fwhm:") self.peakFwhm_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) peakFwhm_label.SetFont(wx.SMALL_FONT) self.peakFwhm_value.SetFont(wx.SMALL_FONT) peakGroup_label = wx.StaticText(panel, -1, "group:") self.peakGroup_value = wx.TextCtrl(panel, -1, '', size=(80, mwx.SMALL_TEXTCTRL_HEIGHT), style=wx.TE_PROCESS_ENTER) peakGroup_label.SetFont(wx.SMALL_FONT) self.peakGroup_value.SetFont(wx.SMALL_FONT) self.peakMonoisotopic_check = wx.CheckBox(panel, -1, "monoisotopic") self.peakMonoisotopic_check.SetValue(True) self.peakMonoisotopic_check.SetFont(wx.SMALL_FONT) self.peakAdd_butt = wx.Button(panel, -1, "Add", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.peakAdd_butt.Bind(wx.EVT_BUTTON, self.onAddPeak) self.peakReplace_butt = wx.Button(panel, -1, "Update", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.peakReplace_butt.Bind(wx.EVT_BUTTON, self.onReplacePeak) self.peakReplace_butt.Enable(False) # pack elements grid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) grid.Add(peakMz_label, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakMz_value, (0,1), flag=wx.EXPAND) grid.Add(peakAi_label, (1,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakAi_value, (1,1), flag=wx.EXPAND) grid.Add(peakBase_label, (2,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakBase_value, (2,1), flag=wx.EXPAND) grid.Add(peakSN_label, (3,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakSN_value, (3,1), flag=wx.EXPAND) grid.Add(peakCharge_label, (4,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakCharge_value, (4,1), flag=wx.EXPAND) grid.Add(peakFwhm_label, (5,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakFwhm_value, (5,1), flag=wx.EXPAND) grid.Add(peakGroup_label, (6,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) grid.Add(self.peakGroup_value, (6,1), flag=wx.EXPAND) grid.Add(self.peakMonoisotopic_check, (7,1), flag=wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL) grid.AddGrowableCol(1) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(self.peakAdd_butt, 0, wx.RIGHT, 10) buttons.Add(self.peakReplace_butt, 0) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(grid, 0, wx.EXPAND|wx.ALIGN_CENTER|wx.ALL, 10) mainSizer.Add(buttons, 0, wx.ALIGN_CENTER|wx.RIGHT|wx.LEFT|wx.BOTTOM, 10) # fit layout mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeImagePanel(self): """Image export panel.""" panel = wx.Panel(self, -1) # make elements imageWidth_label = wx.StaticText(panel, -1, "Width:") self.imageWidth_value = wx.TextCtrl( panel, -1, str(config.export['imageWidth']), size=(140, -1), validator=mwx.validator('floatPos')) imageHeight_label = wx.StaticText(panel, -1, "Height:") self.imageHeight_value = wx.TextCtrl( panel, -1, str(config.export['imageHeight']), size=(140, -1), validator=mwx.validator('floatPos')) self.imageUnits_choice = wx.Choice(panel, -1, choices=['cm', 'in', 'px'], size=(60, mwx.CHOICE_HEIGHT)) self.imageUnits_choice.SetStringSelection(config.export['imageUnits']) imageFormat_label = wx.StaticText(panel, -1, "Format:") self.imageFormat_choice = wx.Choice(panel, -1, choices=['PNG', 'TIFF', 'JPEG'], size=(140, mwx.CHOICE_HEIGHT)) self.imageFormat_choice.SetStringSelection( config.export['imageFormat']) imageResolution_label = wx.StaticText(panel, -1, "Resolution:") imageResolutionUnits_label = wx.StaticText(panel, -1, "dpi") choices = ['72', '150', '200', '300', '600'] self.imageResolution_choice = wx.Choice(panel, -1, choices=choices, size=(140, mwx.CHOICE_HEIGHT)) self.imageResolution_choice.Select(0) if str(config.export['imageResolution']) in choices: self.imageResolution_choice.Select( choices.index(str(config.export['imageResolution']))) self.imageResolution_choice.Bind(wx.EVT_CHOICE, self.onImageResolutionChanged) imageFontsScale_label = wx.StaticText(panel, -1, "Font scale:") self.imageFontsScale_slider = wx.Slider( panel, -1, config.export['imageFontsScale'], 1, 10, size=(140, -1), style=mwx.SLIDER_STYLE) self.imageFontsScale_slider.SetTickFreq(1, 1) imageDrawingsScale_label = wx.StaticText(panel, -1, "Line scale:") self.imageDrawingsScale_slider = wx.Slider( panel, -1, config.export['imageDrawingsScale'], 1, 10, size=(140, -1), style=mwx.SLIDER_STYLE) self.imageDrawingsScale_slider.SetTickFreq(1, 1) # pack elements grid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) grid.Add(imageWidth_label, (0, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageWidth_value, (0, 1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(self.imageUnits_choice, (0, 2), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT) grid.Add(imageHeight_label, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageHeight_value, (1, 1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageResolution_label, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageResolution_choice, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageResolutionUnits_label, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT) grid.Add(imageFontsScale_label, (3, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageFontsScale_slider, (3, 1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageDrawingsScale_label, (4, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageDrawingsScale_slider, (4, 1), flag=wx.ALIGN_CENTER_VERTICAL) grid.Add(imageFormat_label, (5, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) grid.Add(self.imageFormat_choice, (5, 1), flag=wx.ALIGN_CENTER_VERTICAL) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(grid, 0, wx.ALIGN_CENTER | wx.ALL, mwx.PANEL_SPACE_MAIN) # fit layout mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeIonseriesPanel(self): """Make controls for ionseries.""" # init panel ctrlPanel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make controls ionseriesAgent_label = wx.StaticText(ctrlPanel, -1, "Agent:") ionseriesAgent_label.SetFont(wx.SMALL_FONT) self.ionseriesAgentFormula_value = wx.TextCtrl(ctrlPanel, -1, config.massCalculator['ionseriesAgent'], size=(60, mwx.SMALL_TEXTCTRL_HEIGHT)) self.ionseriesAgentFormula_value.SetFont(wx.SMALL_FONT) self.ionseriesAgentFormula_value.Bind(wx.EVT_TEXT, self.onCompoundChanged) ionseriesAgentCharge_label = wx.StaticText(ctrlPanel, -1, "Agent charge:") ionseriesAgentCharge_label.SetFont(wx.SMALL_FONT) self.ionseriesAgentCharge_value = wx.TextCtrl(ctrlPanel, -1, str(config.massCalculator['ionseriesAgentCharge']), size=(40, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('int')) self.ionseriesAgentCharge_value.SetFont(wx.SMALL_FONT) self.ionseriesAgentCharge_value.Bind(wx.EVT_TEXT, self.onCompoundChanged) ionseriesPolarity_label = wx.StaticText(ctrlPanel, -1, "Polarity:") ionseriesPolarity_label.SetFont(wx.SMALL_FONT) self.ionseriesPositive_radio = wx.RadioButton(ctrlPanel, -1, "Positive", style=wx.RB_GROUP) self.ionseriesPositive_radio.SetFont(wx.SMALL_FONT) self.ionseriesPositive_radio.Bind(wx.EVT_RADIOBUTTON, self.onCompoundChanged) self.ionseriesNegative_radio = wx.RadioButton(ctrlPanel, -1, "Negative") self.ionseriesNegative_radio.SetFont(wx.SMALL_FONT) self.ionseriesNegative_radio.Bind(wx.EVT_RADIOBUTTON, self.onCompoundChanged) if config.massCalculator['ionseriesPolarity'] == -1: self.ionseriesNegative_radio.SetValue(True) else: self.ionseriesPositive_radio.SetValue(True) # pack controls controls = wx.BoxSizer(wx.HORIZONTAL) controls.AddSpacer(mwx.CONTROLBAR_LSPACE) controls.Add(ionseriesAgent_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) controls.Add(self.ionseriesAgentFormula_value, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(20) controls.Add(ionseriesAgentCharge_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) controls.Add(self.ionseriesAgentCharge_value, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(20) controls.Add(ionseriesPolarity_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) controls.Add(self.ionseriesPositive_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) controls.Add(self.ionseriesNegative_radio, 0, wx.ALIGN_CENTER_VERTICAL) controls.AddSpacer(mwx.CONTROLBAR_RSPACE) controls.Fit(ctrlPanel) ctrlPanel.SetSizer(controls) # make ions list self.makeIonsList() # pack main mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(ctrlPanel, 0, wx.EXPAND) mainSizer.Add(self.ionsList, 1, wx.EXPAND|wx.ALL, mwx.LISTCTRL_NO_SPACE) return mainSizer
def makeControlbar(self): """Make controlbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make elements massType_label = wx.StaticText(panel, -1, "Mass:") massType_label.SetFont(wx.SMALL_FONT) self.massTypeMo_radio = wx.RadioButton(panel, -1, "Mo", style=wx.RB_GROUP) self.massTypeMo_radio.SetFont(wx.SMALL_FONT) self.massTypeMo_radio.SetValue(True) self.massTypeAv_radio = wx.RadioButton(panel, -1, "Av") self.massTypeAv_radio.SetFont(wx.SMALL_FONT) self.massTypeAv_radio.SetValue(config.compoundsSearch['massType']) maxCharge_label = wx.StaticText(panel, -1, "Max charge:") maxCharge_label.SetFont(wx.SMALL_FONT) self.maxCharge_value = wx.TextCtrl( panel, -1, str(config.compoundsSearch['maxCharge']), size=(30, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('int')) self.maxCharge_value.SetFont(wx.SMALL_FONT) self.radicals_check = wx.CheckBox(panel, -1, "M*") self.radicals_check.SetFont(wx.SMALL_FONT) self.radicals_check.SetValue(config.compoundsSearch['radicals']) adducts_label = wx.StaticText(panel, -1, "Adducts:") adducts_label.SetFont(wx.SMALL_FONT) self.adductNa_check = wx.CheckBox(panel, -1, "Na") self.adductNa_check.SetFont(wx.SMALL_FONT) self.adductNa_check.SetValue( config.compoundsSearch['adducts'].count('Na')) self.adductK_check = wx.CheckBox(panel, -1, "K") self.adductK_check.SetFont(wx.SMALL_FONT) self.adductK_check.SetValue( config.compoundsSearch['adducts'].count('K')) self.adductLi_check = wx.CheckBox(panel, -1, "Li") self.adductLi_check.SetFont(wx.SMALL_FONT) self.adductLi_check.SetValue( config.compoundsSearch['adducts'].count('Li')) self.adductNH4_check = wx.CheckBox(panel, -1, "NH4") self.adductNH4_check.SetFont(wx.SMALL_FONT) self.adductNH4_check.SetValue( config.compoundsSearch['adducts'].count('NH4')) self.adductH2O_check = wx.CheckBox(panel, -1, "-H2O") self.adductH2O_check.SetFont(wx.SMALL_FONT) self.adductH2O_check.SetValue( config.compoundsSearch['adducts'].count('-H2O')) self.adductACN_check = wx.CheckBox(panel, -1, "ACN") self.adductACN_check.SetFont(wx.SMALL_FONT) self.adductACN_check.SetValue( config.compoundsSearch['adducts'].count('ACN')) self.adductMeOH_check = wx.CheckBox(panel, -1, "MeOH") self.adductMeOH_check.SetFont(wx.SMALL_FONT) self.adductMeOH_check.SetValue( config.compoundsSearch['adducts'].count('MeOH')) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(massType_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.massTypeMo_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.massTypeAv_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(maxCharge_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.maxCharge_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.radicals_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(adducts_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductNa_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductK_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductLi_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductNH4_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.adductH2O_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductACN_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.adductMeOH_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeGUI(self): """Make GUI elements.""" labelBox = wx.StaticBoxSizer(wx.StaticBox(self, -1, ""), wx.HORIZONTAL) formulaBox = wx.StaticBoxSizer(wx.StaticBox(self, -1, ""), wx.HORIZONTAL) # make elements label_label = wx.StaticText(self, -1, "Label:", style=wx.ALIGN_RIGHT) self.label_value = wx.TextCtrl(self, -1, '', size=(300,-1), style=wx.TE_PROCESS_ENTER) self.label_value.Bind(wx.EVT_TEXT_ENTER, self.onOK) formula_label = wx.StaticText(self, -1, "Formula:", style=wx.ALIGN_RIGHT) self.formula_value = mwx.formulaCtrl(self, -1, '', size=(300,-1), style=wx.TE_PROCESS_ENTER) self.formula_value.Bind(wx.EVT_TEXT, self.onFormula) self.formula_value.Bind(wx.EVT_TEXT_ENTER, self.onOK) theoreticalMZ_label = wx.StaticText(self, -1, "Theoretical m/z:", style=wx.ALIGN_RIGHT) self.theoreticalMZ_value = wx.TextCtrl(self, -1, '', size=(120,-1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('float')) self.theoreticalMZ_value.Bind(wx.EVT_TEXT_ENTER, self.onOK) charge_label = wx.StaticText(self, -1, " z:") self.charge_value = wx.TextCtrl(self, -1, '', size=(30,-1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('int')) self.charge_value.Bind(wx.EVT_TEXT, self.onFormula) self.charge_value.Bind(wx.EVT_TEXT_ENTER, self.onOK) self.radical_check = wx.CheckBox(self, -1, "M*", size=(50,-1)) self.radical_check.Bind(wx.EVT_CHECKBOX, self.onMassType) self.mzByUser_radio = wx.RadioButton(self, -1, "Manual", style=wx.RB_GROUP) self.mzByUser_radio.SetFont(wx.SMALL_FONT) self.mzByUser_radio.Bind(wx.EVT_RADIOBUTTON, self.onMassType) self.mzByUser_radio.SetValue(True) self.mzByFormulaMo_radio = wx.RadioButton(self, -1, "Mo") self.mzByFormulaMo_radio.SetFont(wx.SMALL_FONT) self.mzByFormulaMo_radio.Bind(wx.EVT_RADIOBUTTON, self.onMassType) self.mzByFormulaAv_radio = wx.RadioButton(self, -1, "Av") self.mzByFormulaAv_radio.SetFont(wx.SMALL_FONT) self.mzByFormulaAv_radio.Bind(wx.EVT_RADIOBUTTON, self.onMassType) buttons = self.makeButtons() # pack elements labelBox.Add(label_label, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) labelBox.Add(self.label_value, 1, wx.TOP|wx.RIGHT|wx.BOTTOM|wx.ALIGN_CENTER_VERTICAL, 10) formulaGrid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) formulaGrid.Add(formula_label, (0,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) formulaGrid.Add(self.formula_value, (0,1), (1,7), flag=wx.EXPAND) formulaGrid.Add(theoreticalMZ_label, (1,0), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) formulaGrid.Add(self.theoreticalMZ_value, (1,1)) formulaGrid.Add(charge_label, (1,2), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT) formulaGrid.Add(self.charge_value, (1,3)) formulaGrid.Add(self.radical_check, (1,4), flag=wx.ALIGN_CENTER_VERTICAL) formulaGrid.Add(self.mzByUser_radio, (1,5), flag=wx.ALIGN_CENTER_VERTICAL) formulaGrid.Add(self.mzByFormulaMo_radio, (1,6), flag=wx.ALIGN_CENTER_VERTICAL) formulaGrid.Add(self.mzByFormulaAv_radio, (1,7), flag=wx.ALIGN_CENTER_VERTICAL) formulaGrid.AddGrowableCol(1) formulaBox.Add(formulaGrid, 1, wx.EXPAND|wx.ALL, 10) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(labelBox, 0, wx.EXPAND|wx.CENTER|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(formulaBox, 0, wx.EXPAND|wx.CENTER|wx.LEFT|wx.RIGHT|wx.BOTTOM, mwx.PANEL_SPACE_MAIN) mainSizer.Add(buttons, 0, wx.CENTER|wx.LEFT|wx.RIGHT|wx.BOTTOM, mwx.PANEL_SPACE_MAIN) return mainSizer
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbarNoBorder'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements compare_label = wx.StaticText(panel, -1, "Compare:") compare_label.SetFont(wx.SMALL_FONT) choices = [ 'Peak Lists', 'Notations (measured)', 'Notations (theoretical)' ] self.compare_choice = wx.Choice(panel, -1, choices=choices, size=(180, mwx.SMALL_CHOICE_HEIGHT)) self.compare_choice.Bind(wx.EVT_CHOICE, self.onUpdatePeaklist) self.compare_choice.Select(0) if config.comparePeaklists['compare'] == 'measured': self.compare_choice.Select(1) elif config.comparePeaklists['compare'] == 'theoretical': self.compare_choice.Select(2) tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl( panel, -1, str(config.comparePeaklists['tolerance']), size=(60, -1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) self.tolerance_value.Bind(wx.EVT_TEXT_ENTER, self.onCompare) self.unitsDa_radio = wx.RadioButton(panel, -1, "Da", style=wx.RB_GROUP) self.unitsDa_radio.SetFont(wx.SMALL_FONT) self.unitsDa_radio.SetValue(True) self.unitsPpm_radio = wx.RadioButton(panel, -1, "ppm") self.unitsPpm_radio.SetFont(wx.SMALL_FONT) self.unitsPpm_radio.SetValue( (config.comparePeaklists['units'] == 'ppm')) self.ignoreCharge_check = wx.CheckBox(panel, -1, "Ignore charge") self.ignoreCharge_check.SetFont(wx.SMALL_FONT) self.ignoreCharge_check.SetValue( config.comparePeaklists['ignoreCharge']) self.ratioCheck_check = wx.CheckBox(panel, -1, "Int. ratio:") self.ratioCheck_check.SetFont(wx.SMALL_FONT) self.ratioCheck_check.SetValue(config.comparePeaklists['ratioCheck']) self.ratioCheck_check.Bind(wx.EVT_CHECKBOX, self.onRatioCheckChanged) self.ratioDirection_choice = wx.Choice(panel, -1, choices=['Above', 'Below'], size=(80, mwx.SMALL_CHOICE_HEIGHT)) self.ratioDirection_choice.Select(0) if config.comparePeaklists['ratioDirection'] == -1: self.ratioDirection_choice.Select(1) self.ratioThreshold_value = wx.TextCtrl( panel, -1, str(config.comparePeaklists['ratioThreshold']), size=(50, -1), validator=mwx.validator('floatPos')) self.compare_butt = wx.Button(panel, -1, "Compare", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.compare_butt.Bind(wx.EVT_BUTTON, self.onCompare) self.onRatioCheckChanged() # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(compare_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.compare_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(self.unitsDa_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.unitsPpm_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ignoreCharge_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ratioCheck_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.ratioDirection_choice, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) sizer.Add(self.ratioThreshold_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.compare_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib["bgrToolbar"], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements formula_label = wx.StaticText(panel, -1, "Formula:") formula_label.SetFont(wx.SMALL_FONT) self.formula_value = mwx.formulaCtrl(panel, -1, "", size=(220, -1)) charge_label = wx.StaticText(panel, -1, "Charge:") charge_label.SetFont(wx.SMALL_FONT) self.charge_value = wx.TextCtrl( panel, -1, str(config.envelopeFit["charge"]), size=(35, -1), validator=mwx.validator("int") ) exchange_label = wx.StaticText(panel, -1, "Exchange:") exchange_label.SetFont(wx.SMALL_FONT) self.exchangeLoss_value = mwx.formulaCtrl(panel, -1, str(config.envelopeFit["loss"]), size=(60, -1)) exchangeVs_label = wx.StaticText(panel, -1, " vs.") exchangeVs_label.SetFont(wx.SMALL_FONT) self.exchangeGain_value = mwx.formulaCtrl(panel, -1, str(config.envelopeFit["gain"]), size=(60, -1)) scale_label = wx.StaticText(panel, -1, "Range:") scale_label.SetFont(wx.SMALL_FONT) scaleDash_label = wx.StaticText(panel, -1, "-") scaleDash_label.SetFont(wx.SMALL_FONT) self.scaleMin_value = wx.TextCtrl( panel, -1, str(config.envelopeFit["scaleMin"]), size=(35, -1), validator=mwx.validator("intPos") ) self.scaleMax_value = wx.TextCtrl( panel, -1, str(config.envelopeFit["scaleMax"]), size=(35, -1), validator=mwx.validator("intPos") ) self.calculate_butt = wx.Button(panel, -1, "Calculate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.calculate_butt.Bind(wx.EVT_BUTTON, self.onCalculate) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(formula_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.formula_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(charge_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.charge_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(exchange_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.exchangeLoss_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(exchangeVs_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.exchangeGain_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(scale_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.scaleMin_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(scaleDash_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.scaleMax_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.calculate_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbarNoBorder'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make match fields difference_label = wx.StaticText(panel, -1, "Difference:") difference_label.SetFont(wx.SMALL_FONT) self.difference_value = wx.TextCtrl( panel, -1, '', size=(100, -1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) self.difference_value.Bind(wx.EVT_TEXT_ENTER, self.onSearch) self.aminoacids_check = wx.CheckBox(panel, -1, "Amino acids") self.aminoacids_check.SetFont(wx.SMALL_FONT) self.aminoacids_check.SetValue(config.peakDifferences['aminoacids']) self.dipeptides_check = wx.CheckBox(panel, -1, "Dipeptides") self.dipeptides_check.SetFont(wx.SMALL_FONT) self.dipeptides_check.SetValue(config.peakDifferences['dipeptides']) massType_label = wx.StaticText(panel, -1, "Mass:") massType_label.SetFont(wx.SMALL_FONT) self.massTypeMo_radio = wx.RadioButton(panel, -1, "Mo", style=wx.RB_GROUP) self.massTypeMo_radio.SetFont(wx.SMALL_FONT) self.massTypeMo_radio.SetValue(True) self.massTypeAv_radio = wx.RadioButton(panel, -1, "Av") self.massTypeAv_radio.SetFont(wx.SMALL_FONT) self.massTypeAv_radio.SetValue(config.peakDifferences['massType']) tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl( panel, -1, str(config.peakDifferences['tolerance']), size=(50, -1), validator=mwx.validator('floatPos')) toleranceUnits_label = wx.StaticText(panel, -1, "m/z") toleranceUnits_label.SetFont(wx.SMALL_FONT) self.consolidate_check = wx.CheckBox(panel, -1, "Hide umatched") self.consolidate_check.SetFont(wx.SMALL_FONT) self.consolidate_check.SetValue(config.peakDifferences['consolidate']) self.search_butt = wx.Button(panel, -1, "Search", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.search_butt.Bind(wx.EVT_BUTTON, self.onSearch) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(difference_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.difference_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.aminoacids_check, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.dipeptides_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(massType_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.massTypeMo_radio, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.massTypeAv_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(toleranceUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.consolidate_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.search_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbarNoBorder'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements compare_label = wx.StaticText(panel, -1, "Compare:") compare_label.SetFont(wx.SMALL_FONT) choices = ['Peak Lists', 'Notations (measured)', 'Notations (theoretical)'] self.compare_choice = wx.Choice(panel, -1, choices=choices, size=(180, mwx.SMALL_CHOICE_HEIGHT)) self.compare_choice.Bind(wx.EVT_CHOICE, self.onUpdatePeaklist) self.compare_choice.Select(0) if config.comparePeaklists['compare'] == 'measured': self.compare_choice.Select(1) elif config.comparePeaklists['compare'] == 'theoretical': self.compare_choice.Select(2) tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl(panel, -1, str(config.comparePeaklists['tolerance']), size=(60, -1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) self.tolerance_value.Bind(wx.EVT_TEXT_ENTER, self.onCompare) self.unitsDa_radio = wx.RadioButton(panel, -1, "Da", style=wx.RB_GROUP) self.unitsDa_radio.SetFont(wx.SMALL_FONT) self.unitsDa_radio.SetValue(True) self.unitsPpm_radio = wx.RadioButton(panel, -1, "ppm") self.unitsPpm_radio.SetFont(wx.SMALL_FONT) self.unitsPpm_radio.SetValue((config.comparePeaklists['units'] == 'ppm')) self.ignoreCharge_check = wx.CheckBox(panel, -1, "Ignore charge") self.ignoreCharge_check.SetFont(wx.SMALL_FONT) self.ignoreCharge_check.SetValue(config.comparePeaklists['ignoreCharge']) self.ratioCheck_check = wx.CheckBox(panel, -1, "Int. ratio:") self.ratioCheck_check.SetFont(wx.SMALL_FONT) self.ratioCheck_check.SetValue(config.comparePeaklists['ratioCheck']) self.ratioCheck_check.Bind(wx.EVT_CHECKBOX, self.onRatioCheckChanged) self.ratioDirection_choice = wx.Choice(panel, -1, choices=['Above', 'Below'], size=(80, mwx.SMALL_CHOICE_HEIGHT)) self.ratioDirection_choice.Select(0) if config.comparePeaklists['ratioDirection'] == -1: self.ratioDirection_choice.Select(1) self.ratioThreshold_value = wx.TextCtrl(panel, -1, str(config.comparePeaklists['ratioThreshold']), size=(50, -1), validator=mwx.validator('floatPos')) self.compare_butt = wx.Button(panel, -1, "Compare", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.compare_butt.Bind(wx.EVT_BUTTON, self.onCompare) self.onRatioCheckChanged() # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(compare_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.compare_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(self.unitsDa_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.unitsPpm_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ignoreCharge_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ratioCheck_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.ratioDirection_choice, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 10) sizer.Add(self.ratioThreshold_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.compare_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeControlbar(self): """Make controlbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make elements self.collapse_butt = wx.BitmapButton(panel, -1, images.lib['arrowsDown'], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE) self.collapse_butt.Bind(wx.EVT_BUTTON, self.onCollapse) fitTo_label = wx.StaticText(panel, -1, "Fit to:") fitTo_label.SetFont(wx.SMALL_FONT) self.fitToPeaklist_radio = wx.RadioButton(panel, -1, "Peak list", style=wx.RB_GROUP) self.fitToPeaklist_radio.SetFont(wx.SMALL_FONT) self.fitToSpectrum_radio = wx.RadioButton(panel, -1, "Spectrum") self.fitToSpectrum_radio.SetFont(wx.SMALL_FONT) self.fitToPeaklist_radio.SetValue(True) if config.envelopeFit['fit'] == 'spectrum': self.fitToSpectrum_radio.SetValue(True) fwhm_label = wx.StaticText(panel, -1, "Default FWHM:") fwhm_label.SetFont(wx.SMALL_FONT) self.fwhm_value = wx.TextCtrl(panel, -1, str(config.envelopeFit['fwhm']), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) self.fwhm_value.SetFont(wx.SMALL_FONT) self.forceFwhm_check = wx.CheckBox(panel, -1, "Force") self.forceFwhm_check.SetFont(wx.SMALL_FONT) self.forceFwhm_check.SetValue(config.envelopeFit['forceFwhm']) relThreshold_label = wx.StaticText(panel, -1, "Rel. int. threshold:") relThreshold_label.SetFont(wx.SMALL_FONT) relThresholdUnits_label = wx.StaticText(panel, -1, "%") relThresholdUnits_label.SetFont(wx.SMALL_FONT) self.relThreshold_value = wx.TextCtrl(panel, -1, str(config.envelopeFit['relThreshold']*100), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) self.relThreshold_value.SetFont(wx.SMALL_FONT) self.autoAlign_check = wx.CheckBox(panel, -1, "Auto align") self.autoAlign_check.SetFont(wx.SMALL_FONT) self.autoAlign_check.SetValue(config.envelopeFit['autoAlign']) self.average_label = wx.StaticText(panel, -1, "", size=(100, -1)) self.average_label.SetFont(wx.SMALL_FONT) self.updateAverageLabel() # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(self.collapse_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(fitTo_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.fitToPeaklist_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.fitToSpectrum_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(fwhm_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.fwhm_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.forceFwhm_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(relThreshold_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.relThreshold_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(relThresholdUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.autoAlign_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.average_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeControlbar(self): """Make controlbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make elements massType_label = wx.StaticText(panel, -1, "Mass:") massType_label.SetFont(wx.SMALL_FONT) self.massTypeMo_radio = wx.RadioButton(panel, -1, "Mo", style=wx.RB_GROUP) self.massTypeMo_radio.SetFont(wx.SMALL_FONT) self.massTypeMo_radio.SetValue(True) self.massTypeAv_radio = wx.RadioButton(panel, -1, "Av") self.massTypeAv_radio.SetFont(wx.SMALL_FONT) self.massTypeAv_radio.SetValue(config.compoundsSearch['massType']) maxCharge_label = wx.StaticText(panel, -1, "Max charge:") maxCharge_label.SetFont(wx.SMALL_FONT) self.maxCharge_value = wx.TextCtrl(panel, -1, str(config.compoundsSearch['maxCharge']), size=(30, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('int')) self.maxCharge_value.SetFont(wx.SMALL_FONT) self.radicals_check = wx.CheckBox(panel, -1, "M*") self.radicals_check.SetFont(wx.SMALL_FONT) self.radicals_check.SetValue(config.compoundsSearch['radicals']) adducts_label = wx.StaticText(panel, -1, "Adducts:") adducts_label.SetFont(wx.SMALL_FONT) self.adductNa_check = wx.CheckBox(panel, -1, "Na") self.adductNa_check.SetFont(wx.SMALL_FONT) self.adductNa_check.SetValue(config.compoundsSearch['adducts'].count('Na')) self.adductK_check = wx.CheckBox(panel, -1, "K") self.adductK_check.SetFont(wx.SMALL_FONT) self.adductK_check.SetValue(config.compoundsSearch['adducts'].count('K')) self.adductLi_check = wx.CheckBox(panel, -1, "Li") self.adductLi_check.SetFont(wx.SMALL_FONT) self.adductLi_check.SetValue(config.compoundsSearch['adducts'].count('Li')) self.adductNH4_check = wx.CheckBox(panel, -1, "NH4") self.adductNH4_check.SetFont(wx.SMALL_FONT) self.adductNH4_check.SetValue(config.compoundsSearch['adducts'].count('NH4')) self.adductH2O_check = wx.CheckBox(panel, -1, "-H2O") self.adductH2O_check.SetFont(wx.SMALL_FONT) self.adductH2O_check.SetValue(config.compoundsSearch['adducts'].count('-H2O')) self.adductACN_check = wx.CheckBox(panel, -1, "ACN") self.adductACN_check.SetFont(wx.SMALL_FONT) self.adductACN_check.SetValue(config.compoundsSearch['adducts'].count('ACN')) self.adductMeOH_check = wx.CheckBox(panel, -1, "MeOH") self.adductMeOH_check.SetFont(wx.SMALL_FONT) self.adductMeOH_check.SetValue(config.compoundsSearch['adducts'].count('MeOH')) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(massType_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.massTypeMo_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.massTypeAv_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(maxCharge_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.maxCharge_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.radicals_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(adducts_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductNa_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductK_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductLi_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductNH4_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.adductH2O_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductACN_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.adductMeOH_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbar'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make elements mass_label = wx.StaticText(panel, -1, "Mo. mass:") mass_label.SetFont(wx.SMALL_FONT) self.mass_value = wx.TextCtrl(panel, -1, "", size=(120, -1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) self.mass_value.Bind(wx.EVT_TEXT_ENTER, self.onGenerate) charge_label = wx.StaticText(panel, -1, "Charge:") charge_label.SetFont(wx.SMALL_FONT) self.charge_value = wx.TextCtrl(panel, -1, str(config.massToFormula['charge']), size=(40, -1), validator=mwx.validator('int')) choices = ['M', 'M*', 'H+', 'Na+', 'K+', 'Li+', 'NH4+'] self.ionization_choice = wx.Choice(panel, -1, choices=choices, size=(80, mwx.SMALL_CHOICE_HEIGHT)) choices = ['', 'e', 'H', 'Na', 'K', 'Li', 'NH4'] if config.massToFormula['ionization'] in choices: self.ionization_choice.Select(choices.index(config.massToFormula['ionization'])) tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl(panel, -1, str(config.massToFormula['tolerance']), size=(50, -1), validator=mwx.validator('floatPos')) self.tolerance_value.Bind(wx.EVT_TEXT_ENTER, self.onGenerate) self.unitsDa_radio = wx.RadioButton(panel, -1, "Da", style=wx.RB_GROUP) self.unitsDa_radio.SetFont(wx.SMALL_FONT) self.unitsDa_radio.SetValue(True) self.unitsDa_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio = wx.RadioButton(panel, -1, "ppm") self.unitsPpm_radio.SetFont(wx.SMALL_FONT) self.unitsPpm_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio.SetValue((config.massToFormula['units'] == 'ppm')) self.generate_butt = wx.Button(panel, -1, "Generate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.generate_butt.Bind(wx.EVT_BUTTON, self.onGenerate) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(mass_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.mass_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(charge_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.charge_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 10) sizer.Add(self.ionization_choice, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(self.unitsDa_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.unitsPpm_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.generate_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.TOOLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbarNoBorder'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make match fields difference_label = wx.StaticText(panel, -1, "Difference:") difference_label.SetFont(wx.SMALL_FONT) self.difference_value = wx.TextCtrl(panel, -1, '', size=(100, -1), style=wx.TE_PROCESS_ENTER, validator=mwx.validator('floatPos')) self.difference_value.Bind(wx.EVT_TEXT_ENTER, self.onSearch) self.aminoacids_check = wx.CheckBox(panel, -1, "Amino acids") self.aminoacids_check.SetFont(wx.SMALL_FONT) self.aminoacids_check.SetValue(config.peakDifferences['aminoacids']) self.dipeptides_check = wx.CheckBox(panel, -1, "Dipeptides") self.dipeptides_check.SetFont(wx.SMALL_FONT) self.dipeptides_check.SetValue(config.peakDifferences['dipeptides']) massType_label = wx.StaticText(panel, -1, "Mass:") massType_label.SetFont(wx.SMALL_FONT) self.massTypeMo_radio = wx.RadioButton(panel, -1, "Mo", style=wx.RB_GROUP) self.massTypeMo_radio.SetFont(wx.SMALL_FONT) self.massTypeMo_radio.SetValue(True) self.massTypeAv_radio = wx.RadioButton(panel, -1, "Av") self.massTypeAv_radio.SetFont(wx.SMALL_FONT) self.massTypeAv_radio.SetValue(config.peakDifferences['massType']) tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl(panel, -1, str(config.peakDifferences['tolerance']), size=(50, -1), validator=mwx.validator('floatPos')) toleranceUnits_label = wx.StaticText(panel, -1, "m/z") toleranceUnits_label.SetFont(wx.SMALL_FONT) self.consolidate_check = wx.CheckBox(panel, -1, "Hide umatched") self.consolidate_check.SetFont(wx.SMALL_FONT) self.consolidate_check.SetValue(config.peakDifferences['consolidate']) self.search_butt = wx.Button(panel, -1, "Search", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.search_butt.Bind(wx.EVT_BUTTON, self.onSearch) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(difference_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.difference_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.aminoacids_check, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.dipeptides_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(massType_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.massTypeMo_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.massTypeAv_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(toleranceUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.consolidate_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.search_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeToolbar(self): """Make toolbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrToolbar'], size=(-1, mwx.TOOLBAR_HEIGHT)) # make buttons self.errors_butt = wx.BitmapButton(panel, ID_matchErrors, images.lib['matchErrorsOff'], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE) self.errors_butt.SetToolTip(wx.ToolTip("Error plot")) self.errors_butt.Bind(wx.EVT_BUTTON, self.onToolSelected) self.summary_butt = wx.BitmapButton(panel, ID_matchSummary, images.lib['matchSummaryOff'], size=(mwx.TOOLBAR_TOOLSIZE), style=wx.BORDER_NONE) self.summary_butt.SetToolTip(wx.ToolTip("Match summary")) self.summary_butt.Bind(wx.EVT_BUTTON, self.onToolSelected) # make match fields tolerance_label = wx.StaticText(panel, -1, "Tolerance:") tolerance_label.SetFont(wx.SMALL_FONT) self.tolerance_value = wx.TextCtrl(panel, -1, str(config.match['tolerance']), size=(60, -1), validator=mwx.validator('floatPos')) self.unitsDa_radio = wx.RadioButton(panel, -1, "Da", style=wx.RB_GROUP) self.unitsDa_radio.SetFont(wx.SMALL_FONT) self.unitsDa_radio.SetValue(True) self.unitsDa_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio = wx.RadioButton(panel, -1, "ppm") self.unitsPpm_radio.SetFont(wx.SMALL_FONT) self.unitsPpm_radio.Bind(wx.EVT_RADIOBUTTON, self.onUnitsChanged) self.unitsPpm_radio.SetValue((config.match['units'] == 'ppm')) self.ignoreCharge_check = wx.CheckBox(panel, -1, "Ignore charge") self.ignoreCharge_check.SetFont(wx.SMALL_FONT) self.ignoreCharge_check.SetValue(config.match['ignoreCharge']) if self.currentModule == 'massfilter': self.ignoreCharge_check.Disable() self.match_butt = wx.Button(panel, -1, "Match", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.match_butt.Bind(wx.EVT_BUTTON, self.onMatch) self.calibrate_butt = wx.Button(panel, -1, "Calibrate", size=(-1, mwx.SMALL_BUTTON_HEIGHT)) self.calibrate_butt.Bind(wx.EVT_BUTTON, self.onCalibrate) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.TOOLBAR_LSPACE) sizer.Add(self.errors_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.Add(self.summary_butt, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT, mwx.BUTTON_SIZE_CORRECTION) sizer.AddSpacer(20) sizer.Add(tolerance_label, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.tolerance_value, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(10) sizer.Add(self.unitsDa_radio, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5) sizer.Add(self.unitsPpm_radio, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ignoreCharge_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() sizer.AddSpacer(20) sizer.Add(self.match_butt, 0, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 10) sizer.Add(self.calibrate_butt, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.TOOLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) panel.SetSizer(mainSizer) mainSizer.Fit(panel) return panel
def makeControlbar(self): """Make controlbar.""" # init toolbar panel = mwx.bgrPanel(self, -1, images.lib['bgrControlbar'], size=(-1, mwx.CONTROLBAR_HEIGHT)) # make elements relIntCutoff_label = wx.StaticText(panel, -1, "Int. threshold:") relIntCutoff_label.SetFont(wx.SMALL_FONT) relIntCutoffUnits_label = wx.StaticText(panel, -1, "%") relIntCutoffUnits_label.SetFont(wx.SMALL_FONT) self.relIntCutoff_value = wx.TextCtrl( panel, -1, str(config.massDefectPlot['relIntCutoff'] * 100), size=(50, mwx.SMALL_TEXTCTRL_HEIGHT), validator=mwx.validator('floatPos')) self.relIntCutoff_value.SetFont(wx.SMALL_FONT) self.removeIsotopes_check = wx.CheckBox(panel, -1, "Remove isotopes") self.removeIsotopes_check.SetFont(wx.SMALL_FONT) self.removeIsotopes_check.SetValue( config.massDefectPlot['removeIsotopes']) self.ignoreCharge_check = wx.CheckBox(panel, -1, "Ignore charge") self.ignoreCharge_check.SetFont(wx.SMALL_FONT) self.ignoreCharge_check.SetValue(config.massDefectPlot['ignoreCharge']) self.showNotations_check = wx.CheckBox(panel, -1, "Highlight annotated") self.showNotations_check.SetFont(wx.SMALL_FONT) self.showNotations_check.SetValue( config.massDefectPlot['showNotations']) self.showNotations_check.Bind(wx.EVT_CHECKBOX, self.onShowNotations) self.showAllDocuments_check = wx.CheckBox(panel, -1, "Show all documents") self.showAllDocuments_check.SetFont(wx.SMALL_FONT) self.showAllDocuments_check.SetValue(False) self.showAllDocuments_check.Bind(wx.EVT_CHECKBOX, self.onShowAllDocuments) # pack elements sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.AddSpacer(mwx.CONTROLBAR_LSPACE) sizer.Add(relIntCutoff_label, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(self.relIntCutoff_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5) sizer.Add(relIntCutoffUnits_label, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.removeIsotopes_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.ignoreCharge_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.showNotations_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(20) sizer.Add(self.showAllDocuments_check, 0, wx.ALIGN_CENTER_VERTICAL) sizer.AddSpacer(mwx.CONTROLBAR_RSPACE) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(sizer, 1, wx.EXPAND) mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel
def makePMFPanel(self): """Make controls for search form panel.""" panel = wx.Panel(self, -1) # make info elements paramSearchTitle_label = wx.StaticText(panel, -1, "Title:") self.paramTitle_value = wx.TextCtrl(panel, -1, "", size=(250, -1)) # make sequence elements paramTaxonomy_label = wx.StaticText(panel, -1, "Taxonomy:") self.paramTaxonomy_choice = wx.Choice(panel, -1, choices=[], size=(300, mwx.CHOICE_HEIGHT)) paramDatabase_label = wx.StaticText(panel, -1, "Database:") self.paramDatabase_choice = wx.Choice(panel, -1, choices=[], size=(150, mwx.CHOICE_HEIGHT)) paramEnzyme_label = wx.StaticText(panel, -1, " Enzyme:") self.paramEnzyme_choice = wx.Choice(panel, -1, choices=[], size=(130, mwx.CHOICE_HEIGHT)) paramMiscleavages_label = wx.StaticText(panel, -1, " Miscl.:") self.paramMiscleavages_choice = wx.Choice(panel, -1, choices=['0','1','2','3','4'], size=(50, mwx.CHOICE_HEIGHT)) self.paramMiscleavages_choice.SetStringSelection(str(config.profound['miscleavages'])) # make modifications elements self.paramFixedMods_label = wx.StaticText(panel, -1, "Complete modifications:") self.paramFixedMods_listbox = wx.ListBox(panel, -1, size=(200, 100), choices=[], style=wx.LB_EXTENDED) self.paramFixedMods_listbox.SetFont(wx.SMALL_FONT) self.paramFixedMods_listbox.Bind(wx.EVT_LISTBOX, self.onModificationSelected) self.paramVariableMods_label = wx.StaticText(panel, -1, "Partial modifications:") self.paramVariableMods_listbox = wx.ListBox(panel, -1, size=(200, 100), choices=[], style=wx.LB_EXTENDED) self.paramVariableMods_listbox.SetFont(wx.SMALL_FONT) self.paramVariableMods_listbox.Bind(wx.EVT_LISTBOX, self.onModificationSelected) # make masses elements paramProteinMass_label = wx.StaticText(panel, -1, "Protein mass:") self.paramProteinMassLow_value = wx.TextCtrl(panel, -1, "0", size=(50, -1), validator=mwx.validator('floatPos')) self.paramProteinMassHigh_value = wx.TextCtrl(panel, -1, "300", size=(50, -1), validator=mwx.validator('floatPos')) paramProteinMass_dash = wx.StaticText(panel, -1, "-") paramProteinMassUnits_label = wx.StaticText(panel, -1, "kDa") paramProteinPI_label = wx.StaticText(panel, -1, "Protein pI:") self.paramProteinPILow_value = wx.TextCtrl(panel, -1, "0", size=(50, -1), validator=mwx.validator('floatPos')) self.paramProteinPIHigh_value = wx.TextCtrl(panel, -1, "14", size=(50, -1), validator=mwx.validator('floatPos')) paramProteinPI_dash = wx.StaticText(panel, -1, "-") paramPeptideTol_label = wx.StaticText(panel, -1, "Peptide tolerance:") self.paramPeptideTol_value = wx.TextCtrl(panel, -1, str(config.profound['peptideTol']), size=(50, -1), validator=mwx.validator('floatPos')) self.paramPeptideTolUnits_choice = wx.Choice(panel, -1, choices=['Da','%','ppm'], size=(80, mwx.CHOICE_HEIGHT)) self.paramPeptideTolUnits_choice.SetStringSelection(config.profound['peptideTolUnits']) paramMassType_label = wx.StaticText(panel, -1, "Mass type:") self.paramMassType_choice = wx.Choice(panel, -1, choices=['Monoisotopic', 'Average'], size=(150, mwx.CHOICE_HEIGHT)) self.paramMassType_choice.SetStringSelection(config.profound['massType']) paramCharge_label = wx.StaticText(panel, -1, "Charge:") self.paramCharge_choice = wx.Choice(panel, -1, choices=['MH+','M'], size=(150, mwx.CHOICE_HEIGHT)) self.paramCharge_choice.SetStringSelection(config.profound['charge']) # results elements self.paramExpectation_radio = wx.RadioButton(panel, -1, "Expectation value:", style=wx.RB_GROUP) self.paramExpectation_value = wx.TextCtrl(panel, -1, str(config.profound['expectation']), size=(60, -1), validator=mwx.validator('floatPos')) if config.profound['ranking'] == 'expect': self.paramExpectation_radio.SetValue(True) self.paramZscore_radio = wx.RadioButton(panel, -1, "Z Score candidates:") self.paramCandidates_value = wx.TextCtrl(panel, -1, str(config.profound['candidates']), size=(60, -1), validator=mwx.validator('floatPos')) if config.profound['ranking'] == 'zscore': self.paramZscore_radio.SetValue(True) # pack elements infoGrid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) infoGrid.Add(paramSearchTitle_label, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) infoGrid.Add(self.paramTitle_value, (0,1), flag=wx.EXPAND) infoGrid.AddGrowableCol(1) sequenceGrid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) sequenceGrid.Add(paramTaxonomy_label, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sequenceGrid.Add(self.paramTaxonomy_choice, (0,1), (1,5), flag=wx.EXPAND) sequenceGrid.Add(paramDatabase_label, (1,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sequenceGrid.Add(self.paramDatabase_choice, (1,1), flag=wx.EXPAND) sequenceGrid.Add(paramEnzyme_label, (1,2), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sequenceGrid.Add(self.paramEnzyme_choice, (1,3), flag=wx.EXPAND) sequenceGrid.Add(paramMiscleavages_label, (1,4), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) sequenceGrid.Add(self.paramMiscleavages_choice, (1,5)) sequenceGrid.AddGrowableCol(1) sequenceGrid.AddGrowableCol(3) modsGrid = wx.GridBagSizer(5, 20) modsGrid.Add(self.paramFixedMods_label, (0,0), flag=wx.ALIGN_CENTER_VERTICAL) modsGrid.Add(self.paramVariableMods_label, (0,1), flag=wx.ALIGN_CENTER_VERTICAL) modsGrid.Add(self.paramFixedMods_listbox, (1,0), flag=wx.EXPAND) modsGrid.Add(self.paramVariableMods_listbox, (1,1), flag=wx.EXPAND) modsGrid.AddGrowableCol(0) modsGrid.AddGrowableCol(1) massesGrid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) massesGrid.Add(paramProteinMass_label, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramProteinMassLow_value, (0,1), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramProteinMass_dash, (0,2), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramProteinMassHigh_value, (0,3), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramProteinMassUnits_label, (0,4), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramProteinPI_label, (1,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramProteinPILow_value, (1,1), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramProteinPI_dash, (1,2), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramProteinPIHigh_value, (1,3), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramPeptideTol_label, (2,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramPeptideTol_value, (2,1), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramPeptideTolUnits_choice, (2,3), (1,2), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramMassType_label, (0,5), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramMassType_choice, (0,6), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(paramCharge_label, (1,5), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) massesGrid.Add(self.paramCharge_choice, (1,6), flag=wx.ALIGN_CENTER_VERTICAL) massesGrid.AddGrowableCol(4) resultsGrid = wx.GridBagSizer(mwx.GRIDBAG_VSPACE, mwx.GRIDBAG_HSPACE) resultsGrid.Add(self.paramExpectation_radio, (0,0), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) resultsGrid.Add(self.paramExpectation_value, (0,1), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) resultsGrid.Add(self.paramZscore_radio, (0,3), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) resultsGrid.Add(self.paramCandidates_value, (0,4), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) resultsGrid.AddGrowableCol(2) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(infoGrid, 0, wx.EXPAND|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.LEFT|wx.RIGHT, mwx.PANEL_SPACE_MAIN) mainSizer.Add(sequenceGrid, 0, wx.EXPAND|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.LEFT|wx.RIGHT, mwx.PANEL_SPACE_MAIN) mainSizer.Add(modsGrid, 0, wx.EXPAND|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.LEFT|wx.RIGHT, mwx.PANEL_SPACE_MAIN) mainSizer.Add(massesGrid, 0, wx.EXPAND|wx.ALL, mwx.PANEL_SPACE_MAIN) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.LEFT|wx.RIGHT, mwx.PANEL_SPACE_MAIN) mainSizer.Add(resultsGrid, 0, wx.EXPAND|wx.ALL, mwx.PANEL_SPACE_MAIN) # fit layout mainSizer.Fit(panel) panel.SetSizer(mainSizer) return panel