def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _("Add template"), pos = wx.DefaultPosition, size = wx.Size( 416,354 ), style = wx.DEFAULT_DIALOG_STYLE ) self.EditMode = False self.SetSizeHintsSz( wx.DefaultSize, maxSize=wx.DefaultSize ) bSizer = wx.BoxSizer( wx.VERTICAL ) gSizer = wx.GridSizer( 2, 2, 0, 1 ) self.stName = wx.StaticText( self, wx.ID_ANY, _("Template name:"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.stName.Wrap( -1 ) gSizer.Add( self.stName, proportion=0, flag=wx.LEFT|wx.RIGHT|wx.TOP, border=5 ) self.stProto = wx.StaticText( self, wx.ID_ANY, _("Prototype:"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.stProto.Wrap( -1 ) gSizer.Add( self.stProto, proportion=0, flag=wx.LEFT|wx.RIGHT|wx.TOP, border=5 ) self.txtName = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer.Add( self.txtName, proportion=0, flag=wx.BOTTOM|wx.EXPAND|wx.LEFT|wx.RIGHT, border=5 ) cbProtoChoices = [] self.cbProto = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, cbProtoChoices, 0 ) self.cbProto.SetSelection( 0 ) gSizer.Add( self.cbProto, proportion=0, flag=wx.BOTTOM|wx.EXPAND|wx.RIGHT, border=5 ) bSizer.Add( gSizer, proportion=0, flag=wx.EXPAND, border=0 ) self.mstAttrs = wx.StaticText( self, wx.ID_ANY, _("Attributes:"), wx.DefaultPosition, wx.DefaultSize, 0 ) self.mstAttrs.Wrap( -1 ) bSizer.Add( self.mstAttrs, proportion=0, flag=wx.LEFT, border=5 ) gbSizer = wx.GridBagSizer( 0, 0 ) gbSizer.AddGrowableCol( 0 ) gbSizer.AddGrowableRow( 2 ) gbSizer.SetFlexibleDirection( wx.BOTH ) gbSizer.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.attrGrid = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.attrGrid.CreateGrid( numRows = 0,numCols = 2 ) self.attrGrid.EnableEditing( True ) self.attrGrid.EnableGridLines( True ) self.attrGrid.EnableDragGridSize( False ) self.attrGrid.SetMargins( 0, 0 ) # Columns self.attrGrid.SetColSize( 0, width = 130 ) self.attrGrid.SetColSize( 1, width = 150 ) self.attrGrid.EnableDragColMove( False ) self.attrGrid.EnableDragColSize( True ) self.attrGrid.SetColLabelSize( 30 ) self.attrGrid.SetColLabelValue( 0, _("Attribute") ) self.attrGrid.SetColLabelValue( 1, _("Default value") ) self.attrGrid.SetColLabelAlignment( horiz = wx.ALIGN_CENTRE, vert = wx.ALIGN_CENTRE ) # Rows self.attrGrid.EnableDragRowSize( True ) self.attrGrid.SetRowLabelSize( 20 ) self.attrGrid.SetRowLabelAlignment( horiz=wx.ALIGN_CENTRE, vert=wx.ALIGN_CENTRE ) # Label Appearance # Cell Defaults self.attrGrid.SetDefaultCellAlignment( horiz=wx.ALIGN_LEFT, vert=wx.ALIGN_TOP ) gbSizer.Add( self.attrGrid, pos=wx.GBPosition( 0, 0 ), span=wx.GBSpan( 3, 1 ), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2 ) self.btnAdd = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider_GetBitmap(str(ed_glob.ID_ADD), wx.ART_MENU, wx.Size(16, 16)), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) gbSizer.Add( self.btnAdd, pos=wx.GBPosition( 0, 1 ), span=wx.GBSpan( 1, 1 ), flag=wx.ALL, border=5 ) self.btnDel = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider_GetBitmap(str(ed_glob.ID_REMOVE), wx.ART_MENU, wx.Size(16, 16)), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) gbSizer.Add( self.btnDel, pos=wx.GBPosition( 1, 1 ), span=wx.GBSpan( 1, 1 ), flag=wx.ALL, border=5 ) self.btnSet = wx.BitmapButton( self, wx.ID_ANY, wx.ArtProvider_GetBitmap(str(ed_glob.ID_FONT), wx.ART_MENU, wx.Size(16, 16)), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW ) gbSizer.Add( self.btnSet, pos=wx.GBPosition( 2, 1 ), span=wx.GBSpan( 1, 1 ), flag=wx.ALL, border=5 ) bSizer.Add( gbSizer, proportion=1, flag=wx.EXPAND, border=0 ) bSizerBottom = wx.BoxSizer( wx.HORIZONTAL ) self.stTitle = wx.StaticText( self, wx.ID_ANY, _("Title attribute: %s") % 'None', wx.DefaultPosition, wx.DefaultSize, 0 ) self.stTitle.Wrap( -1 ) bSizerBottom.Add( self.stTitle, proportion=1, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=5 ) shapeSelChoices = [ "DefaultShape" ] shapeSelChoices.extend(Deca.world.GetShapes()) self.shapeSel = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, shapeSelChoices, 0 ) self.shapeSel.SetSelection( 0 ) bSizerBottom.Add( self.shapeSel, proportion=1, flag=wx.ALL|wx.EXPAND, border=2 ) bSizer.Add( bSizerBottom, proportion=0, flag=wx.EXPAND, border=0 ) dlgButtons = wx.StdDialogButtonSizer() self.dlgButtonsOK = wx.Button( self, wx.ID_OK ) dlgButtons.AddButton( self.dlgButtonsOK ) self.dlgButtonsCancel = wx.Button( self, wx.ID_CANCEL ) dlgButtons.AddButton( self.dlgButtonsCancel ) dlgButtons.Realize() bSizer.Add( dlgButtons, proportion=0, flag=wx.BOTTOM|wx.EXPAND|wx.LEFT|wx.RIGHT, border=5 ) self.SetSizer( bSizer ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.cbProto.Bind( wx.EVT_CHOICE, self.OnPrototype ) self.btnAdd.Bind( wx.EVT_BUTTON, self.OnAdd ) self.btnDel.Bind( wx.EVT_BUTTON, self.OnDel ) self.btnSet.Bind( wx.EVT_BUTTON, self.OnSet ) self.dlgButtonsOK.Bind( wx.EVT_BUTTON, self.OnOK ) self.TitlePos = -1
def __init__(self, parent, size=(800, -1), **kwargs): wx.Frame.__init__(self, parent, -1, size=size, title='Plate Viewer', **kwargs) CPATool.__init__(self) self.SetName(self.tool_name) self.SetBackgroundColour("white") # Fixing the color # Check for required properties fields. fail = False for field in required_fields: if not p.field_defined(field): fail = True raise Exception( 'Properties field "%s" is required for PlateViewer.' % (field)) if fail: self.Destroy() return self.chMap = p.image_channel_colors[:] self.menuBar = wx.MenuBar() self.SetMenuBar(self.menuBar) self.fileMenu = wx.Menu() self.exitMenuItem = self.fileMenu.Append( id=wx.ID_EXIT, item='Exit\tCtrl+Q', helpString='Close Plate Viewer') self.GetMenuBar().Append(self.fileMenu, 'File') self.menuBar.Append( cpa.helpmenu.make_help_menu( self, manual_url="https://cellprofiler.org/viii-plate-viewer"), 'Help') save_csv_menu_item = self.fileMenu.Append(-1, 'Save table to CSV\tCtrl+S') self.Bind(wx.EVT_MENU, self.on_save_csv, save_csv_menu_item) self.Bind(wx.EVT_MENU, lambda _: self.Close(), id=wx.ID_EXIT) dataSourceSizer = wx.StaticBoxSizer( wx.StaticBox(self, label='Source:'), wx.VERTICAL) dataSourceSizer.Add(wx.StaticText(self, label='Data source:')) self.sourceChoice = TableComboBox(self, -1, size=fixed_width) dataSourceSizer.Add(self.sourceChoice) dataSourceSizer.Add(-1, 3, 0) dataSourceSizer.Add(wx.StaticText(self, label='Measurement:')) measurements = get_non_blob_types_from_table(p.image_table) self.measurementsChoice = ComboBox(self, choices=measurements, size=fixed_width, style=wx.CB_READONLY) self.measurementsChoice.Select(0) dataSourceSizer.Add(self.measurementsChoice) dataSourceSizer.Add(wx.StaticText(self, label='Filter:')) self.filterChoice = FilterComboBox(self, size=fixed_width, style=wx.CB_READONLY) dataSourceSizer.Add(self.filterChoice) groupingSizer = wx.StaticBoxSizer( wx.StaticBox(self, label='Data aggregation:'), wx.VERTICAL) groupingSizer.Add(wx.StaticText(self, label='Aggregation method:')) aggregation = ['mean', 'sum', 'median', 'stdev', 'cv%', 'min', 'max'] self.aggregationMethodsChoice = ComboBox(self, choices=aggregation, size=fixed_width) self.aggregationMethodsChoice.Select(0) groupingSizer.Add(self.aggregationMethodsChoice) viewSizer = wx.StaticBoxSizer( wx.StaticBox(self, label='View options:'), wx.VERTICAL) viewSizer.Add(wx.StaticText(self, label='Color map:')) maps = [ m for m in list(matplotlib.cm.datad.keys()) if not m.endswith("_r") ] maps.sort() self.colorMapsChoice = ComboBox(self, choices=maps, size=fixed_width) self.colorMapsChoice.SetSelection(maps.index('jet')) viewSizer.Add(self.colorMapsChoice) viewSizer.Add(-1, 3, 0) viewSizer.Add(wx.StaticText(self, label='Well display:')) if p.image_thumbnail_cols: choices = pmp.all_well_shapes else: choices = list(pmp.all_well_shapes) choices.remove(pmp.THUMBNAIL) self.wellDisplayChoice = ComboBox(self, choices=choices, size=fixed_width) self.wellDisplayChoice.Select(0) viewSizer.Add(self.wellDisplayChoice) viewSizer.Add(-1, 3, 0) viewSizer.Add(wx.StaticText(self, label='Number of plates:')) self.numberOfPlatesTE = wx.TextCtrl(self, -1, '1', style=wx.TE_PROCESS_ENTER) viewSizer.Add(self.numberOfPlatesTE) if not p.plate_id: self.numberOfPlatesTE.Disable() annotationSizer = wx.StaticBoxSizer( wx.StaticBox(self, label='Annotation:'), wx.VERTICAL) annotationSizer.Add(wx.StaticText(self, label='Annotation column:')) annotationColSizer = wx.BoxSizer(wx.HORIZONTAL) self.annotation_cols = dict([ (col, db.GetColumnType(p.image_table, col)) for col in db.GetUserColumnNames(p.image_table) ]) self.annotationCol = ComboBox(self, choices=list( self.annotation_cols.keys()), size=(120, -1)) if len(self.annotation_cols) > 0: self.annotationCol.SetSelection(0) annotationColSizer.Add(self.annotationCol, flag=wx.ALIGN_CENTER_VERTICAL) annotationColSizer.AddSpacer(3) self.addAnnotationColBtn = wx.Button(self, -1, 'Add', size=(44, -1)) annotationColSizer.Add(self.addAnnotationColBtn, flag=wx.ALIGN_CENTER_VERTICAL) annotationSizer.Add(annotationColSizer) annotationSizer.Add(-1, 3, 0) annotationSizer.Add(wx.StaticText(self, label='Label:')) self.annotationLabel = wx.TextCtrl( self, -1, 'Select wells') #, style=wx.TE_PROCESS_ENTER) self.annotationLabel.Disable() self.annotationLabel.SetForegroundColour(wx.Colour(80, 80, 80)) self.annotationLabel.SetBackgroundColour(wx.LIGHT_GREY) annotationSizer.Add(self.annotationLabel) annotationSizer.Add(-1, 3, 0) self.outlineMarked = wx.CheckBox(self, -1, label='Outline annotated wells') annotationSizer.Add(self.outlineMarked) annotationSizer.Add(-1, 3, 0) self.annotationShowVals = wx.CheckBox(self, -1, label='Show values on plate') annotationSizer.Add(self.annotationShowVals) if len(db.GetUserColumnNames(p.image_table)) == 0: self.outlineMarked.Disable() self.annotationShowVals.Disable() controlSizer = wx.BoxSizer(wx.VERTICAL) controlSizer.Add(dataSourceSizer, 0, wx.EXPAND) controlSizer.Add(-1, 3, 0) controlSizer.Add(groupingSizer, 0, wx.EXPAND) controlSizer.Add(-1, 3, 0) controlSizer.Add(viewSizer, 0, wx.EXPAND) controlSizer.Add(-1, 3, 0) controlSizer.Add(annotationSizer, 0, wx.EXPAND) self.plateMapSizer = wx.GridSizer(1, 1, 5, 5) self.plateMaps = [] self.plateMapChoices = [] self.rightSizer = wx.BoxSizer(wx.VERTICAL) self.rightSizer.Add(self.plateMapSizer, 1, wx.EXPAND | wx.BOTTOM, 10) self.colorBar = ColorBarPanel(self, 'jet', size=(-1, 25)) self.rightSizer.Add(self.colorBar, 0, wx.EXPAND) mainSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(controlSizer, 0, wx.LEFT | wx.TOP | wx.BOTTOM, 10) mainSizer.Add(self.rightSizer, 1, wx.EXPAND | wx.ALL, 10) self.SetSizer(mainSizer) self.SetClientSize((self.Size[0], self.Sizer.CalcMin()[1])) self.sourceChoice.Bind(wx.EVT_COMBOBOX, self.UpdateMeasurementChoice) self.measurementsChoice.Bind(wx.EVT_COMBOBOX, self.OnSelectMeasurement) self.measurementsChoice.Select(0) self.aggregationMethodsChoice.Bind(wx.EVT_COMBOBOX, self.OnSelectAggregationMethod) self.colorMapsChoice.Bind(wx.EVT_COMBOBOX, self.OnSelectColorMap) self.numberOfPlatesTE.Bind(wx.EVT_TEXT_ENTER, self.OnEnterNumberOfPlates) self.wellDisplayChoice.Bind(wx.EVT_COMBOBOX, self.OnSelectWellDisplay) self.annotationCol.Bind(wx.EVT_COMBOBOX, self.OnSelectAnnotationCol) self.addAnnotationColBtn.Bind(wx.EVT_BUTTON, self.OnAddAnnotationCol) self.annotationLabel.Bind(wx.EVT_KEY_UP, self.OnEnterAnnotation) self.outlineMarked.Bind(wx.EVT_CHECKBOX, self.OnOutlineMarked) self.annotationShowVals.Bind(wx.EVT_CHECKBOX, self.OnShowAnnotationValues) self.filterChoice.Bind(wx.EVT_COMBOBOX, self.OnSelectFilter) self.AddPlateMap() self.OnSelectMeasurement()
def initViewLayout(self): gridSizer = wx.GridSizer(self.params_["matrix"][0], self.params_["matrix"][1], 0, 0) for gridView in self.m_gridViews: gridSizer.Add(gridView) self.SetSizerAndFit(gridSizer)
def __init__(self, parent, frame): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) self._frame = frame vert = wx.BoxSizer(wx.VERTICAL) s1 = wx.BoxSizer(wx.HORIZONTAL) self._border_size = wx.SpinCtrl(self, ID_PaneBorderSize, "", wx.DefaultPosition, wx.Size(50, 20)) s1.Add((1, 1), 1, wx.EXPAND) s1.Add(wx.StaticText(self, -1, "Pane Border Size:")) s1.Add(self._border_size) s1.Add((1, 1), 1, wx.EXPAND) s1.SetItemMinSize(1, (180, 20)) #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s2 = wx.BoxSizer(wx.HORIZONTAL) self._sash_size = wx.SpinCtrl(self, ID_SashSize, "", wx.DefaultPosition, wx.Size(50, 20)) s2.Add((1, 1), 1, wx.EXPAND) s2.Add(wx.StaticText(self, -1, "Sash Size:")) s2.Add(self._sash_size) s2.Add((1, 1), 1, wx.EXPAND) s2.SetItemMinSize(1, (180, 20)) #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) s3 = wx.BoxSizer(wx.HORIZONTAL) self._caption_size = wx.SpinCtrl(self, ID_CaptionSize, "", wx.DefaultPosition, wx.Size(50, 20)) s3.Add((1, 1), 1, wx.EXPAND) s3.Add(wx.StaticText(self, -1, "Caption Size:")) s3.Add(self._caption_size) s3.Add((1, 1), 1, wx.EXPAND) s3.SetItemMinSize(1, (180, 20)) #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) #vert.Add(1, 1, 1, wx.EXPAND) b = self.CreateColorBitmap(wx.BLACK) s4 = wx.BoxSizer(wx.HORIZONTAL) self._background_color = wx.BitmapButton(self, ID_BackgroundColor, b, wx.DefaultPosition, wx.Size(50, 25)) s4.Add((1, 1), 1, wx.EXPAND) s4.Add(wx.StaticText(self, -1, "Background Color:")) s4.Add(self._background_color) s4.Add((1, 1), 1, wx.EXPAND) s4.SetItemMinSize(1, (180, 20)) s5 = wx.BoxSizer(wx.HORIZONTAL) self._sash_color = wx.BitmapButton(self, ID_SashColor, b, wx.DefaultPosition, wx.Size(50, 25)) s5.Add((1, 1), 1, wx.EXPAND) s5.Add(wx.StaticText(self, -1, "Sash Color:")) s5.Add(self._sash_color) s5.Add((1, 1), 1, wx.EXPAND) s5.SetItemMinSize(1, (180, 20)) s6 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_color = wx.BitmapButton( self, ID_InactiveCaptionColor, b, wx.DefaultPosition, wx.Size(50, 25)) s6.Add((1, 1), 1, wx.EXPAND) s6.Add(wx.StaticText(self, -1, "Normal Caption:")) s6.Add(self._inactive_caption_color) s6.Add((1, 1), 1, wx.EXPAND) s6.SetItemMinSize(1, (180, 20)) s7 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_gradient_color = wx.BitmapButton( self, ID_InactiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50, 25)) s7.Add((1, 1), 1, wx.EXPAND) s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:")) s7.Add(self._inactive_caption_gradient_color) s7.Add((1, 1), 1, wx.EXPAND) s7.SetItemMinSize(1, (180, 20)) s8 = wx.BoxSizer(wx.HORIZONTAL) self._inactive_caption_text_color = wx.BitmapButton( self, ID_InactiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50, 25)) s8.Add((1, 1), 1, wx.EXPAND) s8.Add(wx.StaticText(self, -1, "Normal Caption Text:")) s8.Add(self._inactive_caption_text_color) s8.Add((1, 1), 1, wx.EXPAND) s8.SetItemMinSize(1, (180, 20)) s9 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_color = wx.BitmapButton(self, ID_ActiveCaptionColor, b, wx.DefaultPosition, wx.Size(50, 25)) s9.Add((1, 1), 1, wx.EXPAND) s9.Add(wx.StaticText(self, -1, "Active Caption:")) s9.Add(self._active_caption_color) s9.Add((1, 1), 1, wx.EXPAND) s9.SetItemMinSize(1, (180, 20)) s10 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_gradient_color = wx.BitmapButton( self, ID_ActiveCaptionGradientColor, b, wx.DefaultPosition, wx.Size(50, 25)) s10.Add((1, 1), 1, wx.EXPAND) s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:")) s10.Add(self._active_caption_gradient_color) s10.Add((1, 1), 1, wx.EXPAND) s10.SetItemMinSize(1, (180, 20)) s11 = wx.BoxSizer(wx.HORIZONTAL) self._active_caption_text_color = wx.BitmapButton( self, ID_ActiveCaptionTextColor, b, wx.DefaultPosition, wx.Size(50, 25)) s11.Add((1, 1), 1, wx.EXPAND) s11.Add(wx.StaticText(self, -1, "Active Caption Text:")) s11.Add(self._active_caption_text_color) s11.Add((1, 1), 1, wx.EXPAND) s11.SetItemMinSize(1, (180, 20)) s12 = wx.BoxSizer(wx.HORIZONTAL) self._border_color = wx.BitmapButton(self, ID_BorderColor, b, wx.DefaultPosition, wx.Size(50, 25)) s12.Add((1, 1), 1, wx.EXPAND) s12.Add(wx.StaticText(self, -1, "Border Color:")) s12.Add(self._border_color) s12.Add((1, 1), 1, wx.EXPAND) s12.SetItemMinSize(1, (180, 20)) s13 = wx.BoxSizer(wx.HORIZONTAL) self._gripper_color = wx.BitmapButton(self, ID_GripperColor, b, wx.DefaultPosition, wx.Size(50, 25)) s13.Add((1, 1), 1, wx.EXPAND) s13.Add(wx.StaticText(self, -1, "Gripper Color:")) s13.Add(self._gripper_color) s13.Add((1, 1), 1, wx.EXPAND) s13.SetItemMinSize(1, (180, 20)) grid_sizer = wx.GridSizer(cols=2) grid_sizer.SetHGap(5) grid_sizer.Add(s1) grid_sizer.Add(s4) grid_sizer.Add(s2) grid_sizer.Add(s5) grid_sizer.Add(s3) grid_sizer.Add(s13) grid_sizer.Add((1, 1)) grid_sizer.Add(s12) grid_sizer.Add(s6) grid_sizer.Add(s9) grid_sizer.Add(s7) grid_sizer.Add(s10) grid_sizer.Add(s8) grid_sizer.Add(s11) cont_sizer = wx.BoxSizer(wx.VERTICAL) cont_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(cont_sizer) self.GetSizer().SetSizeHints(self) self._border_size.SetValue(frame.GetDockArt().GetMetric( wx.aui.AUI_DOCKART_PANE_BORDER_SIZE)) self._sash_size.SetValue(frame.GetDockArt().GetMetric( wx.aui.AUI_DOCKART_SASH_SIZE)) self._caption_size.SetValue(frame.GetDockArt().GetMetric( wx.aui.AUI_DOCKART_CAPTION_SIZE)) self.UpdateColors() self.Bind(wx.EVT_SPINCTRL, self.OnPaneBorderSize, id=ID_PaneBorderSize) self.Bind(wx.EVT_SPINCTRL, self.OnSashSize, id=ID_SashSize) self.Bind(wx.EVT_SPINCTRL, self.OnCaptionSize, id=ID_CaptionSize) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BackgroundColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_SashColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionGradientColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionTextColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BorderColor) self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_GripperColor)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Time-Based Brightness Control via sACN for Brompton & MVR", pos = wx.DefaultPosition, size = wx.Size( 542,763 ), style = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.Size( -1,-1 ), wx.Size( -1,-1 ) ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Enter the IP of the processor.", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 ) self.m_textCtrlIP = wx.TextCtrl( self, wx.ID_ANY, u"192.168.0.50", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_textCtrlIP.SetMaxLength( 20 ) bSizer1.Add( self.m_textCtrlIP, 0, wx.ALL|wx.EXPAND, 5 ) self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer2 = wx.BoxSizer( wx.VERTICAL ) m_radioBox1Choices = [ u"Brompton", u"MVR" ] self.m_radioBox1 = wx.RadioBox( self.m_panel1, wx.ID_ANY, u"Processing Platform", wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_ROWS ) self.m_radioBox1.SetSelection( 0 ) bSizer2.Add( self.m_radioBox1, 0, wx.ALL|wx.EXPAND, 5 ) self.m_staticText2 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"For Brompton, Set Live Control to [sACN] and Control Profile to [Colour].", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer2.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText21 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"For MVR, Enable sACN, enable Channel 3 ONLY.", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText21.Wrap( -1 ) bSizer2.Add( self.m_staticText21, 0, wx.ALL, 5 ) self.m_staticText29 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Brightness ONLY!", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText29.Wrap( -1 ) bSizer2.Add( self.m_staticText29, 0, wx.ALL, 5 ) self.m_staticline1 = wx.StaticLine( self.m_panel1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer2.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 ) gSizer7 = wx.GridSizer( 0, 2, 0, 0 ) sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel1, wx.ID_ANY, u"Info" ), wx.VERTICAL ) gSizer1 = wx.GridSizer( 0, 2, 0, 0 ) self.m_staticText3 = wx.StaticText( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Universe", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) gSizer1.Add( self.m_staticText3, 0, wx.ALL, 5 ) self.m_spinCtrlUniverse = wx.SpinCtrl( sbSizer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,-1 ), wx.SP_ARROW_KEYS, 1, 5, 1 ) gSizer1.Add( self.m_spinCtrlUniverse, 0, wx.ALL, 5 ) self.m_staticText4 = wx.StaticText( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Start Address", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText4.Wrap( -1 ) gSizer1.Add( self.m_staticText4, 0, wx.ALL, 5 ) self.m_spinCtrlStartAddress = wx.SpinCtrl( sbSizer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 100,-1 ), wx.SP_ARROW_KEYS, 1, 5, 1 ) gSizer1.Add( self.m_spinCtrlStartAddress, 0, wx.ALL, 5 ) self.m_staticText41 = wx.StaticText( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Channel", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText41.Wrap( -1 ) gSizer1.Add( self.m_staticText41, 0, wx.ALL, 5 ) self.m_textCtrlChannel = wx.TextCtrl( sbSizer1.GetStaticBox(), wx.ID_ANY, u"4", wx.DefaultPosition, wx.Size( 100,-1 ), wx.TE_READONLY ) gSizer1.Add( self.m_textCtrlChannel, 0, wx.ALL, 5 ) sbSizer1.Add( gSizer1, 0, wx.EXPAND, 5 ) sbSizer11 = wx.StaticBoxSizer( wx.StaticBox( sbSizer1.GetStaticBox(), wx.ID_ANY, u"Brompton" ), wx.VERTICAL ) gSizer8 = wx.GridSizer( 0, 2, 0, 0 ) self.m_staticText5 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Channel 1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText5.Wrap( -1 ) gSizer8.Add( self.m_staticText5, 0, wx.ALL, 5 ) self.m_staticText6 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Red Gain: 0~100", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText6.Wrap( -1 ) gSizer8.Add( self.m_staticText6, 0, wx.ALL, 5 ) self.m_staticText7 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Channel 2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText7.Wrap( -1 ) gSizer8.Add( self.m_staticText7, 0, wx.ALL, 5 ) self.m_staticText8 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Green Gain: 0~100", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText8.Wrap( -1 ) gSizer8.Add( self.m_staticText8, 0, wx.ALL, 5 ) self.m_staticText9 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Channel 3", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText9.Wrap( -1 ) gSizer8.Add( self.m_staticText9, 0, wx.ALL, 5 ) self.m_staticText10 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Blue Gain: 0~100", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText10.Wrap( -1 ) gSizer8.Add( self.m_staticText10, 0, wx.ALL, 5 ) self.m_staticText11 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Channel 4", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText11.Wrap( -1 ) gSizer8.Add( self.m_staticText11, 0, wx.ALL, 5 ) self.m_staticText12 = wx.StaticText( sbSizer11.GetStaticBox(), wx.ID_ANY, u"Intensity Gain: 0~100", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText12.Wrap( -1 ) gSizer8.Add( self.m_staticText12, 0, wx.ALL, 5 ) sbSizer11.Add( gSizer8, 1, wx.EXPAND, 5 ) sbSizer1.Add( sbSizer11, 0, wx.EXPAND, 5 ) sbSizer12 = wx.StaticBoxSizer( wx.StaticBox( sbSizer1.GetStaticBox(), wx.ID_ANY, u"MVR" ), wx.VERTICAL ) gSizer11 = wx.GridSizer( 0, 2, 0, 0 ) self.m_staticText51 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Channel 1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText51.Wrap( -1 ) gSizer11.Add( self.m_staticText51, 0, wx.ALL, 5 ) self.m_staticText61 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Blackout", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText61.Wrap( -1 ) gSizer11.Add( self.m_staticText61, 0, wx.ALL, 5 ) self.m_staticText71 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Channel 2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText71.Wrap( -1 ) gSizer11.Add( self.m_staticText71, 0, wx.ALL, 5 ) self.m_staticText81 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Freeze", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText81.Wrap( -1 ) gSizer11.Add( self.m_staticText81, 0, wx.ALL, 5 ) self.m_staticText91 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Channel 3", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText91.Wrap( -1 ) gSizer11.Add( self.m_staticText91, 0, wx.ALL, 5 ) self.m_staticText101 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Brightness", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText101.Wrap( -1 ) gSizer11.Add( self.m_staticText101, 0, wx.ALL, 5 ) self.m_staticText111 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Channel 4", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText111.Wrap( -1 ) gSizer11.Add( self.m_staticText111, 0, wx.ALL, 5 ) self.m_staticText121 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Gamma", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText121.Wrap( -1 ) gSizer11.Add( self.m_staticText121, 0, wx.ALL, 5 ) self.m_staticText35 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Channel 5", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText35.Wrap( -1 ) gSizer11.Add( self.m_staticText35, 0, wx.ALL, 5 ) self.m_staticText36 = wx.StaticText( sbSizer12.GetStaticBox(), wx.ID_ANY, u"Enable Test Pattern", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText36.Wrap( -1 ) gSizer11.Add( self.m_staticText36, 0, wx.ALL, 5 ) sbSizer12.Add( gSizer11, 1, wx.EXPAND, 5 ) sbSizer1.Add( sbSizer12, 0, wx.EXPAND, 5 ) gSizer7.Add( sbSizer1, 1, wx.EXPAND, 5 ) sbSizer2 = wx.StaticBoxSizer( wx.StaticBox( self.m_panel1, wx.ID_ANY, u"Brightness Control" ), wx.VERTICAL ) m_radioBox2Choices = [ u"Time-Based", u"Slider" ] self.m_radioBox2 = wx.RadioBox( sbSizer2.GetStaticBox(), wx.ID_ANY, u"Control", wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_ROWS ) self.m_radioBox2.SetSelection( 0 ) sbSizer2.Add( self.m_radioBox2, 0, wx.ALL|wx.EXPAND, 5 ) sbSizer6 = wx.StaticBoxSizer( wx.StaticBox( sbSizer2.GetStaticBox(), wx.ID_ANY, u"Time-Based Brightness Control" ), wx.VERTICAL ) self.m_staticText37 = wx.StaticText( sbSizer6.GetStaticBox(), wx.ID_ANY, u"Set Time and Brightness", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText37.Wrap( -1 ) sbSizer6.Add( self.m_staticText37, 0, wx.ALL|wx.EXPAND, 5 ) gSizer9 = wx.GridSizer( 0, 2, 0, 0 ) self.m_textCtrlOnOff = wx.TextCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) gSizer9.Add( self.m_textCtrlOnOff, 0, wx.ALL, 5 ) self.m_textCtrlBrightness = wx.TextCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_READONLY ) gSizer9.Add( self.m_textCtrlBrightness, 0, wx.ALL, 5 ) sbSizer6.Add( gSizer9, 0, wx.EXPAND, 5 ) self.m_toggleBtn1 = wx.ToggleButton( sbSizer6.GetStaticBox(), wx.ID_ANY, u"On/Off", wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizer6.Add( self.m_toggleBtn1, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer2 = wx.FlexGridSizer( 0, 3, 0, 0 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_checkBox1 = wx.CheckBox( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) fgSizer2.Add( self.m_checkBox1, 0, wx.ALL|wx.EXPAND, 5 ) self.m_timePicker1 = wx.adv.TimePickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.TP_DEFAULT ) fgSizer2.Add( self.m_timePicker1, 0, wx.ALL, 5 ) self.m_spinCtrl1 = wx.SpinCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.SP_ARROW_KEYS, 0, 255, 0 ) fgSizer2.Add( self.m_spinCtrl1, 0, wx.ALL, 5 ) self.m_checkBox2 = wx.CheckBox( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) fgSizer2.Add( self.m_checkBox2, 0, wx.ALL|wx.EXPAND, 5 ) self.m_timePicker2 = wx.adv.TimePickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.TP_DEFAULT ) fgSizer2.Add( self.m_timePicker2, 0, wx.ALL, 5 ) self.m_spinCtrl2 = wx.SpinCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.SP_ARROW_KEYS, 0, 255, 0 ) fgSizer2.Add( self.m_spinCtrl2, 0, wx.ALL, 5 ) self.m_checkBox3 = wx.CheckBox( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) fgSizer2.Add( self.m_checkBox3, 0, wx.ALL|wx.EXPAND, 5 ) self.m_timePicker3 = wx.adv.TimePickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.TP_DEFAULT ) fgSizer2.Add( self.m_timePicker3, 0, wx.ALL, 5 ) self.m_spinCtrl3 = wx.SpinCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.SP_ARROW_KEYS, 0, 255, 0 ) fgSizer2.Add( self.m_spinCtrl3, 0, wx.ALL, 5 ) self.m_checkBox4 = wx.CheckBox( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) fgSizer2.Add( self.m_checkBox4, 0, wx.ALL|wx.EXPAND, 5 ) self.m_timePicker4 = wx.adv.TimePickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.TP_DEFAULT ) fgSizer2.Add( self.m_timePicker4, 0, wx.ALL, 5 ) self.m_spinCtrl4 = wx.SpinCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.SP_ARROW_KEYS, 0, 255, 0 ) fgSizer2.Add( self.m_spinCtrl4, 0, wx.ALL, 5 ) self.m_checkBox5 = wx.CheckBox( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 ) fgSizer2.Add( self.m_checkBox5, 0, wx.ALL|wx.EXPAND, 5 ) self.m_timePicker5 = wx.adv.TimePickerCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.DefaultDateTime, wx.DefaultPosition, wx.DefaultSize, wx.adv.TP_DEFAULT ) fgSizer2.Add( self.m_timePicker5, 0, wx.ALL, 5 ) self.m_spinCtrl5 = wx.SpinCtrl( sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 60,-1 ), wx.SP_ARROW_KEYS, 0, 255, 0 ) fgSizer2.Add( self.m_spinCtrl5, 0, wx.ALL, 5 ) sbSizer6.Add( fgSizer2, 0, wx.EXPAND, 5 ) sbSizer2.Add( sbSizer6, 1, wx.EXPAND, 5 ) sbSizer5 = wx.StaticBoxSizer( wx.StaticBox( sbSizer2.GetStaticBox(), wx.ID_ANY, u"Brightness Slider" ), wx.VERTICAL ) self.m_slider1 = wx.Slider( sbSizer5.GetStaticBox(), wx.ID_ANY, 255, 0, 255, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL ) sbSizer5.Add( self.m_slider1, 0, wx.ALL|wx.EXPAND, 5 ) self.m_textCtrlSlider = wx.TextCtrl( sbSizer5.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) sbSizer5.Add( self.m_textCtrlSlider, 0, wx.ALL|wx.EXPAND, 5 ) sbSizer2.Add( sbSizer5, 1, wx.EXPAND, 5 ) gSizer7.Add( sbSizer2, 1, wx.EXPAND, 5 ) bSizer2.Add( gSizer7, 1, wx.EXPAND, 5 ) self.m_panel1.SetSizer( bSizer2 ) self.m_panel1.Layout() bSizer2.Fit( self.m_panel1 ) self.m_notebook1.AddPage( self.m_panel1, u"Brightness Control", True ) self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) bSizer9 = wx.BoxSizer( wx.VERTICAL ) self.m_staticText40 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Rony Wang", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText40.Wrap( -1 ) bSizer9.Add( self.m_staticText40, 0, wx.ALL, 5 ) self.m_staticText28 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"v0.1", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText28.Wrap( -1 ) bSizer9.Add( self.m_staticText28, 0, wx.ALL, 5 ) self.m_panel3.SetSizer( bSizer9 ) self.m_panel3.Layout() bSizer9.Fit( self.m_panel3 ) self.m_notebook1.AddPage( self.m_panel3, u"Author", False ) bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.m_statusBar1 = self.CreateStatusBar( 1, wx.STB_SIZEGRIP, wx.ID_ANY ) self.m_timer1 = wx.Timer() self.m_timer1.SetOwner( self, wx.ID_ANY ) self.m_timer1.Start( 1000 ) self.Centre( wx.BOTH ) # Connect Events self.m_radioBox1.Bind( wx.EVT_RADIOBOX, self.PlatformChange ) self.Bind( wx.EVT_TIMER, self.Timer, id=wx.ID_ANY )
def __init__(self, parent, arg, full_pathname, filename, array, title): """ arg: argument for evaluate if this dialog is used for add new profile or edit a existing profiles. Then you can pass three type of strings: arg = 'newprofile' arg = 'edit' arg = 'addprofile' """ wx.Dialog.__init__(self, parent, -1, title, style=wx.DEFAULT_DIALOG_STYLE) self.path_xml = full_pathname self.filename = filename self.arg = arg # arg é solo un parametro di valutazione (edit o newprofile). self.array = array self.txt_name = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER) siz1_staticbox = wx.StaticBox(self, wx.ID_ANY, _("Profile Name")) self.txt_descript = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER) siz2_staticbox = wx.StaticBox(self, wx.ID_ANY, _("Description")) self.txt_cmd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE) siz3_staticbox = wx.StaticBox( self, wx.ID_ANY, (_("Command Line Parameters " "Do not use `-i` or output filename)"))) self.txt_supp = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER) siz4_supp = wx.StaticBox(self, wx.ID_ANY, (_("Files supported in the " "import (do not include the `.`)"))) self.txt_ext = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER) siz4_ext = wx.StaticBox(self, wx.ID_ANY, (_("Output format extension " "(do not include the `.`)"))) btn_help = wx.Button(self, wx.ID_HELP, "") btn_canc = wx.Button(self, wx.ID_CANCEL, "") btn_save = wx.Button(self, wx.ID_OK, _("Save..")) #----------------------Set Properties----------------------# self.txt_name.SetMinSize((150, -1)) self.txt_descript.SetMinSize((300, -1)) self.txt_cmd.SetMinSize((350, 60)) self.txt_supp.SetMinSize((300, -1)) self.txt_ext.SetMinSize((150, -1)) self.txt_name.SetToolTip(_("Assign a short name to the profile. ")) self.txt_descript.SetToolTip( _("Assign a long description to " "the profile.")) self.txt_cmd.SetToolTip(_("Do not use `-i` or output file, please.")) self.txt_supp.SetToolTip( _("You can limit the type " "of files formats imported by specifying in a box " "a format or multiple formats separated by a space " "(a list of extensions without the dot)." "Leave blank to involve any type of file to import " "inbound.")) self.txt_ext.SetToolTip(_("Write here the output format extension")) #----------------------Build layout----------------------# grd_s1 = wx.FlexGridSizer(4, 1, 0, 0) boxSiz = wx.BoxSizer(wx.VERTICAL) grdexit = wx.GridSizer(1, 2, 0, 0) grd_s4 = wx.GridSizer(1, 2, 0, 0) siz4_ext.Lower() s4_ext = wx.StaticBoxSizer(siz4_ext, wx.VERTICAL) siz4_supp.Lower() s4_f_supp = wx.StaticBoxSizer(siz4_supp, wx.VERTICAL) siz3_staticbox.Lower() siz3 = wx.StaticBoxSizer(siz3_staticbox, wx.VERTICAL) grd_s2 = wx.GridSizer(1, 2, 0, 0) siz2_staticbox.Lower() siz2 = wx.StaticBoxSizer(siz2_staticbox, wx.VERTICAL) siz1_staticbox.Lower() siz1 = wx.StaticBoxSizer(siz1_staticbox, wx.VERTICAL) siz1.Add(self.txt_name, 0, wx.ALL, 15) grd_s2.Add(siz1, 1, wx.ALL | wx.EXPAND, 15) siz2.Add(self.txt_descript, 0, wx.ALL, 15) grd_s2.Add(siz2, 1, wx.ALL | wx.EXPAND, 15) grd_s1.Add(grd_s2, 1, wx.EXPAND, 0) siz3.Add(self.txt_cmd, 0, wx.ALL | wx.EXPAND, 15) grd_s1.Add(siz3, 1, wx.ALL | wx.EXPAND, 15) s4_f_supp.Add(self.txt_supp, 0, wx.ALL, 15) grd_s4.Add(s4_f_supp, 1, wx.ALL | wx.EXPAND, 15) s4_ext.Add(self.txt_ext, 0, wx.ALL, 15) grd_s4.Add(s4_ext, 1, wx.ALL | wx.EXPAND, 15) grd_s1.Add(grd_s4, 1, wx.EXPAND, 0) grdBtn = wx.GridSizer(1, 2, 0, 0) grdhelp = wx.GridSizer(1, 1, 0, 0) grdhelp.Add(btn_help, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) grdBtn.Add(grdhelp) grdexit.Add(btn_canc, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) grdexit.Add(btn_save, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) grdBtn.Add(grdexit, flag=wx.ALL | wx.ALIGN_RIGHT | wx.RIGHT, border=0) boxSiz.Add(grdBtn, 1, wx.ALL | wx.EXPAND, 5) grd_s1.Add(boxSiz, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(grd_s1) grd_s1.Fit(self) self.Layout() #----------------------Binder (EVT)----------------------# self.Bind(wx.EVT_BUTTON, self.on_close, btn_canc) self.Bind(wx.EVT_BUTTON, self.on_help, btn_help) self.Bind(wx.EVT_BUTTON, self.on_apply, btn_save) #-------------------Binder (EVT) End --------------------# if arg == 'edit': self.change() # passo alla modifica del profilo, altrimenti # vado avanti per memorizzarne di nuovi elif arg == 'addprofile': self.txt_cmd.AppendText(self.array[0]) # command or param if self.array[1] == '-c:v copy': self.txt_ext.AppendText('Not set') else: self.txt_ext.AppendText(self.array[1]) # extension
def __init__(self, parent, title, id, value): wx.Dialog.__init__(self, parent, title, id, size=(500, 600)) self.value = value self.list = [('', ''), ('', ''), ('', ''), ('', ''), ('', ''), ('', '')] self.initdb() self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer8 = wx.BoxSizer(wx.VERTICAL) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) self.m_bpButton9 = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(cwd + "\\images\\购物.png"), wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW) self.m_bpButton9.SetBackgroundColour("white") bSizer9.Add(self.m_bpButton9, 1, wx.ALL | wx.EXPAND, 5) self.m_staticText17 = wx.StaticText(self, wx.ID_ANY, self.value + "商铺信息", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText17.Wrap(-1) bSizer9.Add(self.m_staticText17, 8, wx.ALL | wx.EXPAND, 5) bSizer8.Add(bSizer9, 1, wx.EXPAND, 5) bSizer10 = wx.BoxSizer(wx.VERTICAL) self.m_staticText18 = wx.StaticText(self, wx.ID_ANY, u"商品一览", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText18.Wrap(-1) bSizer10.Add(self.m_staticText18, 0, wx.ALL, 5) gSizer2 = wx.GridSizer(0, 2, 0, 0) self.m_button5 = wx.Button(self, wx.ID_ANY, self.list[0][0] + ":" + self.list[0][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button5.SetBackgroundColour("#FF6600") self.m_button5.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button5) gSizer2.Add(self.m_button5, 0, wx.ALL | wx.EXPAND, 5) self.m_button6 = wx.Button(self, wx.ID_ANY, self.list[1][0] + ":" + self.list[1][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button6.SetBackgroundColour("#FF6600") self.m_button6.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button6) gSizer2.Add(self.m_button6, 0, wx.ALL | wx.EXPAND, 5) self.m_button7 = wx.Button(self, wx.ID_ANY, self.list[2][0] + ":" + self.list[2][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button7.SetBackgroundColour("#FF6600") self.m_button7.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button7) gSizer2.Add(self.m_button7, 0, wx.ALL | wx.EXPAND, 5) self.m_button8 = wx.Button(self, wx.ID_ANY, self.list[3][0] + ":" + self.list[3][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button8.SetBackgroundColour("#FF6600") self.m_button8.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button8) gSizer2.Add(self.m_button8, 0, wx.ALL | wx.EXPAND, 5) self.m_button9 = wx.Button(self, wx.ID_ANY, self.list[4][0] + ":" + self.list[4][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button9.SetBackgroundColour("#FF6600") self.m_button9.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button9) gSizer2.Add(self.m_button9, 0, wx.ALL | wx.EXPAND, 5) self.m_button10 = wx.Button(self, wx.ID_ANY, self.list[5][0] + ":" + self.list[5][1], wx.DefaultPosition, wx.DefaultSize, 0) self.m_button10.SetBackgroundColour("#FF6600") self.m_button10.SetForegroundColour("white") self.Bind(wx.EVT_BUTTON, self.OnClick, self.m_button10) gSizer2.Add(self.m_button10, 0, wx.ALL | wx.EXPAND, 5) bSizer10.Add(gSizer2, 1, wx.EXPAND, 5) bSizer8.Add(bSizer10, 7, wx.EXPAND, 5) self.SetSizer(bSizer8) self.Layout() self.Centre(wx.BOTH)
def __init__(self, parent, ID, doodle): wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER, size=(20,20)) numCols = 4 spacing = 4 btnSize = wx.Size(self.BMP_SIZE + 2*self.BMP_BORDER, self.BMP_SIZE + 2*self.BMP_BORDER) # Make a grid of buttons for each colour. Attach each button # event to self.OnSetColour. The button ID is the same as the # key in the colour dictionary. self.clrBtns = {} colours = doodle.menuColours keys = colours.keys() sortedkeys = sorted(keys) cGrid = wx.GridSizer(cols=numCols, hgap=2, vgap=2) for k in sortedkeys: bmp = self.MakeBitmap(colours[k]) b = buttons.GenBitmapToggleButton(self, k, bmp, size=btnSize ) b.SetBezelWidth(1) b.SetUseFocusIndicator(False) self.Bind(wx.EVT_BUTTON, self.OnSetColour, b) cGrid.Add(b, 0) self.clrBtns[colours[k]] = b self.clrBtns[colours[sortedkeys[0]]].SetToggle(True) # Make a grid of buttons for the thicknesses. Attach each button # event to self.OnSetThickness. The button ID is the same as the # thickness value. self.thknsBtns = {} tGrid = wx.GridSizer(cols=numCols, hgap=2, vgap=2) for x in range(1, doodle.maxThickness+1): b = buttons.GenToggleButton(self, x, str(x), size=btnSize) b.SetBezelWidth(1) b.SetUseFocusIndicator(False) self.Bind(wx.EVT_BUTTON, self.OnSetThickness, b) tGrid.Add(b, 0) self.thknsBtns[x] = b self.thknsBtns[1].SetToggle(True) # Make a colour indicator window, it is registerd as a listener # with the doodle window so it will be notified when the settings # change ci = ColourIndicator(self) doodle.AddListener(ci) doodle.Notify() self.doodle = doodle # Make a box sizer and put the two grids and the indicator # window in it. box = wx.BoxSizer(wx.VERTICAL) box.Add(cGrid, 0, wx.ALL, spacing) box.Add(tGrid, 0, wx.ALL, spacing) box.Add(ci, 0, wx.EXPAND|wx.ALL, spacing) self.SetSizer(box) self.SetAutoLayout(True) # Resize this window so it is just large enough for the # minimum requirements of the sizer. box.Fit(self)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Size(656, 398), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) wSizer_win = wx.WrapSizer(wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS) self.m_staticText_deviceModel = wx.StaticText( self, wx.ID_ANY, u"Use Typical Device Model:", wx.DefaultPosition, wx.Size(149, -1), 0) self.m_staticText_deviceModel.Wrap(-1) wSizer_win.Add(self.m_staticText_deviceModel, 0, wx.ALL, 5) m_choice_deviceModeChoices = [ u"No", u"ISSI_IS25LP064A_IS25WP064A", u"ISSI_IS26KS512S", u"MXIC_MX25UM51245G_MX66UM51245G_MX25LM51245G", u"MXIC_MX25UM51345G", u"Micron_MT35X", u"Adesto_AT25SF128A", u"Adesto_ATXP032", u"Cypress_S26KS512S", u"GigaDevice_GD25LB256E", u"GigaDevice_GD25LT256E", u"GigaDevice_GD25LX256E" ] self.m_choice_deviceMode = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(340, -1), m_choice_deviceModeChoices, 0) self.m_choice_deviceMode.SetSelection(0) wSizer_win.Add(self.m_choice_deviceMode, 0, wx.ALL, 5) self.m_staticText_winNull0 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(100, -1), 0) self.m_staticText_winNull0.Wrap(-1) wSizer_win.Add(self.m_staticText_winNull0, 0, wx.ALL, 5) self.m_notebook_norOpt0 = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.m_panel_norOpt0 = wx.Panel(self.m_notebook_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) gSizer_norOpt0 = wx.GridSizer(0, 2, 0, 0) self.m_staticText_deviceType = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Device Type:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_deviceType.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_deviceType, 0, wx.ALL, 5) m_choice_deviceTypeChoices = [ u"QuadSPI SDR NOR", u"QuadSPI DDR NOR", u"Hyper Flash 1.8V", u"Hyper Flash 3.0V", u"Macronix Octal DDR", u"Macronix Octal SDR", u"Micron Octal DDR", u"Micron Octal SDR", u"Adesto EcoXIP DDR", u"Adesto EcoXIP SDR" ] self.m_choice_deviceType = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_deviceTypeChoices, 0) self.m_choice_deviceType.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_deviceType, 0, wx.ALL, 5) self.m_staticText_queryPads = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Query Pads:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_queryPads.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_queryPads, 0, wx.ALL, 5) m_choice_queryPadsChoices = [u"1", u"4", u"8"] self.m_choice_queryPads = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_queryPadsChoices, 0) self.m_choice_queryPads.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_queryPads, 0, wx.ALL, 5) self.m_staticText_cmdPads = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Cmd Pads:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_cmdPads.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_cmdPads, 0, wx.ALL, 5) m_choice_cmdPadsChoices = [u"1", u"4", u"8"] self.m_choice_cmdPads = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_cmdPadsChoices, 0) self.m_choice_cmdPads.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_cmdPads, 0, wx.ALL, 5) self.m_staticText_quadModeSetting = wx.StaticText( self.m_panel_norOpt0, wx.ID_ANY, u"Quad Mode Setting:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_quadModeSetting.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_quadModeSetting, 0, wx.ALL, 5) m_choice_quadModeSettingChoices = [ u"Not Configured", u"Set StatusReg1[6]", u"Set StatusReg2[1]", u"Set StatusReg2[7]", u"Set StatusReg2[1] by 0x31" ] self.m_choice_quadModeSetting = wx.Choice( self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_quadModeSettingChoices, 0) self.m_choice_quadModeSetting.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_quadModeSetting, 0, wx.ALL, 5) self.m_staticText_miscMode = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Misc Mode:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_miscMode.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_miscMode, 0, wx.ALL, 5) m_choice_miscModeChoices = [ u"Disabled", u"0_4_4 Mode", u"0_8_8 Mode", u"Data Order Swapped" ] self.m_choice_miscMode = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_miscModeChoices, 0) self.m_choice_miscMode.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_miscMode, 0, wx.ALL, 5) self.m_staticText_maxFrequency = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Max Frequency:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_maxFrequency.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_maxFrequency, 0, wx.ALL, 5) m_choice_maxFrequencyChoices = [ u"30MHz", u"50MHz", u"60MHz", u"75MHz", u"80MHz", u"100MHz", u"133MHz", u"166MHz" ] self.m_choice_maxFrequency = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_maxFrequencyChoices, 0) self.m_choice_maxFrequency.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_maxFrequency, 0, wx.ALL, 5) self.m_staticText_hasOption1 = wx.StaticText(self.m_panel_norOpt0, wx.ID_ANY, u"Has Option1:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText_hasOption1.Wrap(-1) gSizer_norOpt0.Add(self.m_staticText_hasOption1, 0, wx.ALL, 5) m_choice_hasOption1Choices = [u"No", u"Yes"] self.m_choice_hasOption1 = wx.Choice(self.m_panel_norOpt0, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_hasOption1Choices, 0) self.m_choice_hasOption1.SetSelection(0) gSizer_norOpt0.Add(self.m_choice_hasOption1, 0, wx.ALL, 5) self.m_panel_norOpt0.SetSizer(gSizer_norOpt0) self.m_panel_norOpt0.Layout() gSizer_norOpt0.Fit(self.m_panel_norOpt0) self.m_notebook_norOpt0.AddPage(self.m_panel_norOpt0, u"Nor Option0", False) wSizer_win.Add(self.m_notebook_norOpt0, 1, wx.EXPAND | wx.ALL, 5) self.m_notebook_norOpt1 = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.m_panel_norOpt1 = wx.Panel(self.m_notebook_norOpt1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) gSizer_norOpt1 = wx.GridSizer(0, 2, 0, 0) self.m_staticText_flashConnection = wx.StaticText( self.m_panel_norOpt1, wx.ID_ANY, u"Flash Connection:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_flashConnection.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_flashConnection, 0, wx.ALL, 5) m_choice_flashConnectionChoices = [ u"Single Port A", u"Parallel", u"Single Port B", u"Both Ports" ] self.m_choice_flashConnection = wx.Choice( self.m_panel_norOpt1, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_flashConnectionChoices, 0) self.m_choice_flashConnection.SetSelection(0) gSizer_norOpt1.Add(self.m_choice_flashConnection, 0, wx.ALL, 5) self.m_staticText_driveStrength = wx.StaticText( self.m_panel_norOpt1, wx.ID_ANY, u"Drive Strength:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_driveStrength.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_driveStrength, 0, wx.ALL, 5) self.m_textCtrl_driveStrength = wx.TextCtrl(self.m_panel_norOpt1, wx.ID_ANY, u"0", wx.DefaultPosition, wx.Size(140, -1), 0) gSizer_norOpt1.Add(self.m_textCtrl_driveStrength, 0, wx.ALL, 5) self.m_staticText_dqsPinmuxGroup = wx.StaticText( self.m_panel_norOpt1, wx.ID_ANY, u"DQS Pinmux Group:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_dqsPinmuxGroup.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_dqsPinmuxGroup, 0, wx.ALL, 5) self.m_textCtrl_dqsPinmuxGroup = wx.TextCtrl(self.m_panel_norOpt1, wx.ID_ANY, u"0", wx.DefaultPosition, wx.Size(140, -1), 0) gSizer_norOpt1.Add(self.m_textCtrl_dqsPinmuxGroup, 0, wx.ALL, 5) self.m_staticText_enableSecondPinmux = wx.StaticText( self.m_panel_norOpt1, wx.ID_ANY, u"Enable Second Pinmux:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_enableSecondPinmux.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_enableSecondPinmux, 0, wx.ALL, 5) m_choice_enableSecondPinmuxChoices = [u"No", u"Yes"] self.m_choice_enableSecondPinmux = wx.Choice( self.m_panel_norOpt1, wx.ID_ANY, wx.DefaultPosition, wx.Size(140, -1), m_choice_enableSecondPinmuxChoices, 0) self.m_choice_enableSecondPinmux.SetSelection(0) gSizer_norOpt1.Add(self.m_choice_enableSecondPinmux, 0, wx.ALL, 5) self.m_staticText_statusOverride = wx.StaticText( self.m_panel_norOpt1, wx.ID_ANY, u"Status Override:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_statusOverride.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_statusOverride, 0, wx.ALL, 5) self.m_textCtrl_statusOverride = wx.TextCtrl(self.m_panel_norOpt1, wx.ID_ANY, u"0", wx.DefaultPosition, wx.Size(140, -1), 0) gSizer_norOpt1.Add(self.m_textCtrl_statusOverride, 0, wx.ALL, 5) self.m_staticText_dummyCycles = wx.StaticText(self.m_panel_norOpt1, wx.ID_ANY, u"Dummy Cycles:", wx.DefaultPosition, wx.Size(140, -1), 0) self.m_staticText_dummyCycles.Wrap(-1) gSizer_norOpt1.Add(self.m_staticText_dummyCycles, 0, wx.ALL, 5) self.m_textCtrl_dummyCycles = wx.TextCtrl(self.m_panel_norOpt1, wx.ID_ANY, u"0", wx.DefaultPosition, wx.Size(140, -1), 0) gSizer_norOpt1.Add(self.m_textCtrl_dummyCycles, 0, wx.ALL, 5) self.m_panel_norOpt1.SetSizer(gSizer_norOpt1) self.m_panel_norOpt1.Layout() gSizer_norOpt1.Fit(self.m_panel_norOpt1) self.m_notebook_norOpt1.AddPage(self.m_panel_norOpt1, u"Nor Option1", False) wSizer_win.Add(self.m_notebook_norOpt1, 1, wx.EXPAND | wx.ALL, 5) self.m_staticText_winNull1 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(356, -1), 0) self.m_staticText_winNull1.Wrap(-1) wSizer_win.Add(self.m_staticText_winNull1, 0, wx.ALL, 5) self.m_button_ok = wx.Button(self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.Size(100, -1), 0) wSizer_win.Add(self.m_button_ok, 0, wx.ALL, 5) self.m_button_cancel = wx.Button(self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.Size(100, -1), 0) wSizer_win.Add(self.m_button_cancel, 0, wx.ALL, 5) self.SetSizer(wSizer_win) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.callbackClose) self.m_choice_deviceMode.Bind(wx.EVT_CHOICE, self.callbackUseTypicalDeviceModel) self.m_choice_hasOption1.Bind(wx.EVT_CHOICE, self.callbackHasOption1) self.m_button_ok.Bind(wx.EVT_BUTTON, self.callbackOk) self.m_button_cancel.Bind(wx.EVT_BUTTON, self.callbackCancel)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"登录界面", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer3 = wx.BoxSizer(wx.VERTICAL) bSizer3.AddSpacer(10) self.sys_name = wx.StaticText(self, wx.ID_ANY, u"图 像 压 缩 系 统", wx.DefaultPosition, wx.DefaultSize, 0) self.sys_name.Wrap(-1) self.sys_name.SetFont(wx.Font(20, 70, 90, 90, False, wx.EmptyString)) bSizer3.Add(self.sys_name, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) gSizer2 = wx.GridSizer(0, 2, 0, 0) self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"用户名", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) self.m_staticText8.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gSizer2.Add( self.m_staticText8, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) self.username = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(150, -1), 0) self.username.SetMaxLength(6) gSizer2.Add(self.username, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"密 码", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText9.Wrap(-1) self.m_staticText9.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gSizer2.Add(self.m_staticText9, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.password = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(150, -1), wx.TE_PASSWORD) self.password.SetMaxLength(6) gSizer2.Add(self.password, 0, wx.ALL, 5) bSizer3.Add(gSizer2, 1, wx.EXPAND, 5) ok_cancel_help = wx.StdDialogButtonSizer() self.ok_cancel_helpOK = wx.Button(self, wx.ID_OK) ok_cancel_help.AddButton(self.ok_cancel_helpOK) self.ok_cancel_helpCancel = wx.Button(self, wx.ID_CANCEL) ok_cancel_help.AddButton(self.ok_cancel_helpCancel) self.ok_cancel_helpHelp = wx.Button(self, wx.ID_HELP) ok_cancel_help.AddButton(self.ok_cancel_helpHelp) ok_cancel_help.Realize() bSizer3.Add(ok_cancel_help, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) self.register = wx.Button(self, wx.ID_ANY, u"注册", wx.DefaultPosition, wx.DefaultSize, 0) self.register.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 90, False, wx.EmptyString)) bSizer3.Add(self.register, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.SetSizer(bSizer3) self.Layout() self.Centre(wx.BOTH) # Connect Events self.ok_cancel_helpCancel.Bind(wx.EVT_BUTTON, self.cancel_event) self.ok_cancel_helpHelp.Bind(wx.EVT_BUTTON, self.help_event) self.ok_cancel_helpOK.Bind(wx.EVT_BUTTON, self.ok_event) self.register.Bind(wx.EVT_BUTTON, self.open_register_frame_event)
def __init__(self, parent, ori_image_path, cpr_image_path): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Size(1000, 600), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.cpr_image_path = cpr_image_path self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer7 = wx.BoxSizer(wx.VERTICAL) gSizer4 = wx.GridSizer(0, 2, 0, 0) self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"小波变换后的图像", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) self.m_staticText8.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) gSizer4.Add(self.m_staticText8, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) gSizer7 = wx.GridSizer(0, 2, 0, 0) ori_img_name = str(os.path.getsize(ori_image_path) / float(1024)).split('.') self.ori_image_size = wx.StaticText( self, wx.ID_ANY, '原图大小:' + ori_img_name[0] + '.' + ori_img_name[1][:2] + 'KB', wx.DefaultPosition, wx.DefaultSize, 0) self.ori_image_size.Wrap(-1) self.ori_image_size.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) gSizer7.Add(self.ori_image_size, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) cpr_img_name = str(os.path.getsize(cpr_image_path) / float(1024)).split('.') self.cpr_image_type = wx.StaticText( self, wx.ID_ANY, '压缩后大小:' + cpr_img_name[0] + '.' + cpr_img_name[1][:2] + 'KB', wx.DefaultPosition, wx.DefaultSize, 0) self.cpr_image_type.Wrap(-1) self.cpr_image_type.SetFont( wx.Font(12, 70, 90, 90, False, wx.EmptyString)) gSizer7.Add(self.cpr_image_type, 0, wx.ALL, 5) gSizer4.Add(gSizer7, 1, wx.EXPAND, 5) bSizer7.Add(gSizer4, 0, wx.EXPAND, 5) gSizer6 = wx.GridSizer(0, 2, 0, 0) gSizer5 = wx.GridSizer(0, 2, 0, 0) dwt_path = cpr_image_path.split('.') self.i1 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap(dwt_path[0] + '(1).' + dwt_path[1], wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.Size(-1, -1), 0) gSizer5.Add(self.i1, 1, wx.ALL | wx.EXPAND, 5) self.i2 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap(dwt_path[0] + '(2).' + dwt_path[1], wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.i2, 1, wx.ALL | wx.EXPAND, 5) self.i3 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap(dwt_path[0] + '(3).' + dwt_path[1], wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.i3, 1, wx.ALL | wx.EXPAND, 5) self.i4 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap(dwt_path[0] + '(4).' + dwt_path[1], wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.i4, 1, wx.ALL | wx.EXPAND, 5) gSizer6.Add(gSizer5, 1, wx.EXPAND, 5) self.m_scrolledWindow3 = wx.ScrolledWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL) self.m_scrolledWindow3.SetScrollRate(5, 5) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.image = wx.StaticBitmap( self.m_scrolledWindow3, wx.ID_ANY, wx.Bitmap(cpr_image_path, wx.BITMAP_TYPE_ANY), wx.DefaultPosition, wx.DefaultSize, 0) bSizer5.Add(self.image, 1, wx.ALL | wx.EXPAND, 5) self.m_scrolledWindow3.SetSizer(bSizer5) self.m_scrolledWindow3.Layout() bSizer5.Fit(self.m_scrolledWindow3) gSizer6.Add(self.m_scrolledWindow3, 1, wx.EXPAND | wx.ALL, 5) bSizer7.Add(gSizer6, 1, wx.EXPAND, 5) gbSizer7 = wx.GridBagSizer(0, 0) gbSizer7.SetFlexibleDirection(wx.BOTH) gbSizer7.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.cps_image_path = wx.Button(self, wx.ID_ANY, u"压缩图像路径", wx.DefaultPosition, wx.DefaultSize, 0) gbSizer7.Add(self.cps_image_path, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.ALL, 5) self.back_to_main = wx.Button(self, wx.ID_ANY, u"返回主界面", wx.DefaultPosition, wx.DefaultSize, 0) gbSizer7.Add(self.back_to_main, wx.GBPosition(0, 3), wx.GBSpan(1, 1), wx.ALL, 5) self.exit = wx.Button(self, wx.ID_ANY, u"退出系统", wx.DefaultPosition, wx.DefaultSize, 0) gbSizer7.Add(self.exit, wx.GBPosition(0, 6), wx.GBSpan(1, 1), wx.ALL, 5) bSizer7.Add(gbSizer7, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) self.SetSizer(bSizer7) self.Layout() self.Centre(wx.BOTH) # Connect Events self.cps_image_path.Bind(wx.EVT_BUTTON, self.image_path_event) self.back_to_main.Bind(wx.EVT_BUTTON, self.back_to_main_event) self.exit.Bind(wx.EVT_BUTTON, self.exit_event)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"主界面", pos=wx.DefaultPosition, size=wx.Size(500, 500), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer5 = wx.BoxSizer(wx.VERTICAL) gSizer7 = wx.GridSizer(0, 2, 0, 0) gSizer6 = wx.GridSizer(0, 2, 0, 0) self.compression = wx.Button(self, wx.ID_ANY, u"压缩图像", wx.DefaultPosition, wx.DefaultSize, 0) gSizer6.Add(self.compression, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.extract_text = wx.Button(self, wx.ID_ANY, u"提取文本", wx.DefaultPosition, wx.DefaultSize, 0) gSizer6.Add(self.extract_text, 0, wx.ALL, 5) gSizer7.Add(gSizer6, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) self.select_image = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) gSizer7.Add(self.select_image, 0, wx.ALL | wx.EXPAND, 5) bSizer5.Add(gSizer7, 0, wx.EXPAND, 5) self.m_scrolledWindow2 = wx.ScrolledWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL | wx.VSCROLL) self.m_scrolledWindow2.SetScrollRate(5, 5) bSizer6 = wx.BoxSizer(wx.VERTICAL) self.image = wx.StaticBitmap(self.m_scrolledWindow2, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0) bSizer6.Add(self.image, 1, wx.ALL | wx.EXPAND, 5) self.m_scrolledWindow2.SetSizer(bSizer6) self.m_scrolledWindow2.Layout() bSizer6.Fit(self.m_scrolledWindow2) bSizer5.Add(self.m_scrolledWindow2, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer5) self.Layout() self.Centre(wx.BOTH) # Connect Events self.compression.Bind(wx.EVT_BUTTON, self.compression_event) self.extract_text.Bind(wx.EVT_BUTTON, self.extract_text_event) self.select_image.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_image_event)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"注册界面", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer4 = wx.BoxSizer(wx.VERTICAL) bSizer4.AddSpacer(30) gSizer3 = wx.GridSizer(0, 2, 0, 0) self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"用户名", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10.Wrap(-1) self.m_staticText10.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gSizer3.Add(self.m_staticText10, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_BOTTOM, 5) self.username = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.username.SetMaxLength(6) self.username.SetMinSize(wx.Size(150, -1)) gSizer3.Add(self.username, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_staticText11 = wx.StaticText(self, wx.ID_ANY, u"密 码", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText11.Wrap(-1) self.m_staticText11.SetFont( wx.Font(14, 70, 90, 90, False, wx.EmptyString)) gSizer3.Add( self.m_staticText11, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) self.password = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(150, -1), wx.TE_PASSWORD) self.password.SetMaxLength(6) gSizer3.Add(self.password, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) bSizer4.Add(gSizer3, 1, wx.EXPAND, 5) bSizer4.AddSpacer(20) ok_cancel_help = wx.StdDialogButtonSizer() self.ok_cancel_helpOK = wx.Button(self, wx.ID_OK) ok_cancel_help.AddButton(self.ok_cancel_helpOK) self.ok_cancel_helpCancel = wx.Button(self, wx.ID_CANCEL) ok_cancel_help.AddButton(self.ok_cancel_helpCancel) self.ok_cancel_helpHelp = wx.Button(self, wx.ID_HELP) ok_cancel_help.AddButton(self.ok_cancel_helpHelp) ok_cancel_help.Realize() bSizer4.Add(ok_cancel_help, 0, wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer4.AddSpacer(50) self.SetSizer(bSizer4) self.Layout() self.Centre(wx.BOTH) # Connect Events self.ok_cancel_helpCancel.Bind(wx.EVT_BUTTON, self.cancel_event) self.ok_cancel_helpHelp.Bind(wx.EVT_BUTTON, self.help_event) self.ok_cancel_helpOK.Bind(wx.EVT_BUTTON, self.ok_event)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"感知哈希", pos=wx.DefaultPosition, size=wx.Size(-1, -1), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.MainPanel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer5 = wx.BoxSizer(wx.VERTICAL) self.m_panel281 = wx.Panel(self.MainPanel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer341 = wx.BoxSizer(wx.VERTICAL) self.m_panel291 = wx.Panel(self.m_panel281, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer351 = wx.BoxSizer(wx.HORIZONTAL) self.pan = wx.Panel(self.m_panel291, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer40 = wx.BoxSizer(wx.VERTICAL) gSizer12 = wx.GridSizer(3, 2, 10, 10) self.m_staticText18 = wx.StaticText(self.pan, wx.ID_ANY, u"哈希数值长度:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText18.Wrap(-1) gSizer12.Add(self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5) self.hash_size = wx.SpinCtrl(self.pan, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(80, -1), wx.SP_ARROW_KEYS, 4, 32, 8) gSizer12.Add(self.hash_size, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT, 5) self.m_staticText19 = wx.StaticText(self.pan, wx.ID_ANY, u"重设哈希尺度:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText19.Wrap(-1) gSizer12.Add(self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5) self.highfreq_factor = wx.SpinCtrl(self.pan, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(80, -1), wx.SP_ARROW_KEYS, 1, 30, 4) gSizer12.Add(self.highfreq_factor, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT, 5) self.m_staticText181 = wx.StaticText(self.pan, wx.ID_ANY, u"相似度阈值:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText181.Wrap(-1) gSizer12.Add(self.m_staticText181, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5) self.THRESHOLD = wx.SpinCtrlDouble(self.pan, id=-1, size=wx.Size(80, -1), min=0.01, max=1, initial=0.7, inc=0.01) gSizer12.Add(self.THRESHOLD, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT, 5) bSizer40.Add( gSizer12, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) self.pan.SetSizer(bSizer40) self.pan.Layout() bSizer40.Fit(self.pan) bSizer351.Add(self.pan, 1, wx.ALIGN_CENTER, 5) self.m_panel291.SetSizer(bSizer351) self.m_panel291.Layout() bSizer351.Fit(self.m_panel291) bSizer341.Add(self.m_panel291, 1, wx.ALIGN_CENTER, 5) self.m_panel281.SetSizer(bSizer341) self.m_panel281.Layout() bSizer341.Fit(self.m_panel281) bSizer5.Add(self.m_panel281, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) self.m_staticline2 = wx.StaticLine(self.MainPanel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer5.Add(self.m_staticline2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL | wx.EXPAND, 10) gSizer2 = wx.GridSizer(1, 2, 0, 0) self.OkBtn = wx.Button(self.MainPanel, wx.ID_ANY, u"确定", wx.DefaultPosition, wx.DefaultSize, 0) gSizer2.Add(self.OkBtn, 0, wx.ALIGN_LEFT, 5) self.CancelBtn = wx.Button(self.MainPanel, wx.ID_ANY, u"取消", wx.DefaultPosition, wx.DefaultSize, 0) gSizer2.Add(self.CancelBtn, 0, wx.ALIGN_RIGHT, 5) bSizer5.Add(gSizer2, 0, wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.RIGHT, 10) self.MainPanel.SetSizer(bSizer5) self.MainPanel.Layout() bSizer5.Fit(self.MainPanel) bSizer1.Add(self.MainPanel, 1, wx.EXPAND, 0) self.SetSizer(bSizer1) self.Layout() bSizer1.Fit(self) self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.Onclose) self.OkBtn.Bind(wx.EVT_BUTTON, self.OnOk) self.CancelBtn.Bind(wx.EVT_BUTTON, self.OnCancel) self.THRESHOLD.SetDigits(2)
def __init__(self, parent, denoiser): """ Make sure you use the clear button when you finish the task. Enable filters denoiser useful in some case, example when apply a deinterlace filter <https://askubuntu.com/questions/866186/how-to-get-good-quality-when- converting-digital-video> """ if denoiser: self.denoiser = denoiser else: self.denoiser = '' wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) zone = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, (_("Apply Denoisers Filters"))), wx.VERTICAL) self.ckbx_nlmeans = wx.CheckBox(self, wx.ID_ANY, (_("Enable nlmeans denoiser"))) nlmeans = [("Default"), ("Old VHS tapes - good starting point restoration"), ("Heavy - really noisy inputs"), ("Light - good quality inputs")] self.rdb_nlmeans = wx.RadioBox(self, wx.ID_ANY, (_("nlmeans options")), choices=nlmeans, majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.ckbx_hqdn3d = wx.CheckBox(self, wx.ID_ANY, (_("Enable hqdn3d denoiser"))) hqdn3d = [("Default"), ("Conservative [4.0:4.0:3.0:3.0]"), ("Old VHS tapes restoration [9.0:5.0:3.0:3.0]")] self.rdb_hqdn3d = wx.RadioBox(self, wx.ID_ANY, (_("hqdn3d options")), choices=hqdn3d, majorDimension=0, style=wx.RA_SPECIFY_ROWS) # ----- confirm buttons section btn_help = wx.Button(self, wx.ID_HELP, "") btn_close = wx.Button(self, wx.ID_CANCEL, "") self.btn_ok = wx.Button(self, wx.ID_OK, _("Apply")) btn_reset = wx.Button(self, wx.ID_CLEAR, _("Reset")) # ------ set Layout sizer_base = wx.BoxSizer(wx.VERTICAL) sizer_base.Add(zone, 1, wx.ALL | wx.EXPAND, 5) grid_den = wx.FlexGridSizer(2, 2, 0, 0) zone.Add(grid_den) grid_den.Add( self.ckbx_nlmeans, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) grid_den.Add( self.rdb_nlmeans, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) grid_den.Add( self.ckbx_hqdn3d, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) grid_den.Add( self.rdb_hqdn3d, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) # confirm btn section: gridBtn = wx.GridSizer(1, 2, 0, 0) gridhelp = wx.GridSizer(1, 1, 0, 0) gridhelp.Add(btn_help, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) gridBtn.Add(gridhelp) gridexit = wx.BoxSizer(wx.HORIZONTAL) gridexit.Add(btn_close, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) gridexit.Add(self.btn_ok, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) gridexit.Add(btn_reset, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) gridBtn.Add(gridexit, 0, wx.ALL | wx.ALIGN_RIGHT | wx.RIGHT, 0) # final settings: sizer_base.Add(gridBtn, 0, wx.EXPAND) self.SetSizer(sizer_base) sizer_base.Fit(self) self.Layout() # set Properties self.SetTitle(_("Denoiser filters")) tool = _('nlmeans:\nDenoise frames using Non-Local Means algorithm ' 'is capable of restoring video sequences with even strong ' 'noise. It is ideal for enhancing the quality of old VHS ' 'tapes.') self.ckbx_nlmeans.SetToolTip(tool) tool = _('hqdn3d:\nThis is a high precision/quality 3d denoise ' 'filter. It aims to reduce image noise, producing smooth ' 'images and making still images really still. It should ' 'enhance compressibility.') self.ckbx_hqdn3d.SetToolTip(tool) # ----------------------Binding (EVT)--------------------------# self.Bind(wx.EVT_CHECKBOX, self.on_nlmeans, self.ckbx_nlmeans) self.Bind(wx.EVT_CHECKBOX, self.on_hqdn3d, self.ckbx_hqdn3d) self.Bind(wx.EVT_RADIOBOX, self.on_nlmeans_opt, self.rdb_nlmeans) self.Bind(wx.EVT_RADIOBOX, self.on_hqdn3d_opt, self.rdb_hqdn3d) self.Bind(wx.EVT_BUTTON, self.on_help, btn_help) self.Bind(wx.EVT_BUTTON, self.on_close, btn_close) self.Bind(wx.EVT_BUTTON, self.on_ok, self.btn_ok) self.Bind(wx.EVT_BUTTON, self.on_reset, btn_reset) self.settings()
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Application", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) fgSizer1 = wx.FlexGridSizer( 0, 1, 0, 0 ) fgSizer1.SetFlexibleDirection( wx.BOTH ) fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) sbSizer1 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Input File" ), wx.VERTICAL ) self.m_input_file = wx.FilePickerCtrl( sbSizer1.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE ) sbSizer1.Add( self.m_input_file, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer1.Add( sbSizer1, 1, wx.EXPAND, 5 ) sbSizer11 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Output Directory" ), wx.VERTICAL ) self.m_output_dir = wx.DirPickerCtrl( sbSizer11.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE ) sbSizer11.Add( self.m_output_dir, 0, wx.ALL|wx.EXPAND, 5 ) fgSizer1.Add( sbSizer11, 1, wx.EXPAND, 5 ) sbSizer3 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Actions" ), wx.VERTICAL ) gSizer2 = wx.GridSizer( 0, 4, 0, 0 ) self.m_start_button = wx.Button( sbSizer3.GetStaticBox(), wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer2.Add( self.m_start_button, 0, wx.ALL, 5 ) self.m_save_button = wx.Button( sbSizer3.GetStaticBox(), wx.ID_ANY, u"Save Config", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer2.Add( self.m_save_button, 0, wx.ALL, 5 ) self.m_exit_button = wx.Button( sbSizer3.GetStaticBox(), wx.ID_ANY, u"Exit", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer2.Add( self.m_exit_button, 0, wx.ALL, 5 ) self.m_help_button = wx.Button( sbSizer3.GetStaticBox(), wx.ID_ANY, u"Help", wx.DefaultPosition, wx.DefaultSize, 0 ) gSizer2.Add( self.m_help_button, 0, wx.ALL, 5 ) sbSizer3.Add( gSizer2, 1, wx.EXPAND, 5 ) fgSizer1.Add( sbSizer3, 1, wx.EXPAND, 5 ) sbSizer4 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Results" ), wx.VERTICAL ) gSizer3 = wx.GridSizer( 0, 1, 0, 0 ) self.m_status_message = wx.StaticText( sbSizer4.GetStaticBox(), wx.ID_ANY, u"Waiting...", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_status_message.Wrap( -1 ) gSizer3.Add( self.m_status_message, 0, wx.ALL|wx.EXPAND, 5 ) sbSizer4.Add( gSizer3, 1, wx.EXPAND, 5 ) fgSizer1.Add( sbSizer4, 1, wx.EXPAND, 5 ) self.SetSizer( fgSizer1 ) self.Layout() fgSizer1.Fit( self ) self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_CLOSE, self.OnClose ) self.m_start_button.Bind( wx.EVT_BUTTON, self.OnStart ) self.m_save_button.Bind( wx.EVT_BUTTON, self.OnSave ) self.m_exit_button.Bind( wx.EVT_BUTTON, self.OnExit ) self.m_help_button.Bind( wx.EVT_BUTTON, self.OnHelp )
def rebuild_editor(self): """ Rebuilds the editor after its definition is modified. """ panel = self.control panel.SetSizer(None) panel.DestroyChildren() cur_value = parse_value(self.value) # Create a sizer to manage the radio buttons: labels = self.names values = self.values n = len(labels) cols = self.factory.cols rows = (n + cols - 1) / cols incr = [n / cols] * cols rem = n % cols for i in range(cols): incr[i] += (rem > i) incr[-1] = -(reduce(lambda x, y: x + y, incr[:-1], 0) - 1) if cols > 1: sizer = wx.GridSizer(0, cols, 2, 4) else: sizer = wx.BoxSizer(wx.VERTICAL) # Add the set of all possible choices: index = 0 for i in range(rows): for j in range(cols): if n > 0: label = labels[index] control = wx.CheckBox(panel, -1, label) control.value = value = values[index] control.SetValue(value in cur_value) wx.EVT_CHECKBOX(panel, control.GetId(), self.update_object) index += incr[j] n -= 1 else: control = wx.CheckBox(panel, -1, '') control.Show(False) sizer.Add(control, 0, wx.NORTH, 5) # Lay out the controls: panel.SetSizerAndFit(sizer) # FIXME: There are cases where one of the parent panel's of the check # list editor has a fixed 'min size' which prevents the check list # editor from expanding correctly, so we currently are making sure # that all of the parent panels do not have a fixed min size before # doing the layout/refresh: parent = panel.GetParent() while isinstance(parent, wx.Panel): parent.SetMinSize(wx.Size(-1, -1)) panel = parent parent = parent.GetParent() panel.Layout() panel.Refresh()
def createUI(self): rootBox = wx.BoxSizer(wx.VERTICAL) self.panel = wx.Panel(self, wx.ID_ANY) # self.panel = wx.lib.scrolledpanel.ScrolledPanel(self, -1, size=(1024, 400), pos=(0, 0), style=wx.SIMPLE_BORDER) # self.panel.SetupScrolling() # self.panel.SetBackgroundColour('#FFFFFF') panel_box = wx.GridSizer(14, 1, 5, 0) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox1 self.borrower_name1 = self.get_input_text(100) self.pack_input_text(hbox_temp, "借款人1姓名", self.borrower_name1) self.borrower_home1 = self.get_input_text(300) self.pack_input_text(hbox_temp, "借款人1住所地", self.borrower_home1) self.borrower_adress1 = self.get_input_text(300) self.borrower_adress1.Bind(wx.EVT_TEXT, self.syn_borrower_address) self.pack_input_text(hbox_temp, "借款人1通讯地址", self.borrower_adress1) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox2 self.borrower_id1 = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人1身份证号", self.borrower_id1) self.borrower_phone1 = self.get_input_text(200) self.pack_input_text(hbox_temp, "电话", self.borrower_phone1) sex_arr = ['男', '女'] self.sex1 = self.get_choice(sex_arr) self.pack_input_text(hbox_temp, "性别", self.sex1) self.age1 = self.get_input_text(50) self.pack_input_text(hbox_temp, "年龄", self.age1) self.household1 = self.get_input_text(200) self.pack_input_text(hbox_temp, "户籍", self.household1) hbox21 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox21 self.birthday = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人1出生日期", self.birthday) self.set_input_text(self.birthday, '年 月 日') self.marg = self.get_input_text(100) self.pack_input_text(hbox_temp, "借款人1婚姻状况", self.marg) hbox22 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox22 self.company1 = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人1单位", self.company1) self.company_phone1 = self.get_input_text(200) self.pack_input_text(hbox_temp, "单位电话", self.company_phone1) self.month_income1 = self.get_input_text(100) self.month_income1.Bind(wx.EVT_TEXT, self.cal_home_income) self.pack_input_text(hbox_temp, "月收入", self.month_income1) self.sup_people = self.get_input_text(100) self.pack_input_text(hbox_temp, "供养人数", self.sup_people) hbox23 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox23 self.company2 = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人2单位", self.company2) self.company_phone2 = self.get_input_text(200) self.pack_input_text(hbox_temp, "单位电话", self.company_phone2) self.month_income2 = self.get_input_text(100) self.month_income2.Bind(wx.EVT_TEXT, self.cal_home_income) self.pack_input_text(hbox_temp, "月收入", self.month_income2) self.home_income = self.get_input_text(100) self.pack_input_text(hbox_temp, "家庭月收入", self.home_income) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox3 self.borrower_name2 = self.get_input_text(100) self.pack_input_text(hbox_temp, "借款人2姓名", self.borrower_name2) self.borrower_home2 = self.get_input_text(300) self.pack_input_text(hbox_temp, "借款人2住所地", self.borrower_home2) self.borrower_adress2 = self.get_input_text(300) self.pack_input_text(hbox_temp, "借款人2通讯地址", self.borrower_adress2) hbox4 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox4 self.borrower_id2 = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人2身份证号", self.borrower_id2) self.borrower_phone2 = self.get_input_text(200) self.pack_input_text(hbox_temp, "借款人2电话", self.borrower_phone2) hbox5 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox5 self.loan_proportion = self.get_input_text(100) self.loan_proportion.Bind(wx.EVT_TEXT, self.cal_house_price) self.pack_input_text(hbox_temp, "几成购房贷款", self.loan_proportion) self.loan_number_small = self.get_input_text(150) self.loan_number_small.Bind(wx.EVT_TEXT, self.convert_loan_number) self.pack_input_text(hbox_temp, "贷款金额小写", self.loan_number_small) self.loan_number_big = self.get_input_text(300) self.pack_input_text(hbox_temp, "贷款金额大写", self.loan_number_big) self.house_price = self.get_input_text(100) self.house_price.Bind(wx.EVT_TEXT, self.cal_house_uint_price) self.pack_input_text(hbox_temp, "房屋售价", self.house_price) hbox52 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox52 self.house_location = self.get_input_text(300) self.pack_input_text(hbox_temp, "购房地址", self.house_location) self.house_no = self.get_input_text(150) self.pack_input_text(hbox_temp, "房屋座别", self.house_no) self.house_area = self.get_input_text(100) self.house_area.Bind(wx.EVT_TEXT, self.cal_house_uint_price) self.pack_input_text(hbox_temp, "建筑面积", self.house_area) self.house_uint_price = self.get_input_text(100) self.pack_input_text(hbox_temp, "房屋单价", self.house_uint_price) hbox6 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox6 self.paid_house_money = self.get_input_text(100) self.pack_input_text(hbox_temp, "已付购房款", self.paid_house_money) self.loan_duration_month = self.get_input_text(100) self.loan_duration_month.Bind(wx.EVT_TEXT, self.cal_end_date) self.pack_input_text(hbox_temp, "借款期限/月", self.loan_duration_month) self.start_year = self.get_input_text(100) self.start_year.Bind(wx.EVT_TEXT, self.cal_end_date) self.pack_input_text(hbox_temp, "起始年", self.start_year) self.start_month = self.get_input_text(100) self.start_month.Bind(wx.EVT_TEXT, self.cal_end_date) self.pack_input_text(hbox_temp, "-月", self.start_month) self.start_day = self.get_input_text(100) self.start_day.Bind(wx.EVT_TEXT, self.cal_end_date) self.pack_input_text(hbox_temp, "-日", self.start_day) hbox7 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox7 self.end_year = self.get_input_text(100) self.pack_input_text(hbox_temp, "截止年", self.end_year) self.end_month = self.get_input_text(100) self.pack_input_text(hbox_temp, "-月", self.end_month) self.end_day = self.get_input_text(100) self.pack_input_text(hbox_temp, "-日", self.end_day) self.standard_rate = self.get_input_text(100) self.standard_rate.SetLabelText("4.75") self.pack_input_text(hbox_temp, "LPR利率", self.standard_rate) float_direction_arr = ["上", "下"] self.float_direction = self.get_choice(float_direction_arr) self.float_direction.Bind(wx.EVT_TEXT, self.cal_actual_rate) self.pack_input_text(hbox_temp, "浮动(上/下)", self.float_direction) self.float_num = self.get_input_text(100) self.float_num.Bind(wx.EVT_TEXT, self.cal_actual_rate) self.pack_input_text(hbox_temp, "浮动基点", self.float_num) hbox8 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox8 self.actual_rate = self.get_input_text(100) self.pack_input_text(hbox_temp, "执行年利率", self.actual_rate) self.account_name = self.get_input_text(100) self.pack_input_text(hbox_temp, "户名", self.account_name) self.account_num = self.get_input_text(200) self.pack_input_text(hbox_temp, "账号", self.account_num) self.repayment_times = self.get_input_text(100) self.pack_input_text(hbox_temp, "还款期数", self.repayment_times) choice_arr = ["A", "B"] self.repayment_method = self.get_choice(choice_arr) self.pack_input_text(hbox_temp, "还款方式:(A/B)", self.repayment_method) hbox9 = wx.BoxSizer(wx.HORIZONTAL) hbox_temp = hbox9 self.repayment_num_small = self.get_input_text(150) self.repayment_num_small.Bind(wx.EVT_TEXT, self.convert_repayment_num) self.pack_input_text(hbox_temp, "还款金额小写", self.repayment_num_small) self.repayment_num_big = self.get_input_text(300) self.pack_input_text(hbox_temp, "还款金额大写", self.repayment_num_big) panel_box.Add(hbox1) panel_box.Add(hbox2) panel_box.Add(hbox21) panel_box.Add(hbox3) panel_box.Add(hbox4) panel_box.Add(hbox5) panel_box.Add(hbox52) panel_box.Add(hbox6) panel_box.Add(hbox7) panel_box.Add(hbox8) panel_box.Add(hbox9) panel_box.Add(hbox22) panel_box.Add(hbox23) self.panel.SetSizer(panel_box) rootBox.Add(self.panel, 1, wx.EXPAND | wx.ALL, 20) self.btn_generate_template = self.get_button( "生成合同", self.pre_generate_template) self.btn_set_save_path = self.get_button("文件路径", self.set_save_path) self.label_set_save_path = wx.StaticText(self, -1, label="当前路径") self.label_set_save_path.SetFont(self.input_font) cur_path = os.path.abspath(".") self.label_set_save_path.SetLabelText(cur_path) bottom_box = wx.BoxSizer(wx.HORIZONTAL) bottom_box2 = wx.BoxSizer(wx.HORIZONTAL) self.btn_save_data = self.get_button("保存", self.save_user_data) self.btn_resume_last_data = self.get_button("恢复", self.resume_last_data) self.btn_resume_selected_data = self.get_button( "选择恢复", self.resume_selected_user_data) self.btn_clear_data = self.get_button("一键清空", self.clear_input_data) self.btn_full_screen = self.get_button("全屏切换", self.show_full_screen) # self.btn_test = self.get_button("测试", self.test_button_event) # bottom_box.Add(self.btn_test, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 10) bottom_box.Add(self.btn_save_data, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 0) bottom_box.Add(self.btn_resume_last_data, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 10) bottom_box.Add(self.btn_resume_selected_data, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 10) bottom_box.Add(self.btn_clear_data, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 10) bottom_box.Add(self.btn_generate_template, 0, wx.ALIGN_CENTER | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 60) bottom_box.Add(self.btn_full_screen, 0, wx.ALIGN_CENTER | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 60) bottom_box.Add(self.btn_set_save_path, 0, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 10) bottom_box.Add(self.label_set_save_path, 0, wx.ALIGN_LEFT | wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) rootBox.Add(bottom_box, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 40) # rootBox.Add(bottom_box2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.LEFT | wx.DOWN | wx.EXPAND, 40) self.SetSizer(rootBox) self.SetBackgroundColour(self.panel.GetBackgroundColour()) # 创建定时器 self.timer = wx.Timer(self) # 创建定时器 self.Bind(wx.EVT_TIMER, self.refresh_timer, self.timer) # 绑定一个定时器事件 self.timer.Start(1000) self.resume_setting() # icon = wx.EmptyIcon() # icon.CopyFromBitmap(wx.Bitmap("my.ico", wx.BITMAP_TYPE_ANY)) # self.SetIcon(icon) # self.SetBackgroundColour((0, 0, 0)) pass
def __init__(self): wx.Dialog.__init__(self,None,-1,u"服务器IQ文件",wx.DefaultPosition,size=(340,340)) panel = wx.Panel(self,-1) # # locpathLbl = wx.StaticText(panel,-1,u"服务器文件路径选择:") # self.locpath = wx.TextCtrl(panel,-1,u"") # chooseBtn = wx.Button(panel,-1,u"选择") # powLbl = wx.StaticText(panel,-1,u"IQ文件图形显示:") waveDispl = wx.CheckBox(panel,-1,u" 波形图") spDispl = wx.CheckBox(panel,-1,u" 功率谱") waterDispl = wx.CheckBox(panel,-1,u" 瀑布图") ccdfDispl = wx.CheckBox(panel,-1,u" CCDF") eyeDispl = wx.CheckBox(panel,-1,u" 眼图") conDispl = wx.CheckBox(panel,-1,u" 星座图") displBtn = wx.Button(panel,-1,u"显示") img_waveform = wx.Image('./icons//waveform.png',wx.BITMAP_TYPE_ANY) bmp_waveform = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_waveform)) img_spectrum = wx.Image('./icons//spectrum.png',wx.BITMAP_TYPE_ANY) bmp_spectrum = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_spectrum)) img_waterfall = wx.Image('./icons//waterfull.png',wx.BITMAP_TYPE_ANY) bmp_waterfall = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_waterfall)) img_ccdf = wx.Image('./icons//ccdf.png',wx.BITMAP_TYPE_ANY) bmp_ccdf = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_ccdf)) img_eye = wx.Image('./icons//eye.png',wx.BITMAP_TYPE_ANY) bmp_eye = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_eye)) img_constellation = wx.Image('./icons//constellation.png',wx.BITMAP_TYPE_ANY) bmp_constellation = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_constellation)) # pSizer = wx.BoxSizer(wx.VERTICAL) # pSizer.Add(locpathLbl,0,wx.ALL,5) # pSizer.Add(self.locpath,0,wx.ALL|wx.EXPAND,5) # pSizer.Add(chooseBtn,0,wx.ALIGN_CENTER,5) # pSizer.Add((10,10)) # pSizer.Add(wx.StaticLine(panel),0,wx.EXPAND,5) # iqdisSizer = wx.GridSizer(6,3,0,0) iqdisSizer.Add(powLbl,0,wx.ALL,5) iqdisSizer.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) iqdisSizer.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) iqdisSizer.Add(bmp_waveform,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(bmp_spectrum,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(bmp_waterfall,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(waveDispl,0,wx.ALL,5) iqdisSizer.Add(spDispl,0,wx.ALL,5) iqdisSizer.Add(waterDispl,0,wx.ALL,5) iqdisSizer.Add(bmp_ccdf,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(bmp_eye,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(bmp_constellation,0,wx.ALIGN_CENTER,5) iqdisSizer.Add(ccdfDispl,0,wx.ALL,5) iqdisSizer.Add(eyeDispl,0,wx.ALL,5) iqdisSizer.Add(conDispl,0,wx.ALL,5) iqdisSizer.Add(displBtn, 0, wx.ALL, 5) panel.SetSizer(iqdisSizer) # btnSizer = wx.BoxSizer(wx.VERTICAL) # btnSizer.Add(displBtn,0,wx.ALL,5) # # pSizer.Add(iqdisSizer,0,wx.ALL,5) # pSizer.Add(btnSizer,0,wx.ALIGN_CENTER,5) # panel.SetSizer(pSizer) #pSizer.Fit(self) #pSizer.SetSizeHints(self) self.Bind(wx.EVT_BUTTON, self.OnButtonClick, displBtn)
def __do_layout(self): # begin wxGlade: MyFrame2.__do_layout sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_10 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy_1_copy_1_copy_1 = wx.GridSizer(1, 2, 0, 0) sizer_9 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy_1_copy_1 = wx.GridSizer(1, 2, 0, 0) sizer_4 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy = wx.GridSizer(1, 2, 0, 0) sizer_3_copy = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy_1 = wx.GridSizer(1, 2, 0, 0) sizer_4_copy = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy_1_copy = wx.GridSizer(1, 2, 0, 0) sizer_5 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_copy_1_copy_1_copy = wx.GridSizer(1, 2, 0, 0) sizer_3 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy = wx.GridSizer(1, 2, 0, 0) sizer_2 = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.GridSizer(1, 2, 0, 0) sizer_1_copy = wx.BoxSizer(wx.VERTICAL) grid_sizer_1_copy_1 = wx.GridSizer(1, 2, 0, 0) sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_6.Add(self.bitmap_1, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_1.Add(self.label_1, 0, wx.ALL | wx.EXPAND, 7) sizer_1.Add(self.text_ctrl_1, 0, wx.ALL, 7) sizer_1.Add((20, 20), 0, 0, 0) sizer_1.Add(self.checkinstallation, 0, wx.ALL, 7) sizer_1.Add(self.button_next1, 0, wx.ALL, 7) sizer_1.Add((20, 20), 0, 0, 0) sizer_1.Add(self.hyperlink_3, 0, 0, 0) sizer_1.Add(self.hyperlink_2, 0, 0, 0) sizer_1.Add(self.hyperlink_1, 0, 0, 0) sizer_1.Add(self.hyperlink_4, 0, 0, 0) sizer_1.Add(self.hyperlink_10, 0, 0, 0) self.notebook_2_pane_1.SetSizer(sizer_1) sizer_1_copy.Add(self.label_1a, 0, wx.ALL | wx.EXPAND, 7) sizer_1_copy.Add(self.text_ctrl_1a, 0, wx.ALL, 7) sizer_1_copy.Add(self.button_1_copy, 0, wx.ALL, 7) grid_sizer_1_copy_1.Add(self.text_ctrl_3_copy, 0, wx.ALL, 7) grid_sizer_1_copy_1.Add(self.button_runhelp, 0, wx.ALL, 7) sizer_1_copy.Add(grid_sizer_1_copy_1, 0, 0, 0) sizer_1_copy.Add((20, 20), 0, 0, 0) sizer_1_copy.Add(self.button_next1_copy, 0, wx.ALL, 7) sizer_1_copy.Add((20, 20), 0, 0, 0) sizer_1_copy.Add(self.hyperlink_11, 0, 0, 0) self.notebook_2_pane_2.SetSizer(sizer_1_copy) sizer_2.Add(self.label_3, 0, wx.ALL | wx.EXPAND, 7) sizer_2.Add(self.text_ctrl_2, 0, wx.ALL, 7) grid_sizer_1.Add(self.text_ctrl_3, 0, wx.ALL, 7) grid_sizer_1.Add(self.button_run1, 0, wx.ALL, 7) sizer_2.Add(grid_sizer_1, 0, 0, 0) sizer_2.Add((20, 20), 0, 0, 0) sizer_2.Add(self.button_next2, 0, wx.ALL, 7) sizer_2.Add((20, 20), 0, 0, 0) sizer_2.Add(self.hyperlink_6, 0, 0, 0) sizer_2.Add(self.hyperlink_5, 0, 0, 0) self.notebook_2_pane_3.SetSizer(sizer_2) sizer_3.Add(self.label_6, 0, wx.ALL | wx.EXPAND, 7) sizer_3.Add(self.text_ctrl_4, 0, wx.ALL, 7) sizer_3.Add(self.button_1, 0, wx.ALL, 7) grid_sizer_1_copy.Add(self.text_ctrl_5, 0, wx.ALL, 7) grid_sizer_1_copy.Add(self.button_run2, 0, wx.ALL, 7) sizer_3.Add(grid_sizer_1_copy, 0, 0, 0) sizer_3.Add((20, 20), 0, 0, 0) sizer_3.Add(self.button_next3, 0, wx.ALL, 7) sizer_3.Add((20, 20), 0, 0, 0) sizer_3.Add(self.hyperlink_7, 0, 0, 0) sizer_3.Add(self.hyperlink_8, 0, 0, 0) self.notebook_2_pane_4.SetSizer(sizer_3) sizer_5.Add(self.label_5a, 0, wx.ALL | wx.EXPAND, 7) sizer_5.Add(self.text_ctrl_5a, 0, wx.ALL, 7) sizer_5.Add(self.button_1_copy_1, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1_copy.Add(self.text_ctrl_12, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1_copy.Add(self.button_run5, 0, wx.ALL, 7) sizer_5.Add(grid_sizer_1_copy_copy_1_copy_1_copy, 0, 0, 0) sizer_5.Add((20, 20), 0, 0, 0) sizer_5.Add(self.button_next5, 0, wx.ALL, 7) sizer_5.Add((20, 20), 0, 0, 0) sizer_5.Add(self.hyperlink_12_copy, 0, 0, 0) sizer_5.Add(self.hyperlink_13_copy, 0, 0, 0) sizer_5.Add(self.hyperlink_14, 0, 0, 0) sizer_5.Add(self.hyperlink_15, 0, 0, 0) self.notebook_2_pane_5.SetSizer(sizer_5) sizer_4_copy.Add(self.label_5, 0, wx.ALL | wx.EXPAND, 7) sizer_4_copy.Add(self.text_ctrl_4_copy_copy, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy.Add(self.text_ctrl_9, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy.Add(self.button_run6, 0, wx.ALL, 7) sizer_4_copy.Add(grid_sizer_1_copy_copy_1_copy, 0, 0, 0) sizer_4_copy.Add((20, 20), 0, 0, 0) sizer_4_copy.Add(self.button_next6, 0, wx.ALL, 7) sizer_4_copy.Add((20, 20), 0, 0, 0) sizer_4_copy.Add(self.hyperlink_7_copy_copy, 0, 0, 0) self.notebook_2_pane_6.SetSizer(sizer_4_copy) sizer_3_copy.Add(self.label_7, 0, wx.ALL | wx.EXPAND, 7) sizer_3_copy.Add(self.text_ctrl_7, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1.Add(self.text_ctrl_8, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1.Add(self.button_run8, 0, wx.ALL, 7) sizer_3_copy.Add(grid_sizer_1_copy_copy_1, 0, 0, 0) sizer_3_copy.Add((20, 20), 0, 0, 0) sizer_3_copy.Add(self.button_next7, 0, wx.ALL, 7) sizer_3_copy.Add((20, 20), 0, 0, 0) sizer_3_copy.Add(self.hyperlink_7_copy_1, 0, 0, 0) sizer_3_copy.Add(self.hyperlink_8_copy, 0, 0, 0) self.notebook_2_pane_7.SetSizer(sizer_3_copy) sizer_4.Add(self.label_4, 0, wx.ALL | wx.EXPAND, 7) sizer_4.Add(self.text_ctrl_4a, 0, wx.ALL, 7) sizer_4.Add(self.label_4b, 0, wx.ALL | wx.EXPAND, 7) sizer_4.Add(self.text_ctrl_4b, 0, wx.ALL, 7) sizer_4.Add(self.button_OpenSystem, 0, wx.ALL, 7) grid_sizer_1_copy_copy.Add(self.text_ctrl_5_copy, 0, wx.ALL, 7) grid_sizer_1_copy_copy.Add(self.button_run7, 0, wx.ALL, 7) sizer_4.Add(grid_sizer_1_copy_copy, 0, 0, 0) sizer_4.Add((20, 20), 0, 0, 0) sizer_4.Add(self.button_next8, 0, wx.ALL, 7) sizer_4.Add((20, 20), 0, 0, 0) sizer_4.Add(self.hyperlink_7_copy, 0, 0, 0) sizer_4.Add(self.hyperlink_9, 0, 0, 0) self.notebook_2_pane_8.SetSizer(sizer_4) sizer_9.Add(self.label_9, 0, wx.ALL | wx.EXPAND, 7) sizer_9.Add(self.text_ctrl_10, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1.Add(self.text_ctrl_8_copy, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1.Add(self.button_run9, 0, wx.ALL, 7) sizer_9.Add(grid_sizer_1_copy_copy_1_copy_1, 0, 0, 0) sizer_9.Add((20, 20), 0, 0, 0) sizer_9.Add(self.button_next9, 0, wx.ALL, 7) sizer_9.Add((20, 20), 0, 0, 0) sizer_9.Add(self.hyperlink_12, 0, 0, 0) sizer_9.Add(self.hyperlink_13, 0, 0, 0) self.notebook_2_pane_9.SetSizer(sizer_9) sizer_10.Add(self.label_10, 0, wx.ALL | wx.EXPAND, 7) sizer_10.Add(self.text_ctrl_11, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1_copy_1.Add(self.text_ctrl_8_copy_copy, 0, wx.ALL, 7) grid_sizer_1_copy_copy_1_copy_1_copy_1.Add(self.button_run10, 0, wx.ALL, 7) sizer_10.Add(grid_sizer_1_copy_copy_1_copy_1_copy_1, 0, 0, 0) sizer_10.Add((20, 20), 0, 0, 0) sizer_10.Add(self.hyperlink_16, 0, 0, 0) sizer_10.Add(self.hyperlink_13_copy_1, 0, 0, 0) self.notebook_2_pane_10.SetSizer(sizer_10) self.notebook_2.AddPage(self.notebook_2_pane_1, _("Start")) self.notebook_2.AddPage(self.notebook_2_pane_2, _("Options")) self.notebook_2.AddPage(self.notebook_2_pane_3, _("Mapping")) self.notebook_2.AddPage(self.notebook_2_pane_4, _("Neighbor List")) self.notebook_2.AddPage(self.notebook_2_pane_5, _("Site Energies")) self.notebook_2.AddPage(self.notebook_2_pane_6, _("Neutral/Charged Molecule")) self.notebook_2.AddPage(self.notebook_2_pane_7, _("Outersphere Energies")) self.notebook_2.AddPage(self.notebook_2_pane_8, _("Electronic Coupling")) self.notebook_2.AddPage(self.notebook_2_pane_9, _("Rates")) self.notebook_2.AddPage(self.notebook_2_pane_10, _("Transport")) sizer_6.Add(self.notebook_2, 1, wx.EXPAND, 0) self.SetSizer(sizer_6) self.Layout() self.Centre()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"File directory", pos=wx.DefaultPosition, size=wx.Size(645, 284), style=wx.DEFAULT_FRAME_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer3 = wx.BoxSizer(wx.VERTICAL) fgSizer1 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_textCtrl6 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.Point(-1, -1), wx.DefaultSize, 0) self.m_textCtrl6.SetForegroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) self.m_textCtrl6.SetMinSize(wx.Size(350, -1)) fgSizer1.Add(self.m_textCtrl6, 0, wx.ALL, 5) self.m_button3 = wx.Button(self, wx.ID_ANY, u"Browse", wx.Point(-1, -1), wx.Size(100, 25), 0) fgSizer1.Add(self.m_button3, 0, wx.ALL | wx.ALIGN_RIGHT, 5) gSizer7 = wx.GridSizer(0, 3, 0, 0) self.m_button13 = wx.Button(self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.m_button13, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_button14 = wx.Button(self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.m_button14, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.m_button15 = wx.Button(self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.m_button15, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) fgSizer1.Add(gSizer7, 1, wx.EXPAND, 5) self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6.Wrap(-1) fgSizer1.Add(self.m_staticText6, 0, wx.ALL, 5) fgSizer2 = wx.FlexGridSizer(0, 2, 0, 0) fgSizer2.SetFlexibleDirection(wx.BOTH) fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText51 = wx.StaticText(self, wx.ID_ANY, u"Estimation Method", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText51.Wrap(-1) fgSizer2.Add(self.m_staticText51, 0, wx.ALL, 5) self.m_staticText71 = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText71.Wrap(-1) fgSizer2.Add(self.m_staticText71, 0, wx.ALL, 5) self.m_checkBox1 = wx.CheckBox(self, wx.ID_ANY, u"Standard", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add(self.m_checkBox1, 0, wx.ALL, 5) gSizer3 = wx.GridSizer(0, 2, 0, 0) self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"Start Date :", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) gSizer3.Add(self.m_staticText8, 0, wx.ALL, 5) self.m_textCtrl4 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer3.Add(self.m_textCtrl4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) fgSizer2.Add(gSizer3, 1, wx.EXPAND, 5) self.m_checkBox2 = wx.CheckBox(self, wx.ID_ANY, u"Blume", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add(self.m_checkBox2, 0, wx.ALL, 5) gSizer4 = wx.GridSizer(0, 2, 0, 0) self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"End Date: ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText9.Wrap(-1) gSizer4.Add(self.m_staticText9, 0, wx.ALL, 5) self.m_textCtrl5 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer4.Add(self.m_textCtrl5, 0, wx.ALL, 5) fgSizer2.Add(gSizer4, 1, wx.EXPAND, 5) self.m_button8 = wx.Button(self, wx.ID_ANY, u"Estimate", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add(self.m_button8, 0, wx.ALL, 5) fgSizer1.Add(fgSizer2, 1, wx.EXPAND, 5) gSizer9 = wx.GridSizer(0, 2, 0, 0) self.m_staticText3 = wx.StaticText(self, wx.ID_ANY, u"Optimization", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) self.m_staticText3.SetMinSize(wx.Size(100, 25)) gSizer9.Add(self.m_staticText3, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_staticText4 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText4.Wrap(-1) gSizer9.Add(self.m_staticText4, 0, wx.ALL, 5) self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Fixed return: ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText5.Wrap(-1) gSizer9.Add(self.m_staticText5, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_textCtrl7 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer9.Add(self.m_textCtrl7, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"Risk-free rate: ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText7.Wrap(-1) gSizer9.Add(self.m_staticText7, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_textCtrl8 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer9.Add(self.m_textCtrl8, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_button5 = wx.Button(self, wx.ID_ANY, u"Print", wx.DefaultPosition, wx.DefaultSize, 0) gSizer9.Add(self.m_button5, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) self.m_button6 = wx.Button(self, wx.ID_ANY, u"Optimize", wx.DefaultPosition, wx.DefaultSize, 0) gSizer9.Add(self.m_button6, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) fgSizer1.Add(gSizer9, 1, wx.EXPAND, 5) bSizer3.Add(fgSizer1, 1, wx.EXPAND, 5) self.SetSizer(bSizer3) self.Layout() self.m_statusBar2 = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY) self.Centre(wx.BOTH)
def __init__( self, parent, threads, cpu_used, save_log, path_log, ffmpeg_link, ffmpeg_check, ffprobe_link, ffprobe_check, ffplay_link, ffplay_check, OS, iconset, ): """ NOTE 0): self.rowsNum attribute is a sorted list with a exatly number index corresponding to each read line of the videomass.conf. NOTE 1): The code block (USEFUL FOR DEBUGGING) prints in console a convenient representation of the parsing, which can also be efforting consulted for future implementations. - POSITION, the number index of self.rowsNum items (how many objects it contains). - ROW, is the current numeric rows on the file configuration - VALUE, is the value as writing in the file configuration """ wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) """constructor""" # Make a items list of self.rowsNum = [] #rows number list dic = {} # used for debug with open(filename, 'r') as f: self.full_list = f.readlines() for a, b in enumerate(self.full_list): if not b.startswith('#'): if not b == '\n': self.rowsNum.append(a) #dic [a] = b.strip()# used for easy reading print debug ##USEFUL FOR DEBUGGING (see Setup.__init__.__doc__) ##uncomment the following code for a convenient reading #print "\nPOSITION: ROW: VALUE:" #for n, k in enumerate(sorted(dic)): #print n, ' -------> ', k, ' --> ', dic[k] self.threads = threads self.cpu_used = cpu_used self.save_log = save_log self.path_log = path_log self.ffmpeg_link = ffmpeg_link self.ffmpeg_check = ffmpeg_check self.ffprobe_link = ffprobe_link self.ffprobe_check = ffprobe_check self.ffplay_link = ffplay_link self.ffplay_check = ffplay_check self.OS = OS self.iconset = iconset if self.OS == 'Windows': self.ffmpeg = 'ffmpeg.exe' self.ffprobe = 'ffprobe.exe' self.ffplay = 'ffplay.exe' else: self.ffmpeg = 'ffmpeg' self.ffprobe = 'ffprobe' self.ffplay = 'ffplay' #----------------------------set notebook and tabs pages notebook = wx.Notebook(self, wx.ID_ANY, style=0) tabOne = wx.Panel(notebook, wx.ID_ANY) notebook.AddPage(tabOne, _(u"General")) tabTwo = wx.Panel(notebook, wx.ID_ANY) notebook.AddPage(tabTwo, _(u"Log")) tabThree = wx.Panel(notebook, wx.ID_ANY) notebook.AddPage(tabThree, _(u"Executables")) tabFour = wx.Panel(notebook, wx.ID_ANY) notebook.AddPage(tabFour, _(u"Appearance")) # make a sizer base and grid base. Note that grid base contains # buttons close and apply. First add notebook then the buttons at bottom sizer = wx.BoxSizer(wx.VERTICAL) gridBase = wx.FlexGridSizer(2, 1, 0, 0) # ntbook + buttons ok,close gridBase.Add(notebook, 1, wx.ALL | wx.EXPAND, 15) #--------------------------------------------------TAB 1 gridGeneral = wx.FlexGridSizer(3, 1, 0, 0) tabOne.SetSizer(gridGeneral) #aggiungo il sizer su tab 1 boxLabThreads = wx.StaticBoxSizer( wx.StaticBox(tabOne, wx.ID_ANY, (_(u"Settings CPU"))), wx.VERTICAL) gridGeneral.Add(boxLabThreads, 1, wx.ALL | wx.EXPAND, 15) gridThreads = wx.FlexGridSizer(4, 1, 0, 0) boxLabThreads.Add(gridThreads, 1, wx.ALL | wx.EXPAND, 15) lab1_pane1 = wx.StaticText( tabOne, wx.ID_ANY, (_(u"Set the number of threads (from 0 to 32)"))) gridThreads.Add(lab1_pane1, 0, wx.ALL, 5) self.spinctrl_threads = wx.SpinCtrl(tabOne, wx.ID_ANY, "%s" % threads[9:], size=(-1, -1), min=0, max=32, style=wx.TE_PROCESS_ENTER) gridThreads.Add(self.spinctrl_threads, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) lab2_pane1 = wx.StaticText( tabOne, wx.ID_ANY, (_(u"Quality/Speed ratio modifier (from -16 to 16)"))) gridThreads.Add(lab2_pane1, 0, wx.ALL, 5) gridctrl = wx.FlexGridSizer(1, 2, 0, 0) gridThreads.Add(gridctrl) self.spinctrl_cpu = wx.SpinCtrl(tabOne, wx.ID_ANY, "%s" % cpu_used[9:], min=-16, max=16, size=(-1, -1), style=wx.TE_PROCESS_ENTER) gridctrl.Add(self.spinctrl_cpu, 0, wx.ALL, 5) #gridctrl.Add(self.ckbx_autoThreads, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) #--------------------------------------------------TAB 2 gridLog = wx.FlexGridSizer(4, 1, 0, 0) tabTwo.SetSizer(gridLog) #aggiungo il sizer su tab 2 #self.check_ffmpeglog = wx.CheckBox(tabTwo, wx.ID_ANY, #(" Generates ffmpeg log files")) #gridLog.Add(self.check_ffmpeglog, 0, wx.ALL, 15) self.check_cmdlog = wx.CheckBox( tabTwo, wx.ID_ANY, (_(u" Specifies a custom path to save the log"))) gridLog.Add(self.check_cmdlog, 0, wx.ALL, 15) lab3_pane2 = wx.StaticText(tabTwo, wx.ID_ANY, (_(u"Where do you want to save the log?"))) gridLog.Add(lab3_pane2, 0, wx.ALL, 15) grid_logBtn = wx.FlexGridSizer(1, 2, 0, 0) gridLog.Add(grid_logBtn) self.btn_log = wx.Button(tabTwo, wx.ID_ANY, _(u"Browse..")) grid_logBtn.Add(self.btn_log, 0, wx.ALL, 15) self.txt_pathlog = wx.TextCtrl(tabTwo, wx.ID_ANY, "") grid_logBtn.Add(self.txt_pathlog, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 15) #--------------------------------------------------TAB 3 gridExec = wx.FlexGridSizer(6, 1, 0, 0) tabThree.SetSizer(gridExec) #aggiungo il sizer su tab 3 self.checkbox_exeFFmpeg = wx.CheckBox( tabThree, wx.ID_ANY, (_(u" Use a custom path to run FFmpeg"))) self.btn_pathFFmpeg = wx.Button(tabThree, wx.ID_ANY, _(u"Browse..")) self.txtctrl_ffmpeg = wx.TextCtrl(tabThree, wx.ID_ANY, "") gridExec.Add( self.checkbox_exeFFmpeg, 1, wx.TOP | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 15) gridFFmpeg = wx.FlexGridSizer(1, 2, 0, 0) gridExec.Add(gridFFmpeg) gridFFmpeg.Add(self.btn_pathFFmpeg, 0, wx.ALL, 15) gridFFmpeg.Add(self.txtctrl_ffmpeg, 0, wx.ALIGN_CENTER_VERTICAL, 5) self.checkbox_exeFFprobe = wx.CheckBox( tabThree, wx.ID_ANY, (_(u" Use a custom path to run FFprobe"))) self.btn_pathFFprobe = wx.Button(tabThree, wx.ID_ANY, _(u"Browse..")) self.txtctrl_ffprobe = wx.TextCtrl(tabThree, wx.ID_ANY, "") gridExec.Add( self.checkbox_exeFFprobe, 1, wx.TOP | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 15) gridFFprobe = wx.FlexGridSizer(1, 2, 0, 0) gridExec.Add(gridFFprobe) gridFFprobe.Add(self.btn_pathFFprobe, 0, wx.ALL, 15) gridFFprobe.Add(self.txtctrl_ffprobe, 0, wx.ALIGN_CENTER_VERTICAL, 5) self.checkbox_exeFFplay = wx.CheckBox( tabThree, wx.ID_ANY, (_(u" Use a custom path to run FFplay"))) self.btn_pathFFplay = wx.Button(tabThree, wx.ID_ANY, _(u"Browse..")) self.txtctrl_ffplay = wx.TextCtrl(tabThree, wx.ID_ANY, "") gridExec.Add( self.checkbox_exeFFplay, 1, wx.TOP | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 15) gridFFplay = wx.FlexGridSizer(1, 2, 0, 0) gridExec.Add(gridFFplay) gridFFplay.Add(self.btn_pathFFplay, 0, wx.ALL, 15) gridFFplay.Add(self.txtctrl_ffplay, 0, wx.ALIGN_CENTER_VERTICAL, 5) #--------------------------------------------------TAB 4 gridappearance = wx.FlexGridSizer(3, 1, 0, 0) tabFour.SetSizer(gridappearance) #aggiungo il sizer su tab 4 boxLabIcons = wx.StaticBoxSizer( wx.StaticBox(tabFour, wx.ID_ANY, (_(u"Set Icon Themes"))), wx.VERTICAL) gridappearance.Add(boxLabIcons, 1, wx.ALL | wx.EXPAND, 15) self.cmbx_icons = wx.ComboBox(tabFour, wx.ID_ANY, choices=[ ("Videomass_Sign_Icons"), ("Material_Design_Icons_black"), ("Material_Design_Icons_white"), ("Flat_Color_Icons"), ], style=wx.CB_DROPDOWN | wx.CB_READONLY) boxLabIcons.Add(self.cmbx_icons, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 15) self.cmbx_icons.SetValue(self.iconset) boxLabColor = wx.StaticBoxSizer( wx.StaticBox(tabFour, wx.ID_ANY, (_(u"Custom Colour UI"))), wx.VERTICAL) gridappearance.Add(boxLabColor, 1, wx.ALL | wx.EXPAND, 15) gridTBColor = wx.FlexGridSizer(3, 2, 0, 0) boxLabColor.Add(gridTBColor) labTBColor = wx.StaticText(tabFour, wx.ID_ANY, (_(u"Change Toolbar Colour:"))) gridTBColor.Add( labTBColor, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 15) btn_TBcolor = wx.Button(tabFour, wx.ID_ANY, _(u"Bar Colour")) gridTBColor.Add(btn_TBcolor, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 15) labTBColorBtn = wx.StaticText(tabFour, wx.ID_ANY, (_(u"Change Toolbar Buttons Colour:"))) gridTBColor.Add( labTBColorBtn, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 15) btn_TBcolorBtn = wx.Button(tabFour, wx.ID_ANY, _(u"Buttons Colour")) gridTBColor.Add(btn_TBcolorBtn, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 15) btn_TBcolorClearBtn = wx.Button(tabFour, wx.ID_CLEAR, _(u"Restore default settings")) gridappearance.Add(btn_TBcolorClearBtn, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 15) #------------------------------------------------------bottom gridBottom = wx.GridSizer(1, 2, 0, 0) btn_help = wx.Button(self, wx.ID_HELP, "") gridhelp = wx.GridSizer(1, 1, 0, 0) gridhelp.Add(btn_help, 0, wx.ALL, 5) gridBottom.Add(gridhelp, 0, wx.ALL, 10) btn_close = wx.Button(self, wx.ID_CANCEL, "") gridexit = wx.GridSizer(1, 2, 0, 0) gridexit.Add(btn_close, 0, wx.ALL, 5) btn_ok = wx.Button(self, wx.ID_APPLY, "") gridexit.Add(btn_ok, 0, wx.ALL, 5) gridBottom.Add(gridexit, 0, wx.ALL, 10) gridBase.Add(gridBottom, flag=wx.ALIGN_RIGHT | wx.RIGHT, border=10) sizer.Add(gridBase, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer) sizer.Fit(self) self.Layout() #----------------------Properties----------------------# self.SetTitle(_(u"Videomass: setup")) self.spinctrl_cpu.SetToolTipString( _(u"Quality/Speed ratio modifier " u"(from -16 to 16) (default 1)")) self.check_cmdlog.SetToolTipString( _(u"Generates a log file command in " u"the directory specified below. Log file is a " u"file containing the parameters of the " u"execution process, info and error messages.")) self.btn_log.SetToolTipString(_(u"Open Path")) self.txt_pathlog.SetMinSize((200, -1)) self.txt_pathlog.SetToolTipString(_(u"Path generation file")) self.checkbox_exeFFmpeg.SetToolTipString( _(u"Enable custom search for " u"the executable FFmpeg. If the checkbox is disabled or " u"if the path field is empty, the search of the " u"executable is entrusted to the system.")) self.btn_pathFFmpeg.SetToolTipString(_(u"Open path FFmpeg")) self.txtctrl_ffmpeg.SetMinSize((200, -1)) self.txtctrl_ffmpeg.SetToolTipString( _(u"path to executable binary FFmpeg")) self.checkbox_exeFFprobe.SetToolTipString(_(u"Path generation file")) self.checkbox_exeFFmpeg.SetToolTipString( _(u"Enable custom search for " u"the executable FFprobe. If the checkbox is disabled or " u"if the path field is empty, the search of the " u"executable is entrusted to the system.")) self.btn_pathFFprobe.SetToolTipString(_(u"Open path FFprobe")) self.txtctrl_ffprobe.SetMinSize((200, -1)) self.txtctrl_ffprobe.SetToolTipString( _(u"path to executable binary FFprobe")) self.checkbox_exeFFplay.SetToolTipString(_(u"Path generation file")) self.checkbox_exeFFmpeg.SetToolTipString( _(u"Enable custom search for " u"the executable FFplay. If the checkbox is disabled or " u"if the path field is empty, the search of the " u"executable is entrusted to the system.")) self.btn_pathFFplay.SetToolTipString(_(u"Open path FFplay")) self.txtctrl_ffplay.SetMinSize((200, -1)) self.txtctrl_ffplay.SetToolTipString( _(u"path to executable binary FFplay")) #----------------------Binding (EVT)----------------------# #self.Bind(wx.EVT_CHECKBOX, self.log_ffmpeg, self.check_ffmpeglog) self.Bind(wx.EVT_CHECKBOX, self.log_command, self.check_cmdlog) self.Bind(wx.EVT_BUTTON, self.save_path_log, self.btn_log) #self.Bind(wx.EVT_TEXT, self.text_save, self.txt_pathlog) self.Bind(wx.EVT_SPINCTRL, self.on_threads, self.spinctrl_threads) self.Bind(wx.EVT_SPINCTRL, self.on_cpu_used, self.spinctrl_cpu) self.Bind(wx.EVT_CHECKBOX, self.exeFFmpeg, self.checkbox_exeFFmpeg) self.Bind(wx.EVT_BUTTON, self.open_path_ffmpeg, self.btn_pathFFmpeg) self.Bind(wx.EVT_TEXT_ENTER, self.txtffmpeg, self.txtctrl_ffmpeg) self.Bind(wx.EVT_CHECKBOX, self.exeFFprobe, self.checkbox_exeFFprobe) self.Bind(wx.EVT_BUTTON, self.open_path_ffprobe, self.btn_pathFFprobe) self.Bind(wx.EVT_TEXT_ENTER, self.txtffprobe, self.txtctrl_ffprobe) self.Bind(wx.EVT_CHECKBOX, self.exeFFplay, self.checkbox_exeFFplay) self.Bind(wx.EVT_BUTTON, self.open_path_ffplay, self.btn_pathFFplay) self.Bind(wx.EVT_TEXT_ENTER, self.txtffplay, self.txtctrl_ffplay) self.Bind(wx.EVT_COMBOBOX, self.on_Iconthemes, self.cmbx_icons) self.Bind(wx.EVT_BUTTON, self.onColorDlg, btn_TBcolor) self.Bind(wx.EVT_BUTTON, self.onColorDlg, btn_TBcolorBtn) self.Bind(wx.EVT_BUTTON, self.onAppearanceDefault, btn_TBcolorClearBtn) self.Bind(wx.EVT_BUTTON, self.on_help, btn_help) self.Bind(wx.EVT_BUTTON, self.on_close, btn_close) self.Bind(wx.EVT_BUTTON, self.on_ok, btn_ok) #--------------------------------------------# self.current_settings() # call function for initialize setting layout
def initViewLayout(self): gridSizer = wx.GridSizer(self.__params["cols"]) self.SetSizer(gridSizer) pass
def spinbutton_value_change(event): obj = event.GetEventObject() frame.SetStatusText("SpinButton value is " + str(obj.GetValue())) app = wx.App() # アプリケーション初期化 frame = wx.Frame(None, wx.ID_ANY, u"テストフレーム", size=(300, 300)) # フレーム初期化 frame.CreateStatusBar() frame.Center() # 中央へ表示 panel = wx.Panel(frame, wx.ID_ANY) # パネル初期化 panel.SetBackgroundColour("#AFAFAF") spin_button = wx.SpinButton(panel, style=wx.SP_HORIZONTAL) # 横表示 # spin_button = wx.SpinButton(panel, style=wx.SP_VERTICAL) # 縦表示 spin_button.SetMin(100) # 最小値、最大値の設定 spin_button.SetMax(500) spin_button.SetValue(150) print spin_button.GetValue() spin_button.Bind(wx.EVT_SPIN, spinbutton_value_change) layout = wx.GridSizer(3, 1) layout.Add(spin_button, flag=wx.GROW | wx.ALL, border=10) panel.SetSizer(layout) frame.Show() app.MainLoop()
def ShowSensors(self): """ Display the sensors. """ sensors = self.getSensorsToDisplay(self.istart) # Destroy previous widgets for b in self.boxes: b.Destroy() for t in self.texts: t.Destroy() self.boxes = [] self.texts = [] # Main sizer boxSizerMain = wx.BoxSizer(wx.VERTICAL) # Grid sizer nrows, ncols = 1, 1 vgap, hgap = 50, 50 gridSizer = wx.GridSizer(nrows, ncols, vgap, hgap) # Create a box for each sensor for index, sensor in sensors: (name, value, unit) = self.port.sensor(index) box = OBDStaticBox(self, wx.ID_ANY) self.boxes.append(box) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) # Text for sensor value if type(value) == float: value = str("%.2f" % round(value, 3)) t1 = wx.StaticText(parent=self, label=str(value), style=wx.ALIGN_CENTER) t1.SetForegroundColour('WHITE') font1 = wx.Font(53, wx.ROMAN, wx.NORMAL, wx.NORMAL, faceName="Monaco") t1.SetFont(font1) boxSizer.Add(t1, 0, wx.ALIGN_CENTER | wx.ALL, 50) boxSizer.AddStretchSpacer() self.texts.append(t1) # Text for sensor name t2 = wx.StaticText(parent=self, label=name, style=wx.ALIGN_CENTER) t2.SetForegroundColour('WHITE') font2 = wx.Font(20, wx.ROMAN, wx.NORMAL, wx.BOLD, faceName="Monaco") t2.SetFont(font2) boxSizer.Add(t2, 0, wx.ALIGN_CENTER | wx.ALL, 15) self.texts.append(t2) gridSizer.Add(boxSizer, 1, wx.EXPAND | wx.ALL) # Add invisible boxes if necessary nsensors = len(sensors) for i in range(1 - nsensors): box = OBDStaticBox(self) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.boxes.append(box) box.Show(False) gridSizer.Add(boxSizer, 1, wx.EXPAND | wx.ALL) # Layout boxSizerMain.Add(gridSizer, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(boxSizerMain) self.Refresh() self.Layout() # Timer for update self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.refresh, self.timer) self.timer.Start(1000)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Teardrops", pos=wx.DefaultPosition, size=wx.Size(410, 323), style=wx.CAPTION | wx.CLOSE_BOX | wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) import sys if sys.version_info[0] == 2: self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) else: self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bvs_main = wx.BoxSizer(wx.VERTICAL) rbx_actionChoices = [u"Set Teardrops", u"Remove All Teardrops"] self.rbx_action = wx.RadioBox(self, wx.ID_ANY, u"Action", wx.DefaultPosition, wx.DefaultSize, rbx_actionChoices, 1, wx.RA_SPECIFY_ROWS) self.rbx_action.SetSelection(0) bvs_main.Add(self.rbx_action, 0, wx.ALL, 5) bhs_params = wx.BoxSizer(wx.HORIZONTAL) gs_params = wx.GridSizer(0, 2, 0, 0) self.st_hpercent = wx.StaticText(self, wx.ID_ANY, u"Horizontal percent", wx.DefaultPosition, wx.DefaultSize, 0) self.st_hpercent.Wrap(-1) gs_params.Add( self.st_hpercent, 0, wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE, 5) self.sp_hpercent = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 30) gs_params.Add( self.sp_hpercent, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE | wx.SHAPED, 5) self.st_vpercent = wx.StaticText(self, wx.ID_ANY, u"Vertical percent", wx.DefaultPosition, wx.DefaultSize, 0) self.st_vpercent.Wrap(-1) gs_params.Add( self.st_vpercent, 0, wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE, 5) self.sp_vpercent = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 70) gs_params.Add( self.sp_vpercent, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE | wx.SHAPED, 5) self.st_nbseg = wx.StaticText(self, wx.ID_ANY, u"Number of segments", wx.DefaultPosition, wx.DefaultSize, 0) self.st_nbseg.Wrap(-1) gs_params.Add( self.st_nbseg, 0, wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE, 5) self.sp_nbseg = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10) gs_params.Add( self.sp_nbseg, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.EXPAND | wx.FIXED_MINSIZE | wx.SHAPED, 5) bhs_params.Add(gs_params, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.SHAPED, 5) self.m_bitmap_help = wx.StaticBitmap(self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0) bhs_params.Add( self.m_bitmap_help, 0, wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.ALL, 5) bhs_params.Add((0, 0), 1, wx.EXPAND, 5) bvs_main.Add(bhs_params, 1, wx.EXPAND, 5) bvs_options = wx.BoxSizer(wx.VERTICAL) self.cb_include_smd_pads = wx.CheckBox(self, wx.ID_ANY, u"Include SMD pads", wx.DefaultPosition, wx.DefaultSize, 0) bvs_options.Add( self.cb_include_smd_pads, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, 5) self.cb_discard_in_same_zone = wx.CheckBox( self, wx.ID_ANY, u"Do not insert teardrop inside same net zones", wx.DefaultPosition, wx.DefaultSize, 0) self.cb_discard_in_same_zone.SetValue(True) bvs_options.Add( self.cb_discard_in_same_zone, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, 5) bvs_options.Add((0, 0), 1, wx.EXPAND, 5) bvs_main.Add(bvs_options, 1, wx.EXPAND, 5) self.m_staticline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bvs_main.Add(self.m_staticline1, 0, wx.EXPAND | wx.ALL, 5) bhs_modal = wx.BoxSizer(wx.HORIZONTAL) self.but_cancel = wx.Button(self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0) bhs_modal.Add(self.but_cancel, 0, wx.ALL, 5) self.but_ok = wx.Button(self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0) bhs_modal.Add(self.but_ok, 0, wx.ALL, 5) bvs_main.Add(bhs_modal, 0, wx.ALIGN_RIGHT, 5) self.SetSizer(bvs_main) self.Layout() self.Centre(wx.BOTH)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent) # A mostly default clock c1 = ac.AnalogClock(self) # A plain clock, with square hour and round minute marks, no # shadow, static border c2 = ac.AnalogClock(self, style=wx.STATIC_BORDER, hoursStyle=ac.TICKS_SQUARE, minutesStyle=ac.TICKS_CIRCLE, clockStyle=ac.SHOW_HOURS_TICKS| \ ac.SHOW_MINUTES_TICKS| ac.SHOW_HOURS_HAND| \ ac.SHOW_MINUTES_HAND| \ ac.SHOW_SECONDS_HAND) c2.SetTickSize(12, target=ac.HOUR) # No minute tick marks c3 = ac.AnalogClock(self, hoursStyle=ac.TICKS_CIRCLE, clockStyle=ac.SHOW_HOURS_TICKS| \ ac.SHOW_HOURS_HAND| \ ac.SHOW_MINUTES_HAND| \ ac.SHOW_SECONDS_HAND| \ ac.SHOW_SHADOWS) c3.SetTickSize(12) # A clock with hex numbers no seconds hand and different colours. c4 = ac.AnalogClock(self, hoursStyle=ac.TICKS_HEX, clockStyle=ac.SHOW_HOURS_TICKS| \ ac.SHOW_HOURS_HAND| \ ac.SHOW_MINUTES_HAND| \ ac.SHOW_SHADOWS) colour = wx.Colour(0, 255, 255) c4.SetForegroundColour(colour) colour = wx.Colour(0, 132, 132) c4.SetShadowColour(colour) c4.SetTickFont(wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)) c4.SetBackgroundColour(wx.BLACK) c4.SetFaceBorderColour(wx.BLACK) c4.SetFaceFillColour(wx.BLACK) # A clock with binary numbers shown only at the quarter tick marks, # no minutes ticks and different colours. c5 = ac.AnalogClock(self, style = wx.RAISED_BORDER, hoursStyle=ac.TICKS_BINARY, clockStyle=ac.SHOW_QUARTERS_TICKS| \ ac.SHOW_HOURS_HAND| \ ac.SHOW_MINUTES_HAND| \ ac.SHOW_SECONDS_HAND| \ ac.SHOW_SHADOWS) colour = wx.Colour(0, 128, 0) c5.SetHandFillColour(colour, target=ac.SECOND) c5.SetHandBorderColour(colour, target=ac.SECOND) c5.SetBackgroundColour(colour) colour = wx.Colour(128, 0, 64) c5.SetTickFillColour(colour) c5.SetFaceBorderColour(colour) c5.SetFaceBorderWidth(1) colour = wx.Colour(0, 198, 0) c5.SetFaceFillColour(colour) c5.SetShadowColour(wx.WHITE) # A clock with a sunken border, roman numerals shown only at the # quarter tick marks with a roman font, circular minutes ticks, # no seconds hand, no shadows, tick overlapping and different colours. c6 = ac.AnalogClock(self, style = wx.SUNKEN_BORDER, hoursStyle=ac.TICKS_ROMAN, minutesStyle=ac.TICKS_CIRCLE, clockStyle=ac.SHOW_QUARTERS_TICKS| \ ac.SHOW_MINUTES_TICKS| \ ac.SHOW_HOURS_HAND| \ ac.SHOW_MINUTES_HAND| \ ac.OVERLAP_TICKS) colour = wx.Colour(128, 0, 0) c6.SetHandFillColour(colour) colour = wx.Colour(179, 0, 89) c6.SetHandBorderColour(colour) c6.SetTickFillColour(colour) c6.SetTickBorderColour(colour) colour = wx.Colour(225, 255, 255) c6.SetFaceBorderColour(colour) c6.SetBackgroundColour(colour) colour = wx.Colour(249, 255, 255) c6.SetFaceFillColour(colour) colour = wx.Colour(255, 213, 213) c6.SetShadowColour(colour) c6.SetTickFont(wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.BOLD)) # layout the clocks in a grid gs = wx.GridSizer(2, 3, 4, 4) gs.Add(c1, 0, wx.EXPAND) gs.Add(c2, 0, wx.EXPAND) gs.Add(c3, 0, wx.EXPAND) gs.Add(c4, 0, wx.EXPAND) gs.Add(c5, 0, wx.EXPAND) gs.Add(c6, 0, wx.EXPAND) # put it in another sizer for a border sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 10) self.SetSizerAndFit(sizer)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Size(474, 438), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) gSizer4 = wx.GridSizer(0, 2, 0, 0) bSizer41 = wx.BoxSizer(wx.VERTICAL) self.m_textFreq = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(250, 40), 0) bSizer41.Add(self.m_textFreq, 0, wx.ALL | wx.EXPAND, 5) gNumPad = wx.GridSizer(4, 3, 0, 0) self.m_button7 = wx.Button(self, wx.ID_ANY, u"7", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button7.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button7, 0, wx.ALL, 5) self.m_button8 = wx.Button(self, wx.ID_ANY, u"8", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button8.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button8, 0, wx.ALL, 5) self.m_button9 = wx.Button(self, wx.ID_ANY, u"9", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button9.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button9, 0, wx.ALL, 5) self.m_button4 = wx.Button(self, wx.ID_ANY, u"4", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button4.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button4, 0, wx.ALL, 5) self.m_button5 = wx.Button(self, wx.ID_ANY, u"5", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button5.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button5, 0, wx.ALL, 5) self.m_button6 = wx.Button(self, wx.ID_ANY, u"6", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button6.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button6, 0, wx.ALL, 5) self.m_button1 = wx.Button(self, wx.ID_ANY, u"1", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button1.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button1, 0, wx.ALL, 5) self.m_button2 = wx.Button(self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button2.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button2, 0, wx.ALL, 5) self.m_button3 = wx.Button(self, wx.ID_ANY, u"3", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button3.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button3, 0, wx.ALL, 5) self.m_button0 = wx.Button(self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_button0.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_button0, 0, wx.ALL, 5) self.m_buttonk = wx.Button(self, wx.ID_ANY, u",", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_buttonk.SetFont( wx.Font(50, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_buttonk, 0, wx.ALL, 5) self.m_buttondel = wx.Button(self, wx.ID_ANY, u"C", wx.DefaultPosition, wx.Size(80, 80), 0) self.m_buttondel.SetFont( wx.Font(40, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) gNumPad.Add(self.m_buttondel, 0, wx.ALL, 5) bSizer41.Add(gNumPad, 0, 0, 5) gSizer4.Add(bSizer41, 0, 0, 5) bSizer14 = wx.BoxSizer(wx.VERTICAL) self.m_buttonGHz = wx.Button(self, wx.ID_ANY, u"GHz", wx.DefaultPosition, wx.DefaultSize, 0) self.m_buttonGHz.SetFont( wx.Font(30, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) bSizer14.Add(self.m_buttonGHz, 0, wx.ALL | wx.EXPAND, 5) self.m_buttonMHz = wx.Button(self, wx.ID_ANY, u"MHz", wx.DefaultPosition, wx.DefaultSize, 0) self.m_buttonMHz.SetFont( wx.Font(30, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) bSizer14.Add(self.m_buttonMHz, 0, wx.ALL | wx.EXPAND, 5) self.m_buttonHz = wx.Button(self, wx.ID_ANY, u"Hz", wx.DefaultPosition, wx.DefaultSize, 0) self.m_buttonHz.SetFont( wx.Font(30, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) bSizer14.Add(self.m_buttonHz, 0, wx.ALL | wx.EXPAND, 5) self.m_button60 = wx.Button(self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0) self.m_button60.SetFont( wx.Font(30, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString)) bSizer14.Add(self.m_button60, 0, wx.ALL | wx.EXPAND, 5) gSizer4.Add(bSizer14, 0, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, 5) self.SetSizer(gSizer4) self.Layout() self.Centre(wx.BOTH) # Connect Events self.m_button7.Bind(wx.EVT_BUTTON, self.On7) self.m_button8.Bind(wx.EVT_BUTTON, self.On8) self.m_button9.Bind(wx.EVT_BUTTON, self.On9) self.m_button4.Bind(wx.EVT_BUTTON, self.On4) self.m_button5.Bind(wx.EVT_BUTTON, self.On5) self.m_button6.Bind(wx.EVT_BUTTON, self.On6) self.m_button1.Bind(wx.EVT_BUTTON, self.On1) self.m_button2.Bind(wx.EVT_BUTTON, self.On2) self.m_button3.Bind(wx.EVT_BUTTON, self.On3) self.m_button0.Bind(wx.EVT_BUTTON, self.On0) self.m_buttonk.Bind(wx.EVT_BUTTON, self.Onk) self.m_buttondel.Bind(wx.EVT_BUTTON, self.OnDel) self.m_buttonGHz.Bind(wx.EVT_BUTTON, self.OnGHz) self.m_buttonMHz.Bind(wx.EVT_BUTTON, self.OnMHz) self.m_buttonHz.Bind(wx.EVT_BUTTON, self.OnHz) self.m_button60.Bind(wx.EVT_BUTTON, self.OnCancel)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"实时行情", pos=wx.DefaultPosition, size=wx.Size(716, 508), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) self.m_menubar1 = wx.MenuBar(0) self.m_menuupdb = wx.Menu() self.m_menuupdb.AppendSeparator() self.m_menuItemdb = wx.MenuItem(self.m_menuupdb, wx.ID_ANY, u"选择更新数据库", wx.EmptyString, wx.ITEM_NORMAL) self.m_menuupdb.AppendItem(self.m_menuItemdb) self.m_menuupdb.AppendSeparator() self.m_menubar1.Append(self.m_menuupdb, u"更新数据库") self.m_menuanal = wx.Menu() self.m_menuanal.AppendSeparator() self.m_menuItemanal1 = wx.MenuItem(self.m_menuanal, wx.ID_ANY, u"报价分析", wx.EmptyString, wx.ITEM_NORMAL) self.m_menuanal.AppendItem(self.m_menuItemanal1) self.m_menuItemanal2 = wx.MenuItem(self.m_menuanal, wx.ID_ANY, u"即时分析", wx.EmptyString, wx.ITEM_NORMAL) self.m_menuanal.AppendItem(self.m_menuItemanal2) self.m_menuItemanal3 = wx.MenuItem(self.m_menuanal, wx.ID_ANY, u"技术分析", wx.EmptyString, wx.ITEM_NORMAL) self.m_menuanal.AppendItem(self.m_menuItemanal3) self.m_menuItemanal4 = wx.MenuItem(self.m_menuanal, wx.ID_ANY, u"报表分析", wx.EmptyString, wx.ITEM_NORMAL) self.m_menuanal.AppendItem(self.m_menuItemanal4) self.m_menuanal.AppendSeparator() self.m_menubar1.Append(self.m_menuanal, u"分析") self.SetMenuBar(self.m_menubar1) bSizer6 = wx.BoxSizer(wx.VERTICAL) self.m_panel2 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_staticline33 = wx.StaticLine(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline33, 0, wx.EXPAND | wx.ALL, 5) gSizer6 = wx.GridSizer(1, 2, 0, 0) self.m_staticText1 = wx.StaticText(self.m_panel2, wx.ID_ANY, u"当前行情", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) gSizer6.Add(self.m_staticText1, 0, wx.ALL | wx.EXPAND, 5) self.m_button119 = wx.Button(self.m_panel2, wx.ID_ANY, u"刷新", wx.DefaultPosition, wx.DefaultSize, 0) gSizer6.Add(self.m_button119, 0, wx.ALL | wx.ALIGN_RIGHT, 5) bSizer1.Add(gSizer6, 0, wx.EXPAND, 5) self.m_staticline6 = wx.StaticLine(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline6, 0, wx.EXPAND | wx.ALL, 5) fgSizer14 = wx.FlexGridSizer(1, 1, 0, 0) fgSizer14.SetFlexibleDirection(wx.BOTH) fgSizer14.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) ''' self.m_grid1 = wx.grid.Grid( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) # Grid self.m_grid1.CreateGrid( 20, 12 ) self.m_grid1.EnableEditing( True ) self.m_grid1.EnableGridLines( True ) self.m_grid1.EnableDragGridSize( True ) self.m_grid1.SetMargins( 0, 0 ) # Columns self.m_grid1.SetColSize( 0, 80 ) self.m_grid1.SetColSize( 1, 80 ) self.m_grid1.SetColSize( 2, 80 ) self.m_grid1.SetColSize( 3, 80 ) self.m_grid1.SetColSize( 4, 93 ) self.m_grid1.EnableDragColMove( False ) self.m_grid1.EnableDragColSize( True ) self.m_grid1.SetColLabelSize( 30 ) self.m_grid1.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) ''' #创建网格表 self.grid = wx.grid.Grid(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.table = TestTable(data) self.grid.SetTable(self.table, True) self.grid.EnableEditing(False) self.grid.EnableGridLines(True) self.grid.EnableDragGridSize(True) self.grid.SetColSize(8, 100) #self.grid.AutoSizeColumns() #self.grid.AutoSizeRows() self.grid.SetDefaultCellAlignment(wx.ALIGN_LEFT, wx.ALIGN_TOP) fgSizer14.Add(self.grid, 1, wx.ALL | wx.EXPAND, 5) bSizer1.Add(fgSizer14, 1, wx.EXPAND, 5) ''' # Rows self.m_grid1.SetRowSize( 0, 20 ) self.m_grid1.SetRowSize( 1, 20 ) self.m_grid1.SetRowSize( 2, 20 ) self.m_grid1.SetRowSize( 3, 20 ) self.m_grid1.SetRowSize( 4, 20 ) self.m_grid1.AutoSizeRows() self.m_grid1.EnableDragRowSize( True ) self.m_grid1.SetRowLabelSize( 80 ) self.m_grid1.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) # Label Appearance # Cell Defaults self.m_grid1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) fgSizer14.Add( self.m_grid1, 1, wx.ALL|wx.EXPAND, 5 ) ''' self.m_staticline17 = wx.StaticLine(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline17, 0, wx.EXPAND | wx.ALL, 5) ''' bSizer17 = wx.BoxSizer( wx.HORIZONTAL ) self.m_button6 = wx.Button( self.m_panel2, wx.ID_ANY, u"button", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer17.Add( self.m_button6, 0, wx.ALIGN_RIGHT|wx.ALL|wx.BOTTOM, 5 ) bSizer1.Add( bSizer17, 0, wx.ALIGN_RIGHT, 5 ) self.m_staticline18 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) bSizer1.Add( self.m_staticline18, 0, wx.EXPAND |wx.ALL, 5 ) ''' self.m_panel2.SetSizer(bSizer1) self.m_panel2.Layout() bSizer1.Fit(self.m_panel2) bSizer6.Add(self.m_panel2, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer6) self.Layout() self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_MENU, self.OnUpdata, id=self.m_menuItemdb.GetId()) self.Bind(wx.EVT_MENU, self.Onbaojia, id=self.m_menuItemanal1.GetId()) self.Bind(wx.EVT_MENU, self.Onjishi, id=self.m_menuItemanal2.GetId()) self.Bind(wx.EVT_MENU, self.Onjishu, id=self.m_menuItemanal3.GetId()) self.Bind(wx.EVT_MENU, self.Onbaobiao, id=self.m_menuItemanal4.GetId()) self.m_button119.Bind(wx.EVT_BUTTON, self.Onrefresh)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Titi-k", pos=wx.DefaultPosition, size=wx.Size(867, 538), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer7 = wx.BoxSizer(wx.VERTICAL) self.m_notebook1 = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.m_panel2 = wx.Panel(self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer12 = wx.BoxSizer(wx.VERTICAL) bSizer13 = wx.BoxSizer(wx.HORIZONTAL) self.mc_gDir = wx.GenericDirCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(200, 100), wx.DIRCTRL_3D_INTERNAL | wx.SUNKEN_BORDER, wx.EmptyString, 0) self.mc_gDir.ShowHidden(False) bSizer13.Add(self.mc_gDir, 0, wx.ALL | wx.EXPAND, 5) mc_LBox_Files2ProcessChoices = [u"Files or dirs to be processed"] self.mc_LBox_Files2Process = wx.ListBox(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.Size(200, 220), mc_LBox_Files2ProcessChoices, 0) bSizer13.Add(self.mc_LBox_Files2Process, 0, wx.ALL | wx.EXPAND, 5) bSizer14 = wx.BoxSizer(wx.VERTICAL) mc_rBox_points_typeChoices = [u"Lat/Lon", u"Row/Col"] self.mc_rBox_points_type = wx.RadioBox( self.m_panel2, wx.ID_ANY, u"Point type", wx.DefaultPosition, wx.DefaultSize, mc_rBox_points_typeChoices, 1, 0) self.mc_rBox_points_type.SetSelection(0) bSizer14.Add(self.mc_rBox_points_type, 0, wx.ALL | wx.EXPAND, 5) gSizer5 = wx.GridSizer(2, 2, 0, 0) self.m_staticText11 = wx.StaticText(self.m_panel2, wx.ID_ANY, u"Label", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText11.Wrap(-1) gSizer5.Add(self.m_staticText11, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.mc_txt_po_label = wx.TextCtrl(self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.mc_txt_po_label, 0, wx.ALL | wx.EXPAND, 5) self.mc_stxt_lat = wx.StaticText(self.m_panel2, wx.ID_ANY, u"Latitude", wx.DefaultPosition, wx.DefaultSize, 0) self.mc_stxt_lat.Wrap(-1) gSizer5.Add(self.mc_stxt_lat, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.mc_txt_lat = wx.TextCtrl(self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(40, -1), 0) gSizer5.Add(self.mc_txt_lat, 0, wx.ALL | wx.EXPAND, 5) self.mc_stxt_lon = wx.StaticText(self.m_panel2, wx.ID_ANY, u"Longitude", wx.DefaultPosition, wx.DefaultSize, 0) self.mc_stxt_lon.Wrap(-1) gSizer5.Add(self.mc_stxt_lon, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.mc_txt_lon = wx.TextCtrl(self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0) gSizer5.Add(self.mc_txt_lon, 0, wx.ALL | wx.EXPAND, 5) self.mc_btn_add_point = wx.Button(self.m_panel2, wx.ID_ANY, u"Add Point", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT) gSizer5.Add(self.mc_btn_add_point, 0, wx.ALL | wx.EXPAND, 5) self.mc_btn_file_points = wx.FilePickerCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) gSizer5.Add(self.mc_btn_file_points, 0, wx.ALL, 5) bSizer14.Add(gSizer5, 0, wx.EXPAND, 5) self.m_staticline3 = wx.StaticLine(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer14.Add(self.m_staticline3, 0, wx.EXPAND | wx.ALL, 5) gSizer51 = wx.GridSizer(2, 2, 0, 0) self.m_staticText23 = wx.StaticText(self.m_panel2, wx.ID_ANY, u"Band", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText23.Wrap(-1) gSizer51.Add(self.m_staticText23, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.mc_txt_band = wx.TextCtrl(self.m_panel2, wx.ID_ANY, u"1", wx.DefaultPosition, wx.Size(40, -1), 0) gSizer51.Add(self.mc_txt_band, 0, wx.ALL | wx.EXPAND, 5) bSizer14.Add(gSizer51, 1, wx.EXPAND, 5) bSizer13.Add(bSizer14, 0, wx.ALIGN_TOP, 5) mc_LBox_pointsChoices = [u"Points to extract"] self.mc_LBox_points = wx.ListBox(self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.Size(100, -1), mc_LBox_pointsChoices, 0) bSizer13.Add(self.mc_LBox_points, 1, wx.ALL | wx.EXPAND, 5) bSizer12.Add(bSizer13, 0, wx.EXPAND, 5) bSizer17 = wx.BoxSizer(wx.VERTICAL) bSizer16 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText13 = wx.StaticText(self.m_panel2, wx.ID_ANY, u"Filename Output", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText13.Wrap(-1) bSizer16.Add(self.m_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.mc_txt_filename_out = wx.TextCtrl(self.m_panel2, wx.ID_ANY, u"outfilename.csv", wx.DefaultPosition, wx.Size(450, -1), 0) bSizer16.Add(self.mc_txt_filename_out, 0, wx.ALL, 5) self.mc_btn_start_extraction = wx.Button(self.m_panel2, wx.ID_ANY, u"Start extraction", wx.DefaultPosition, wx.Size(260, -1), wx.BU_EXACTFIT) bSizer16.Add(self.mc_btn_start_extraction, 0, wx.ALL, 5) bSizer17.Add(bSizer16, 0, wx.EXPAND, 5) self.mc_txt_log = wx.TextCtrl(self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE) bSizer17.Add(self.mc_txt_log, 0, wx.ALL | wx.EXPAND, 5) bSizer12.Add(bSizer17, 1, wx.EXPAND, 5) self.m_panel2.SetSizer(bSizer12) self.m_panel2.Layout() bSizer12.Fit(self.m_panel2) self.m_notebook1.AddPage(self.m_panel2, u"Extraction", True) self.m_panel7 = wx.Panel(self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_notebook1.AddPage(self.m_panel7, u"Band Calcs", False) bSizer7.Add(self.m_notebook1, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer7) self.Layout() self.m_statusBar2 = self.CreateStatusBar(1, wx.ST_SIZEGRIP, wx.ID_ANY) self.mc_toolBar1 = self.CreateToolBar(wx.TB_HORIZONTAL, wx.ID_ANY) self.mc_toolBar1.AddLabelTool( wx.Save, u"Save", wx.Bitmap(u"titi/icons/document-save.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, u"Save project", u"Save a proyect with the current file and directories to be processed with the extraction points added", None) self.mc_toolBar1.AddLabelTool( wx.Open, u"Open", wx.Bitmap(u"titi/icons/project-open.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, u"Open project", u"Open a previously saved project", None) self.mc_toolBar1.Realize() self.Centre(wx.BOTH) # Connect Events self.mc_gDir.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onTreeItemRClick) self.mc_LBox_Files2Process.Bind(wx.EVT_RIGHT_DOWN, self.onFiles2ProcessRightDown) self.mc_rBox_points_type.Bind(wx.EVT_RADIOBOX, self.onPointsTypeClick) self.mc_btn_add_point.Bind(wx.EVT_BUTTON, self.onBtnAddPointClick) self.mc_btn_file_points.Bind(wx.EVT_FILEPICKER_CHANGED, self.onOpenPointsFile) self.mc_LBox_points.Bind(wx.EVT_RIGHT_DOWN, self.onPoints2ExtractRightDown) self.mc_btn_start_extraction.Bind(wx.EVT_BUTTON, self.onStartExtractionClick) self.Bind(wx.EVT_TOOL, self.onSaveProjectClicked, id=wx.Save) self.Bind(wx.EVT_TOOL, self.onOpenProjectClicked, id=wx.Open)