Skip to content

Commit

Permalink
Add year rounding option to preferences
Browse files Browse the repository at this point in the history
Fixes #12422
  • Loading branch information
SNoiraud authored and Nick-Hall committed Feb 7, 2024
1 parent 82550c6 commit a7d1362
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions gramps/gen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def emit(key):
register("preferences.family-relation-type", 3) # UNKNOWN
register("preferences.age-display-precision", 1)
register("preferences.age-after-death", True)
register("preferences.age-rounded-year", True)
register("preferences.cite-plugin", "cite-legacy")

register("colors.scheme", 0)
Expand Down
4 changes: 3 additions & 1 deletion gramps/gen/lib/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ def _format(self, diff_tuple, dlocale=glocale):
).format(number_of=diff_tuple[0])
detail += 1
if self.precision == detail:
if diff_tuple[1] >= 6: # round up years
if diff_tuple[1] >= 6 and config.get(
"preferences.age-rounded-year"
): # round up years
# Translators: leave all/any {...} untranslated
retval = ngettext(
"{number_of} year", "{number_of} years", diff_tuple[0] + 1
Expand Down
11 changes: 11 additions & 0 deletions gramps/gui/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,17 @@ def add_data_panel(self, configdialog):
grid.attach(lwidget, 1, row, 1, 1)
grid.attach(obox, 2, row, 2, 1)

row += 1
# Display rounded year
self.add_checkbox(
grid,
_("Round the year"),
row,
"preferences.age-rounded-year",
start=2,
stop=3,
)

row += 1
# Display ages for events after death
self.add_checkbox(
Expand Down

0 comments on commit a7d1362

Please sign in to comment.