我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.LEFT。
def addCheckBoxes(self): # Regular Box Sizer boxSizerH = wx.BoxSizer(wx.HORIZONTAL) chk1 = wx.CheckBox(self.panel, label='Disabled') chk1.SetValue(True) chk1.Disable() boxSizerH.Add(chk1) chk2 = wx.CheckBox(self.panel, label='UnChecked') boxSizerH.Add(chk2, flag=wx.LEFT, border=10) chk3 = wx.CheckBox(self.panel, label='Toggle') boxSizerH.Add(chk3, flag=wx.LEFT, border=10) chk3.SetValue(True) # Add Regular Box Sizer to StaticBox sizer self.statBoxSizerV.Add(boxSizerH, flag=wx.LEFT, border=10) self.statBoxSizerV.Add((0, 8)) #----------------------------------------------------------
def __init__(self, parent=None, default_url=""): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) self._url = wx.TextCtrl(self) self._url.Bind(wx.EVT_KILL_FOCUS, self._field_changed) self._url.SetValue(default_url) self._status_label = ProcessingPlaceholderText(self) label = wx.StaticText(self, label="Server URL") label.SetToolTipString("URL for the IRIDA server API.") self._sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) self._sizer.Add(self._url, flag=wx.EXPAND, proportion=1) self._sizer.Add(self._status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0) self.SetSizerAndFit(self._sizer) self.Layout() self.Bind(wx.EVT_CLOSE, self._on_close) pub.subscribe(self._status_label.SetError, APIConnectorTopics.connection_error_url_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_topic) pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_valid_url)
def __init__(self, parent=None, default_directory="", monitor_directory=False): wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.HORIZONTAL) directory_label = wx.StaticText(self, label="Default directory") directory_label.SetToolTipString("Default directory to scan for uploads") self._sizer.Add(directory_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0) directory = wx.DirPickerCtrl(self, path=default_directory) self.Bind(wx.EVT_DIRPICKER_CHANGED, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="default_dir", field_value=directory.GetPath())) self._sizer.Add(directory, flag=wx.EXPAND, proportion=1) monitor_checkbox = wx.CheckBox(self, label="Monitor directory for new runs?") monitor_checkbox.SetValue(monitor_directory) monitor_checkbox.SetToolTipString("Monitor the default directory for when the Illumina Software indicates that the analysis is complete and ready to upload (when CompletedJobInfo.xml is written to the directory).") monitor_checkbox.Bind(wx.EVT_CHECKBOX, lambda evt: send_message(SettingsDialog.field_changed_topic, field_name="monitor_default_dir", field_value=str(monitor_checkbox.GetValue()))) self._sizer.Add(monitor_checkbox, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=5, proportion=0) self.SetSizerAndFit(self._sizer) self.Layout()
def __init__(self, parent=None, first_run=False): wx.Dialog.__init__(self, parent, title="Settings", style=wx.DEFAULT_DIALOG_STYLE) self._first_run = first_run self._sizer = wx.BoxSizer(wx.VERTICAL) self._defaults = {} self._sizer.Add(URLEntryPanel(self, default_url=read_config_option("baseurl")), flag=wx.EXPAND | wx.ALL, border=5) authorization_sizer = wx.BoxSizer(wx.HORIZONTAL) authorization_sizer.Add(ClientDetailsPanel(self, default_client_id=read_config_option("client_id"), default_client_secret=read_config_option("client_secret")), flag=wx.EXPAND | wx.RIGHT, border=2, proportion=1) authorization_sizer.Add(UserDetailsPanel(self, default_user=read_config_option("username"), default_pass=read_config_option("password")), flag=wx.EXPAND | wx.LEFT, border=2, proportion=1) self._sizer.Add(authorization_sizer, flag=wx.EXPAND | wx.ALL, border=5) self._sizer.Add(PostProcessingTaskPanel(self, default_post_process=read_config_option("completion_cmd")), flag=wx.EXPAND | wx.ALL, border=5) self._sizer.Add(DefaultDirectoryPanel(self, default_directory=read_config_option("default_dir"), monitor_directory=read_config_option("monitor_default_dir", expected_type=bool)), flag=wx.EXPAND | wx.ALL, border=5) self._sizer.Add(self.CreateSeparatedButtonSizer(flags=wx.OK), flag=wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(self._sizer) self.Layout() pub.subscribe(self._field_changed, SettingsDialog.field_changed_topic) self.Bind(wx.EVT_CLOSE, self._on_close) self.Bind(wx.EVT_BUTTON, self._on_close, id=wx.ID_OK) threading.Thread(target=connect_to_irida).start()
def _post_processing_task_started(self): """Show a 'processing' message on the UI while the post processing task is executing.""" pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing) pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing) pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing) logging.info("Post-processing started, updating UI.") self.Freeze() self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL) self._post_processing_placeholder = ProcessingPlaceholderText(self) self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol")) self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.") self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self._post_processing_text.Wrap(350) self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd"))) self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1) self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0) self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5) self.Layout() self.Thaw()
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 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 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=5, 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 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) 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 initOptions(self): STransConfigPanel.initOptions(self) optionsSizer = wx.BoxSizer(wx.HORIZONTAL) kurtosisControlBox = widgets.ControlBox(self, label='Kurtosis', orient=wx.VERTICAL) self.kurtosisComboBox = wx.ComboBox(self, choices=('Adapt', 'Sub', 'Super'), value=self.flt.kurtosis, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setKurtosis, self.kurtosisComboBox) kurtosisControlBox.Add(self.kurtosisComboBox, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(kurtosisControlBox, proportion=1, flag=wx.LEFT | wx.RIGHT, border=8) maxIterControlBox = widgets.ControlBox(self, label='Max Iter.', orient=wx.HORIZONTAL) self.maxIterSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.maxIter), min=50, max=3500) self.Bind(wx.EVT_SPINCTRL, self.setMaxIter, self.maxIterSpinCtrl) maxIterControlBox.Add(self.maxIterSpinCtrl, proportion=1, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=8) optionsSizer.Add(maxIterControlBox, proportion=0, flag=wx.RIGHT | wx.EXPAND, border=8) #lrControlBox = widgets.ControlBox(self, label='Learning Rate.', orient=wx.HORIZONTAL) self.sizer.Add(optionsSizer, proportion=0)
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 add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top self.SetToolBar(self.toolbar) else: # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update()
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 __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: 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 getPanelBottomButtons(self): panel = wx.Panel(self) sizer = wx.BoxSizer(wx.HORIZONTAL) b1 = wx.Button(panel, -1, "OK") sizer.Add(b1, 0, wx.ALIGN_RIGHT, border=5) b2 = wx.Button(panel, -1, "Apply") sizer.Add(b2, 0, wx.ALIGN_RIGHT, border=5) b3 = wx.Button(panel, -1, "Cancel") sizer.Add(b3, 0, wx.LEFT|wx.RIGHT, border=5) b1.Bind(wx.EVT_BUTTON, self._OnButtonOK) b2.Bind(wx.EVT_BUTTON, self._OnButtonApply) b3.Bind(wx.EVT_BUTTON, self._OnButtonCancel) panel.SetSizer(sizer) return panel
def __init__(self, parent, table, pos=(150, 680), size=(1000, 200)): wx.Panel.__init__(self, parent, pos=pos, size=size) self.parent = parent self.table = table self.size = size sizer = wx.BoxSizer(wx.HORIZONTAL) self.sndView = GuiSndViewPlayHead(self.parent, size=self.size) self.sndView.setTable(self.table) sizer.Add(self.sndView, 0, wx.EXPAND) # def createSndTable(self): # print self.parent.GetSize() # sizer = wx.BoxSizer(wx.HORIZONTAL) # jr 1 juin 2017 # self.sndview = GuiSndViewPlayHead(self.parent, size=(1000, 400)) # self.sndview.setTable(self.table) # sizer.Add(self.sndview, 0, wx.LEFT | wx.EXPAND, 155) # JR 1 juin 2017 # return sizer # def createTimeSlider(self): # sizer = wx.BoxSizer(wx.VERTICAL) # self.timeSlider = PyoGuiControlSlider(self.parent, 0, self.table.getDur(False), 0, orient=wx.HORIZONTAL) # self.timeSlider.Bind(EVT_PYO_GUI_CONTROL_SLIDER, self.moveTimeSlider) # # self.timeSlider = wx.Slider(self.parent, -1, value=0, minValue=0, maxValue=self.table.getDur(False), # # style=wx.SL_HORIZONTAL|wx.SL_LABELS) ## self.timeSlider.Bind(wx.EVT_SLIDER, self.moveTimeSlider) # sizer.Add(self.timeSlider, 0, wx.LEFT | wx.EXPAND, 155) # return sizer # def moveTimeSlider(self,e): # print self.timeSlider.value # # def setRange(self,min,max): # self.timeSlider.setRange(min,max)
def InitLayout(self): """Lay out controls and add buttons.""" sizer = wx.BoxSizer(wx.HORIZONTAL) txtSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.VERTICAL) replaceSizer = wx.BoxSizer(wx.HORIZONTAL) txtSizer.Add(wx.StaticText(self, -1, "Unrecognised Word:"), 0, wx.LEFT|wx.TOP, 5) txtSizer.Add(self.error_text, 1, wx.ALL|wx.EXPAND, 5) replaceSizer.Add(wx.StaticText(self, -1, "Replace with:"), 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) replaceSizer.Add(self.replace_text, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) txtSizer.Add(replaceSizer, 0, wx.EXPAND, 0) txtSizer.Add(self.replace_list, 2, wx.ALL|wx.EXPAND, 5) sizer.Add(txtSizer, 1, wx.EXPAND, 0) self.buttons = [] for label, action, tip in (\ ("Ignore", self.OnIgnore, "Ignore this word and continue"), ("Ignore All", self.OnIgnoreAll, "Ignore all instances of this word and continue"), ("Replace", self.OnReplace, "Replace this word"), ("Replace All", self.OnReplaceAll, "Replace all instances of this word"), ("Add", self.OnAdd, "Add this word to the dictionary"), ("Done", self.OnDone, "Finish spell-checking and accept changes"), ): btn = wx.Button(self, -1, label) btn.SetToolTip(wx.ToolTip(tip)) btnSizer.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 4) btn.Bind(wx.EVT_BUTTON, action) self.buttons.append(btn) sizer.Add(btnSizer, 0, wx.ALL|wx.EXPAND, 5) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self)
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 __init__(self, parent, name, number, minnamelen, maxnamelen): wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry") self.SetAutoLayout(True) self.name = None self.number = None nameTextId = wx.NewId() # Main window resizer object border = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.") border.Add(label, 1, wx.ALL, 10) #fgs = wx.FlexGridSizer(2,3,5,20) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen) fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen)) fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Number (max 20): ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20)) fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) border.Add(buttons, 1, wx.ALL) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK) wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK) self.SetAutoLayout(1); self.SetSizer(border) border.Fit(self) self.Layout()
def createWidgets(self): sizer = wx.GridSizer(3,3,5,5) self.SIM.gatherInfo() sizer.Add(wx.Size(0,0), 10, 1, wx.LEFT, 10) # Spacer sizer.Add(wxskinStaticText(self, -1, "Activated"), 1, wx.LEFT | wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "Tries left"), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN1"), 1, wx.LEFT, 10) if self.SIM.chv1_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv1_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wxskinStaticText(self, -1, "PIN2"), 1, wx.LEFT, 10) if self.SIM.chv2_enabled: sizer.Add(wx.TextCtrl(self, -1, "Yes", style=wx.TE_READONLY), 1, wx.RIGHT, 10) else: sizer.Add(wx.TextCtrl(self, -1, "No", style=wx.TE_READONLY), 1, wx.RIGHT, 10) sizer.Add(wx.TextCtrl(self, -1, "%d" % self.SIM.chv2_tries_left, style=wx.TE_READONLY), 1, wx.RIGHT, 10) self.SetSizer(sizer) self.SetAutoLayout(1) sizer.Fit(self) sizer.Layout()
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 __init__(self, parent, run, api): """Initialize the RunPanel. Args: parent: The parent Window for this panel. run: The sequencing run that should be displayed. api: An initialized instance of an API for interacting with IRIDA. """ ScrolledPanel.__init__(self, parent, style=wx.SUNKEN_BORDER) box = wx.StaticBox(self, label=run.sample_sheet_name) self._timer = wx.Timer(self) self._run = run self._progress_value = 0 self._last_progress = 0 self._last_timer_progress = 0 self._sample_panels = {} # the current overall progress for the run is calculated as a percentage # of the total file size of all samples in the run. self._progress_max = sum(sample.get_files_size() for sample in run.samples_to_upload) logging.info("Total file size for run is {}".format(self._progress_max)) self._sizer = wx.StaticBoxSizer(box, wx.VERTICAL) pub.subscribe(self._upload_started, run.upload_started_topic) pub.subscribe(self._handle_progress, run.upload_progress_topic) pub.subscribe(self._upload_complete, run.upload_completed_topic) pub.subscribe(self._upload_failed, run.upload_failed_topic) for sample in run.sample_list: self._sample_panels[sample.get_id()] = SamplePanel(self, sample, run, api) self._sizer.Add(self._sample_panels[sample.get_id()], flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) self.SetSizer(self._sizer) self.Bind(wx.EVT_TIMER, self._update_progress_timer, self._timer) self.Layout() self.SetupScrolling()