我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.TOP。
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 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 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 initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) self.filtTypeComboBox = wx.ComboBox(self, choices=self.flt.filtMap.keys(), value=self.flt.filtType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setFiltType, self.filtTypeComboBox) optionsSizer.Add(self.filtTypeComboBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.ALIGN_CENTER, border=20) self.zeroPhaseCheckBox = wx.CheckBox(self, label='Zero Phase') self.zeroPhaseCheckBox.SetValue(self.flt.zeroPhase) self.Bind(wx.EVT_CHECKBOX, self.setZeroPhase, self.zeroPhaseCheckBox) optionsSizer.Add(self.zeroPhaseCheckBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.ALIGN_CENTER, border=20) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.add_toolbar() # comment this out for no toolbar self.axes.set_title("NURBS and B-Spline Algorithms: ")
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Sum or Subtract Arrays") title.SetToolTipNew("Sum or subtract array2 from array 1") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input File 1: ", "",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.input_filename1 = TextPanelObject(self, "Input File 2: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename1, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.addsub = RadioBoxNew(self, label="Add or Subtract:", choices=['Add','Subtract'], majorDimension=2, style=wx.RA_SPECIFY_COLS) self.addsub.SetToolTipNew("Add or Subtract") vbox.Add(self.addsub, 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 = StaticTextNew(self, label="Rotate Support Array") title.SetToolTipNew("Rotate support (binary complex) arrays only. \nStrange results will ensue if used on data arrays.") 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: ", "data_rotated.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.rotationaxis = SpinnerObject(self,"Axis:",3,1,1,1,150,150) self.rotationaxis.label.SetToolTipNew("Rotation axis.") vbox.Add(self.rotationaxis, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.rotationangle = SpinnerObject(self,"Angle:",360,-360,1,0,150,150) self.rotationangle.label.SetToolTipNew("Rotation angle in degrees.") vbox.Add(self.rotationangle, 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="Create binary mask from Numpy array") 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: ", "mask.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.max = SpinnerObject(self,"Maximum Value:",MAX_INT,MIN_INT,1.0,MAX_INT,150,150) self.max.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") self.min = SpinnerObject(self,"Minimum Value:",MAX_INT,MIN_INT,1,50.0,150,150) self.min.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") vbox.Add(self.max, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add(self.min, 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 = 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 = StaticTextNew(self, label="Threshold data in Numpy array") title.SetToolTipNew("Data outside range is set to zero.") 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: ", "data_thresh.npy",150,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.max = SpinnerObject(self,"Maximum Value:",MAX_INT,MIN_INT,1.0,MAX_INT,150,150) self.max.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") self.min = SpinnerObject(self,"Minimum Value:",MAX_INT,MIN_INT,1,50.0,150,150) self.min.label.SetToolTipNew("Data within the min/max range "+os.linesep+"will result in a non-zero mask value.") vbox.Add(self.max, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add(self.min, 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): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Numpy array with coordinates to VTK array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input file: ", "input.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.coords_filename = TextPanelObject(self, "Co-ord's file: ", "coordinates.npy",150,'*.npy') vbox.Add(self.coords_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.output_filename = TextPanelObject(self, "Output file: ", "output.vtk",150,"VTK files (*.vtk)|*.vtk|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) vbox.Add((-1, 5)) self.rbampphase = wx.RadioBox(self, label="Type", choices=['Amplitude','Phase'], majorDimension=2, style=wx.RA_SPECIFY_COLS) vbox.Add(self.rbampphase,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): wx.Panel.__init__(self, parent, -1) # ????? self.response_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE) response_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response")) response_sizer.Add(self.response_text, 1, wx.EXPAND) # ??????? self.doc_text = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) doc_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Document")) doc_sizer.Add(self.doc_text, 1, wx.EXPAND) main_box = wx.BoxSizer(wx.VERTICAL) main_box.Add(response_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) main_box.Add(doc_sizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5) self.SetSizer(main_box) self.response_text.Bind(wx.EVT_CHAR, self.on_key_down) self.doc_text.Bind(wx.EVT_CHAR, self.on_key_down)
def __init__(self, parent,**kwargs): wx.Panel.__init__(self,parent,**kwargs) self.parent = parent self.figure = matplotlib.figure.Figure() self.canvas = wxaggb.FigureCanvasWxAgg(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.Bind(wx.EVT_SIZE, self.sizeHandler) # canvas is your canvas, and root is your parent (Frame, TopLevel, Tk instance etc.) #self.zoomhandle = wxaggb.NavigationToolbar2WxAgg(self.canvas) #self.toolbar = wxb.NavigationToolbar2Wx(self.canvas) #self.toolbar.Realize() #self.toolbar.update() self.cmap = matplotlib.cm.RdYlBu_r
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: CE_TE.__do_layout sizer_5 = wx.BoxSizer(wx.VERTICAL) sizer_8 = wx.BoxSizer(wx.HORIZONTAL) sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_6.Add(self.label_1, 0, wx.LEFT, 0) sizer_6.Add(self.text_ctrl_1, 0, wx.LEFT|wx.ALIGN_RIGHT, 35) sizer_5.Add(sizer_6, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 30) sizer_7.Add(self.label_2, 0, wx.LEFT, 0) sizer_7.Add(self.text_ctrl_2, 0, wx.LEFT, 35) sizer_5.Add(sizer_7, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 30) sizer_8.Add(self.button_2, 0, 0, 0) sizer_8.Add(self.button_1, 0, wx.LEFT, 35) sizer_5.Add(sizer_8, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 20) self.SetSizer(sizer_5) self.text_ctrl_1.SetFocus() self.Layout() # end wxGlade
def __do_layout(self): # begin wxGlade: working_days.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(4, 2, 10, 10) grid_sizer_1.Add(self.label_1, 0, wx.LEFT, 20) grid_sizer_1.Add(self.combo_box_1, 0, wx.RIGHT, 20) grid_sizer_1.Add(self.label_5, 0, wx.LEFT, 74) grid_sizer_1.Add((0, 0), 0, 0, 0) grid_sizer_1.Add(self.label_2, 0, wx.LEFT | wx.TOP, 7) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.label_3, 0, wx.LEFT | wx.TOP, 7) grid_sizer_1.Add(self.text_ctrl_2, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, wx.LEFT | wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_3, 0, 0, 0) grid_sizer_1.Add(self.button_1, 0, wx.LEFT, 60) grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 10) sizer_1.Add(grid_sizer_1, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: disclaimer_win.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_6_copy = wx.BoxSizer(wx.HORIZONTAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_3.Add(self.label_1, 1, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 10) sizer_3.Add(self.text_ctrl_1, 5, wx.EXPAND, 0) sizer_5.Add(self.button_disagree, 0, wx.RIGHT, 20) sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_6_copy.Add(self.button_agree, 0, wx.LEFT, 20) sizer_4.Add(sizer_6_copy, 1, 0, 0) sizer_6.Add(sizer_4, 1, wx.EXPAND, 0) sizer_3.Add(sizer_6, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_2.Add(sizer_3, 1, wx.EXPAND, 0) sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) self.SetSizer(sizer_1) self.Layout() self.Centre() # end wxGlade
def __do_layout(self): # begin wxGlade: chng_pass.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) grid_sizer_1 = wx.GridSizer(4, 2, 0, 0) grid_sizer_1.Add(self.label_3, 0, wx.TOP, 10) grid_sizer_1.Add(self.combo_box_1, 0, 0, 0) grid_sizer_1.Add(self.label_4, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_1, 0, 0, 0) grid_sizer_1.Add(self.label_5, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_2, 0, 0, 0) grid_sizer_1.Add(self.label_6, 0, wx.TOP, 10) grid_sizer_1.Add(self.text_ctrl_3, 0, 0, 0) sizer_2.Add(grid_sizer_1, 1, wx.EXPAND, 0) sizer_3.Add(self.button_1, 0, wx.LEFT, 80) sizer_3.Add(self.button_2, 0, wx.LEFT, 30) sizer_2.Add(sizer_3, 0, wx.TOP | wx.EXPAND, 20) sizer_1.Add(sizer_2, 1, wx.ALL | wx.EXPAND, 20) self.SetSizer(sizer_1) sizer_1.Fit(self) 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.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 __do_layout(self): # begin wxGlade: add_academic_year.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(2, 1, 10, 10) sizer_4 = wx.BoxSizer(wx.VERTICAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_3.Add(self.label_3, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.text_ctrl_1, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0) sizer_3.Add(self.text_ctrl_2, 0, wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer_1.Add(sizer_3, 1, wx.EXPAND, 0) sizer_5.Add(self.button_close, 0, wx.RIGHT, 20) sizer_5.Add(self.button_add, 0, wx.LEFT, 20) sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_VERTICAL, 10) grid_sizer_1.Add(sizer_4, 1, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 30) sizer_2.Add(grid_sizer_1, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) sizer_1.Add(sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) self.frame = parent sizer = wx.BoxSizer(wx.VERTICAL) hSizer = wx.BoxSizer(wx.HORIZONTAL) for num in range(4): label = "Button %s" % num btn = wx.Button(self, label=label) sizer.Add(btn, 0, wx.ALL, 5) hSizer.Add((1,1), 1, wx.EXPAND) hSizer.Add(sizer, 0, wx.TOP, 100) hSizer.Add((1,1), 0, wx.ALL, 75) self.SetSizer(hSizer) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
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 _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 __init__(self, parent, sheets_directory): """Initalize InvalidSampleSheetsPanel. Args: parent: the owning Window sheets_directory: the parent directory for searching sample sheets. This argument is used in the error message that's displayed to the user to tell them where to look to fix any issues. """ wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) header = wx.StaticText(self, label=u"? Looks like some sample sheets are not valid.") header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) header.SetForegroundColour(wx.Colour(255, 0, 0)) header.Wrap(350) self._sizer.Add(header,flag=wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER, border=5) self._sizer.Add(wx.StaticText(self, label=wordwrap(( "I found the following sample sheets in {}, but I couldn't understand " "their contents. Check these sample sheets in an editor outside " "of the uploader, then click the 'Scan Again' button below.").format(sheets_directory), 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self._errors_tree = wx.TreeCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_LINES_AT_ROOT | wx.TR_HIDE_ROOT) self._errors_tree_root = self._errors_tree.AddRoot("") self._sizer.Add(self._errors_tree, flag=wx.EXPAND, proportion=1) scan_again_button = wx.Button(self, label="Scan Again") self.Bind(wx.EVT_BUTTON, lambda evt: send_message(SettingsDialog.settings_closed_topic), id=scan_again_button.GetId()) self._sizer.Add(scan_again_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) pub.subscribe(self._sample_sheet_error, DirectoryScannerTopics.garbled_sample_sheet) pub.subscribe(self._sample_sheet_error, DirectoryScannerTopics.missing_files)
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 initGridLayout(self): gridLayoutControlBox = widgets.ControlBox(self, label='Layout', orient=wx.VERTICAL) topSizer = wx.BoxSizer(orient=wx.HORIZONTAL) bottomSizer = wx.BoxSizer(orient=wx.HORIZONTAL) self.gridLayoutLowButton = wx.Button(self, label='Low') self.gridLayoutUppButton = wx.Button(self, label='Upp') self.gridLayoutNumButton = wx.Button(self, label='Num') self.gridLayoutEtcButton = wx.Button(self, label='Etc') self.gridLayoutSymButton = wx.Button(self, label='Sym') topSizer.Add(self.gridLayoutLowButton, proportion=0, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=10) self.Bind(wx.EVT_BUTTON, self.setGridLayoutLow, self.gridLayoutLowButton) topSizer.Add(self.gridLayoutUppButton, proportion=0, flag=wx.TOP | wx.BOTTOM, border=10) self.Bind(wx.EVT_BUTTON, self.setGridLayoutUpp, self.gridLayoutUppButton) topSizer.Add(self.gridLayoutNumButton, proportion=0, flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10) self.Bind(wx.EVT_BUTTON, self.setGridLayoutNum, self.gridLayoutNumButton) bottomSizer.Add(self.gridLayoutEtcButton, proportion=0, flag=wx.LEFT | wx.BOTTOM, border=10) self.Bind(wx.EVT_BUTTON, self.setGridLayoutEtc, self.gridLayoutEtcButton) bottomSizer.Add(self.gridLayoutSymButton, proportion=0, flag=wx.RIGHT | wx.BOTTOM , border=10) self.Bind(wx.EVT_BUTTON, self.setGridLayoutSym, self.gridLayoutSymButton) gridLayoutControlBox.Add(topSizer, proportion=0, flag=wx.EXPAND) gridLayoutControlBox.Add(bottomSizer, proportion=0, flag=wx.EXPAND) self.sizer.Add(gridLayoutControlBox, 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 initTiming(self): timingSizer = wx.BoxSizer(orient=wx.HORIZONTAL) widthControlBox = widgets.ControlBox(self, label='Train Width', orient=wx.VERTICAL) self.widthFloatSpin = agwfs.FloatSpin(self, min_val=0.5, max_val=60.0, increment=0.25, 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.ALL | wx.EXPAND, border=10) retrainDelayControlBox = widgets.ControlBox(self, label='Retrain Delay', orient=wx.VERTICAL) self.retrainDelayFloatSpin = agwfs.FloatSpin(self, min_val=2.0, max_val=60.0, increment=0.25, value=self.pg.retrainDelay) self.retrainDelayFloatSpin.SetFormat('%f') self.retrainDelayFloatSpin.SetDigits(4) self.Bind(agwfs.EVT_FLOATSPIN, self.setRetrainDelay, self.retrainDelayFloatSpin) self.offlineControls += [self.retrainDelayFloatSpin] retrainDelayControlBox.Add(self.retrainDelayFloatSpin, proportion=1, flag=wx.ALL | wx.EXPAND, border=10) timingSizer.Add(retrainDelayControlBox, proportion=1, flag=wx.BOTTOM | wx.RIGHT | wx.TOP | wx.EXPAND, border=10) self.sizer.Add(timingSizer, proportion=0, flag=wx.EXPAND)
def initRateControls(self): """Initialize the sample rate and poll size controls. """ rateSizer = wx.BoxSizer(orient=wx.VERTICAL) pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL) self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP, value=str(self.src.pollSize), min=1, max=32) pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl) rateSizer.Add(pollSizeControlBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10) self.sizer.Add(rateSizer)
def initRateControls(self): """Initialize the sample rate and poll size controls. """ rateSizer = wx.BoxSizer(orient=wx.VERTICAL) pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL) self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP, value=str(self.src.pollSize), min=1, max=32) pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl) rateSizer.Add(pollSizeControlBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10) sampRates = np.array((128,256,512,1024)) self.sampRateRadios = [wx.RadioButton(self, label=str(sampRates[0])+'Hz', style=wx.RB_GROUP)] +\ [wx.RadioButton(self, label=str(sr)+'Hz') for sr in sampRates[1:]] self.sampRateRadios[0].SetValue(True) sampRateControlBox= widgets.ControlBox(self, label='Sample Rate', orient=wx.VERTICAL) for sr,rbtn in zip(sampRates, self.sampRateRadios): def sampRadioWrapper(event, sr=sr): self.src.setSampRate(sr) self.Bind(wx.EVT_RADIOBUTTON, sampRadioWrapper, id=rbtn.GetId()) for rbtn in self.sampRateRadios[:-1]: sampRateControlBox.Add(rbtn, proportion=0, flag=wx.TOP | wx.LEFT | wx.RIGHT, border=10) sampRateControlBox.Add(self.sampRateRadios[-1], proportion=0, flag=wx.ALL, border=10) rateSizer.Add(sampRateControlBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT, border=10) self.sizer.Add(rateSizer)
def initRateControls(self): """Initialize the sample rate and poll size controls. """ rateSizer = wx.BoxSizer(orient=wx.VERTICAL) pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL) self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP, value=str(self.src.pollSize), min=1, max=32) pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10) self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl) rateSizer.Add(pollSizeControlBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10) sampRates = np.array((128,256,512,1024)) self.sampRateRadios = [wx.RadioButton(self, label=str(sampRates[0])+'Hz', style=wx.RB_GROUP)] +\ [wx.RadioButton(self, label=str(sr)+'Hz') for sr in sampRates[1:]] self.sampRateRadios[0].SetValue(True) sampRateControlBox = widgets.ControlBox(self, label='Sample Rate', orient=wx.VERTICAL) for sr,rbtn in zip(sampRates, self.sampRateRadios): def sampRadioWrapper(event, sr=sr): try: self.src.setSampRate(sr) except Exception as e: wx.LogError('Failed to set sample rate: ' + str(e.message)) self.Bind(wx.EVT_RADIOBUTTON, sampRadioWrapper, id=rbtn.GetId()) for rbtn in self.sampRateRadios[:-1]: sampRateControlBox.Add(rbtn, proportion=0, flag=wx.TOP | wx.LEFT | wx.RIGHT, border=10) sampRateControlBox.Add(self.sampRateRadios[-1], proportion=0, flag=wx.ALL, border=10) rateSizer.Add(sampRateControlBox, proportion=0, flag=wx.BOTTOM | wx.RIGHT, border=10) self.sizer.Add(rateSizer)
def initResponse(self): self.freqResponseFig = plt.Figure() self.freqResponseCanvas = FigureCanvas(parent=self, id=wx.ID_ANY, figure=self.freqResponseFig) self.freqResponseAx = self.freqResponseFig.add_subplot(1,1,1) #self.freqResponseFig.tight_layout() self.phaseResponseFig = plt.Figure() self.phaseResponseCanvas = FigureCanvas(parent=self, id=wx.ID_ANY, figure=self.phaseResponseFig) self.phaseResponseAx = self.phaseResponseFig.add_subplot(1,1,1) #self.freqResponseFig.tight_layout() responseSizer = wx.BoxSizer(wx.VERTICAL) freqResponseControlBox = widgets.ControlBox(self, label='Freqency Response', orient=wx.VERTICAL) freqResponseControlBox.Add(self.freqResponseCanvas, proportion=1, flag=wx.ALL | wx.EXPAND, border=8) responseSizer.Add(freqResponseControlBox, proportion=1, flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=10) phaseResponseControlBox = widgets.ControlBox(self, label='Phase Response', orient=wx.VERTICAL) phaseResponseControlBox.Add(self.phaseResponseCanvas, proportion=1, flag=wx.ALL | wx.EXPAND, border=8) responseSizer.Add(phaseResponseControlBox, proportion=1, flag=wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=10) self.bottomSizer.Add(responseSizer, proportion=1, flag=wx.EXPAND) self.freqResponseCanvas.SetMinSize((0,0)) self.phaseResponseCanvas.SetMinSize((0,0)) # could we prevent resize when panel is not visible? XXX - idfah self.freqResponseLastSize = (0,0) self.freqResponseCanvas.Bind(wx.EVT_SIZE, self.freqResponseResize) self.phaseResponseLastSize = (0,0) self.phaseResponseCanvas.Bind(wx.EVT_SIZE, self.phaseResponseResize) self.updateResponse()
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) self.filtTypeComboBox = wx.ComboBox(self, choices=self.flt.filtMap.keys(), value=self.flt.filtType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setFiltType, self.filtTypeComboBox) optionsSizer.Add(self.filtTypeComboBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.ALIGN_CENTER, border=20) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) # sizes should only be odd, easiest way is to implement this as slider with odd values XXX - idfah sizeControlBox = widgets.ControlBox(self, label='Size', orient=wx.HORIZONTAL) self.sizeSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.size), min=3, max=100) self.Bind(wx.EVT_SPINCTRL, self.setSize, self.sizeSpinCtrl) sizeControlBox.Add(self.sizeSpinCtrl, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(sizeControlBox, proportion=0, flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=8) # need to add slider for noise parameter XXX - idfah self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) self.ztv_frame = self.GetTopLevelParent() self.ztv_frame.primary_image_panel.popup_menu_cursor_modes.append('Slice plot') self.ztv_frame.primary_image_panel.available_cursor_modes['Slice plot'] = { 'set-to-mode':self.set_cursor_to_plot_mode, 'on_button_press':self.on_button_press, 'on_motion':self.on_motion, 'on_button_release':self.on_button_release} for cur_key in ['c', 'C', 'v', 'V', 'y', 'Y']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_column_plot for cur_key in ['r', 'R', 'h', 'H', 'x', 'X']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_row_plot for cur_key in ['z', 'Z']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_stack_plot self.primary_image_patch = None self.sizer = wx.BoxSizer(wx.VERTICAL) self.plot_panel = PlotPlotPanel(self) self.sizer.Add(self.plot_panel, 1, wx.LEFT | wx.TOP | wx.EXPAND) self.hideshow_button = wx.Button(self, wx.ID_ANY, u"Hide", wx.DefaultPosition, wx.DefaultSize, 0) self.sizer.Add(self.hideshow_button, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM, 2) self.hideshow_button.Bind(wx.EVT_BUTTON, self.on_hideshow_button) self.SetSizer(self.sizer) self.Fit() self.start_pt = wx.RealPoint(0., 0.) self.end_pt = wx.RealPoint(0., 0.) self.redraw() pub.subscribe(self.on_new_xy0, 'set-new-slice-plot-xy0') pub.subscribe(self.on_new_xy1, 'set-new-slice-plot-xy1') pub.subscribe(self.queue_redraw, 'primary-xy-limits-changed') pub.subscribe(self.queue_redraw, 'recalc-display-image-called') pub.subscribe(self.remove_overplot_on_image, 'hide-plot-panel-overplot') pub.subscribe(self.redraw_overplot_on_image, 'show-plot-panel-overplot') pub.subscribe(self.publish_xy0xy1_to_stream, 'get-slice-plot-coords')
def __init__(self, parent,ancestor): wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) vbox = wx.BoxSizer(wx.VERTICAL) title = StaticTextNew(self, label="Pipeline Comments:") title.SetToolTipNew("Pipeline Comments.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.txt = wx.TextCtrl(self, style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.txt.Enable(True) vbox.Add(self.txt, 1, wx.EXPAND | wx.ALL, 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 = StaticTextNew(self, label="Scale Arrays") title.SetToolTipNew("Scale array by a specified factor") 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: ", "output.npy",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*") vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.scale = SpinnerObject(self,"Scale factor:",MAX_INT,0.0,1.0,1.0,150,150) self.scale.label.SetToolTipNew("Scale factor.") vbox.Add(self.scale, 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) self.panelphase = self.GetParent().GetParent().GetParent() self.font = self.GetParent().font self.file = None vbox = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self, label="Convert HDF5 to Numpy array.") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input HDF5 File: ", "",150,"HDF files (*.hdf)|*.hdf|HDF5 files (*.h5)|*.h5|All files (*.*)|*.*") vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) hbox = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1,"HDF Key Path:" , style =wx.ALIGN_RIGHT, size=(150,-1) ) label.SetFont(self.font) hbox.Add( label, 0, wx.CENTER ) def OnEdit(event): self.objectpath.ChangeValue(event.GetString()) self.objectpath = TextCtrlNew(self, -1) self.objectpath.SetFont(self.font) self.objectpath.SetValue("") self.objectpath.SetToolTipNew("Comma separated key names.") self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit) hbox.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND ) self.button = ButtonNew(self, -1, "Browse") self.button.SetFont(self.font) self.button.SetToolTipNew("Browse for HDF5 key path.") self.button.Bind(wx.EVT_BUTTON, self.OnBrowse) hbox.Add( self.button, 0, wx.LEFT|wx.CENTER) vbox.Add(hbox, 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) 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="Convert SPE to Numpy array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input SPE File: ", "",150,'*.SPE') 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,'*.npy') vbox.Add(self.output_filename, 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="Convert Image file to Numpy array") vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.input_filename = TextPanelObject(self, "Input Image File: ", "",150,"PNG files (*.png)|*.png|JPEG files (*.jpg)|*.jpg|PPM files (*.ppm)|*.ppm|TIF files (*.tif)|*.tif|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,'*.npy') vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2) self.SetAutoLayout(True) self.SetSizer( vbox )