def init_components(self): self.old_pw_label = wx.StaticText(self, label=_("Old Password: "******"New Password: "******"Confirm New Password: ")) self.new2_pw_text = wx.TextCtrl(self, style=wx.TE_PASSWORD, validator=LengthLimit(1024)) self.ok_btn = wx.Button(self, wx.ID_OK) self.ok_btn.Enable(False) self.ok_btn.SetDefault() self.cancel_btn = wx.Button(self, wx.ID_CANCEL) self.old_sizer = BoxSizer(HORIZONTAL) self.new1_sizer = BoxSizer(HORIZONTAL) self.new2_sizer = BoxSizer(HORIZONTAL) self.btn_sizer = build_button_sizer(self.ok_btn, self.cancel_btn, 2) self.main_sizer = BoxSizer(VERTICAL) self.Sizer = BoxSizer(HORIZONTAL)
def construct(self, is_exception, status_message = None): if not is_exception: self.title_label = wx.StaticText(self, -1, _('&Title:')) self.title = t = wx.TextCtrl(self, -1, '', size=(340,-1), validator=LengthLimit(255)) t.Bind(wx.EVT_TEXT, lambda e: setattr(self, 'title_edited', bool(self.title.Value))) self.status_label = wx.StaticText(self, -1, _('&State:')) curstatus = self.status_message.status if self.status_message is not None else None choices = get_state_choices(curstatus, is_exception) self.status = StatusChoice(self, choices) self.status.SetStatus('Away') self.message_label = wx.StaticText(self, -1, _('&Status message:')) self.message_panel = OutlinePanel(self) self.message = FormattedInput(self.message_panel, multiFormat = False, autosize = False, format = getattr(status_message, 'format', None) or StyleFromPref('messaging.default_style'), skin = 'AppDefaults.FormattingBar', validator= LengthLimit(10240), ) self.message_panel.AddControl(self.message, 1, wx.EXPAND) self.message.SetMinSize(status_message_size) if not is_exception: self.message.tc.Bind(wx.EVT_TEXT, self.on_message_text) msg = self.status_message self.exceptionspanel = StatusExceptionPanel(self) self.exceptions = StatusExceptionList(self.exceptionspanel, self, status_message.exceptions if status_message else {}) self.exceptionspanel.SetExceptionList(self.exceptions) hasexcs = msg is not None and msg.use_exceptions self.exceptionspanel.Show(hasexcs) chk = self.diffcheck = wx.CheckBox(self, -1, _('&Use a different status for some accounts')) chk.Value = hasexcs chk.Bind(wx.EVT_CHECKBOX, lambda e: self.show_exceptions(not self.exceptionspanel.IsShown())) s = self.save = wx.Button(self, wx.ID_SAVE, _('&Set') if self.save_checkbox else _('&Save')) s.SetDefault() s.Bind(wx.EVT_BUTTON, self.on_save) c = self.cancel = wx.Button(self, wx.ID_CANCEL, _('&Cancel')) c.Bind(wx.EVT_BUTTON, self.on_cancel) # Save checkbox if self.save_checkbox: self.save_check = wx.CheckBox(self, -1, _('Save for &later'))
def __init__(self, parent): wx.SearchCtrl.__init__(self, parent, -1, style=wx.TE_PROCESS_ENTER, validator=LengthLimit(128)) self.ShowSearchButton(True)
def construct(self): Text = lambda s: wx.StaticText(self,-1,_(s)) self.line1 = Text(_('Would you like to merge these contacts?')) self.line1.Font = CopyFont(self.line1.Font,weight = wx.BOLD) self.line2 = Text(_('They will appear as one item on your buddy list.')) self.sep = wx.StaticLine(self,-1) self.alias_label = wx.StaticText(self, -1, _('Alias:')) self.alias_label.Font = CopyFont(self.alias_label.Font,weight = wx.BOLD) # Decide on an alias: don't use the alias property from the metacontact # because that falls through to the best available one. alias = self.find_alias_suggestion() self.alias_text = wx.TextCtrl(self, -1, alias if alias else '', validator=LengthLimit(255)) s = self.save = wx.Button(self, wx.ID_SAVE, _('&Save')) # save s.SetDefault() s.Bind(wx.EVT_BUTTON, self.Parent.on_save) if REQUIRE_ALIAS: self.alias_text.Bind(wx.EVT_TEXT, lambda e: self.save.Enable(self.alias_text.Value!='')) self.save.Enable(self.alias_text.Value != '') self.cancel = wx.Button(self, wx.ID_CANCEL, _('&Cancel')) # cancel self.line4 = Text(_('Drag and drop to rearrange:')) self.line4.Font = CopyFont(self.line4.Font,weight = wx.BOLD) self.contacts_list = MetaListEditor(self,self.contacts,self.update_contacts_list)
def init_components(self, msg): self.help_bmp = wx.StaticBitmap(self) self.help_bmp.SetBitmap( wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_OTHER, (32, 32))) self.msg_label = wx.StaticText(self, label=msg) self.del_check = wx.CheckBox(self, label="Also delete from Jabber server") self.pw_text = wx.TextCtrl(self, style=wx.TE_PASSWORD, validator=LengthLimit(1024)) self.pw_label = wx.StaticText(self, label="Password: ") self.yes_btn = wx.Button(self, wx.ID_YES) self.yes_btn.SetDefault() self.no_btn = wx.Button(self, wx.ID_NO) self.del_label = wx.StaticText(self, label='Deleting...') self.del_label.Show(False) self.del_label.Enable(False) self.info_sizer = BoxSizer(HORIZONTAL) self.btn_sizer = BoxSizer(HORIZONTAL) self.pw_sizer = BoxSizer(HORIZONTAL) self.delpw_sizer = BoxSizer(VERTICAL) self.in_sizer = BoxSizer(HORIZONTAL) self.main_sizer = BoxSizer(VERTICAL) self.Sizer = BoxSizer(HORIZONTAL)
def __init__( self, parent, id=-1, typeable=False, value='', pos=wx.DefaultPosition, size=wx.DefaultSize, empty_text=None, empty_text_hide=True, validator=None, ): """ ComboDisplay constructor. value - what is initialy displayed """ wx.Window.__init__(self, parent, id, pos, size, style=ComboDisplayStyle) Bind = self.Bind Bind(wx.EVT_PAINT, self.OnPaint) Bind(wx.EVT_LEFT_DOWN, self.OnLDown) Bind(wx.EVT_TEXT, self.OnType) Bind(wx.EVT_TEXT_ENTER, self.OnLoseFocus) Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave) Bind(wx.EVT_MOTION, self.OnMouseMove) Bind(wx.EVT_SIZE, self.OnSize) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.value = self.lastvalue = value self.defaultvalue = '' self.empty_text = empty_text self.empty_text_hide = empty_text_hide self.hover = False if validator is None: validator = LengthLimit(20480) txt = self.txtfld = wx.TextCtrl(self, -1, style=self.textfield_style, validator=validator) txt.Show(False) txt.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus) txt.Bind(wx.EVT_SET_FOCUS, self.OnType) self._enabled = True self.Editable = typeable self.UpdateSkin()
def __init__(self, *a, **k): k['style'] = k.get('style', 0) | wx.CB_DROPDOWN #| wx.CB_READONLY if k.get('validator', None) is None: k['validator'] = LengthLimit(1024) wx.ComboBox.__init__(self, *a, **k) self._items = self.Items self._modifying = False self.last_selection = self.Value
def construct_smtp(self): self.smtp_server = TextCtrl(self, -1, size = txtSize, value = unicode(getattr(self.account, 'smtp_server', '')), validator = LengthLimit(1024), ) self.smtp_port = TextCtrl(self, -1, size = (60, -1), value = unicode(getattr(self.account, 'smtp_port', '')), validator = PortValidator()) reqssl = self.smtp_require_ssl = CheckBox(self, '&This server requires SSL', value = bool(getattr(self.account, 'smtp_require_ssl', False))) reqssl.Bind(wx.EVT_CHECKBOX, lambda e: self.SwapDefaultPorts(e, 'smtp_', reqssl.Value, self.smtp_port)) servertype = self.protocolinfo.get('needs_server') self.smtp_same = RadioButton(self, -1, _('SMTP username/password are the same as {servertype}').format(servertype=servertype), style = wx.RB_GROUP) self.smtp_different = RadioButton(self, -1, _('Log on using:')) u = self.smtp_username = TextCtrl(self, -1, size = (110, -1), validator=LengthLimit(1024)) p = self.smtp_password = TextCtrl(self, -1, size = (110, -1), style = wx.TE_PASSWORD, validator=LengthLimit(1024)) smtpuser, smtppass = getattr(self.account, 'smtp_username', ''), getattr(self.account, 'smtp_password', '') if (not smtpuser and not smtppass) or smtpuser == self.name.Value and smtppass == self.password.Value: self.smtp_same.SetValue(True) u.Enable(False) p.Enable(False) else: self.smtp_different.SetValue(True) u.Enable(True) p.Enable(True) u.Value = smtpuser p.Value = smtppass def on_radio(e = None, val = False): # when a radio is clicked enabled = val if e is None else e.EventObject is not self.smtp_same u.Enable(enabled) p.Enable(enabled) self.Bind(wx.EVT_RADIOBUTTON, on_radio)
def construct(self): self.name_st = wx.StaticText(self, -1, _('Contact &Name:')) self.name_txt = wx.TextCtrl(self, -1, validator=LengthLimit(255)) self.acct_st = wx.StaticText(self, -1, _('Accoun&t:')) self.acct_choice = wx.Choice(self, -1) self.get_acct = lambda: get_profile().account_manager.connected_accounts[self.acct_choice.Selection] # Add and Cancel buttons self.save = wx.Button(self, wx.ID_SAVE, _('&Add')) self.save.SetDefault() self.save.Bind(wx.EVT_BUTTON, self.Parent.on_save) self.cancel = wx.Button(self, wx.ID_CANCEL, _('&Cancel'))
def construct_common(self, is_new): self.label_warnings = StaticText(self, -1, '', style = wx.ALIGN_CENTER) self.label_warnings.SetForegroundColour(wx.Colour(224, 0, 0)) self.clear_warning() needs_password = self.protocolinfo.get('needs_password', True) self.label_screenname = StaticText(self, -1, self.screenname_name + ':', style = ALIGN_RIGHT) if needs_password: self.label_password = StaticText(self, -1, 'Password:'******'' and hasattr(self.protocolinfo, 'newuser_url'): sn = self.url_screenname = wx.HyperlinkCtrl(self, -1, 'New User?', getattr(self.protocolinfo, 'newuser_url')) sn.HoverColour = sn.VisitedColour = sn.NormalColour if needs_password and hasattr(self.protocolinfo, 'password_url'): password = self.url_password = wx.HyperlinkCtrl(self, -1, 'Forgot Password?', getattr(self.protocolinfo, 'password_url')) password.HoverColour = password.VisitedColour = password.NormalColour if self.protocolinfo.get('needs_smtp', False): self.email_address = TextCtrl(self, -1, value = getattr(self.account, 'email_address', ''), size = txtSize, validator=LengthLimit(1024)) self.name = TextCtrl(self, -1, value=self.account.name, size=txtSize, validator=LengthLimit(1024)) # disable editing of username if this account is not new if not self.new: self.name.SetEditable(False) self.name.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_SCROLLBAR)) # self.name.Enable(self.new) if needs_password: password = self.account._decryptedpw() f = lambda p: TextCtrl(self, -1, value = p, size = txtSize, style = wx.TE_PASSWORD, validator = LengthLimit(128)) try: self.password = f(password) except UnicodeDecodeError: self.password = f('')
def construct_default(self): acct = self.account # Auto login checkbox: shown by default, turn off with show_autologin = False if getattr(self.protocolinfo, 'show_autologin', True): self.autologin = wx.CheckBox(self, -1, _('&Auto login')) self.autologin.SetToolTipString(_('If checked, this account will automatically sign in when Digsby starts.')) self.autologin.Value = bool(getattr(self.account, 'autologin', False)) # Register new account checkbox: off by default. shows only on when this # is a new account dialog, and when needs_register = True if self.new and getattr(self.protocolinfo, 'needs_register', False): self.register = wx.CheckBox(self, -1, _('&Register New Account')) self.register.Bind(wx.EVT_CHECKBOX, self.on_register) if getattr(self.protocolinfo, 'needs_remotealias', False): self.remote_alias = TextCtrl(self, -1, value = getattr(acct, 'remote_alias', ''), validator = LengthLimit(120)) if getattr(self.protocolinfo, 'needs_resourcepriority', False): # Length limit is according to rfc self.resource = TextCtrl(self, value = getattr(acct, 'resource') or 'Digsby', validator = LengthLimit(1023)) priority = getattr(acct, 'priority', DEFAULT_JABBER_PRIORITY) if priority == '': priority = DEFAULT_JABBER_PRIORITY self.priority = TextCtrl(self, value = str(priority), validator = NumericLimit(-127,128)) self.priority.MinSize = wx.Size(1, -1) if getattr(self.protocolinfo, 'needs_dataproxy', False): self.dataproxy = TextCtrl(self, value = getattr(acct, 'dataproxy', ''), validator = LengthLimit(1024)) if getattr(self.protocolinfo, 'hostport', True): server = getattr(self.account, 'server') if server: host, port = server else: host, port = '', '' self.host = TextCtrl(self, size = (110, -1), value=host, validator = LengthLimit(1023)) self.port = TextCtrl(self, value = str(port), validator = PortValidator()) self.port.MinSize = wx.Size(1, -1)
def __init__(self, parent, prefname, name='', size=wx.DefaultSize, validator=None, _type=None, style=0): wx.TextCtrl.__init__(self, parent, size=size, validator=(validator or LengthLimit(2048)), style=style) if not isinstance(prefname, basestring): prefix, prefname = prefname else: prefix = '' self.validator = validator self.type = _type self.prefix = prefix self.prefname = prefname self._style = style if self.validator is not None: self.Bind(wx.EVT_CHAR, self.validator.OnChar) self.Bind(wx.EVT_TEXT, self.validator.OnText) if self.pname.startswith('local.'): self.prefname = self.pname[len('local.'):] self.prefix = '' self.mapping = profile.localprefs else: self.mapping = profile.prefs self.mapping.link(self.pname, self.pref_changed) self.secret = 0 self.Bind(wx.EVT_KILL_FOCUS, self.changed)
def __init__(self): sc.SizedDialog.__init__(self, None, -1, _('New IM'), style = wx.DEFAULT_DIALOG_STYLE | wx.FRAME_FLOAT_ON_PARENT) self.Name = 'New IM Dialog' p = self.GetContentsPane() p.SetSizerType("form") R_CENTER= dict(halign='right', valign='center') Text = lambda t: wx.StaticText(p, -1, t) Text(_('To')).SetSizerProps(**R_CENTER) toctrl = self.toctrl = wx.TextCtrl(p,style = wx.TE_PROCESS_ENTER, validator=LengthLimit(255)) toctrl.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown) toctrl.SetSizerProps(expand=True) Text(_('From')).SetSizerProps(**R_CENTER) fromcombo = self.fromcombo = UberCombo(p, None, skinkey='AppDefaults.PrefCombo') fromcombo.SetItems(self.UpdateAccountItems(),0) fromcombo.SetSizerProps(expand=True) self.SetButtonSizer(self.CreateButtonSizer(wx.OK | wx.CANCEL)) sendbutton = self.sendbutton = self.FindWindowById(wx.ID_OK, self) sendbutton.SetLabel(_('IM')) sendbutton.Enable(False) sendbutton.Bind(wx.EVT_BUTTON,self.OnAccept) profile.account_manager.connected_accounts.add_observer(self.WhenOnlineAcctsChange) Bind = self.Bind Bind(wx.EVT_CLOSE,self.OnClose) Bind(wx.EVT_KEY_DOWN,self.OnKeyDown) persist_window_pos(self, defaultPos = 'center', position_only = True) self.Fit() self.SetSize((300, self.BestSize.height))
def __init__(self, parent=None, group='', onservice='', newname='', onaccount=None): sc.SizedDialog.__init__(self, parent, -1, _('Add Contact'), size=(314, 250), style=wx.DEFAULT_DIALOG_STYLE | wx.FRAME_FLOAT_ON_PARENT | wx.RESIZE_BORDER) #S = self.Sizer = wx.BoxSizer(VERTICAL) p = self.panel = self.GetContentsPane() #wx.Panel(self) p.SetSizerType("form") self.SetButtonSizer(self.CreateButtonSizer(wx.OK | wx.CANCEL)) okbutton = self.okbutton = self.FindWindowById( wx.ID_OK, self) #wx.Button(p, wx.ID_OK, _('Add')) okbutton.SetLabel(_('Add')) okbutton.SetDefault() okbutton.Enabled = False cancelbutton = self.FindWindowById( wx.ID_CANCEL, self) #wx.Button(p,wx.ID_CANCEL, _('Cancel')) #================================================================= protoitems = self.MakeProtocolItems() groupitems = self.MakeGroupItems() Text = lambda s: wx.StaticText(p, -1, s) #========================================================================================================= R_CENTER = dict(halign='right', valign='center') Text(_('Contact Type:')).SetSizerProps(**R_CENTER) protocombo = self.protocombo = UberCombo( p, no_connections_label, False, None, skinkey='AppDefaults.PrefCombo') protocombo.SetSizerProps(expand=True) namelabel = self.namelabel = Text(_('Screen Name:')) namelabel.SetSizerProps(**R_CENTER) name = self.namefield = wx.TextCtrl(p, validator=LengthLimit(255), value=newname) name.SetFocus() name.Bind(wx.EVT_TEXT, self.OnNameChange) name.SetSizerProps(expand=True) Text(_('Alias:')).SetSizerProps(**R_CENTER) alias = self.aliasfield = wx.TextCtrl(p, validator=LengthLimit(255)) alias.SetSizerProps(expand=True) Text(_('In Group:')).SetSizerProps(**R_CENTER) groupcombo = self.groupcombo = UberCombo( p, group, True, None, skinkey='AppDefaults.PrefCombo') groupcombo.display.txtfld.Bind(wx.EVT_TEXT, self.OnNameChange) groupcombo.SetSizerProps(expand=True) Text(_('On Accounts:')).SetSizerProps(halign='right', valign='top') checklist = self.accountchecks = CheckableList( p, setchangedcallback=self.OnCheckedSetChange) checklist.MinSize = (-1, 66) checklist.SetSizerProps(expand=True, proportion=1) #========================================================================================================== defserv = 0 if onservice: for item in protoitems: if item.id == onservice: defserv = protoitems.index(item) break protocombo.SetItems(protoitems, defserv) groupcombo.SetItems(groupitems, 0 if group == '' else None) #=========================================================================================================== def onproto(*a): self.UpdateAccounts() name.SetFocus() protocombo.SetCallbacks(value=onproto) self.UpdateAccounts() if onaccount is not None: checklist.SelectAccount(onaccount) def NoEmptyGroup(*a): if groupcombo.Value == '': groupcombo.SetSelection(0) if groupcombo.Value == '': groupcombo.Value = pref('buddylist.fakeroot_name', default='Contacts') groupcombo.SetCallbacks(value=NoEmptyGroup) self.Fit() self.Size = (314, self.Size.y) self.MinSize = self.Size okbutton.Bind(wx.EVT_BUTTON, self.OnOk) cancelbutton.Bind(wx.EVT_BUTTON, lambda e: self.Close()) Bind = self.Bind Bind(wx.EVT_CLOSE, self.OnClose) profile.account_manager.connected_accounts.add_observer( self.WhenOnlineAcctsChange) profile.blist.add_observer(self.WhenGroupsChange, 'view') import hooks hooks.notify('digsby.statistics.ui.dialogs.add_contact.created')
def construct_gui(self): self.Sizer = wx.BoxSizer(wx.VERTICAL) s = self.subject_bar = UberBar(self, skinkey=self.subjectskin) self.subject_input = SkinTextCtrl( s, skinkey=('EmailSubjectBar', 'SubjectField'), skinkey_bg='EmailSubjectBar.FieldBackgroundColor', validator=LengthLimit(1024), ) self.subject_label = ClearText(s, _('Subject:'), alignment=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) self.subject_label.Font = self.subjectfont self.subject_label.FontColor = self.subjectfc s.Add(self.subject_label) s.Add(self.subject_input, 1) # construct email buttons panel email_buttons = self.email_buttons = UberBar( self, skinkey=self.buttonbarskin) ept = self.email_progress_text = ClearText( email_buttons, '', alignment=wx.ALIGN_CENTER_VERTICAL) ept.SetFont(self.buttonbarfont) ept.SetFontColor(self.buttonnarfc) # email body text input self.email_input_area = wx.TextCtrl( self, style=wx.TE_MULTILINE, validator=LengthLimit(20480), ) # "open in" and "send" self.openin = UberButton(email_buttons, -1, _('Edit...'), onclick=self.OnEditEmail) self.send_button = UberButton(email_buttons, -1, _('Send'), onclick=self.OnSendClicked) # layout email buttons email_buttons.Add(ept) email_buttons.Add(wx.Size(1, 1), 1) #StretchSpacer(1) email_buttons.Add(self.openin) email_buttons.Add(self.send_button) # Make sure Tab from the subject input goes to the body input. self.email_input_area.MoveAfterInTabOrder(self.subject_bar) s = self.Sizer s.AddMany([(self.subject_bar, 0, wx.EXPAND), (self.email_input_area, 1, wx.EXPAND), (self.email_buttons, 0, wx.EXPAND)]) self.gui_constructed = True
def __init__(self, parent, pos = wx.DefaultPosition, size = wx.DefaultSize, value = '', entercallback = None, font = True, pointsize = True, bold = True, italic = True, underline = True, textcolor = True, bgcolor = True, sizes = DEFAULT_SIZES, emots = None, singleFormat = False, show_formatting_bar = True, rtl_input = False, prefmode = False, outlined = False, aimprofile = False, autosize = True, default_skin = False, validator = None, format = None,): cgui.SimplePanel.__init__(self, parent) self.prefmode = prefmode self.aimprofile = aimprofile self.autosize = autosize self.UseAppDefaultSkin = (self.prefmode or self.aimprofile) or default_skin self.initover = False self.entercallback = entercallback self.sizes = sizes self.emots = emots # create the Formatting bar, buttons, and menus self.Sizer = wx.BoxSizer(wx.VERTICAL) csizer = self.csizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(csizer, 1, wx.EXPAND | wx.ALL, 1 if outlined else 0) self.UpdateSkin() if validator is None: validator = LengthLimit(20480) if self.autosize: tc = self.tc = FormattedExpandoTextCtrl(self, style=txtFlags, value = value, validator=validator) tc.Bind(EVT_ETC_LAYOUT_NEEDED, self.expandEvent) tc.Bind(wx.EVT_SIZE, self.OnSize) if config.platform == 'win': tc.Bind(wx.EVT_COMMAND_TEXT_PASTE, self.OnPaste) tc.SetMaxHeight(100) loadedHeight = pref('conversation_window.input_base_height') baseHeight = self.tc.GetCharHeight() + getattr(self.tc, 'GetExtraHeight', lambda: 0)() tc.SetMinHeight(loadedHeight or baseHeight) if loadedHeight: log.info("input_base_height loaded as %s", loadedHeight) else: log.info("input_base_height not used, set to baseHeight as %s", baseHeight) tc.MinSize = wx.Size(tc.MinSize.width, tc.GetMinHeight()) # wx.CallAfter(self.tc.HideScrollbars) self.expandEvent() else: tc = self.tc = FormattedTextCtrl(self, style = txtFlags, value = value, validator=validator) self.tc.LayoutDirection = wx.Layout_RightToLeft if rtl_input else wx.Layout_LeftToRight tc.Bind(wx.EVT_CONTEXT_MENU, lambda e: default_umenu(tc).PopupMenu(event = e)) # bind textfield events tc.Bind(wx.EVT_KEY_DOWN, self.OnKey) self.shownbuttons = dict( font = font, pointsize = pointsize, bold = bold, italic = italic, underline = underline, textcolor = textcolor, bgcolor = bgcolor) if config.platform != 'mac' and show_formatting_bar: self.construct_formatting_bar() else: self.formatbar = None csizer.Add(self.tc, 1, wx.EXPAND) self.single_format = singleFormat self.initover = True if format is None: wx.CallAfter(self.LoadStyle) profile.prefs.add_observer(self.WhenDefaultLayoutChange, 'messaging.default_style') else: self.SetFormatStorage(format) Bind = self.Bind if outlined: Bind(wx.EVT_PAINT,self.OnPaint) Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
def construct_email(self): srv = self.protocolinfo.get('needs_server', None) if srv is not None: srv = srv.lower() self.emailserver = TextCtrl(self, -1, size = txtSize, value = unicode(getattr(self.account, srv + 'server')), validator=LengthLimit(1024)) self.emailport = TextCtrl(self, -1, size = (60, -1), value = unicode(getattr(self.account, srv + 'port')), validator = PortValidator()) reqssl = self.require_ssl = CheckBox(self, '&This server requires SSL', value = bool(self.account.require_ssl)) reqssl.Bind(wx.EVT_CHECKBOX, lambda e: self.SwapDefaultPorts(e, srv, reqssl.Value, self.emailport)) smtp = self.protocolinfo.get('needs_smtp', False) if smtp: self.construct_smtp() updatetext = _('Check for new mail every {n} minutes').split(' {n} ') self.updatetext1 = StaticText(self, -1, updatetext[0]) self.updatetext2 = StaticText(self, -1, updatetext[1]) # email update frequency self.updatefreq = TextCtrl(self, -1, size=(30, -1), validator = NumericLimit(1, 999)) def update_changed(e): e.Skip(True) import gettext newval = gettext.ngettext(u'minute', u'minutes', int(self.updatefreq.Value or 0)) if newval != self.updatetext2.Label: self.updatetext2.Label = newval self.updatefreq.Bind(wx.EVT_TEXT, update_changed) minutes = str(self.account.updatefreq/60) self.updatefreq.Value = minutes if self.protocolinfo.get('needs_webclient', True): self.mailclient = self.account.mailclient or 'sysdefault' self.custom_inbox_url = self.account.custom_inbox_url self.custom_compose_url = self.account.custom_compose_url self.mailclienttext = StaticText(self, -1, _('Mail Client:')) self.mailclient_choice = wx.Choice(self) self.update_mailclient() self.mailclient_choice.Bind(wx.EVT_CHOICE, self.on_mailclient_choice)