Added relationship status, occupation, last seen and website to profile viewer #7

This commit is contained in:
Manuel Cortez 2016-09-21 13:59:31 -05:00
parent f1ce4b834a
commit 3973b57413
3 changed files with 58 additions and 14 deletions

View File

@ -4,11 +4,12 @@
* Added a new menu in the menu bar that allows you to control the audio playback. For some actions (like play, next and back), if you are not focusing an audio buffer, the program will take the song from the "my audios" buffer. * Added a new menu in the menu bar that allows you to control the audio playback. For some actions (like play, next and back), if you are not focusing an audio buffer, the program will take the song from the "my audios" buffer.
* Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests". * Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests".
* Added an experimental photo viewer. Will show options for see the next and previous photo if the current post contains multiple images. * Added an experimental photo viewer. Will show options for seeing the next and previous photo if the current post contains multiple images.
* Improved chats, now they should be more stable. Also you will be able to send the message by pressing enter in the text box. If you are trying to send the same message multiple times, you will be warned. * Improved chats, now they should be more stable. Also you will be able to send the message by pressing enter in the text box. If you are trying to send the same message multiple times, you will be warned.
* Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser. * Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser.
* Added a setting that allows you to specify if you want socializer to load images when you are opening posts. It could be useful for slow connection or those who don't want images to be loaded. * Added a setting that allows you to specify if you want socializer to load images when you are opening posts. It could be useful for slow connections or those who don't want images to be loaded.
* Added basic tagging for users in posts and comments. You can tag only people in your friends buffer. * Added basic tagging for users in posts and comments. You can tag only people in your friends buffer.
* Added a basic user profile viewer.
## Changes in build 2016.07.08 (08/07/2016) ## Changes in build 2016.07.08 (08/07/2016)

View File

