diff --git a/src/presenters/profiles.py b/src/presenters/profiles.py index b534aa9..45674e2 100644 --- a/src/presenters/profiles.py +++ b/src/presenters/profiles.py @@ -66,7 +66,13 @@ class userProfilePresenter(base.basePresenter): self.send_message("set", tab="main_info", control="bdate", value=d.format(_("MMMM D"), locale=languageHandler.curLang[:2])) else: # mm.dd.yyyy d = arrow.get(person["bdate"], "D.M.YYYY") - self.send_message("set", tab="main_info", control="bdate", value=d.format(_("MMMM D, YYYY"), locale=languageHandler.curLang[:2])) + # Calculate user's years. + now = arrow.get() + timedelta = now-d + years = int(timedelta.days/365) + date = d.format(_("MMMM D, YYYY"), locale=languageHandler.curLang[:2]) + msg = _("{date} ({age} years)").format(date=date, age=years) + self.send_message("set", tab="main_info", control="bdate", value=msg) # Format current city and home town city = "" if "home_town" in person and person["home_town"] != "": diff --git a/src/views/dialogs/profiles.py b/src/views/dialogs/profiles.py index f12b39c..1c22552 100644 --- a/src/views/dialogs/profiles.py +++ b/src/views/dialogs/profiles.py @@ -14,7 +14,7 @@ def text_size(wxObject, chars): (x, y) = dc.GetMultiLineTextExtent("0"*chars) return (x, -1) -class mainInfo(wx.Panel): +class baseTab(wx.Panel): """ Panel to store main user information in a profile viewer.""" def get(self, control): @@ -40,6 +40,8 @@ class mainInfo(wx.Panel): def disable(self, control): getattr(self, control).Enable(False) +class mainInfo(baseTab): + def __init__(self, panel): super(mainInfo, self).__init__(panel) sizer = wx.BoxSizer(wx.VERTICAL)