我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.BOTTOM。
def initNTrial(self): trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL) trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL) self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.nTrainTrial), min=2, max=100) self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl) self.offlineControls += [self.trainTrialSpinCtrl] trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) trialSizer.Add(trainTrialControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL) self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.nTestTrial), min=1, max=100) self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl) self.offlineControls += [self.testTrialSpinCtrl] testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) trialSizer.Add(testTrialControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
def initMediaPath(self): mediaPathControlBox = widgets.ControlBox(self, label='Media Path', orient=wx.HORIZONTAL) self.mediaPathTextCtrl = wx.TextCtrl(parent=self, style=wx.TE_PROCESS_ENTER) self.mediaPathTextCtrl.SetValue(self.pg.defaultMusicDir) mediaPathControlBox.Add(self.mediaPathTextCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_TEXT_ENTER, self.setMediaPath, self.mediaPathTextCtrl) self.offlineControls += [self.mediaPathTextCtrl] self.mediaBrowseButton = wx.Button(self, label='Browse') mediaPathControlBox.Add(self.mediaBrowseButton, proportion=0, flag=wx.TOP | wx.RIGHT | wx.BOTTOM, border=10) self.Bind(wx.EVT_BUTTON, self.mediaBrowse, self.mediaBrowseButton) self.offlineControls += [self.mediaBrowseButton] self.sizer.Add(mediaPathControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
def initNTrial(self): trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL) trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL) self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.nTrainTrial), min=10, max=100) self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl) self.offlineControls += [self.trainTrialSpinCtrl] trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) trialSizer.Add(trainTrialControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL) self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.nTestTrial), min=1, max=100) self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl) self.offlineControls += [self.testTrialSpinCtrl] testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) trialSizer.Add(testTrialControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
def initControls(self): # slider for controlling the length of the spans in Welch's method # since sliders are int, we use divide by 4 to get float value spanControlBox = widgets.ControlBox(self, label='Span', orient=wx.HORIZONTAL) self.spanText = wx.StaticText(self, label='%4.2f(s)' % self.pg.welchConfig.span) spanTextSizer = wx.BoxSizer(orient=wx.VERTICAL) spanTextSizer.Add(self.spanText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.spanSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=int(self.pg.welchConfig.span*4), minValue=1, maxValue=12) spanControlBox.Add(spanTextSizer, proportion=0, flag=wx.TOP, border=10) spanControlBox.Add(self.spanSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setSpan, self.spanSlider) self.sizer.Add(spanControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initMethod(self): methodControlBox = widgets.ControlBox(self, label='Method', orient=wx.VERTICAL) self.methodComboBox = wx.ComboBox(self, value=self.pg.method, style=wx.CB_READONLY, choices=('Welch Power', 'Autoregressive')) self.Bind(wx.EVT_COMBOBOX, self.setMethod, self.methodComboBox) self.offlineControls += [self.methodComboBox] methodControlBox.Add(self.methodComboBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(methodControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.methodConfigSizer = wx.BoxSizer(orient=wx.VERTICAL) self.welchPanel = WelchConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.welchPanel, proportion=1, flag=wx.EXPAND) self.autoregPanel = AutoregConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.autoregPanel, proportion=1, flag=wx.EXPAND) self.sizer.Add(self.methodConfigSizer, proportion=1, flag=wx.EXPAND) self.methodConfig = self.welchPanel
def initLattice(self): latticeSizer = wx.BoxSizer(orient=wx.HORIZONTAL) latticeSizeXControlBox = widgets.ControlBox(self, label='Lattice Size X', orient=wx.VERTICAL) self.latticeSizeXSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.latticeSize[0]), min=1, max=512) self.Bind(wx.EVT_SPINCTRL, self.setLatticeSizeX, self.latticeSizeXSpinCtrl) self.offlineControls += [self.latticeSizeXSpinCtrl] latticeSizeXControlBox.Add(self.latticeSizeXSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) latticeSizer.Add(latticeSizeXControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) latticeSizeYControlBox = widgets.ControlBox(self, label='Lattice Size Y', orient=wx.VERTICAL) self.latticeSizeYSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.latticeSize[0]), min=1, max=512) self.Bind(wx.EVT_SPINCTRL, self.setLatticeSizeY, self.latticeSizeYSpinCtrl) self.offlineControls += [self.latticeSizeYSpinCtrl] latticeSizeYControlBox.Add(self.latticeSizeYSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) latticeSizer.Add(latticeSizeYControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(latticeSizer, proportion=0, flag=wx.EXPAND)
def initSigControls(self): """Initialize signal controls. """ sigSizer = wx.BoxSizer(orient=wx.VERTICAL) scaleControlBox = widgets.ControlBox(self, label='Noise', orient=wx.VERTICAL) self.scaleText = wx.StaticText(self, label='%4.1f' % self.src.scale.value) scaleTextSizer = wx.BoxSizer(orient=wx.VERTICAL) scaleTextSizer.Add(self.scaleText, proportion=1, flag=wx.EXPAND) self.scaleSlider = wx.Slider(self, style=wx.SL_VERTICAL, value=self.src.scale.value*10.0, minValue=1, maxValue=100) self.Bind(wx.EVT_SLIDER, self.setScale, self.scaleSlider) scaleControlBox.Add(scaleTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) scaleControlBox.Add(self.scaleSlider, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) sigSizer.Add(scaleControlBox, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(sigSizer, proportion=1, flag=wx.EXPAND)
def initFileControls(self): fileSizer = wx.BoxSizer(orient=wx.VERTICAL) fileControlBox = widgets.ControlBox(self, label='Data File', orient=wx.VERTICAL) self.fileTextCtrl = wx.TextCtrl(self, value=str('SAMPLE DATA'), style=wx.TE_READONLY) self.fileBrowseButton = wx.Button(self, label='Browse') fileControlBox.Add(self.fileTextCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) fileControlBox.Add(self.fileBrowseButton, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) fileSizer.Add(fileControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(fileSizer, proportion=1, flag=wx.EXPAND)
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) kernTypeControlBox = widgets.ControlBox(self, label='Kernel Type', orient=wx.HORIZONTAL) self.kernTypeComboBox = wx.ComboBox(self, choices=self.flt.kernMap.keys(), value=self.flt.kernType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setKernType, self.kernTypeComboBox) kernTypeControlBox.Add(self.kernTypeComboBox, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(kernTypeControlBox, proportion=1, flag=wx.ALL | wx.ALIGN_CENTER, border=8) widthControlBox = widgets.ControlBox(self, label='Width', orient=wx.HORIZONTAL) self.widthSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.width), min=2, max=100) self.Bind(wx.EVT_SPINCTRL, self.setWidth, self.widthSpinCtrl) widthControlBox.Add(self.widthSpinCtrl, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(widthControlBox, proportion=0, flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=8) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) from wx.lib.floatcanvas.ScreenShot import getScreenShotBitmap note1 = wx.StaticText(self, -1, errorText) note2 = wx.StaticText(self, -1, "This is what the FloatCanvas can look like:") S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 4) S.Add(wx.StaticBitmap(self,-1,getScreenShotBitmap()),0,wx.ALIGN_CENTER) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs") note2 = wx.StaticText(self, -1, "a separate frame") b = wx.Button(self, -1, "Open Demo Frame Now") b.Bind(wx.EVT_BUTTON, self.OnButton) S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5) S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def makeSettings(self, settingsSizer): # Translators: This is the static text of the Quick Profile Wizard dialog. msgIntro=_("Choose which options you want to reset to the default value for the Lambdas profile") self.introStxt=wx.StaticText(self,-1,label=msgIntro) settingsSizer.Add(self.introStxt,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.defaultTranslationTableCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Keep the LAMBDA braille table for the current language (%s)") % TABLE_NAME) self.defaultTranslationTableCheckBox.SetValue(True) settingsSizer.Add(self.defaultTranslationTableCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.brailleTetherToFocusCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Set the braille cursor to tether the focus")) self.brailleTetherToFocusCheckBox.SetValue(True) settingsSizer.Add(self.brailleTetherToFocusCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.disableReadByParagraphCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable the Braille reading by paragraph")) self.disableReadByParagraphCheckBox.SetValue(True) settingsSizer.Add(self.disableReadByParagraphCheckBox,border=10,flag=wx.BOTTOM) # Translators: This is the label for a checkbox in the # Quick Profile Wizard dialog. self.disableBrailleWordWrapCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Disable word wrappping of the braille line")) self.disableBrailleWordWrapCheckBox.SetValue(True) settingsSizer.Add(self.disableBrailleWordWrapCheckBox,border=10,flag=wx.BOTTOM)
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Bin Numpy Array") title.SetToolTipNew("Input array will be binned "+os.linesep+"according to the values below.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) title2 = wx.StaticText(self, label="Bin dimensions: ") vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.bdims=[{} for i in range(3)] self.bdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,1,20,60) self.bdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,1,20,60) self.bdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.bdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.bdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.bdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Filter array with median filter.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File: ", "",150,'*.npy') vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) title2 = wx.StaticText(self, label="Filter kernel dimensions: ") vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.kdims=[{} for i in range(3)] self.kdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,3,20,60) self.kdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,3,20,60) self.kdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.kdims[0], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.kdims[1], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) hbox.Add(self.kdims[2], 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.maxdev = SpinnerObject(self,"Normal deviation:",MAX_INT_16,0.0,0.1,0.5,150,150) self.maxdev.label.SetToolTipNew("Maximum element-wise normal deviation.") vbox.Add(self.maxdev, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="HIO Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100) vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="ER Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) #self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") #vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Phase-Only Algorithm") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent): self.start_iter = None wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="HIO Algorithm with positivity constraint") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.exp_amps = TextPanelObject(self, "Exp Amp: ", "",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.exp_amps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.chkbox_sqrt_expamps = wx.CheckBox(self, -1, 'Square Root Exp Amp', (50, 10)) self.chkbox_sqrt_expamps.SetValue(True) vbox.Add(self.chkbox_sqrt_expamps, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=5) self.support = TextPanelObject(self,"Support: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") self.support.label.SetToolTipNew("Support. If empty, previous instance will be used.") vbox.Add(self.support, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.mask = TextPanelObject(self,"Mask: ","",100,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.mask, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.beta = SpinnerObject(self,"Beta: ",1.0,0.0,0.01,0.9,100,100) vbox.Add(self.beta, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.niter = SpinnerObject(self,"Iterations: ",MAX_INT,1,1,1,100,100) vbox.Add(self.niter, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )
def __init__(self, parent, info): wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) if parent and parent.GetIcon(): self.SetIcon(parent.GetIcon()) self.SetMinSize((400, 300)) close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close")) ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE) ctrl.SetValue(info.License) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(close) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10) sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10) self.SetSizer(sizer) self.Layout() self.Show() self.SetEscapeId(close.GetId()) close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
def __init__(self, parent, enable_required=True): wx.Dialog.__init__(self, parent, title=_('Project properties'), style=wx.DEFAULT_DIALOG_STYLE) main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) main_sizer.AddGrowableCol(0) main_sizer.AddGrowableRow(0) self.ProjectProperties = ProjectPropertiesPanel( self, enable_required=enable_required) main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE) self.Bind(wx.EVT_BUTTON, self.OnOK, self.ButtonSizer.GetAffirmativeButton()) main_sizer.AddSizer(self.ButtonSizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.SetSizer(main_sizer) self.ProjectProperties.Fit() self.Fit()
def rgb(self, hist): panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) back = wx.BoxSizer( wx.VERTICAL ) back.Add(panel, 1, wx.EXPAND) sizer = wx.BoxSizer( wx.VERTICAL ) rgb = ['Red', 'Green', 'Blue'] for i in (0,1,2): histc = HistCanvas(panel) histc.set_hist(hist[i]) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+ rgb[i], wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 ) sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 ) mean, lim = np.dot(hist[i], range(256))/hist[i].sum(), np.where(hist[i]>0)[0] sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max()) txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 ) panel.SetSizer( sizer ) self.SetSizer(back) self.Fit()
def gray(self, hist): panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) back = wx.BoxSizer( wx.VERTICAL ) back.Add(panel, 1, wx.EXPAND) sizer = wx.BoxSizer( wx.VERTICAL ) histc = HistCanvas(panel) histc.set_hist(hist) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+'Gray', wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 ) sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 ) mean, lim = np.dot(hist, range(256))/hist.sum(), np.where(hist>0)[0] sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max()) txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 ) panel.SetSizer( sizer ) self.SetSizer(back) self.Fit()
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20) grid_sizer_1.Add(self.label_4, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20) grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20) grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20) #grid_sizer_1.Add(self.button_3, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20) #grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20) grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre()
def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(5, 2, 0, 0) grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20) grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20) grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20) #grid_sizer_1.Add(self.button_3, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20) #grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20) grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30) sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre()
def __init__(self, controller_uid): TopLevel.__init__(self, controller_uid) UIM = UIManager() controller = UIM.get(self._controller_uid) wx.Dialog.__init__(self, None, wx.ID_ANY, controller.model.title, pos=controller.model.pos, size=controller.model.size, style=controller.model.style ) self._objects = {} if controller.model.icon: self.icon = wx.Icon(controller.model.icon, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) if controller.model.maximized: self.Maximize() self.Bind(wx.EVT_MAXIMIZE, self.on_maximize) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_MOVE, self.on_move) dialog_box = wx.BoxSizer(wx.VERTICAL) self.SetSizer(dialog_box) self.mainpanel = self.AddCreateContainer('BoxSizer', self, proportion=1, flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND, border=10 ) button_sizer = self.CreateButtonSizer(controller.model.flags) dialog_box.Add(button_sizer, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10) dialog_box.Layout()
def InitUI(self): sb = wx.StaticText(self, label='Stop! Open or Create new project first!') ic = wx.ArtProvider.GetBitmap( wx.ART_TIP, size=(48,48) ) icn= wx.StaticBitmap(self,-1,ic,name='Stop') lbl_mt = wx.StaticText(self, label="") vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) vbox.Add(lbl_mt,flag=wx.CENTER, border=2) vbox.Add(sb,flag=wx.CENTER, border=2) vbox.Add(icn,flag=wx.CENTER, border=0) hbox2 = wx.BoxSizer(wx.HORIZONTAL) OButton = wx.Button(self, label='Open') NButton = wx.Button(self, label='New') hbox2.Add(OButton, flag=wx.CENTER, border=2) hbox2.Add(NButton, flag=wx.LEFT, border=5) vbox.Add(hbox2,flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=2) OButton.Bind(wx.EVT_BUTTON,self.OpenBtn) NButton.Bind(wx.EVT_BUTTON,self.NewBtn) self.Show() self.SetFocus() self.SetWindowStyle( wx.STAY_ON_TOP )
def _handle_connection_error(self, error_message=None): """Handle connection errors that might be thrown when initially connecting to IRIDA. Args: error_message: A more detailed error message than "Can't connect" """ logging.error("Handling connection error.") self.Freeze() connection_error_sizer = wx.BoxSizer(wx.HORIZONTAL) connection_error_header = wx.StaticText(self, label=u"? Uh-oh. I couldn't to connect to IRIDA.") connection_error_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) connection_error_header.SetForegroundColour(wx.Colour(255, 0, 0)) connection_error_header.Wrap(350) connection_error_sizer.Add(connection_error_header, flag=wx.LEFT | wx.RIGHT, border=5) self._sizer.Add(connection_error_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) if error_message: self._sizer.Add(wx.StaticText(self, label=wordwrap(error_message, 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) open_settings_button = wx.Button(self, label="Open Settings") self.Bind(wx.EVT_BUTTON, self._parent._open_settings, id=open_settings_button.GetId()) self._sizer.Add(open_settings_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Layout() self.Thaw() pub.unsubscribe(self._handle_connection_error, APIConnectorTopics.connection_error_topic)
def _finished_loading(self): """Update the display when the run scan is finished. When the `DirectoryScannerTopics.finished_run_scan` topic is received, add the upload button to the page so that the user can start the upload. """ if not self._invalid_sheets_panel.IsShown(): self.Freeze() if self._discovered_runs: upload_button = wx.Button(self, label="Upload") self._upload_sizer.Add(upload_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Bind(wx.EVT_BUTTON, self._start_upload, id=upload_button.GetId()) else: all_uploaded_sizer = wx.BoxSizer(wx.HORIZONTAL) all_uploaded_header = wx.StaticText(self, label=u"? All sample sheets uploaded.") all_uploaded_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) all_uploaded_header.SetForegroundColour(wx.Colour(51, 204, 51)) all_uploaded_header.Wrap(350) all_uploaded_sizer.Add(all_uploaded_header, flag=wx.LEFT | wx.RIGHT, border=5) self._sizer.Add(all_uploaded_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) all_uploaded_details = wx.StaticText(self, label="I scanned {}, but I didn't find any sample sheets that weren't already uploaded. Click 'Scan again' to try finding new runs.".format(self._get_default_directory())) all_uploaded_details.Wrap(350) self._sizer.Add(all_uploaded_details, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) scan_again = wx.Button(self, label="Scan again") self._sizer.Add(scan_again, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Bind(wx.EVT_BUTTON, self._settings_changed, id=scan_again.GetId()) self.Layout() self.Thaw()
def _upload_failed(self, exception=None): """The upload failed, add a button to restart the upload. Args: exception: the error that caused the upload. """ logging.info("Adding try again button on upload failure.") self.Freeze() try_again = wx.Button(self, label="Try again") self._upload_sizer.Add(try_again, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Bind(wx.EVT_BUTTON, self._retry_upload, id=try_again.GetId()) self.Layout() self.Thaw()
def initFreqs(self): lowHighFreqSizer = wx.BoxSizer(orient=wx.HORIZONTAL) lowFreqControlBox = widgets.ControlBox(self, label='Low Freq', orient=wx.VERTICAL) self.lowFreqFloatSpin = agwfs.FloatSpin(self, min_val=0.25, max_val=100.0, increment=1/4.0, value=self.pg.welchConfig.lowFreq) self.lowFreqFloatSpin.SetFormat('%f') self.lowFreqFloatSpin.SetDigits(4) self.Bind(agwfs.EVT_FLOATSPIN, self.setLowFreq, self.lowFreqFloatSpin) self.cp.offlineControls += [self.lowFreqFloatSpin] lowFreqControlBox.Add(self.lowFreqFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) lowHighFreqSizer.Add(lowFreqControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) highFreqControlBox = widgets.ControlBox(self, label='High Freq', orient=wx.VERTICAL) self.highFreqFloatSpin = agwfs.FloatSpin(self, min_val=0.25, max_val=100.0, increment=1/4.0, value=self.pg.welchConfig.highFreq) self.highFreqFloatSpin.SetFormat('%f') self.highFreqFloatSpin.SetDigits(4) self.Bind(agwfs.EVT_FLOATSPIN, self.setHighFreq, self.highFreqFloatSpin) self.cp.offlineControls += [self.highFreqFloatSpin] highFreqControlBox.Add(self.highFreqFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) lowHighFreqSizer.Add(highFreqControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(lowHighFreqSizer, proportion=0, flag=wx.EXPAND)
def initTrialSecs(self): secsSizer = wx.BoxSizer(orient=wx.HORIZONTAL) trainTrialSecsControlBox = widgets.ControlBox(self, label='Train Trial Secs', orient=wx.VERTICAL) self.trainTrialSecsFloatSpin = agwfs.FloatSpin(self, min_val=2.00, max_val=60.0, increment=1/4.0, value=self.pg.trainTrialSecs) self.trainTrialSecsFloatSpin.SetFormat('%f') self.trainTrialSecsFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setTrialSecs, self.trainTrialSecsFloatSpin) self.offlineControls += [self.trainTrialSecsFloatSpin] trainTrialSecsControlBox.Add(self.trainTrialSecsFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) secsSizer.Add(trainTrialSecsControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) pauseSecsControlBox = widgets.ControlBox(self, label='Pause Secs', orient=wx.VERTICAL) self.pauseSecsFloatSpin = agwfs.FloatSpin(self, min_val=0.25, max_val=10.0, increment=1/4.0, value=self.pg.pauseSecs) self.pauseSecsFloatSpin.SetFormat('%f') self.pauseSecsFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setPauseSecs, self.pauseSecsFloatSpin) self.offlineControls += [self.pauseSecsFloatSpin] pauseSecsControlBox.Add(self.pauseSecsFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) secsSizer.Add(pauseSecsControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(secsSizer, proportion=0, flag=wx.EXPAND)
def initTiming(self): timingSizer = wx.BoxSizer(orient=wx.HORIZONTAL) widthControlBox = widgets.ControlBox(self, label='Width Secs', orient=wx.VERTICAL) self.widthFloatSpin = agwfs.FloatSpin(self, min_val=0.2, max_val=5.0, increment=0.05, value=self.pg.width) self.widthFloatSpin.SetFormat('%f') self.widthFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setWidth, self.widthFloatSpin) self.offlineControls += [self.widthFloatSpin] widthControlBox.Add(self.widthFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) timingSizer.Add(widthControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) decisionSecsControlBox = widgets.ControlBox(self, label='Decision Secs', orient=wx.VERTICAL) self.decisionSecsFloatSpin = agwfs.FloatSpin(self, min_val=0.025, max_val=5.0, increment=0.025, value=self.pg.decisionSecs) self.decisionSecsFloatSpin.SetFormat('%f') self.decisionSecsFloatSpin.SetDigits(4) self.Bind(agwfs.EVT_FLOATSPIN, self.setDecisionSecs, self.decisionSecsFloatSpin) self.offlineControls += [self.decisionSecsFloatSpin] decisionSecsControlBox.Add(self.decisionSecsFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) timingSizer.Add(decisionSecsControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(timingSizer, proportion=0, flag=wx.EXPAND)
def initMethod(self): methodControlBox = widgets.ControlBox(self, label='Method', orient=wx.VERTICAL) self.methodComboBox = wx.ComboBox(self, value=self.pg.method, style=wx.CB_READONLY, choices=('Welch Power', 'Autoregressive', 'Time Embedded Net', 'Convolutional Net')) self.Bind(wx.EVT_COMBOBOX, self.setMethod, self.methodComboBox) self.offlineControls += [self.methodComboBox] methodControlBox.Add(self.methodComboBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(methodControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.methodConfigSizer = wx.BoxSizer(orient=wx.VERTICAL) self.welchPanel = WelchConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.welchPanel, proportion=1, flag=wx.EXPAND) self.autoregPanel = AutoregConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.autoregPanel, proportion=1, flag=wx.EXPAND) self.tdeNetPanel = ConvNetConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.tdeNetPanel, proportion=1, flag=wx.EXPAND) self.convNetPanel = ConvNetConfigPanel(self, pg=self.pg, cp=self) self.methodConfigSizer.Add(self.convNetPanel, proportion=1, flag=wx.EXPAND) self.sizer.Add(self.methodConfigSizer, proportion=1, flag=wx.EXPAND) self.methodConfig = self.welchPanel
def initControls(self): nFreqControlBox = widgets.ControlBox(self, label='Num Freqs', orient=wx.HORIZONTAL) self.nFreqText = wx.StaticText(self, label='%3d' % self.pg.waveletConfig.nFreq) nFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) nFreqTextSizer.Add(self.nFreqText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.nFreqSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=self.pg.waveletConfig.nFreq/5, minValue=1, maxValue=100) nFreqControlBox.Add(nFreqTextSizer, proportion=0, flag=wx.TOP, border=10) nFreqControlBox.Add(self.nFreqSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setNFreq, self.nFreqSlider) self.sizer.Add(nFreqControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) spanControlBox = widgets.ControlBox(self, label='Span', orient=wx.HORIZONTAL) self.spanText = wx.StaticText(self, label='%3d' % self.pg.waveletConfig.span) spanTextSizer = wx.BoxSizer(orient=wx.VERTICAL) spanTextSizer.Add(self.spanText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.spanSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=self.pg.waveletConfig.span, minValue=1, maxValue=50) spanControlBox.Add(spanTextSizer, proportion=0, flag=wx.TOP, border=10) spanControlBox.Add(self.spanSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setSpan, self.spanSlider) self.sizer.Add(spanControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initLayout(self): controlSizer = wx.BoxSizer(orient=wx.VERTICAL) controlSizer.Add(self.filterControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) controlSizer.Add(self.chanControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.widthControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.scaleControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.decimateControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.interpControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.refreshControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.methodControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT| wx.EXPAND, border=10) controlSizer.Add(self.methodConfigSizer, proportion=1, flag=wx.EXPAND) self.sizer.Add(controlSizer, proportion=0, flag=wx.EXPAND) # set sizer and figure layout self.initStandardLayout() self.FitInside() self.fourierPanel.Hide() self.FitInside()
def initSegWindow(self): windowSizer = wx.BoxSizer(orient=wx.HORIZONTAL) windowStartControlBox = widgets.ControlBox(self, label='Window Start', orient=wx.VERTICAL) self.windowStartFloatSpin = agwfs.FloatSpin(self, min_val=0.0, max_val=0.25, increment=1/40.0, value=self.pg.windowStart) self.windowStartFloatSpin.SetFormat("%f") self.windowStartFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setWindowStart, self.windowStartFloatSpin) self.offlineControls += [self.windowStartFloatSpin] windowStartControlBox.Add(self.windowStartFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) windowSizer.Add(windowStartControlBox, proportion=1, flag=wx.RIGHT | wx.BOTTOM | wx.LEFT | wx.EXPAND, border=10) windowEndControlBox = widgets.ControlBox(self, label='Window End', orient=wx.VERTICAL) self.windowEndFloatSpin = agwfs.FloatSpin(self, min_val=0.3, max_val=1.5, increment=1/20.0, value=self.pg.windowEnd) self.windowEndFloatSpin.SetFormat("%f") self.windowEndFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setWindowEnd, self.windowEndFloatSpin) self.offlineControls += [self.windowEndFloatSpin] windowEndControlBox.Add(self.windowEndFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) windowSizer.Add(windowEndControlBox, proportion=1, flag=wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=10) self.sizer.Add(windowSizer, proportion=0, flag=wx.EXPAND)
def initClassifierKind(self): classifierKindControlBox = widgets.ControlBox(self, label='Classifier', orient=wx.VERTICAL) self.classifierKindComboBox = wx.ComboBox(self, value=self.pg.classifierKind, style=wx.CB_READONLY, choices=self.pg.classifierChoices) self.Bind(wx.EVT_COMBOBOX, self.setClassifierKind, self.classifierKindComboBox) self.offlineControls += [self.classifierKindComboBox] classifierKindControlBox.Add(self.classifierKindComboBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(classifierKindControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initNTrial(self): trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL) trialControlBox = widgets.ControlBox(self, label='Num Trials', orient=wx.VERTICAL) self.trialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP, value=str(self.pg.nTrials), min=1, max=100) self.Bind(wx.EVT_SPINCTRL, self.setNTrial, self.trialSpinCtrl) self.offlineControls += [self.trialSpinCtrl] trialControlBox.Add(self.trialSpinCtrl, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) trialSizer.Add(trialControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.EXPAND, border=10) pauseControlBox = widgets.ControlBox(self, label='Pause Secs', orient=wx.VERTICAL) self.pauseFloatSpin = agwfs.FloatSpin(self, min_val=0.5, max_val=5.0, increment=0.5, value=self.pg.pause) self.pauseFloatSpin.SetFormat("%f") self.pauseFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setPause, self.pauseFloatSpin) self.offlineControls += [self.pauseFloatSpin] pauseControlBox.Add(self.pauseFloatSpin, proportion=0, flag=wx.ALL | wx.EXPAND, border=12) trialSizer.Add(pauseControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
def initIntervals(self): intervalSizer = wx.BoxSizer(orient=wx.HORIZONTAL) siControlBox = widgets.ControlBox(self, label='Stim Secs', orient=wx.VERTICAL) self.siFloatSpin = agwfs.FloatSpin(self, min_val=0.025, max_val=0.5, increment=1/40.0, value=self.pg.si) self.siFloatSpin.SetFormat("%f") self.siFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setSI, self.siFloatSpin) self.offlineControls += [self.siFloatSpin] siControlBox.Add(self.siFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) intervalSizer.Add(siControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.EXPAND, border=10) isiControlBox = widgets.ControlBox(self, label='Inter-Stim Secs', orient=wx.VERTICAL) self.isiFloatSpin = agwfs.FloatSpin(self, min_val=0.05, max_val=1.0, increment=1/40.0, value=self.pg.isi) self.isiFloatSpin.SetFormat("%f") self.isiFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setISI, self.isiFloatSpin) self.offlineControls += [self.isiFloatSpin] isiControlBox.Add(self.isiFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) intervalSizer.Add(isiControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(intervalSizer, proportion=0, flag=wx.EXPAND)
def initSegWindow(self): windowSizer = wx.BoxSizer(orient=wx.HORIZONTAL) windowStartControlBox = widgets.ControlBox(self, label='Window Start', orient=wx.VERTICAL) self.windowStartFloatSpin = agwfs.FloatSpin(self, min_val=0.0, max_val=0.25, increment=1/40.0, value=self.pg.windowStart) self.windowStartFloatSpin.SetFormat("%f") self.windowStartFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setWindowStart, self.windowStartFloatSpin) self.offlineControls += [self.windowStartFloatSpin] windowStartControlBox.Add(self.windowStartFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) windowSizer.Add(windowStartControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.EXPAND, border=10) windowEndControlBox = widgets.ControlBox(self, label='Window End', orient=wx.VERTICAL) self.windowEndFloatSpin = agwfs.FloatSpin(self, min_val=0.3, max_val=1.5, increment=1/20.0, value=self.pg.windowEnd) self.windowEndFloatSpin.SetFormat("%f") self.windowEndFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setWindowEnd, self.windowEndFloatSpin) self.offlineControls += [self.windowEndFloatSpin] windowEndControlBox.Add(self.windowEndFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) windowSizer.Add(windowEndControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(windowSizer, proportion=0, flag=wx.EXPAND)
def initClassifier(self): classifierKindControlBox = widgets.ControlBox(self, label='Classifier', orient=wx.VERTICAL) self.classifierKindComboBox = wx.ComboBox(self, value=self.pg.classifierKind, style=wx.CB_READONLY, choices=self.pg.classifierChoices) self.Bind(wx.EVT_COMBOBOX, self.setClassifierKind, self.classifierKindComboBox) self.offlineControls += [self.classifierKindComboBox] classifierKindControlBox.Add(self.classifierKindComboBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) self.sizer.Add(classifierKindControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initControls(self): orderControlBox = widgets.ControlBox(self, label='Model Order', orient=wx.HORIZONTAL) self.orderText = wx.StaticText(self, label='%3d' % self.pg.autoregConfig.order) orderTextSizer = wx.BoxSizer(orient=wx.VERTICAL) orderTextSizer.Add(self.orderText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.orderSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=self.pg.autoregConfig.order, minValue=1, maxValue=100) orderControlBox.Add(orderTextSizer, proportion=0, flag=wx.TOP, border=10) orderControlBox.Add(self.orderSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setOrder, self.orderSlider) self.sizer.Add(orderControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) nFreqControlBox = widgets.ControlBox(self, label='Num Freqs', orient=wx.HORIZONTAL) self.nFreqText = wx.StaticText(self, label='%3d' % self.pg.autoregConfig.nFreq) nFreqTextSizer = wx.BoxSizer(orient=wx.VERTICAL) nFreqTextSizer.Add(self.nFreqText, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=8) self.nFreqSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=self.pg.autoregConfig.nFreq/5, minValue=1, maxValue=100) nFreqControlBox.Add(nFreqTextSizer, proportion=0, flag=wx.TOP, border=10) nFreqControlBox.Add(self.nFreqSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SLIDER, self.setNFreq, self.nFreqSlider) self.sizer.Add(nFreqControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
def initLayout(self): controlSizer = wx.BoxSizer(orient=wx.VERTICAL) controlSizer.Add(self.filterControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) controlSizer.Add(self.widthControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.decimateControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.qualityControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.refreshControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) controlSizer.Add(self.methodControlBox, proportion=0, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT| wx.EXPAND, border=10) controlSizer.Add(self.methodConfigSizer, proportion=1, flag=wx.EXPAND) self.sizer.Add(controlSizer, proportion=0, flag=wx.EXPAND) # set sizer and figure layout self.initStandardLayout() self.FitInside() self.autoregPanel.Hide() self.FitInside()
def initFeatures(self): featureSizer = wx.BoxSizer(orient=wx.HORIZONTAL) spanControlBox = widgets.ControlBox(self, label='Welch Span', orient=wx.VERTICAL) self.spanFloatSpin = agwfs.FloatSpin(self, min_val=0.1, max_val=3.0, increment=0.05, value=self.pg.welchConfig.span) self.spanFloatSpin.SetFormat('%f') self.spanFloatSpin.SetDigits(3) self.Bind(agwfs.EVT_FLOATSPIN, self.setSpan, self.spanFloatSpin) self.cp.offlineControls += [self.spanFloatSpin] spanControlBox.Add(self.spanFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) featureSizer.Add(spanControlBox, proportion=1, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) # radio buttons for turning log transform on and off logTransControlBox = widgets.ControlBox(self, label='Log Trans', orient=wx.HORIZONTAL) logTransOnRbtn = wx.RadioButton(self, label='On', style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.setLogTransOn, logTransOnRbtn) logTransControlBox.Add(logTransOnRbtn, proportion=0, flag=wx.ALL, border=10) self.cp.offlineControls += [logTransOnRbtn] logTransOffRbtn = wx.RadioButton(self, label='Off') self.Bind(wx.EVT_RADIOBUTTON, self.setLogTransOff, logTransOffRbtn) logTransControlBox.Add(logTransOffRbtn, proportion=0, flag=wx.ALL, border=10) self.cp.offlineControls += [logTransOffRbtn] if self.pg.welchConfig.logTrans: logTransOnRbtn.SetValue(True) else: logTransOffRbtn.SetValue(True) featureSizer.Add(logTransControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(featureSizer, proportion=0, flag=wx.EXPAND)
def initGainLoss(self): gainLossSizer = wx.BoxSizer(orient=wx.VERTICAL) gainControlBox = widgets.ControlBox(self, label='Gain', orient=wx.HORIZONTAL) self.gainText = wx.StaticText(self, label='%0.2f' % self.pg.gain) gainTextSizer = wx.BoxSizer(orient=wx.VERTICAL) gainTextSizer.Add(self.gainText, proportion=1, flag=wx.EXPAND) self.gainSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=int(self.pg.gain*100.0), minValue=1, maxValue=100) self.Bind(wx.EVT_SLIDER, self.setGain, self.gainSlider) gainControlBox.Add(gainTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) gainControlBox.Add(self.gainSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) gainLossSizer.Add(gainControlBox, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) lossControlBox = widgets.ControlBox(self, label='Loss', orient=wx.HORIZONTAL) self.lossText = wx.StaticText(self, label='%0.2f' % self.pg.loss) lossTextSizer = wx.BoxSizer(orient=wx.VERTICAL) lossTextSizer.Add(self.lossText, proportion=1, flag=wx.EXPAND) self.lossSlider = wx.Slider(self, style=wx.SL_HORIZONTAL, value=int(self.pg.loss*100.0), minValue=1, maxValue=100) self.Bind(wx.EVT_SLIDER, self.setLoss, self.lossSlider) lossControlBox.Add(lossTextSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) lossControlBox.Add(self.lossSlider, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) gainLossSizer.Add(lossControlBox, flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10) self.sizer.Add(gainLossSizer, proportion=0, flag=wx.EXPAND)