Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BirthdaysGramplet/BirthdaysGramplet.gpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Copyright (C) 2010 Peter Potrowl <peter017@gmail.com>
# Copyright (C) 2019 Matthias Kemmer <matt.familienforschung@gmail.com>
# Copyright (C) 2026 Javad Razavian <javadr@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +26,7 @@
name=_("Birthdays"),
description=_("a gramplet that displays the birthdays of the living people"),
status=STABLE,
version = '1.1.18',
version = '1.1.19',
fname="BirthdaysGramplet.py",
height=200,
gramplet="BirthdaysGramplet",
Expand Down
36 changes: 27 additions & 9 deletions BirthdaysGramplet/BirthdaysGramplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Copyright (C) 2010 Peter Potrowl <peter017@gmail.com>
# Copyright (C) 2019 Matthias Kemmer <matt.familienforschung@gmail.com>
# Copyright (C) 2026 Javad Razavian <javadr@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -22,7 +23,7 @@
from gramps.gen.plug import Gramplet
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.display.name import displayer as name_displayer
from gramps.gen.lib.date import Today, Date
from gramps.gen.lib.date import Today, Date, gregorian
import gramps.gen.datehandler
from gramps.gen.config import config
from gramps.gen.plug.menu import EnumeratedListOption
Expand All @@ -37,11 +38,18 @@ class BirthdaysGramplet(Gramplet):
def init(self):
self.set_text(_("No Family Tree loaded."))
self.max_age = config.get('behavior.max-age-prob-alive')
self.sort_mode = 'proximity'

def build_options(self):
"""Build the configuration options"""
db = self.dbstate.db

name_sort = _("Sort birthdays by")
self.opt_sort = EnumeratedListOption(name_sort, self.sort_mode)
self.opt_sort.add_item("proximity", _("Proximity to current date"))
self.opt_sort.add_item("month_day", _("Month and day"))


name_ignore = _("Ignore birthdays with tag")
name_only = _("Only show birthdays with tag")
self.opt_ignore = EnumeratedListOption(name_ignore, self.ignore_tag)
Expand All @@ -56,26 +64,30 @@ def build_options(self):
self.opt_ignore.add_item(tag_name, tag_name)
self.opt_only.add_item(tag_name, tag_name)

self.add_option(self.opt_sort)
self.add_option(self.opt_ignore)
self.add_option(self.opt_only)

def save_options(self):
"""Save gramplet configuration data"""
self.sort_mode = self.opt_sort.get_value()
self.ignore_tag = self.opt_ignore.get_value()
self.only_tag = self.opt_only.get_value()

def save_update_options(self, obj):
"""Save a gramplet's options to file"""
self.save_options()
self.gui.data = [self.ignore_tag, self.only_tag]
self.gui.data = [self.sort_mode, self.ignore_tag, self.only_tag]
self.update()

def on_load(self):
"""Load stored configuration data"""
if len(self.gui.data) == 2:
self.ignore_tag = self.gui.data[0]
self.only_tag = self.gui.data[1]
if len(self.gui.data) == 3:
self.sort_mode = self.gui.data[0]
self.ignore_tag = self.gui.data[1]
self.only_tag = self.gui.data[2]
else:
self.sort_mode = 'proximity'
self.ignore_tag = ''
self.only_tag = ''

Expand Down Expand Up @@ -114,8 +126,13 @@ def main(self):
# calculate age and days until birthday
self.__calculate(database, person)

# Reverse sort on number of days from now:
self.result.sort(key=lambda item: -item[0])
# Sort based on user preference:
sort_by = self.opt_sort.get_value()
if sort_by == "proximity":
self.result.sort(key=lambda item: -item[0])
else:
self.result.sort(key=lambda item: (item[2].get_month(),
item[2].get_day()))
self.clear_text()

