From 7b22c7d0f8d7cf7d1993c439a83dd513132e671b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sat, 20 Feb 2016 06:43:56 -0600 Subject: [PATCH] Added relationship information in user details dialogue. --- src/controller/user.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/controller/user.py b/src/controller/user.py index 2dca11c7..af8cef58 100644 --- a/src/controller/user.py +++ b/src/controller/user.py @@ -31,6 +31,8 @@ class profileController(object): def get_data(self, screen_name): self.data = self.session.twitter.twitter.show_user(screen_name=screen_name) + if screen_name != self.session.db["user_name"]: + self.friendship_status = self.session.twitter.twitter.show_friendship(source_screen_name=self.session.db["user_name"], target_screen_name=screen_name) def fill_profile_fields(self): self.dialog.set_name(self.data["name"]) @@ -90,6 +92,13 @@ class profileController(object): if self.data["protected"] == True: protected = _(u"Yes") else: protected = _(u"No") string = string+ _(u"Protected: %s\n") % (protected) + if hasattr(self, "friendship_status"): + friendship = "Relationship: " + if self.friendship_status["relationship"]["target"]["followed_by"]: + friendship += _(u"You follow {0}. ").format(self.data["name"],) + if self.friendship_status["relationship"]["target"]["following"]: + friendship += _(u"{0} is following you.").format(self.data["name"],) + string = string+friendship+"\n" string = string+_(u"Followers: %s\n Friends: %s\n") % (self.data["followers_count"], self.data["friends_count"]) if self.data["verified"] == True: verified = _(u"Yes") else: verified = _(u"No")