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()
python类BOTTOM的实例源码
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 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 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)