# handle text shown in gramplet
Expand All @@ -137,9 +154,10 @@ def __calculate(self, database, person):
birth = database.get_event_from_handle(birth_ref.ref)
birth_date = birth.get_date_object()
if birth_date.is_regular():
birth_greg = gregorian(birth_date)
birthday_this_year = Date(today.get_year(),
birth_date.get_month(),
birth_date.get_day())
birth_greg.get_month(),
birth_greg.get_day())
next_age = birthday_this_year - birth_date
# (0 year, months, days) between now and birthday of this
# year (positive if passed):
Expand Down
26 changes: 25 additions & 1 deletion BirthdaysGramplet/po/ca-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ca\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2025-09-03 03:01+0000\n"
"Last-Translator: Adolfo Jayme Barrientos <fitojb@ubuntu.com>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -16,3 +16,27 @@ msgstr ""

msgid "Birthdays"
msgstr "Aniversaris"

msgid "a gramplet that displays the birthdays of the living people"
msgstr "un grample que mostra els aniversaris de les persones vives"

msgid "No Family Tree loaded."
msgstr "No s'ha carregat cap arbre genealògic."

msgid "Sort birthdays by"
msgstr "Ordena els aniversaris per"

msgid "Month and day"
msgstr "Mes i dia"

msgid "Proximity to current date"
msgstr "Proximitat a la data actual"

msgid "Ignore birthdays with tag"
msgstr "Ignora els aniversaris amb l'etiqueta"

msgid "Only show birthdays with tag"
msgstr "Mostra només els aniversaris amb etiqueta"

msgid "Processing..."
msgstr "S'està processant..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/da-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2025-02-25 16:12+0000\n"
"Last-Translator: Kaj Arne Mikkelsen <kmi@vgdata.dk>\n"
"Language-Team: Danish <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -20,8 +20,23 @@ msgstr "Fødseldage"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "en gramplet der viser fødselsdage for levende persone"

msgid "No Family Tree loaded."
msgstr "Intet stamtræ er indlæst."

msgid "Sort birthdays by"
msgstr "Sorter fødselsdage efter"

msgid "Month and day"
msgstr "Måned og dag"

msgid "Proximity to current date"
msgstr "Nærhed til nuværende dato"

msgid "Ignore birthdays with tag"
msgstr "Undlad fødseldage med ettiket"

msgid "Only show birthdays with tag"
msgstr "Vis kun fødseldage med ettiket"

msgid "Processing..."
msgstr "Forarbejdning..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/de-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: de\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2025-05-19 21:02+0000\n"
"Last-Translator: Mirko Leonhäuser <mirko@leonhaeuser.de>\n"
"Language-Team: German <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -20,8 +20,23 @@ msgstr "Geburtstage"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "ein Gramplet, das die Geburtstage der lebenden Personen anzeigt"

msgid "No Family Tree loaded."
msgstr "Kein Stammbaum geladen."

msgid "Sort birthdays by"
msgstr "Geburtstage sortieren nach"

msgid "Month and day"
msgstr "Monat und Tag"

msgid "Proximity to current date"
msgstr "Nähe zum aktuellen Datum"

msgid "Ignore birthdays with tag"
msgstr "Geburtstage mit Etikett ignorieren"

msgid "Only show birthdays with tag"
msgstr "Nur Geburtstage mit Etikett anzeigen"

msgid "Processing..."
msgstr "Verarbeitung..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/es-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: GRAMPS 3.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2026-05-04 21:37+0000\n"
"Last-Translator: Francisco Serrador <fserrador@gmail.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -20,8 +20,23 @@ msgstr "Cumpleaños"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "un gramplet que exhibe los cumpleaños de la gente viva"

msgid "No Family Tree loaded."
msgstr "No se ha cargado ningún árbol genealógico."

msgid "Sort birthdays by"
msgstr "Ordenar cumpleaños por"

msgid "Month and day"
msgstr "mes y dia"

msgid "Proximity to current date"
msgstr "Proximidad a la fecha actual"

msgid "Ignore birthdays with tag"
msgstr "Ignorar cumpleaños con etiqueta"

msgid "Only show birthdays with tag"
msgstr "Solo mostrar cumpleaños con etiqueta"

msgid "Processing..."
msgstr "Tratamiento..."
42 changes: 42 additions & 0 deletions BirthdaysGramplet/po/fa-local.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
msgid ""
msgstr ""
"Project-Id-Version: BirthdaysGramplet\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2026-07-03 00:00+0000\n"
"Last-Translator: Javad Razavian <javadr@gmail.com>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/gramps-project/"
"addons/fa/>\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Weblate 5.13-dev\n"

