Added mobile and home phone to basic info tab in the profile display dialog

This commit is contained in:
Manuel Cortez 2019-09-17 17:26:23 -05:00
parent a015593971
commit ff175c0c8f
3 changed files with 25 additions and 1 deletions

View File

@ -23,6 +23,7 @@
* Less confidential user data will be send to the logs, so it will be much safer to pass logs publicly.
* automatic update checks will be disabled if using socializer from the source code.
* it is possible to post in an user's wall by using the post button located next to the user, in people buffers. This applies only to online users and list of friends.
* When displaying a profile, information about mobile and home phone is displayed in the basic information tab.
## changes in Versions 0.21 and 0.22 (14.07.2019)

View File

@ -38,7 +38,7 @@ class userProfilePresenter(base.basePresenter):
See https://vk.com/dev/users.get"""
# List of fields (information) to retrieve. For a list of fields available for user objects,
# see https://vk.com/dev/fields
fields = "first_name, last_name, bdate, city, country, home_town, photo_200_orig, online, site, status, last_seen, occupation, relation, relatives, personal, connections, activities, interests, music, movies, tv, books, games, about, quotes, can_write_private_message"
fields = "first_name, last_name, bdate, city, country, home_town, photo_200_orig, online, site, status, last_seen, occupation, relation, relatives, personal, connections, activities, interests, music, movies, tv, books, games, about, quotes, can_write_private_message, contacts, has_mobile, universities, education, schools"
# ToDo: this method supports multiple user IDS, I'm not sure if this may be of any help for profile viewer.
person = self.session.vk.client.users.get(user_ids=self.user_id, fields=fields)
# If VK does not return anything it is very likely we have found a community.
@ -50,6 +50,13 @@ class userProfilePresenter(base.basePresenter):
# From this part we will format data from VK so users will see it in the GUI control.
# Format full name.
n = "{0} {1}".format(person["first_name"], person["last_name"])
# format phones
if person.get("mobile_phone") != None and person.get("mobile_phone") != "":
self.send_message("enable_control", tab="main_info", control="mobile_phone")
self.send_message("set", tab="main_info", control="mobile_phone", value=person["mobile_phone"])
if person.get("home_phone") != None and person.get("home_phone") != "":
self.send_message("enable_control", tab="main_info", control="home_phone")
self.send_message("set", tab="main_info", control="home_phone", value=person["home_phone"])
# Format birthdate.
if "bdate" in person and person["bdate"] != "":
self.send_message("enable_control", tab="main_info", control="bdate")

View File

@ -68,6 +68,22 @@ class mainInfo(wx.Panel):
sizerLastSeen.Add(self.last_seen, 0, wx.ALL, 5)
sizer.Add(sizerLastSeen, 0, wx.ALL, 5)
lblMobilePhone = wx.StaticText(self, wx.NewId(), _("Mobile phone"))
self.mobile_phone = wx.TextCtrl(self, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.mobile_phone.Enable(False)
sizerMobilePhone = wx.BoxSizer(wx.HORIZONTAL)
sizerMobilePhone.Add(lblMobilePhone, 0, wx.ALL, 5)
sizerMobilePhone.Add(self.mobile_phone, 0, wx.ALL, 5)
sizer.Add(sizerMobilePhone, 0, wx.ALL, 5)
lblHomePhone = wx.StaticText(self, wx.NewId(), _("Home phone"))
self.home_phone = wx.TextCtrl(self, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.home_phone.Enable(False)
sizerHomePhone = wx.BoxSizer(wx.HORIZONTAL)
sizerHomePhone.Add(lblHomePhone, 0, wx.ALL, 5)
sizerHomePhone.Add(self.home_phone, 0, wx.ALL, 5)
sizer.Add(sizerHomePhone, 0, wx.ALL, 5)
lblBDate = wx.StaticText(self, wx.NewId(), _("Birthdate"))
self.bdate = wx.TextCtrl(self, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.bdate.Enable(False)