comparison frontends/wix/profile.py @ 42:874de3020e1c

Initial VCard (XEP-0054) support + misc fixes - new xep-0054 plugin, avatar are cached, new getProfile bridge method - gateways plugin (XEP-0100): new __private__ key in resulting data, used to keep target jid
author Goffi <goffi@goffi.org>
date Mon, 21 Dec 2009 13:22:11 +1100
parents
children 8a438a6ff587
comparison
equal deleted inserted replaced
41:d24629c631fc 42:874de3020e1c
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 """
5 wix: a SAT frontend
6 Copyright (C) 2009 Jérôme Poisson (goffi@goffi.org)
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """
21
22 import wx
23 import pdb
24 from logging import debug, info, error
25 from tools.jid import JID
26
27
28 class Profile(wx.Frame):
29 """This class is used to show/modify profile given by SàT"""
30
31 def __init__(self, host, data, title="Profile"):
32 super(Profile, self).__init__(None, title=title)
33 self.host = host
34
35 self.name_dict = { 'fullname': 'Full Name',
36 'nick' : 'Nickname',
37 'birthday' : 'Birthday',
38 'phone' : 'Phone #',
39 'website' : 'Website',
40 'email' : 'E-mail'
41 }
42 self.ctl_list = {} # usefull to access ctrl, key = (name)
43
44 self.sizer = wx.BoxSizer(wx.VERTICAL)
45 self.notebook=wx.Notebook(self, -1)
46 self.sizer.Add(self.notebook, 1, flag=wx.EXPAND)
47 self.SetSizer(self.sizer)
48 self.SetAutoLayout(True)
49
50 #events
51 self.Bind(wx.EVT_CLOSE, self.onClose, self)
52
53 self.MakeModal()
54 self.showData(data)
55 self.Show()
56
57 def showData(self, data):
58 flags = wx.TE_READONLY
59
60 #General tab
61 generaltab = wx.Panel(self.notebook)
62 sizer = wx.FlexGridSizer(cols=2)
63 sizer.AddGrowableCol(1)
64 generaltab.SetSizer(sizer)
65 generaltab.SetAutoLayout(True)
66 for field in ['fullname','nick', 'birthday', 'phone', 'website', 'email']:
67 value = data[field] if data.has_key(field) else ''
68 label=wx.StaticText(generaltab, -1, self.name_dict[field]+": ")
69 sizer.Add(label)
70 self.ctl_list[field] = wx.TextCtrl(generaltab, -1, value, style = flags)
71 sizer.Add(self.ctl_list[field], 1, flag = wx.EXPAND)
72
73
74 self.notebook.AddPage(generaltab, "General")
75
76
77 def onClose(self, event):
78 """Close event"""
79 debug("close")
80 self.MakeModal(False)
81 event.Skip()
82