msgid "Birthdays"
msgstr "تولدها"

msgid "a gramplet that displays the birthdays of the living people"
msgstr "یک گرمپلت که تولدهای افراد زنده را نمایش می‌دهد"

msgid "No Family Tree loaded."
msgstr "هیچ شجره‌نامه‌ای بارگذاری نشده است."

msgid "Sort birthdays by"
msgstr "مرتب‌سازی تولدها بر اساس"

msgid "Month and day"
msgstr "ماه و روز"

msgid "Proximity to current date"
msgstr "نزدیکی به تاریخ فعلی"

msgid "Ignore birthdays with tag"
msgstr "نادیده گرفتن تولدهای دارای برچسب"

msgid "Only show birthdays with tag"
msgstr "فقط نمایش تولدهای دارای برچسب"

msgid "Processing..."
msgstr "در حال پردازش..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/fi-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: fi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2025-02-20 13:28+0000\n"
"Last-Translator: Matti Niemelä <niememat@gmail.com>\n"
"Language-Team: Finnish <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -21,8 +21,23 @@ msgstr "Syntymäpäivät"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "Gramplet, joka näyttää elävien ihmisten syntymä päivät ja iät"

msgid "No Family Tree loaded."
msgstr "Sukupuuta ei ladattu."

msgid "Sort birthdays by"
msgstr "Lajittele syntymäpäivät"

msgid "Month and day"
msgstr "Kuukausi ja päivä"

msgid "Proximity to current date"
msgstr "Läheisyys nykyiseen päivämäärään"

msgid "Ignore birthdays with tag"
msgstr "Jätä pois syntymäpäivät, joissa on tagi"

msgid "Only show birthdays with tag"
msgstr "Näytä vain syntymäpäivät, joissa on tagi"

msgid "Processing..."
msgstr "Käsitellään..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/fr-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: trunk\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-02 12:49-0700\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2026-05-14 19:17+0000\n"
"Last-Translator: \"David D.\" <dadu042@users.noreply.hosted.weblate.org>\n"
"Language-Team: French <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -20,8 +20,23 @@ msgstr "Jours de naissance"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "Ce Gramplet affiche les anniversaires des personnes en vie"

msgid "No Family Tree loaded."
msgstr "Aucun arbre généalogique chargé."

msgid "Sort birthdays by"
msgstr "Trier les anniversaires par"

msgid "Month and day"
msgstr "Mois et jour"

msgid "Proximity to current date"
msgstr "Proximité à la date actuelle"

msgid "Ignore birthdays with tag"
msgstr "Ignorer les anniversaires avec cette étiquette"

msgid "Only show birthdays with tag"
msgstr "Montrer seulement les anniversaires avec cette étiquette"

msgid "Processing..."
msgstr "Traitement..."
17 changes: 16 additions & 1 deletion BirthdaysGramplet/po/he-local.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Gramps 5.2.0 – mediamerge\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-06 08:56-0800\n"
"POT-Creation-Date: 2026-07-04 00:00-0000\n"
"PO-Revision-Date: 2025-08-11 18:01+0000\n"
"Last-Translator: Avi Markovitz <avi.markovitz@gmail.com>\n"
"Language-Team: Hebrew <https://hosted.weblate.org/projects/gramps-project/"
Expand All @@ -21,8 +21,23 @@ msgstr "ימי הולדת"
msgid "a gramplet that displays the birthdays of the living people"
msgstr "גרמפלט שמציג את ימי ההולדת של האנשים החיים"

msgid "No Family Tree loaded."
msgstr "לא נטען אילן יוחסין."

msgid "Sort birthdays by"
msgstr "מיין ימי הולדת לפי"

msgid "Month and day"
msgstr "חודש ויום"

msgid "Proximity to current date"
msgstr "קרבה לתאריך הנוכחי"

msgid "Ignore birthdays with tag"
msgstr "להתעלם מימי הולדת מתוייגים בתג"

msgid "Only show birthdays with tag"
msgstr "להציג רק ימי הולדת מתוייגים בתג"

msgid "Processing..."
msgstr "מעבד..."
Loading