diff --git a/changelog.md b/changelog.md index 28d7705..c2919aa 100644 --- a/changelog.md +++ b/changelog.md @@ -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 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. * 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 a basic user profile viewer. ## Changes in build 2016.07.08 (08/07/2016) diff --git a/src/controller/posts.py b/src/controller/posts.py index 3782fc2..24f1427 100644 --- a/src/controller/posts.py +++ b/src/controller/posts.py @@ -539,17 +539,18 @@ class userProfile(object): self.session = session self.user_id = user_id self.dialog = postDialogs.userProfile() - self.get_information() + self.get_basic_information() if self.person != None: self.dialog.get_response() - def get_information(self): - """ Gets and inserts 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" + def get_basic_information(self): + """ Gets and inserts basic user information""" + 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) if len(person) == 0: return output.speak(_(u"Information for groups is not supported, yet.")) person = person[0] + print person.keys() # Gets full name. n = u"{0} {1}".format(person["first_name"], person["last_name"]) # Gets birthdate. @@ -563,9 +564,10 @@ class userProfile(object): self.dialog.set("bdate", d.format(_(u"MMMM D, YYYY"), locale=languageHandler.getLanguage())) # Gets current city and home town city = "" - home_city = "" 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: city = person["city"]["title"] if person.has_key("country") and person["country"] != "": @@ -573,12 +575,8 @@ class userProfile(object): city = city+u", {0}".format(person["country"]["title"]) else: city = person["country"]["title"] - if home_city != "": - self.dialog.set("city", city+" "+home_city) self.dialog.enable("city") - else: self.dialog.set("city", city) - self.dialog.enable("city") self.dialog.set("name", n) # Gets website if person.has_key("site") and person["site"] != "": @@ -599,6 +597,33 @@ class userProfile(object): c2 = "" self.dialog.enable("occupation") 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...") self.person = person self.dialog.SetClientSize(self.dialog.sizer.CalcMin()) diff --git a/src/wxUI/dialogs/postDialogs.py b/src/wxUI/dialogs/postDialogs.py index e887eeb..1d3df00 100644 --- a/src/wxUI/dialogs/postDialogs.py +++ b/src/wxUI/dialogs/postDialogs.py @@ -243,6 +243,14 @@ class userProfile(widgetUtils.BaseDialog): sizerStatus.Add(self.status, 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")) self.bdate = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE) self.bdate.Enable(False) @@ -250,8 +258,10 @@ class userProfile(widgetUtils.BaseDialog): sizerBDate.Add(lblBDate, 0, wx.ALL, 5) sizerBDate.Add(self.bdate, 0, wx.ALL, 5) self.sizer.Add(sizerBDate, 0, wx.ALL, 5) - - lblCity = wx.StaticText(panel, wx.NewId(), _(u"City")) + self.relation = wx.Button(panel, -1, "") + 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.Enable(False) sizerCity = wx.BoxSizer(wx.HORIZONTAL) @@ -259,6 +269,14 @@ class userProfile(widgetUtils.BaseDialog): sizerCity.Add(self.city, 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")) self.website = wx.TextCtrl(panel, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE) self.website.Enable(False)