Skip to content

Commit

Permalink
Merge pull request #337 from vkbo/built_time
Browse files Browse the repository at this point in the history
Built Time – A Few Tweaks
  • Loading branch information
vkbo committed Jun 23, 2020
2 parents 6d65c7a + 2d9c92a commit 4043f81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 13 additions & 6 deletions nw/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ def fuzzyTime(secDiff):
"""
if secDiff < 0:
return "in the future"
elif secDiff < 15:
elif secDiff < 30:
return "just now"
elif secDiff < 45:
return "a few seconds ago"
elif secDiff < 90:
return "a minute ago"
elif secDiff < 3300: # 55 minutes
Expand All @@ -213,10 +211,19 @@ def fuzzyTime(secDiff):
return "%d hours ago" % int(round(secDiff/3600))
elif secDiff < 129600: # 1.5 days
return "a day ago"
elif secDiff < 31104000: # 360 days
elif secDiff < 561600: # 6.5 days
return "%d days ago" % int(round(secDiff/86400))
elif secDiff < 36288000: # 420 days
elif secDiff < 907200: # 10.5 days
return "a week ago"
elif secDiff < 2419200: # 28 days
return "%d weeks ago" % int(round(secDiff/604800))
elif secDiff < 3888000: # 45 days
return "a month ago"
elif secDiff < 31104000: # 360 days
return "%d months ago" % int(round(secDiff/2592000))
elif secDiff < 47304000: # 1.5 years
return "a year ago"
else:
return "ages ago"
return "%d years ago" % int(round(secDiff/31557600))

return "beyond time and space"
4 changes: 2 additions & 2 deletions nw/gui/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ def __init__(self, theParent, theProject):
fPx = int(1.1*self.theTheme.fontPixelSize)
mPx = self.mainConf.pxInt(4)

self.theTitle = QLabel("", self)
self.theTitle = QLabel("<b>Build Time:</b> Unknown", self)
self.theTitle.setIndent(0)
self.theTitle.setAutoFillBackground(True)
self.theTitle.setAlignment(Qt.AlignCenter)
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def resizeEvent(self, theEvent):
##

def _updateBuildAge(self):
"""
"""Update the build time and the fuzzy age.
"""
if self.buildTime > 0:
strBuildTime = "%s (%s)" % (
Expand Down

0 comments on commit 4043f81

Please sign in to comment.