Skip to content

Allow invalid dates in the relationship graph. #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions gramps/plugins/graph/gvrelgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def __init__(self, database, options, user):
self.show_family_leaves = get_value("show_family_leaves")
self.use_subgraphs = get_value("usesubgraphs")
self.event_choice = get_value("event_choice")
self.valid_date = get_value("valid")
self.occupation = get_value("occupation")
self.use_html_output = False

Expand Down Expand Up @@ -824,7 +825,7 @@ def get_date_string(self, event):
"""
if event and event.get_date_object() is not None:
event_date = event.get_date_object()
if event_date.get_year_valid():
if event_date:
if self.event_choice in [4, 5]:
return self.get_date(Date(event_date.get_year())) # localized year
elif self.event_choice in [1, 2, 3, 7]:
Expand All @@ -847,7 +848,13 @@ def get_place_string(self, event):

def get_date(self, date):
"""return a formatted date"""
return html.escape(self._get_date(date))
if self.valid_date:
if date.get_year_valid():
return html.escape(self._get_date(date))
else:
return ""
else:
return self._get_date(date)


# ------------------------------------------------------------------------
Expand Down Expand Up @@ -979,6 +986,9 @@ def add_menu_options(self, menu):
)
add_option("show_family_leaves", show_family_leaves)

valid = BooleanOption(_("Only valid dates"), True)
add_option("valid", valid)

url = BooleanOption(_("Include URLs"), False)
url.set_help(
_(
Expand Down