def __init__(self, parent=None, *args, **kw): wx.Panel.__init__(self, parent, id=-1) self.parent = parent import wx.lib.rcsizer as rcs sizer = rcs.RowColSizer() # vBox = wx.BoxSizer(wx.VERTICAL) self.tableDict = dict() # self.setData(self.tableDict) # schemaNameLabel = wx.StaticText(self, -1, "Schema Name:") # self.schemaNameText = wx.TextCtrl(self, -1, '', size=(250, -1)) # self.schemaNameText.Bind(wx.EVT_TEXT, self.onSchemaName) tableNameLabel = wx.StaticText(self, -1, "Table Name:") self.tableNameText = wx.TextCtrl(self, -1, '', size=(250, -1)) self.tableNameText.Bind(wx.EVT_TEXT, self.onTableName) # sizer.Add(schemaNameLabel, flag=wx.EXPAND, row=1, col=1) # sizer.Add(self.schemaNameText, row=1, col=2) sizer.Add(tableNameLabel, flag=wx.EXPAND, row=0, col=1) sizer.Add(self.tableNameText, row=0, col=2) # vBox.Add(sizer) self.SetSizer(sizer)
def OnScheduleSetup(self, evt): if True: self.scheduleDlg = wx.Dialog(self, -1, "Schedule Setup", style=wx.DEFAULT_DIALOG_STYLE|wx.SAVE, size=(400, 180)) textDate = wx.StaticText(self.scheduleDlg, -1, "Date:", size=(30,-1)) self.dpc = wx.GenericDatePickerCtrl(self.scheduleDlg, #size=(120,-1), style = wx.TAB_TRAVERSAL | wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE ) btn_selectSaved = wx.Button(self.scheduleDlg, -1, "Browse...") self.scheduleDlg.Bind(wx.EVT_BUTTON, self.OnSelectSaved, btn_selectSaved) st = wx.StaticText(self.scheduleDlg, -1, "Choose:") self.tc_saved = wx.TextCtrl(self.scheduleDlg, -1, "", size=(200, -1)) textTime = wx.StaticText(self.scheduleDlg, -1, "Time:", size=(30,-1)) spin2 = wx.SpinButton(self.scheduleDlg, -1, wx.DefaultPosition, (-1, 25), wx.SP_VERTICAL) self.time24 = masked.TimeCtrl( self.scheduleDlg, -1, name="24 hour control", fmt24hr=True, spinButton = spin2 ) sizer = rcs.RowColSizer() box0 = wx.BoxSizer(wx.HORIZONTAL) box0.Add(st, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box0.Add(self.tc_saved, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box0.Add(btn_selectSaved, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(box0, row=1, col=1, colspan=8) box1 = wx.BoxSizer(wx.HORIZONTAL) box1.Add(textDate, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box1.Add(self.dpc, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(box1, row=2, col=1, colspan=2) box2 = wx.BoxSizer(wx.HORIZONTAL) box2.Add(textTime, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box2.Add(self.time24, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box2.Add(spin2, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(box2, row=2, col=4, colspan=2) btnsizer = wx.StdDialogButtonSizer() if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(self) btnsizer.AddButton(btn) btnSave = wx.Button(self.scheduleDlg, wx.ID_SAVE) btnSave.SetDefault() self.scheduleDlg.Bind(wx.EVT_BUTTON, self.OnScheduleSave, btnSave) btnsizer.AddButton(btnSave) btnCancel = wx.Button(self.scheduleDlg, wx.ID_CANCEL) btnsizer.AddButton(btnCancel) btnsizer.Realize() sizer.Add(btnsizer, row=4, col=1, colspan=5) self.scheduleDlg.SetSizer(sizer) scheduleDlgCode = self.scheduleDlg.ShowModal() self.scheduleDlg.Destroy()
def show_panel(self): # Make Panel self.panel = wx.Panel(self, -1) self.layout = rcs.RowColSizer() button_row = 0 button_row += 1 scroll_up_button = wx.Button(self.panel, wx.ID_ANY, label='Scroll Up', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnScrollUp, scroll_up_button) scroll_up_button.SetDefault() scroll_up_button.SetSize(scroll_up_button.GetBestSize()) self.layout.Add(scroll_up_button, row=button_row, col=1) button_row += 1 scroll_down_button = wx.Button(self.panel, wx.ID_ANY, label='Scroll Down', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnScrollDown, scroll_down_button) scroll_down_button.SetDefault() scroll_down_button.SetSize(scroll_down_button.GetBestSize()) self.layout.Add(scroll_down_button, row=button_row, col=1) button_row += 2 next_line_button = wx.Button(self.panel, wx.ID_ANY, label='Next Line', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnNextLine, next_line_button) next_line_button.SetDefault() next_line_button.SetSize(next_line_button.GetBestSize()) self.layout.Add(next_line_button, row=button_row, col=1) button_row += 1 prev_line_button = wx.Button(self.panel, wx.ID_ANY, label='Prev Line', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnPrevLine, prev_line_button) prev_line_button.SetDefault() prev_line_button.SetSize(prev_line_button.GetBestSize()) self.layout.Add(prev_line_button, row=button_row, col=1) button_row += 2 remove_line_button = wx.Button(self.panel, wx.ID_ANY, label='Remove Line', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnRemoveLine, remove_line_button) remove_line_button.SetDefault() remove_line_button.SetSize(remove_line_button.GetBestSize()) self.layout.Add(remove_line_button, row=button_row, col=1) button_row += 1 add_line_button = wx.Button(self.panel, wx.ID_ANY, label='Add Line', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnAddLine, add_line_button) add_line_button.SetDefault() add_line_button.SetSize(add_line_button.GetBestSize()) self.layout.Add(add_line_button, row=button_row, col=1) button_row += 4 write_line_infos_button = wx.Button(self.panel, wx.ID_ANY, label='Write', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnWriteLineInfos, write_line_infos_button) write_line_infos_button.SetDefault() write_line_infos_button.SetSize(add_line_button.GetBestSize()) self.layout.Add(write_line_infos_button, row=button_row, col=1) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, self.scaled_image(), size=(self.width, IMG_HEIGHT,)) self.layout.Add(self.imageCtrl, row=8, col=2) self.panel.SetSizerAndFit(self.layout)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.page_nbr = 0 self.page_image = None self.line = None # Make Panel self.panel = wx.Panel(self, -1) self.current_text = rcs.RowColSizer() self.pageCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, str(self.page_nbr), size=( 40, 20, ), style=wx.TE_READONLY) self.linesCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 80, ), style=wx.TE_MULTILINE | wx.TE_READONLY) self.editCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 40, ), style=wx.TE_PROCESS_ENTER) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.BitmapFromBuffer( 1, 1, array.array('B', ( 0, 0, 0, ))), size=( WIDTH - 100, 180, )) self.Bind(wx.EVT_TEXT_ENTER, self.OnEdit, self.editCtrl) self.current_text.Add(wx.StaticText(self.panel, wx.ID_ANY, 'Page'), row=1, col=1) self.current_text.Add(self.pageCtrl, row=1, col=2) self.current_text.Add(self.linesCtrl, row=2, col=2, rowspan=4) self.current_text.Add(self.editCtrl, row=6, col=2) self.current_text.Add(self.imageCtrl, row=7, col=2) self.last_page_callback = None self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, parent, *args, **kw): wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS | wx.BORDER_NONE) self.parent = parent vBox = wx.BoxSizer(wx.VERTICAL) #################################################################### vBox1 = wx.BoxSizer(wx.VERTICAL) import wx.lib.rcsizer as rcs sizer = rcs.RowColSizer() fbbLabel = wx.StaticText(self, -1, "Database File") os.chdir(wx.GetHomeDir()) self.fbb = filebrowse.FileBrowseButton( self, -1, size=(350, -1), labelText="", fileMask= 'sqlite (*.sqlite)|*.sqlite|Database (*.db)|*.db*|All Files|*.*', changeCallback=self.fbbCallback) connectionNameLabel = wx.StaticText(self, -1, "Connection Name ") self.connectionNameText = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER, size=(250, -1)) self.Bind(wx.EVT_TEXT, self.onChangeConnectionName, self.connectionNameText) sizer.Add(fbbLabel, flag=wx.EXPAND, row=1, col=1) sizer.Add(self.fbb, flag=wx.EXPAND, row=1, col=2) sizer.Add(connectionNameLabel, flag=wx.EXPAND, row=2, col=1) sizer.Add(self.connectionNameText, row=2, col=2) vBox1.Add(sizer) vBox.Add(vBox1, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) #################################################################### sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(vBox, 1, wx.EXPAND, 0) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__(self, parent, descr, get_vis): title = _(descr['name']) wx.Dialog.__init__(self, parent, -1, title) sizer = wx.BoxSizer(wx.VERTICAL) vp = get_vis(self) sizer.Add(vp, 0, wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) hsizer = rcs.RowColSizer() is_ok = wx.Button(self, wx.ID_OK) is_cancel = wx.Button(self, wx.ID_CANCEL) hsizer.Add(is_cancel, 0, 0, 5, 0, 0) hsizer.AddGrowableCol(1) hsizer.Add(is_ok, 0, 0, 5, 0, 2) sizer.Add(hsizer, 0, wx.EXPAND | wx.ALL, 5) sizer.Fit(self) self.SetSizer(sizer)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.page_nbr = 0 self.page_image = None self.line = None self.repeating = False self.proper_nouns = set() with codecs.open('working/proper_nouns.txt', mode='ab', encoding='utf-8') as f: pass with codecs.open('working/proper_nouns.txt', mode='rb', encoding='utf-8') as f: for l in f: line = l.strip() if line: self.proper_nouns.add(line) self.abbreviations = set() with codecs.open('working/abbreviations.txt', mode='ab', encoding='utf-8') as f: pass with codecs.open('working/abbreviations.txt', mode='rb', encoding='utf-8') as f: for l in f: line = l.strip() if line: self.abbreviations.add(line) self.possible_proper_nouns = [] # Make Panel self.panel = wx.Panel(self, -1) self.current_text = rcs.RowColSizer() self.pageCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, str(self.page_nbr), size=( 40, 20, ), style=wx.TE_READONLY) self.linesCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 80, ), style=wx.TE_MULTILINE | wx.TE_READONLY) self.errorsCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=(WIDTH - 100, 40), style=wx.TE_READONLY) self.editCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 40, ), style=wx.TE_PROCESS_ENTER) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.BitmapFromBuffer( 1, 1, array.array('B', ( 0, 0, 0, ))), size=( WIDTH - 100, 180, )) self.Bind(wx.EVT_TEXT_ENTER, self.OnEdit, self.editCtrl) self.current_text.Add(wx.StaticText(self.panel, wx.ID_ANY, 'Page'), row=1, col=1) self.current_text.Add(self.pageCtrl, row=1, col=2) self.current_text.Add(self.linesCtrl, row=2, col=2, rowspan=4) self.current_text.Add(self.errorsCtrl, row=6, col=2) self.current_text.Add(self.editCtrl, row=7, col=2) self.current_text.Add(self.imageCtrl, row=8, col=2) self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, parent, id=wx.ID_ANY): wx.Dialog.__init__(self, parent, id, _("Chip Reader Setup"), style=wx.DEFAULT_DIALOG_STYLE | wx.TAB_TRAVERSAL) self.timer = None self.receivedCount = 0 self.refTime = None self.enableJChipCheckBox = wx.CheckBox( self, label=_('Accept RFID Reader Data During Race')) if Model.race: self.enableJChipCheckBox.SetValue( getattr(Model.race, 'enableJChipIntegration', False)) else: self.enableJChipCheckBox.Enable(False) self.testJChip = wx.ToggleButton(self, label=_('Start RFID Test')) self.testJChip.SetFont( wx.Font((0, 24), wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.Bind(wx.EVT_TOGGLEBUTTON, self.testJChipToggle, self.testJChip) self.testList = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE, size=(-1, 200)) self.testList.Bind(wx.EVT_RIGHT_DOWN, self.skip) self.okBtn = wx.Button(self, wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onOK, self.okBtn) self.cancelBtn = wx.Button(self, wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.onCancel, self.cancelBtn) self.helpBtn = wx.Button(self, wx.ID_HELP) self.Bind( wx.EVT_BUTTON, lambda evt: HelpSearch.showHelp( 'Menu-ChipReader.html#chip-reader-setup'), self.helpBtn) self.Bind(EVT_CHIP_READER, self.handleChipReaderEvent) bs = wx.BoxSizer(wx.VERTICAL) todoList = u'\n'.join('%d) %s' % (i + 1, s) for i, s in enumerate([ _('Make sure the RFID receiver is plugged into the network.'), _('If you are using Impinj/Alien, make sure the CrossMgrImpinj or CrossMgrAlien bridge programs are running.' ), _('You must have the Sign-On Excel sheet ready and linked before your race.' ), _('You must configure a "Tag" field in your Sign-On Excel Sheet.'), _('Run this test before each race.'), ])) intro = (u'\n'.join([ _('CrossMgr supports the JChip, RaceResult, Ultra, Impinj and Alien RFID readers.' ), _('For more details, consult the documentation for your reader.'), ]) + u'\n' + _('Checklist:') + u'\n\n{}\n').format(todoList) border = 4 bs.Add(wx.StaticText(self, label=intro), 0, wx.EXPAND | wx.ALL, border) bs.Add(self.enableJChipCheckBox, 0, wx.EXPAND | wx.ALL | wx.ALIGN_LEFT, border) #------------------------------------------------------------------- bs.AddSpacer(border) bs.Add(wx.StaticText(self, label=_('Reader Configuration:')), 0, wx.EXPAND | wx.ALL, border) #------------------------------------------------------------------- rowColSizer = rcs.RowColSizer() bs.Add(rowColSizer, 0, wx.EXPAND | wx.ALL, border) row = 0 rowColSizer.Add(wx.StaticText(self, label=u'{}:'.format(_('Reader Type'))), row=row, col=0, border=border, flag=wx.TOP | wx.LEFT | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) self.chipReaderType = wx.Choice( self, choices=[_('JChip/Impinj/Alien'), _('RaceResult'), _('Ultra')]) self.chipReaderType.SetSelection(0) self.chipReaderType.Bind(wx.EVT_CHOICE, self.changechipReaderType) rowColSizer.Add(self.chipReaderType, row=row, col=1, border=border, flag=wx.EXPAND | wx.TOP | wx.RIGHT | wx.ALIGN_LEFT) row += 1 sep = u' -' + _('or') + u'- ' ips = sep.join(GetAllIps()) self.ipaddr = wx.TextCtrl(self, value=ips, style=wx.TE_READONLY, size=(240, -1)) self.autoDetect = wx.Button(self, label=_('AutoDetect')) self.autoDetect.Show(False) self.autoDetect.Bind(wx.EVT_BUTTON, self.doAutoDetect) iphs = wx.BoxSizer(wx.HORIZONTAL) iphs.Add(self.ipaddr, 1, flag=wx.EXPAND) iphs.Add(self.autoDetect, 0, flag=wx.LEFT, border=4) rowColSizer.Add(wx.StaticText(self, label=_('Remote IP Address:')), row=row, col=0, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) rowColSizer.Add(iphs, row=row, col=1, border=border, flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_LEFT) row += 1 self.port = wx.lib.intctrl.IntCtrl(self, -1, min=1, max=65535, value=PORT, limited=True, style=wx.TE_READONLY) rowColSizer.Add(wx.StaticText(self, label=_('Remote Port:')), row=row, col=0, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) rowColSizer.Add(self.port, row=row, col=1, border=border, flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_LEFT) bs.Add(wx.StaticText( self, label= _('If using JChip, see "7 Setting of Connections" in JChip "Control Panel Soft Manual" for more details.' )), border=border, flag=wx.GROW | wx.ALL) #------------------------------------------------------------------- bs.Add(self.testJChip, 0, wx.ALIGN_CENTER | wx.ALL, border) bs.Add(wx.StaticText(self, label=_('Messages:')), 0, wx.EXPAND | wx.ALL, border=border) bs.Add(self.testList, 1, wx.EXPAND | wx.ALL, border) buttonBox = wx.BoxSizer(wx.HORIZONTAL) buttonBox.AddStretchSpacer() buttonBox.Add(self.okBtn, flag=wx.RIGHT, border=border) self.okBtn.SetDefault() buttonBox.Add(self.cancelBtn) buttonBox.Add(self.helpBtn) bs.Add(buttonBox, 0, wx.EXPAND | wx.ALL, border) self.stopTest() self.SetSizerAndFit(bs) bs.Fit(self) self.update() self.CentreOnParent(wx.BOTH) wx.CallAfter(self.SetFocus)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.page_nbr = 0 self.page_image = None self.line = None self.repeating = False self.words = [] with codecs.open('working/maybe_ok.txt', mode='rb', encoding='utf-8') as f: for l in f: self.words.append(l.split()[0]) self.errors = [] self.speller = None # Make Panel self.panel = wx.Panel(self, -1) self.current_text = rcs.RowColSizer() self.pageCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, str(self.page_nbr), size=( 40, 20, ), style=wx.TE_READONLY) self.linesCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 80, ), style=wx.TE_MULTILINE | wx.TE_READONLY) self.errorsCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=(WIDTH - 100, 40), style=wx.TE_READONLY) self.editCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 40, ), style=wx.TE_PROCESS_ENTER) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.BitmapFromBuffer( 1, 1, array.array('B', ( 0, 0, 0, ))), size=( WIDTH - 100, 180, )) self.Bind(wx.EVT_TEXT_ENTER, self.OnEdit, self.editCtrl) self.current_text.Add(wx.StaticText(self.panel, wx.ID_ANY, 'Page'), row=1, col=1) self.current_text.Add(self.pageCtrl, row=1, col=2) self.current_text.Add(self.linesCtrl, row=2, col=2, rowspan=4) self.current_text.Add(self.errorsCtrl, row=6, col=2) self.current_text.Add(self.editCtrl, row=7, col=2) self.current_text.Add(self.imageCtrl, row=8, col=2)
def __init__(self, *args, **kwds): kwds['style'] = wx.NO_BORDER | wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.selected = -1 # create controls self.number = wx.StaticText(self, -1, '808', style=wx.ALIGN_RIGHT) self.position = wx.StaticText(self, -1, '6, 88, 9', style=wx.ALIGN_LEFT) self.symbol = wx.StaticText(self, -1, 'Mm', style=wx.ALIGN_CENTER_HORIZONTAL) self.name = wx.StaticText(self, -1, 'Praseodymium ', style=wx.ALIGN_CENTER_HORIZONTAL) self.mass = wx.StaticText(self, -1, '123.4567890 ', style=wx.ALIGN_CENTER_HORIZONTAL) self.massnumber = wx.StaticText(self, -1, '123 A ', style=wx.ALIGN_RIGHT) self.protons = wx.StaticText(self, -1, '123 P ', style=wx.ALIGN_RIGHT) self.neutrons = wx.StaticText(self, -1, '123 N ', style=wx.ALIGN_RIGHT) self.electrons = wx.StaticText(self, -1, '123 e ', style=wx.ALIGN_RIGHT) self.eleshell = wx.StaticText(self, -1, '2, 8, 18, 32, 32, 15, 2', style=wx.ALIGN_LEFT) self.eleconfig = StaticFancyText( self, -1, '[Xe] 4f<sup>14</sup> 5d<sup>10</sup>' ' 6s<sup>2</sup> 6p<sup>6</sup> ', style=wx.ALIGN_LEFT, ) self.oxistates = wx.StaticText(self, -1, '1*, 2, 3, 4, 5, 6, -7 ') self.atmrad = wx.StaticText(self, -1, '1.234 A ', style=wx.ALIGN_RIGHT) self.ionpot = wx.StaticText(self, -1, '123.4567890 eV ') self.eleneg = wx.StaticText(self, -1, '123.45678 ') # set control properties font = self.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) self.number.SetFont(font) self.name.SetFont(font) font.SetPointSize(int(font.GetPointSize() * 1.9)) self.symbol.SetFont(font) self.number.SetToolTip('Atomic number') self.position.SetToolTip('Group, Period, Block') self.symbol.SetToolTip('Symbol') self.name.SetToolTip('Name') self.mass.SetToolTip('Relative atomic mass') self.eleshell.SetToolTip('Electrons per shell') self.massnumber.SetToolTip('Mass number (most abundant isotope)') self.protons.SetToolTip('Protons') self.neutrons.SetToolTip('Neutrons (most abundant isotope)') self.electrons.SetToolTip('Electrons') self.eleconfig.SetToolTip('Electron configuration') self.oxistates.SetToolTip('Oxidation states') self.atmrad.SetToolTip('Atomic radius') self.ionpot.SetToolTip('Ionization potentials') self.eleneg.SetToolTip('Electronegativity') # layout sizer = rcsizer.RowColSizer() sizer.col_w = SPACER sizer.row_h = SPACER sizer.Add( self.number, row=0, col=0, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE, ) sizer.Add(self.position, row=0, col=1, flag=wx.ALIGN_LEFT | wx.FIXED_MINSIZE) sizer.Add( self.symbol, row=1, col=0, rowspan=2, colspan=2, flag=(wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.ALL), ) sizer.Add( self.name, row=3, col=0, colspan=2, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE, ) sizer.Add( self.mass, row=4, col=0, colspan=2, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE, ) sizer.Add( self.massnumber, row=0, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE, ) sizer.Add(self.protons, row=1, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.neutrons, row=2, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add( self.electrons, row=3, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE, ) sizer.Add(self.atmrad, row=4, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.eleconfig, row=0, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.eleshell, row=1, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.oxistates, row=2, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.ionpot, row=3, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.eleneg, row=4, col=4, flag=wx.ADJUST_MINSIZE) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) sizer.SetSizeHints(self) self.Layout()
def __do_layout(self): grid_sizer_infos = rcs.RowColSizer() grid_sizer_infos.Add(self.label_credit_restant, row=0, col=0) grid_sizer_infos.Add(self.label_credit_restant_valeur, flag=wx.ALIGN_RIGHT, row=0, col=1) grid_sizer_infos.Add(self.label_cotisation, row=1, col=0) grid_sizer_infos.Add(self.label_cotisation_valeur, flag=wx.ALIGN_RIGHT, row=1, col=1) grid_sizer_infos.Add(self.label_cotisation_payee, row=2, col=0, colspan=2) grid_sizer_infos.Add(self.label_total_achats, row=3, col=0) grid_sizer_infos.Add(self.label_total_achats_valeur, flag=wx.ALIGN_RIGHT, row=3, col=1) grid_sizer_infos.Add(self.label_cout_supplementaire, flag=wx.ALIGN_CENTER_VERTICAL, row=4, col=0) grid_sizer_infos.Add(self.text_cout_supplementaire, flag=wx.ALIGN_RIGHT, row=4, col=1) grid_sizer_infos.Add(self.text_cout_supplementaire_commentaire, flag=wx.EXPAND, row=5, col=0, colspan=2) grid_sizer_infos.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL), flag=wx.EXPAND, row=6, col=0, colspan=2) grid_sizer_infos.Add(self.label_solde, row=7, col=0) grid_sizer_infos.Add(self.label_solde_valeur, flag=wx.ALIGN_RIGHT, row=7, col=1) sizer_infos = wx.StaticBoxSizer(self.sizer_infos_staticbox, wx.VERTICAL) sizer_infos.Add(grid_sizer_infos, 1, wx.ALL | wx.EXPAND, 5) sizer_liste_produits = wx.StaticBoxSizer( self.sizer_liste_produits_staticbox, wx.VERTICAL) sizer_liste_produits.Add(self.search_nom, 0, wx.BOTTOM, 6) sizer_liste_produits.Add(self.liste_produits, 1, wx.EXPAND, 0) sizer_infos_produits = wx.BoxSizer(wx.HORIZONTAL) sizer_infos_produits.Add(sizer_infos, 0, wx.EXPAND | wx.RIGHT, 5) sizer_infos_produits.Add(sizer_liste_produits, 1, wx.EXPAND, 0) sizer_achat = wx.StaticBoxSizer(self.sizer_achat_staticbox, wx.VERTICAL) sizer_achat.Add(self.liste_lignes_achat, 1, wx.EXPAND, 0) sizer_boutons = wx.BoxSizer(wx.HORIZONTAL) sizer_boutons.Add(self.bouton_sauvegarder, 1) sizer_boutons.Add((10, 10), 1, wx.EXPAND) sizer_boutons.Add(self.bouton_annuler, 1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.label_titre_achat, 0, wx.BOTTOM | wx.EXPAND, 10) sizer.Add(sizer_infos_produits, 1, wx.TOP | wx.BOTTOM | wx.EXPAND, 5) sizer.Add(sizer_achat, 1, wx.EXPAND, 0) sizer.Add(sizer_boutons, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 6) sizer_dialog = wx.BoxSizer(wx.VERTICAL) sizer_dialog.Add(sizer, 1, wx.ALL | wx.EXPAND, 10) self.SetSizer(sizer_dialog) sizer_dialog.Fit(self)
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.page_nbr = 0 self.page_image = None self.line = None self.repeating = False self.errors = [] self.skips = [] self.speller = None self.strict = False # Make Panel self.panel = wx.Panel(self, -1) self.current_text = rcs.RowColSizer() self.pageCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, str(self.page_nbr), size=( 40, 20, ), style=wx.TE_READONLY) self.linesCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 80, ), style=wx.TE_MULTILINE | wx.TE_READONLY) self.errorsCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=(WIDTH - 100, 40), style=wx.TE_READONLY) self.editCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 40, ), style=wx.TE_PROCESS_ENTER) self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.BitmapFromBuffer( 1, 1, array.array('B', ( 0, 0, 0, ))), size=( WIDTH - 100, 180, )) self.searchCtrl = wx.TextCtrl(self.panel, wx.ID_ANY, '', size=( WIDTH - 100, 40, ), style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.OnEdit, self.editCtrl) self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.searchCtrl) self.current_text.Add(wx.StaticText(self.panel, wx.ID_ANY, 'Page'), row=1, col=1) self.current_text.Add(self.pageCtrl, row=1, col=2) self.current_text.Add(self.linesCtrl, row=2, col=2, rowspan=4) self.current_text.Add(self.errorsCtrl, row=6, col=2) self.current_text.Add(self.editCtrl, row=7, col=2) self.current_text.Add(self.imageCtrl, row=8, col=2) self.current_text.Add(self.searchCtrl, row=9, col=2) search_button = wx.Button(self.panel, wx.ID_ANY, label='Search', size=(90, 30)) self.Bind(wx.EVT_BUTTON, self.OnSearch, search_button) search_button.SetDefault() search_button.SetSize(search_button.GetBestSize()) self.current_text.Add(search_button, row=9, col=1) self.last_page_callback = None self.Bind(wx.EVT_CLOSE, self.OnClose)
def __init__(self, parent, headless=False, dirs=[], extensions=['png'], log_filepath=''): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title="Image Processor", pos=wx.DefaultPosition, size=(450, 500), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) # ATTRIBUTES self.dirs = dirs self.extensions = extensions self.log_filepath = log_filepath # BUILD UI #======================================================= side_buffer = 8 # Main Sizer self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.main_sizer) # CheckListBox to allow the user to specify image extension types self.main_sizer.AddSpacer(5) self.main_sizer.Add( wx.StaticText(self, wx.ID_ANY, "Image Extensions to Process:"), 0, wx.LEFT, side_buffer + 2) self.clb_extensions = wx.CheckListBox(self, wx.ID_ANY, (-1, -1), (-1, 72), IMAGE_EXTENSTIONS) self.main_sizer.Add(self.clb_extensions, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, side_buffer) self.clb_extensions.Bind(wx.EVT_CHECKLISTBOX, self.on_exts_changed) # Listbox for multiple directories to run the batch on self.main_sizer.AddSpacer(5) self.main_sizer.Add( wx.StaticText(self, wx.ID_ANY, "Directories to Process:"), 0, wx.LEFT, side_buffer + 2) self.lst_dirs = wx.ListBox(self, wx.ID_ANY, choices=self.dirs, style=wx.LB_MULTIPLE) self.main_sizer.Add(self.lst_dirs, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, side_buffer) # Listbox Add\Remove buttons self.main_sizer.AddSpacer(3) btn_sizer = wx.BoxSizer(wx.HORIZONTAL) self.btn_add_dir = wx.Button(self, wx.ID_ANY, "Add Directories", size=(-1, 20)) btn_sizer.Add(self.btn_add_dir, 1, wx.EXPAND) self.btn_add_dir.Bind(wx.EVT_BUTTON, self.on_add_dir_pressed) self.btn_rem_dir = wx.Button(self, wx.ID_ANY, "Remove Directories", size=(-1, 20)) btn_sizer.Add(self.btn_rem_dir, 1, wx.EXPAND) self.btn_rem_dir.Bind(wx.EVT_BUTTON, self.on_rem_dir_pressed) self.main_sizer.Add(btn_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, side_buffer) # Extra Options #===================================== self.main_sizer.AddSpacer(10) box = wx.StaticBox(self, wx.ID_ANY, "Optional Actions:") self.box_sizer = wx.StaticBoxSizer(box, wx.VERTICAL) grid_sizer = rcs.RowColSizer() grid_sizer.AddGrowableCol(0) grid_sizer.AddGrowableCol(1) self.box_sizer.Add(grid_sizer, 1, wx.EXPAND) self.main_sizer.Add(self.box_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15) # Loop thru all of the Base_Image_Action subclasses and add a widget to the options panel row = 0 col = 0 idx = 0 for sub_class in Base_Image_Action.__subclasses__(): if sub_class.add_to_ui: widget = sub_class.widget_class(self, wx.ID_ANY, sub_class.widget_title) widget.SetValue(sub_class.can_execute) grid_sizer.Add(widget, 0, wx.LEFT | wx.BOTTOM, side_buffer, row=row, col=col) widget.Bind(wx.EVT_CHECKBOX, sub_class.update_can_execute) if idx % 2 == 0: col += 1 else: row += 1 col = 0 idx += 1 # Output log file self.main_sizer.AddSpacer(10) self.use_log = wx.CheckBox(self, wx.ID_ANY, "Create Output Log") self.use_log.Bind(wx.EVT_CHECKBOX, self.on_use_log_checked) self.use_log.SetValue(True) self.main_sizer.Add(self.use_log, 0, wx.LEFT, side_buffer + 2) self.main_sizer.AddSpacer(2) log_sizer = wx.BoxSizer(wx.HORIZONTAL) self.main_sizer.Add(log_sizer, 0, wx.EXPAND) self.txt_log_filename = wx.StaticText(self, wx.ID_ANY, "Filename:") log_sizer.Add(self.txt_log_filename, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, side_buffer) self.txt_log_path = wx.TextCtrl(self, wx.ID_ANY, self.log_filepath) log_sizer.Add(self.txt_log_path, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 4) log_sizer.AddSpacer(1) self.txt_log_path.Bind(wx.EVT_TEXT, self.on_log_path_changed) self.btn_browse_log_path = wx.Button(self, wx.ID_ANY, "...", size=(33, -1)) log_sizer.Add(self.btn_browse_log_path, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 4) self.btn_browse_log_path.Bind(wx.EVT_BUTTON, self.on_browse_log_pressed) # Start Button self.main_sizer.AddSpacer(10) self.btn_start_batch = wx.Button(self, wx.ID_ANY, "Start Processor", size=(-1, 33)) self.btn_start_batch.Enable(False) self.main_sizer.Add(self.btn_start_batch, 0, wx.EXPAND | wx.ALL, 5) self.btn_start_batch.Bind(wx.EVT_BUTTON, self.on_start_pressed) # Status Bar self.txt_status_msg = wx.StaticText(self, wx.ID_ANY, "Status: <inactive>") self.main_sizer.Add(self.txt_status_msg, 0, wx.LEFT | wx.RIGHT, side_buffer + 2) self.status_bar = wx.Gauge(self, wx.ID_ANY) self.main_sizer.Add(self.status_bar, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, side_buffer) self.main_sizer.AddSpacer(5) #======================================================= # Create the batch class self.batch = Image_Batch(headless=headless, frame=self, log_filepath=self.log_filepath, status_bar=self.status_bar, status_bar_title=self.txt_status_msg) # Get the log filepath after the batch has had a chance to validate it self.log_filepath = self.batch.get_log_filepath() # Other random UI stuff self.SetBackgroundColour(wx.Colour(225, 225, 225)) self.refresh_ui()
def __init__(self, internal): title = _("Calculation of the structure factor") parent = internal["window"] data = internal["data"]["Exp. data"] rho_rc = internal["data"].get("RhoRc") self.internal = internal self.data = data wx.Dialog.__init__(self, parent, -1, title) if parent is not None: self.SetIcon(parent.GetIcon()) # Elements rcszr = rcs.RowColSizer() label = wx.StaticText(self, -1, _("Elements:")) rcszr.Add(label, row=0, col=0, border=5, flag=wx.ALL) telements = u'' if data is not None and data.elements: for lmn in data.elements: telements += u" %s %s;" % (lmn[0], loc.str(lmn[1])) telements = telements[1:-1] self.elements_ea = wx.TextCtrl(self, value=telements, validator=ValidElements()) rcszr.Add(self.elements_ea, row=0, col=1, colspan=3, flag=wx.EXPAND) # mode modes = [_MOD_NAMES[i] for i in "clsc mix pcf pcfi pcfir pblk".split()] self.calc_modes = wx.RadioBox(self, -1, _("Calculation mode"), choices=modes, majorDimension=2, style=wx.RA_SPECIFY_COLS) self.calc_modes.Bind(wx.EVT_RADIOBOX, self.on_mode_change) item = internal["sqcalc_mode"] if 0 > item or item >= len(modes): item = 0 self.calc_modes.SetSelection(item) rcszr.Add(self.calc_modes, row=1, col=0, colspan=4, flag=wx.ALIGN_CENTER | wx.ALL, border=5) # ############# Horizontal line ########################### line = wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL) rcszr.Add(line, row=2, col=0, colspan=4, flag=wx.EXPAND) # pol size label = wx.StaticText(self, -1, _("Polynomial's range:")) rcszr.Add(label, row=3, col=0, border=5, flag=wx.ALL) self.pol_spin = wx.SpinCtrl(self, -1) self.pol_spin.SetRange(1, 50) rang = internal["sqcalc_polrang"] if rang < 1 or rang > 50: rang = 1 self.pol_spin.SetValue(rang) rcszr.Add(self.pol_spin, row=3, col=1) # sects prev opt label = wx.StaticText(self, -1, _("Sections:")) rcszr.Add(label, row=4, col=0, border=5, flag=wx.ALL) self.opt_sects = wx.SpinCtrl(self, -1) self.opt_sects.SetRange(0, 10) rang = internal["sqcalc_optsects"] if rang < 0 or rang > 10: rang = 0 self.opt_sects.SetValue(rang) rcszr.Add(self.opt_sects, row=4, col=1) label = wx.StaticText(self, -1, _("Start dens. opt.:")) rcszr.Add(label, row=4, col=2, border=5, flag=wx.ALL) self.ord_r_spin = wx.SpinCtrl(self, -1) self.ord_r_spin.SetRange(1, 50) rang = internal["sqcalc_polrangrho"] if rang < 1 or rang > 50: rang = 1 self.ord_r_spin.SetValue(rang) rcszr.Add(self.ord_r_spin, row=4, col=3) # \rho_0 label = wx.StaticText(self, -1, _("Atomic density:")) rcszr.Add(label, row=3, col=2, border=5, flag=wx.ALL) trho_0 = '' if data is not None and data.rho0: trho_0 = loc.format(u"%g", data.rho0) if rho_rc: if trho_0: trho_0 = [trho_0, loc.format(u"%g", rho_rc[0])] else: trho_0 = loc.format(u"%g", rho_rc[0]) if type(trho_0) == list: self.rho0_ea = wx.ComboBox(self, value=trho_0[0], choices=trho_0, style=wx.CB_DROPDOWN, validator=ValidFloat()) else: self.rho0_ea = wx.TextCtrl(self, value=trho_0, validator=ValidFloat()) rcszr.Add(self.rho0_ea, row=3, col=3) # r_c / steps label = wx.StaticText(self, -1, _("Cutoff radius:")) rcszr.Add(label, row=5, col=0, border=5, flag=wx.ALL) if rho_rc: r_c = rho_rc[1] else: r_c = internal["sqcalc_rc"] r_c = loc.format("%g", r_c) self.rc_ea = wx.TextCtrl(self, value=r_c, validator=ValidFloat()) rcszr.Add(self.rc_ea, row=5, col=1) label = wx.StaticText(self, -1, _("Samples:")) rcszr.Add(label, row=5, col=2, border=5, flag=wx.ALL) self.rc_num = wx.SpinCtrl(self, -1) self.rc_num.SetRange(3, 1000) rang = internal["sqcalc_rc_num"] if rang < 3 or rang > 1000: rang = 10 self.rc_num.SetValue(rang) rcszr.Add(self.rc_num, row=5, col=3) # Buttons... btn = wx.Button(self, wx.ID_CANCEL) rcszr.Add(btn, row=7, col=0, border=5, flag=wx.ALL) btn = wx.Button(self, wx.ID_OK) btn.SetDefault() rcszr.Add(btn, row=7, col=2, colspan=2, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) rcszr.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), row=6, col=0, colspan=4, flag=wx.EXPAND) rcszr.RecalcSizes() self.SetSizer(rcszr) rcszr.Fit(self) enables = ["000000", "110110", "110000", "110110", "110111", "110110"] self.enables = [tuple(map(bool, map(int, i))) for i in enables] self.on_mode_change()
def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(600, -1)) Size = namedtuple("Size", ['x', 'y']) s = Size(100, 50) self.cn_text = None self.en_text = None cwd = os.getcwd() self.mask_path = path.join(path.abspath(cwd), 'alice_mask.png') self.user_sw = STOPWORDS self.lt = layout_template() self.name = 'WordCloud draw' self.version = '0.2' self.des = '''Draw the word cloud.\n''' self.git_website = "https://github.com/WellenWoo/WordCloud_draw" self.copyright = "(C) 2018 All Right Reserved" """创建菜单栏""" filemenu = wx.Menu() menuExit = filemenu.Append(wx.ID_EXIT, "E&xit\tCtrl+Q", "Tenminate the program") confmenu = wx.Menu() menuSw = confmenu.Append(wx.ID_ANY, "StopWords", "Add user StopWrods dict") menuMask = confmenu.Append(wx.ID_ANY, "Mask", "Set mask") helpmenu = wx.Menu() menuAbout = helpmenu.Append(wx.ID_ABOUT, "&About", "Information about this program") menuBar = wx.MenuBar() menuBar.Append(filemenu, "&File") menuBar.Append(confmenu, "&Configure") menuBar.Append(helpmenu, "&Help") self.SetMenuBar(menuBar) """创建输入框""" self.in1 = wx.TextCtrl(self, -1, size=(2 * s.x, s.y)) """创建按钮""" b1 = gbtn.GradientButton(self, -1, label="text") b2 = gbtn.GradientButton(self, -1, label="run") """设置输入框的提示信息""" self.in1.SetToolTipString('choose a text file') """界面布局""" self.sizer0 = rcs.RowColSizer() self.sizer0.Add(b1, row=1, col=1) self.sizer0.Add(self.in1, row=1, col=2) self.sizer0.Add(b2, row=1, col=3) """绑定回调函数""" self.Bind(wx.EVT_BUTTON, self.choose_cn, b1) self.Bind(wx.EVT_BUTTON, self.draw_cn, b2) '''菜单绑定函数''' self.Bind(wx.EVT_MENU, self.OnExit, menuExit) self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) self.Bind(wx.EVT_MENU, self.get_stopwords, menuSw) self.Bind(wx.EVT_MENU, self.get_mask, menuMask) self.SetSizer(self.sizer0) self.SetAutoLayout(1) self.sizer0.Fit(self) self.CreateStatusBar() self.Show(True)
def __init__(self, parent, *args, **kw): wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS | wx.SUNKEN_BORDER) self.parent = parent vBox = wx.BoxSizer(wx.VERTICAL) #################################################################### self.tableDict = dict() self.tableDict['tableName'] = '' vBox1 = wx.BoxSizer(wx.VERTICAL) import wx.lib.rcsizer as rcs sizer = rcs.RowColSizer() fbbLabel = wx.StaticText(self, -1, "Select CSV / Excel File") os.chdir(wx.GetHomeDir()) self.fbb = filebrowse.FileBrowseButton( self, -1, size=(450, -1), labelText="", fileMask='CSV (*.csv)|*.csv|Excel (*.xls)|*.xls*|All Files|*.*', changeCallback=self.fbbCallback ) tableNameLabel = wx.StaticText(self, -1, "Table Name") self.tableNameText = wx.TextCtrl(self, -1, self.tableDict['tableName'], style=wx.TE_PROCESS_ENTER, size=(250, -1)) self.Bind(wx.EVT_TEXT, self.onChangeTableName, self.tableNameText) columnNameFirstRowLabel = wx.StaticText(self, -1, "Column Name in first row") self.columNameFirstRow = wx.CheckBox(self, -1, "", style=wx.ALIGN_RIGHT) self.Bind(wx.EVT_CHECKBOX, self.evtColumNameFirstRowCheckBox, self.columNameFirstRow) fieldSeparatorLabel = wx.StaticText(self, -1, "Field Separator") self.fieldSeparatorChoice = wx.Choice(self, choices=[",", ";", "Tab", "|", "Other"]) self.Bind(wx.EVT_CHOICE, self.evtFieldSeparatorChoice, self.fieldSeparatorChoice) self.fieldSeparatorChoice.SetSelection(0) quoteCharacterLabel = wx.StaticText(self, -1, "Quote Character") self.quoteCharacterChoice = wx.Choice(self, choices=['"', "'", " ", "Other"]) self.Bind(wx.EVT_CHOICE, self.evtQuoteCharacterChoice, self.quoteCharacterChoice) self.quoteCharacterChoice.SetSelection(0) encodingLabel = wx.StaticText(self, -1, "Encoding") self.encodingLabelChoice = wx.Choice(self, choices=["UTF-8", "UTF-16", "ISO-8859-1", "Other"]) self.Bind(wx.EVT_CHOICE, self.evtEncodingLabelChoice, self.encodingLabelChoice) self.encodingLabelChoice.SetSelection(0) trimFieldsLabel = wx.StaticText(self, -1, "Trim Fields ?") self.trimFieldCheck = wx.CheckBox(self, -1, "", style=wx.ALIGN_RIGHT) self.trimFieldCheck.SetValue(1) sizer.Add(fbbLabel, flag=wx.EXPAND, row=1, col=1) sizer.Add(self.fbb, flag=wx.EXPAND, row=1, col=2) sizer.Add(tableNameLabel, flag=wx.EXPAND, row=2, col=1) sizer.Add(self.tableNameText, row=2, col=2) sizer.Add(columnNameFirstRowLabel, flag=wx.EXPAND, row=3, col=1) sizer.Add(self.columNameFirstRow, row=3, col=2) sizer.Add(fieldSeparatorLabel, flag=wx.EXPAND, row=4, col=1) sizer.Add(self.fieldSeparatorChoice, row=4, col=2) sizer.Add(quoteCharacterLabel, flag=wx.EXPAND, row=5, col=1) sizer.Add(self.quoteCharacterChoice, row=5, col=2) sizer.Add(encodingLabel, flag=wx.EXPAND, row=6, col=1) sizer.Add(self.encodingLabelChoice, row=6, col=2) sizer.Add(trimFieldsLabel, flag=wx.EXPAND, row=7, col=1) sizer.Add(self.trimFieldCheck, row=7, col=2) # sizer.Add(self.tableNameText, row=1, col=2) vBox1.Add(sizer) vBox.Add(vBox1, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) # vBox.Add(self.tb, 0, wx.EXPAND) # vBox.Add(self.list, 1, wx.EXPAND) #################################################################### sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(vBox, 1, wx.EXPAND , 0) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) sizer = rcs.RowColSizer() text = "This sizer lays out it's items by row and column "\ "that are specified explicitly when the item is \n"\ "added to the sizer. Grid cells with nothing in "\ "them are supported and column- or row-spanning is \n"\ "handled as well. Growable rows and columns are "\ "specified just like the wxFlexGridSizer." sizer.Add(wx.StaticText(self, -1, text), row=1, col=1, colspan=5) sizer.Add(wx.TextCtrl(self, -1, "(3,1)"), flag=wx.EXPAND, row=3, col=1) sizer.Add(wx.TextCtrl(self, -1, "(3,2)"), row=3, col=2) sizer.Add(wx.TextCtrl(self, -1, "(3,3)"), row=3, col=3) sizer.Add(wx.TextCtrl(self, -1, "(3,4)"), row=3, col=4) sizer.Add(wx.TextCtrl(self, -1, "(4,2) span:(2,2)"), flag=wx.EXPAND, row=4, col=2, rowspan=2, colspan=2) sizer.Add(wx.TextCtrl(self, -1, "(6,4)"), row=6, col=4) sizer.Add(wx.TextCtrl(self, -1, "(7,2)"), row=7, col=2) sizer.Add(wx.TextCtrl(self, -1, "(8,3)"), row=8, col=3) sizer.Add(wx.TextCtrl(self, -1, "(10,1) colspan: 4"), flag=wx.EXPAND, pos=(10, 1), colspan=4) sizer.Add(wx.TextCtrl(self, -1, "(3,5) rowspan: 8, growable col", style=wx.TE_MULTILINE), flag=wx.EXPAND, pos=(3, 5), size=(8, 1)) box = wx.BoxSizer(wx.VERTICAL) box.Add(wx.Button(self, -1, "A vertical box"), flag=wx.EXPAND) box.Add(wx.Button(self, -1, "sizer put in the"), flag=wx.EXPAND) box.Add(wx.Button(self, -1, "RowColSizer at (12,1)"), flag=wx.EXPAND) sizer.Add(box, pos=(12, 1)) sizer.Add(wx.TextCtrl(self, -1, "(12,2) align bottom"), flag=wx.ALIGN_BOTTOM, pos=(12, 2)) sizer.Add(wx.TextCtrl(self, -1, "(12,3) align center"), flag=wx.ALIGN_CENTER_VERTICAL, pos=(12, 3)) sizer.Add(wx.TextCtrl(self, -1, "(12,4)"), pos=(12, 4)) sizer.Add(wx.TextCtrl(self, -1, "(12,5) full border"), flag=wx.EXPAND | wx.ALL, border=15, pos=(12, 5)) sizer.AddGrowableCol(5) sizer.AddGrowableRow(9) sizer.AddSpacer(10, 10, pos=(1, 6)) sizer.AddSpacer(10, 10, pos=(13, 1)) self.SetSizer(sizer) self.SetAutoLayout(True)
def __init__( self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, ): pre = wx.PreDialog() pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) pre.Create(parent, ID, title, pos, size, style) self.PostCreate(pre) sizer = rcs.RowColSizer() self.lc_result = wx.ListCtrl(self, -1, size=(200,300), style=wx.LC_REPORT) self.lc_result.InsertColumn(0, "Index", width=41, format=wx.LIST_FORMAT_CENTER) self.lc_result.InsertColumn(1, "Configuration Name", width=160) sizer.Add(self.lc_result, row=1, col=1, colspan=6, rowspan=10) btn_add = wx.Button(self, -1, "<- ADD") self.Bind(wx.EVT_BUTTON, self.OnAddClick, btn_add) sizer.Add(btn_add, row=2, col=8, colspan=2) btn_up = wx.Button(self, -1, "UP") self.Bind(wx.EVT_BUTTON, self.OnUpClick, btn_up) sizer.Add(btn_up, row=4, col=8, colspan=2) btn_down = wx.Button(self, -1, "DOWN") self.Bind(wx.EVT_BUTTON, self.OnDownClick, btn_down) sizer.Add(btn_down, row=6, col=8, colspan=2) btn_remove = wx.Button(self, -1, "REMOVE ->") self.Bind(wx.EVT_BUTTON, self.OnRemoveClick, btn_remove) sizer.Add(btn_remove, row=8, col=8, colspan=2) self.lc_config = wx.ListCtrl(self, -1, size=(200,300), style=wx.LC_REPORT|wx.LC_SINGLE_SEL) info = wx.ListItem() info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT info.m_image = -1 info.m_format = 0 info.m_text = "Configuration Name" info.SetWidth(200) info.SetTextColour(wx.BLUE) info.SetAlign(wx.LIST_FORMAT_CENTER) self.lc_config.InsertColumnInfo(0, info) gvc = iLoadTools.GetValidConfig() self.configuration = gvc.getValidConfig() for i in self.configuration: self.lc_config.Append([i]) sizer.Add(self.lc_config, row=1, col=11, colspan=6, rowspan=10) line = wx.StaticLine(self, -1, size=(544,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, row=12, col=1, colspan=19) btnOpen = wx.Button(self, wx.ID_OPEN) self.Bind(wx.EVT_BUTTON, self.OnOpenExists, btnOpen) sizer.Add(btnOpen, row=13, col=1, colspan=3) btnSave = wx.Button(self, wx.ID_SAVE) self.Bind(wx.EVT_BUTTON, self.OnSaveFile, btnSave) sizer.Add(btnSave, row=13, col=4, colspan=3) btnClose = wx.Button(self, wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnCloseClick, btnClose) sizer.Add(btnClose, row=13, col=7, colspan=3) btnsScheduleSetup = wx.Button(self, -1, "Schedule Setup", size=(200,-1)) self.Bind(wx.EVT_BUTTON, self.OnScheduleSetup, btnsScheduleSetup) sizer.Add(btnsScheduleSetup, row=13, col=10, colspan=5) self.SetSizer(sizer)
def __init__(self, parent=None, *args, **kw): wx.Panel.__init__(self, parent, id=-1) self.parent = parent self.findText = '' self.replaceText = '' self.setFindText() vBox = wx.BoxSizer(wx.VERTICAL) try: import wx.lib.rcsizer as rcs except Exception as e: logger.error(e, exc_info=True) rowColumnSizer = rcs.RowColSizer() # sizer = wx.GridBagSizer(hgap=3, vgap=3) sizer = wx.BoxSizer(wx.VERTICAL) h1 = wx.BoxSizer(wx.HORIZONTAL) h2 = wx.BoxSizer(wx.HORIZONTAL) h1.Add((1, 1), -1, wx.ALL) # this is a spacer schemaNameLabel = wx.StaticText(self, -1, "F&ind: ") schemaNameText = wx.TextCtrl(self, -1, self.findText, size=(400, -1)) tableNameLabel = wx.StaticText(self, -1, "Replace with:") tableNameText = wx.TextCtrl(self, -1, self.replaceText, size=(400, -1)) h1.Add(schemaNameLabel, 0, wx.ALL, 2) h1.Add(schemaNameText, 0, wx.ALL, 2) h2.Add((1, 1), -1, wx.ALL) # this is a spacer h2.Add(tableNameLabel, 0, wx.ALL, 2) h2.Add(tableNameText, 0, wx.ALL, 2) directionRadioBox = wx.RadioBox(self, -1, "Direction", (10, 10), wx.DefaultSize, ['Forward', 'Backword'], 1, wx.RA_SPECIFY_COLS) scopeRadioBox = wx.RadioBox(self, -1, "Scope", (10, 10), wx.DefaultSize, ['All', 'Selected lines'], 1, wx.RA_SPECIFY_COLS) # first the static box box_10 = wx.StaticBox(self, -1, 'Options') cb1 = wx.CheckBox(box_10, -1, "Case sensitive", (35, 40), (150, 20)) cb2 = wx.CheckBox(box_10, -1, "Wra&p search", (35, 60), (150, 20)) cb3 = wx.CheckBox(box_10, -1, "&Incremental", (35, 80), (150, 20)) cb4 = wx.CheckBox(box_10, -1, "Regular expressions", (35, 80), (150, 20)) cb5 = wx.CheckBox(box_10, -1, "Whole word", (35, 80), (150, 20)) # then the sizer staticBoxSizer_11 = wx.StaticBoxSizer(box_10, wx.VERTICAL) rowColumnSizer1 = rcs.RowColSizer() rowColumnSizer1.Add(cb1, row=1, col=1) rowColumnSizer1.Add(cb2, row=2, col=1) rowColumnSizer1.Add(cb3, row=3, col=1) # rowColumnSizer1.Add( (2,2),row=1, col=2) rowColumnSizer1.Add(cb4, row=2, col=2) rowColumnSizer1.Add(cb5, row=3, col=2) staticBoxSizer_11.Add(rowColumnSizer1) # staticBoxSizer_11.AddMany( [ cb1, # cb2, # cb3, # cb4, # cb5 # ]) # sizer.AddGrowableCol(0) # sizer.AddGrowableCol(1) self.findButton = wx.Button(self, -1, "Find", pos=(50, 20)) self.Bind(wx.EVT_BUTTON, self.onFindClicked, self.findButton) self.findButton.SetDefault() self.replaceButton = wx.Button(self, -1, "Replace", pos=(50, 20)) self.Bind(wx.EVT_BUTTON, self.onReplaceClicked, self.replaceButton) self.replaceButton.SetDefault() self.replaceFindButton = wx.Button(self, -1, "Replace/Fin&d", pos=(50, 20)) self.Bind(wx.EVT_BUTTON, self.onReplaceFindClicked, self.replaceFindButton) self.replaceFindButton.SetDefault() self.replaceAllButton = wx.Button(self, -1, "Replace &All", pos=(50, 20)) self.Bind(wx.EVT_BUTTON, self.onReplaceAllClicked, self.replaceAllButton) self.replaceAllButton.SetDefault() self.closeButton = wx.Button(self, -1, "Close", pos=(50, 20)) self.Bind(wx.EVT_BUTTON, self.GetParent().OnExitApp, self.closeButton) self.closeButton.SetDefault() rowColumnSizer.Add(self.findButton, row=1, col=1) rowColumnSizer.Add(self.replaceButton, row=2, col=1) rowColumnSizer.Add(self.replaceFindButton, row=1, col=2) rowColumnSizer.Add(self.replaceAllButton, row=2, col=2) rowColumnSizer.Add(self.closeButton, row=3, col=2) hbox000 = wx.BoxSizer(wx.HORIZONTAL) hbox000.Add((2, 2), 1, wx.EXPAND | wx.ALL, 2) hbox000.Add(rowColumnSizer) vBox.Add(h1, 0, wx.EXPAND, 0) vBox.Add(h2, 0, wx.EXPAND, 0) hbox001 = wx.BoxSizer(wx.HORIZONTAL) hbox001.Add(directionRadioBox, 1, wx.EXPAND | wx.ALL, 2) hbox001.Add(scopeRadioBox, 1, wx.EXPAND | wx.ALL, 2) vBox.Add(hbox001, 0, wx.EXPAND | wx.ALL, 0) vBox.Add(staticBoxSizer_11, 0, wx.EXPAND, 0) vBox.Add(rowColumnSizer, 0, wx.LEFT, 0) # vBox.Add(vBox1, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) # vBox.Add(self.tb, 0, wx.EXPAND) # vBox.Add(self.list, 1, wx.EXPAND) #################################################################### # sizer = wx.BoxSizer(wx.VERTICAL) # sizer.Add(vBox, 1, wx.EXPAND , 0) self.SetSizer(vBox) self.SetAutoLayout(True)
def __init__(self, parent, id=wx.ID_ANY, style=wx.DEFAULT_DIALOG_STYLE, size=wx.DefaultSize, pos=wx.DefaultPosition): pre = wx.PreDialog() pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) pre.Create(parent, id, "DAG Options", pos, size, style) self.PostCreate(pre) sizer = wx.BoxSizer(wx.VERTICAL) inputs_sizer = rcs.RowColSizer() inputs_sizer.AddGrowableCol(2) # max depth input label = wx.StaticText(self, -1, "Max depth") label.SetHelpText("Maximum depth of nodes to show in the graph") self._max_depth = wx.TextCtrl(self, -1, str(self._last_selected_max_depth), validator=StringValidator(string.digits)) self._max_depth.SetHelpText( "Maximum depth of nodes to show in the graph") inputs_sizer.Add(label, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, row=0, col=1, border=5) inputs_sizer.Add(self._max_depth, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, row=0, col=2, border=5) # layout choice label = wx.StaticText(self, -1, "Layout") label.SetHelpText("How to layout the nodes when drawing") self._layout_choice = wx.Choice( self, -1, choices=[x[0] for x in self._layout_choices]) self._layout_choice.SetStringSelection(self._last_selected_layout) inputs_sizer.Add(label, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, row=1, col=1, border=5) inputs_sizer.Add(self._layout_choice, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, row=1, col=2, border=5) sizer.Add(inputs_sizer, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) # ok/cancel buttons btnsizer = wx.StdDialogButtonSizer() okbtn = wx.Button(self, wx.ID_OK) okbtn.SetDefault() btnsizer.AddButton(okbtn) cancelbtn = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(cancelbtn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.Bind(wx.EVT_BUTTON, self.OnOK, okbtn) self.SetSizer(sizer) sizer.Fit(self) self.CenterOnParent()
def __init__(self, parent, form, *args, **kwargs): from ProvCon.dbui.wxwin.art import BITMAPS wx.Panel.__init__(self, parent, *args, **kwargs) self.form = form self.sizer = wx.BoxSizer(wx.VERTICAL) font18 = wx.Font(18, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) font20 = wx.Font(20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) font20b = wx.Font(20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) font22b = wx.Font(22, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) self.edit = AttrDict() self.edit.subscriberid = Entry.Static( self.form.table["subscriberid"], self, variable=self.form.getvar("subscriberid")) self.edit.name = Entry.Static(self.form.table["name"], self, variable=self.form.getvar("name")) self.edit.primarylocation = Entry.StaticReference( self.form.table["primarylocationid"], self, variable=self.form.getvar("primarylocationid")) for ctrl in self.edit.values(): ctrl.SetForegroundColour(wx.Color(0, 0, 0)) ctrl.SetFont(font18) self.edit.subscriberid.SetFont(font22b) self.row_1 = rcs.RowColSizer() self.row_1.Add(self.edit.subscriberid, row=1, col=1, rowspan=2, border=30, flag=wx.EXPAND) self.row_1.Add(self.edit.name, row=1, col=2, flag=wx.EXPAND) self.row_1.Add(self.edit.primarylocation, row=2, col=2, flag=wx.EXPAND) self.sizer.Add(self.row_1, 10, flag=wx.EXPAND) ##Save option self.row_2 = wx.BoxSizer(wx.HORIZONTAL) #self.row_2.Add ( wx.StaticBitmap (self, bitmap=BITMAPS.WRITE) ) self.row_2.AddStretchSpacer(5) txt = wx.StaticText(self, label="DANE ZOSTAŁY ZMIENIONE") #txt.Font = font18 self.row_2.Add(txt, flag=wx.ALIGN_CENTER_VERTICAL) self.row_2.AddSpacer(40) btn = wx.BitmapButton(self, bitmap=BITMAPS.WRITE) btn.Bind(wx.EVT_BUTTON, self.doSave) self.row_2.Add(btn, flag=wx.ALIGN_CENTER_VERTICAL) self.row_2.AddSpacer(40) self.sizer.Add(self.row_2, 0, wx.EXPAND) self.SetSizer(self.sizer) self.sizer.Hide(self.row_2)
def __init__(self, parent, title, onProcess_callback=None, onClose_callback=None, callback_is_running_securely_for_developers=None): self.__onProcess_callback = onProcess_callback self.__onClose_callback = onClose_callback from vyperlogix.wx.pyax import SalesForceLoginModel self.__sf_login_model__ = SalesForceLoginModel.SalesForceLoginModel(callback_developers_check=callback_is_running_securely_for_developers) isStaging = self.__sf_login_model__.isStaging wx.Dialog.__init__(self, parent, -1, title, wx.DefaultPosition, (300, 160), style=wx.SYSTEM_MENU | wx.CAPTION | wx.STAY_ON_TOP) # | wx.CLOSE_BOX | wx.RESIZE_BORDER | 0 | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX self.panel = wx.Panel(self, -1) self.labelUsername = wx.StaticText(self.panel, -1, 'UserName:'******'Microsoft Sans Serif')) self.labelUsername.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.textUsername = wx.TextCtrl(self.panel, -1, 'username', (96,8), size=(185, 20)) self.textUsername.SetBackgroundColour(wx.Colour(255, 255, 255)) self.textUsername.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.textUsername.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.labelPassword = wx.StaticText(self.panel, -1, 'Password:'******'Microsoft Sans Serif')) self.labelPassword.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.textPassword = wx.TextCtrl(self.panel, -1, 'password', (96,32), size=(185, 20), style=wx.TE_PASSWORD | wx.TE_PROCESS_ENTER) self.textPassword.SetBackgroundColour(wx.Colour(255, 255, 255)) self.textPassword.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.textPassword.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) servers = [] for k,v in self.__sf_login_model__.sfServers.iteritems(): servers += v if (misc.isList(v)) else [v] self.cbServerEndPoints = wx.ComboBox(self.panel, -1, 'combobox for Server End-Points', (164,136), (180, 21), servers, style=wx.CB_READONLY | wx.CB_SORT) self.cbServerEndPoints.SetBackgroundColour(wx.Colour(255, 255, 255)) self.cbServerEndPoints.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.cbServerEndPoints.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.cbServerEndPoints.SetSelection(0) self.textEndPoint = wx.TextCtrl(self.panel, -1, 'endpoint', (96,8), size=(300, 20)) self.textEndPoint.SetBackgroundColour(wx.Colour(255, 255, 255)) self.textEndPoint.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.textEndPoint.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.textEndPoint.SetValue(self.sf_login_model.get_endpoint(self.cbServerEndPoints.GetValue())) self.btnLogin = wx.Button(self.panel, -1, 'Login', (24,96), (75, 23)) self.btnLogin.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.btnLogin.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.btnCancel = wx.Button(self.panel, -1, 'Cancel', (120,96), (75, 23)) self.btnCancel.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.btnCancel.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) self.boxRadioButtons = wx.StaticBox(self.panel, -1, "SalesForce End-Points" ) self.boxRadioButtons.SetFont(wx.Font(8.25, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, 'Microsoft Sans Serif')) self.boxRadioButtons.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT)) import salesforce_icon self.SetIcon(wx.IconFromBitmap(salesforce_icon.getsalesforce_iconBitmap())) vbox = wx.BoxSizer(wx.VERTICAL) hboxes = [] box1 = wx.StaticBoxSizer( self.boxRadioButtons, wx.VERTICAL ) sizer = rcs.RowColSizer() sizer.Add(self.cbServerEndPoints, row=0, col=1) sizer.Add(self.textEndPoint, row=1, col=1) box1.Add(sizer, 0, wx.ALIGN_LEFT | wx.ALL, 5 ) hboxes.append(wx.BoxSizer(wx.HORIZONTAL)) hboxes[-1].Add(self.labelUsername, 0, wx.RIGHT, 8) hboxes[-1].Add((5, -1)) hboxes[-1].Add(self.textUsername, 1) vbox.Add(hboxes[-1], 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) vbox.Add((-1, 1)) hboxes.append(wx.BoxSizer(wx.HORIZONTAL)) hboxes[-1].Add(self.labelPassword, 0, wx.RIGHT, 8) hboxes[-1].Add((5, -1)) hboxes[-1].Add(self.textPassword, 1) vbox.Add(hboxes[-1], 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) vbox.Add((-1, 1)) vbox.Add(box1, 0, wx.ALIGN_LEFT | wx.ALL, 10) vbox.Add((-1, 1)) hboxes.append(wx.BoxSizer(wx.HORIZONTAL)) hboxes[-1].Add(self.btnLogin, 0, wx.RIGHT, 8) hboxes[-1].Add((5, -1)) hboxes[-1].Add(self.btnCancel, 1) vbox.Add(hboxes[-1], 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10) vbox.Add((-1, 1)) self.panel.SetSizer(vbox) x = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) y = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) self.SetSizeHints(300,160,x,y) vbox.Fit(self) self.Bind(wx.EVT_BUTTON, self.onProcess, self.btnLogin) self.Bind(wx.EVT_BUTTON, self.OnClose, self.btnCancel) self.Bind(wx.EVT_COMBOBOX, self.OnSelectedServerEndPoints, self.cbServerEndPoints) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_TEXT_ENTER, self.onProcess, self.textPassword)
def __init__(self, *args, **kwds): kwds["style"] = wx.NO_BORDER | wx.TAB_TRAVERSAL wx.Panel.__init__(self, *args, **kwds) self.selected = -1 # create controls self.number = wx.StaticText(self, -1, "808", style=wx.ALIGN_RIGHT) self.position = wx.StaticText(self, -1, "6, 88, 9", style=wx.ALIGN_LEFT) self.symbol = wx.StaticText(self, -1, "Mm", style=wx.ALIGN_CENTER_HORIZONTAL) self.name = wx.StaticText(self, -1, "Praseodymium ", style=wx.ALIGN_CENTER_HORIZONTAL) self.mass = wx.StaticText(self, -1, "123.4567890 ", style=wx.ALIGN_CENTER_HORIZONTAL) self.massnumber = wx.StaticText(self, -1, "123 A ", style=wx.ALIGN_RIGHT) self.protons = wx.StaticText(self, -1, "123 P ", style=wx.ALIGN_RIGHT) self.neutrons = wx.StaticText(self, -1, "123 N ", style=wx.ALIGN_RIGHT) self.electrons = wx.StaticText(self, -1, "123 e ", style=wx.ALIGN_RIGHT) self.eleshell = wx.StaticText(self, -1, "2, 8, 18, 32, 32, 15, 2", style=wx.ALIGN_LEFT) self.eleconfig = StaticFancyText(self, -1, "[Xe] 4f<sup>14</sup> 5d<sup>10</sup>" " 6s<sup>2</sup> 6p<sup>6</sup> ", style=wx.ALIGN_LEFT) self.oxistates = wx.StaticText(self, -1, "1*, 2, 3, 4, 5, 6, -7 ") self.atmrad = wx.StaticText(self, -1, "1.234 A ", style=wx.ALIGN_RIGHT) self.ionpot = wx.StaticText(self, -1, "123.4567890 eV ") self.eleneg = wx.StaticText(self, -1, "123.45678 ") # set control properties font = self.GetFont() font.SetWeight(wx.FONTWEIGHT_BOLD) self.number.SetFont(font) self.name.SetFont(font) font.SetPointSize(font.GetPointSize() * 1.9) self.symbol.SetFont(font) self.number.SetToolTipString("Atomic number") self.position.SetToolTipString("Group, Period, Block") self.symbol.SetToolTipString("Symbol") self.name.SetToolTipString("Name") self.mass.SetToolTipString("Relative atomic mass") self.eleshell.SetToolTipString("Electrons per shell") self.massnumber.SetToolTipString("Mass number (most abundant isotope)") self.protons.SetToolTipString("Protons") self.neutrons.SetToolTipString("Neutrons (most abundant isotope)") self.electrons.SetToolTipString("Electrons") self.eleconfig.SetToolTipString("Electron configuration") self.oxistates.SetToolTipString("Oxidation states") self.atmrad.SetToolTipString("Atomic radius") self.ionpot.SetToolTipString("Ionization potentials") self.eleneg.SetToolTipString("Electronegativity") # layout sizer = rcsizer.RowColSizer() sizer.col_w = SPACER sizer.row_h = SPACER sizer.Add(self.number, row=0, col=0, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE) sizer.Add(self.position, row=0, col=1, flag=wx.ALIGN_LEFT | wx.FIXED_MINSIZE) sizer.Add(self.symbol, row=1, col=0, rowspan=2, colspan=2, flag=(wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE)) sizer.Add(self.name, row=3, col=0, colspan=2, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE) sizer.Add(self.mass, row=4, col=0, colspan=2, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.FIXED_MINSIZE) sizer.Add(self.massnumber, row=0, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.protons, row=1, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.neutrons, row=2, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.electrons, row=3, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.atmrad, row=4, col=2, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) sizer.Add(self.eleconfig, row=0, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.eleshell, row=1, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.oxistates, row=2, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.ionpot, row=3, col=4, flag=wx.ADJUST_MINSIZE) sizer.Add(self.eleneg, row=4, col=4, flag=wx.ADJUST_MINSIZE) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) sizer.SetSizeHints(self) self.Layout()