def layout(self): self.Sizer = None # # overrides AnyRow.layout # sz = BoxSizer(HORIZONTAL) p = self.padding links = self.links rlinks = self.right_links blinks = self.bottom_links if self.image: sz.AddSpacer((p.x + self.image.Width + p.x, self.row_height)) v = BoxSizer(VERTICAL) topH = BoxSizer(HORIZONTAL) topH.AddSpacer((1, self.Parent.fonts.filename.LineHeight), 0, EXPAND) topH.AddStretchSpacer(1) if rlinks: topH.Add(rlinks[0], 0, EXPAND | RIGHT | ALIGN_RIGHT, p.x) v.Add(topH, 0, EXPAND | TOP | BOTTOM, p.y) v.Add(self.pbar, 0, EXPAND | RIGHT, p.x) bottomH = BoxSizer(HORIZONTAL) Add = bottomH.Add Add(self.details, 0, EXPAND) if blinks: for link in blinks: Add(link, 0, EXPAND | RIGHT, p.x) bottomH.AddStretchSpacer(1) if rlinks: for link in rlinks[1:]: Add(link, 0, EXPAND | RIGHT, p.x) v.Add(bottomH, 0, EXPAND | TOP | BOTTOM, p.y) sz.Add(v, 1) # apply margins self.Sizer = self.margins.Sizer(sz)
class JabberDeleteConfirmBox(wx.Dialog): def __init__(self, acct, msg, *a, **k): self.acct = acct wx.Dialog.__init__(self, *a, **k) self.init_components(msg) self.bind_events() self.layout_components() # TODO: we need self.del_check.Enable(self.acct.connection is not None) self.Layout() self.Sizer.Fit(self) 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: "******"Incorrect Password"), _("Incorrect Password")) return self.show_buttons(False) self.acct.delete_from_server( self.password, on_success=success, on_fail=lambda: (self.show_buttons(), wx.MessageBox(message=_( "Failed to delete account from the server."), caption=_("Delete Account - Failed"), style=wx.OK))) else: success() def show_buttons(self, val=True): self.yes_btn.Enabled = val self.no_btn.Enabled = val self.yes_btn.Show(val) self.no_btn.Show(val) self.del_label.Show(not val) self.Layout() def no_clicked(self, e): self.EndModal(wx.NO) def on_check(self, e): self.pw_text.Enabled = self.delete delete = wx_prop('del_check') password = wx_prop('pw_text')