@ -539,17 +539,18 @@ class userProfile(object):
self.session = session self.session = session
self.user_id = user_id self.user_id = user_id
self.dialog = postDialogs.userProfile() self.dialog = postDialogs.userProfile()
self.get_information() self.get_basic_information()
if self.person != None: if self.person != None:
self.dialog.get_response() self.dialog.get_response()
def get_information(self): def get_basic_information(self):
""" Gets and inserts user information""" """ Gets and inserts basic user information"""
fields = "first_name, last_name, sex, bdate, city, country, home_town, photo_200_orig, online, contacts, site, education, universities, schools, status, last_seen, counters, occupation" fields = "first_name, last_name, bdate, city, country, home_town, photo_200_orig, online, site, status, last_seen, occupation, relation, relatives"
person = self.session.vk.client.users.get(user_ids=self.user_id, fields=fields) person = self.session.vk.client.users.get(user_ids=self.user_id, fields=fields)
if len(person) == 0: if len(person) == 0:
return output.speak(_(u"Information for groups is not supported, yet.")) return output.speak(_(u"Information for groups is not supported, yet."))
person = person[0] person = person[0]
print person.keys()
# Gets full name. # Gets full name.
n = u"{0} {1}".format(person["first_name"], person["last_name"]) n = u"{0} {1}".format(person["first_name"], person["last_name"])
# Gets birthdate. # Gets birthdate.
@ -563,9 +564,10 @@ class userProfile(object):
self.dialog.set("bdate", d.format(_(u"MMMM D, YYYY"), locale=languageHandler.getLanguage())) self.dialog.set("bdate", d.format(_(u"MMMM D, YYYY"), locale=languageHandler.getLanguage()))
# Gets current city and home town # Gets current city and home town
city = "" city = ""
home_city = ""
if person.has_key("home_town") and person["home_town"] != "": if person.has_key("home_town") and person["home_town"] != "":
home_city = _(u"(from {0})").format(person["home_town"]) home_town = person["home_town"]
self.dialog.enable("home_town")
self.dialog.set("home_town", home_town)
if person.has_key("city") and len(person["city"]) > 0: if person.has_key("city") and len(person["city"]) > 0:
city = person["city"]["title"] city = person["city"]["title"]
if person.has_key("country") and person["country"] != "": if person.has_key("country") and person["country"] != "":
@ -573,12 +575,8 @@ class userProfile(object):
city = city+u", {0}".format(person["country"]["title"]) city = city+u", {0}".format(person["country"]["title"])
else: else:
city = person["country"]["title"] city = person["country"]["title"]
if home_city != "":
self.dialog.set("city", city+" "+home_city)
self.dialog.enable("city") self.dialog.enable("city")
else:
self.dialog.set("city", city) self.dialog.set("city", city)
self.dialog.enable("city")
self.dialog.set("name", n) self.dialog.set("name", n)
# Gets website # Gets website
if person.has_key("site") and person["site"] != "": if person.has_key("site") and person["site"] != "":
@ -599,6 +597,33 @@ class userProfile(object):
c2 = "" c2 = ""
self.dialog.enable("occupation") self.dialog.enable("occupation")
self.dialog.set("occupation", c1+c2) self.dialog.set("occupation", c1+c2)
if person.has_key("relation") and person["relation"] != 0:
print person["relation"]
if person["relation"] == 1:
r = _(u"Single")
elif person["relation"] == 2:
if person.has_key("relation_partner"):
r = _(u"Dating with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
else:
r = _(u"Dating")
elif person["relation"] == 3:
r = _(u"Engaged with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
elif person["relation"] == 4:
r = _(u"Married with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
elif person["relation"] == 5:
r = _(u"It's complicated")
elif person["relation"] == 6:
r = _(u"Actively searching")
elif person["relation"] == 7:
r = _(u"In love")
self.dialog.enable("relation")
self.dialog.relation.SetLabel(_(u"Relationship: ")+r)
if person.has_key("last_seen") and person["last_seen"] != False:
original_date = arrow.get(person["last_seen"]["time"])
# Translators: This is the date of last seen
last_seen = _(u"{0}").format(original_date.humanize(locale=languageHandler.getLanguage()),)
self.dialog.enable("last_seen")
self.dialog.set("last_seen", last_seen)
log.info("getting info...") log.info("getting info...")
self.person = person self.person = person
self.dialog.SetClientSize(self.dialog.sizer.CalcMin()) self.dialog.SetClientSize(self.dialog.sizer.CalcMin())

View File

@ -243,6 +243,14 @@ class userProfile(widgetUtils.BaseDialog):
sizerStatus.Add(self.status, 0, wx.ALL, 5) sizerStatus.Add(self.status, 0, wx.ALL, 5)
self.sizer.Add(sizerStatus, 0, wx.ALL, 5) self.sizer.Add(sizerStatus, 0, wx.ALL, 5)
lblLastSeen = wx.StaticText(panel, wx.NewId(), _(u"Last seen"))
self.last_seen = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.last_seen.Enable(False)
sizerLastSeen = wx.BoxSizer(wx.HORIZONTAL)
sizerLastSeen.Add(lblLastSeen, 0, wx.ALL, 5)
sizerLastSeen.Add(self.last_seen, 0, wx.ALL, 5)
self.sizer.Add(sizerLastSeen, 0, wx.ALL, 5)
lblBDate = wx.StaticText(panel, wx.NewId(), _(u"Birthdate")) lblBDate = wx.StaticText(panel, wx.NewId(), _(u"Birthdate"))
self.bdate = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE) self.bdate = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.bdate.Enable(False) self.bdate.Enable(False)
@ -250,8 +258,10 @@ class userProfile(widgetUtils.BaseDialog):
sizerBDate.Add(lblBDate, 0, wx.ALL, 5) sizerBDate.Add(lblBDate, 0, wx.ALL, 5)
sizerBDate.Add(self.bdate, 0, wx.ALL, 5) sizerBDate.Add(self.bdate, 0, wx.ALL, 5)
self.sizer.Add(sizerBDate, 0, wx.ALL, 5) self.sizer.Add(sizerBDate, 0, wx.ALL, 5)
self.relation = wx.Button(panel, -1, "")
lblCity = wx.StaticText(panel, wx.NewId(), _(u"City")) self.relation.Enable(False)
self.sizer.Add(self.relation, 0, wx.ALL, 5)
lblCity = wx.StaticText(panel, wx.NewId(), _(u"Current city"))
self.city = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE) self.city = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.city.Enable(False) self.city.Enable(False)
sizerCity = wx.BoxSizer(wx.HORIZONTAL) sizerCity = wx.BoxSizer(wx.HORIZONTAL)
@ -259,6 +269,14 @@ class userProfile(widgetUtils.BaseDialog):
sizerCity.Add(self.city, 0, wx.ALL, 5) sizerCity.Add(self.city, 0, wx.ALL, 5)
self.sizer.Add(sizerCity, 0, wx.ALL, 5) self.sizer.Add(sizerCity, 0, wx.ALL, 5)
lblHometown = wx.StaticText(panel, wx.NewId(), _(u"Home Town"))
self.home_town = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.home_town.Enable(False)
sizerHometown = wx.BoxSizer(wx.HORIZONTAL)
sizerHometown.Add(lblHometown, 0, wx.ALL, 5)
sizerHometown.Add(self.home_town, 0, wx.ALL, 5)
self.sizer.Add(sizerHometown, 0, wx.ALL, 5)
lblWebsite = wx.StaticText(panel, wx.NewId(), _(u"Website")) lblWebsite = wx.StaticText(panel, wx.NewId(), _(u"Website"))
self.website = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE) self.website = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE)
self.website.Enable(False) self.website.Enable(False)