Show age in profile dialog
This commit is contained in:
parent
29e8b00656
commit
33ba50a7b4
@ -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"] != "":
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user