From 38f4cd7e85be0b64425c57ad40db326dae830ed7 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Mon, 22 May 2006 02:57:27 +0000 Subject: [PATCH] src/plugins/TimeLine.py: round all dates to nearest decade svn: r6746 --- ChangeLog | 1 + src/plugins/TimeLine.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d562f5524..5b76dc7b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ * src/plugins/Calendar.py: make calendar work in Windows * src/GrampsLocale.py: make calendar work in Windows * src/plugins/GraphViz.py: fix unicode encoding + * src/plugins/TimeLine.py: round all dates to nearest decade 2006-05-21 Alex Roitman * src/GrampsDb/_GrampsBSDDB.py: Do not import unused module. diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index ecbc7eddc..17ab937d7 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -312,9 +312,14 @@ class TimeLine(Report.Report): if d: low = min(low,d) high = max(high,d) - - low = (low/10)*10 - high = ((high+9)/10)*10 + + # round the dates to the nearest decade + low = int((low/10))*10 + high = int(((high+9)/10))*10 + + # Make sure the difference is a multiple of 50 so all year ranges land + # on a decade. + low -= 50 - ((high-low) % 50) if low == None: low = high