Built-in Calendar Gramplet

Can our Calendar Gramplet have Day of the Week column headers without sacrificing the selector controls?

The Calendar Gramplet is missing day of the week labels. But if the display option for SHOW_HEADING

        self.gui.calendar.set_display_options(
			Gtk.CalendarDisplayOptions.SHOW_HEADING)

Is changed to:

        self.gui.calendar.set_display_options(
			Gtk.CalendarDisplayOptions.SHOW_DAY_NAMES)

Then you lose the Month & Year controls. It doesn’t seem to like the options combined with commas or applied sequentially in separate statements.

Combine options with bar delimiter:

    self.gui.calendar.set_display_options(
        Gtk.CalendarDisplayOptions.SHOW_DAY_NAMES |
        Gtk.CalendarDisplayOptions.SHOW_WEEK_NUMBERS |
        Gtk.CalendarDisplayOptions.SHOW_HEADING)

It also seems strange that the GTK widget library doesn’t seem to have a European calendar – where the weeks start on Mondays. [Automatically adjusts to the locality]

I was initially looking at this Gramplet hoping to add « (U+00AB) and » (U+00BB) to move by decades instead of years. But that appears to not be an option either.

Based on other applications (that don’t support spans, ranges or date quality), I had anticipated a simple calendar selector when clicking the “Daily Calendar” gadget beside the Date field. Instead, the more complex “Date Selection” dialog appears.

You can do that with:

    self.gui.calendar.set_display_options(
        Gtk.CalendarDisplayOptions.SHOW_DAY_NAMES |
        Gtk.CalendarDisplayOptions.SHOW_HEADING)
1 Like

The calendar gramplet is based on Gtk.Calendar widget.
You can’t add methods, preferences, …

1 Like

Thanks! (Filed feature request 12515/Pull 1319)

That’s unfortunate.

Perhaps it might be possible to have date field in the Gramplet that is synched to the widget? So that you could jump the calendar directly to a date years in the past?

This would be a useful reference for when hand parsing source record (such as an obit) that refers to day of the week in relative terms to its current date. As in “died Tuesday” in an obituary dated 7 Aug 2021.

I noted that the tooltip on line 48 is inaccurate too. [Filed bug report 12514]

 ​        ​self​.​set_tooltip​(​_​(​"Double-click a day for details"​))

Double-click actually opens the “On This Day” Quick View. Although the more important tip might be that the day is draggable.

You can’t, unless you do a little bit more work. I like this very much:

  • Three arrows - decade controls
  • Two arrows - year controls
  • One arrow - month controls

If this looks good to you all, I’ll make a PR for Gramps 6.1.

4 Likes

You can without problems.

1 Like

Could the Calendar gramplet be extended to be able to convert ‘church’ dates to ordinary calendar dates?
With ‘church’ dates I mean the date naming like ‘Dominica Quasimodogeniti’. These dates changes from year to year.
I typically use a web site to look up the date for e.g. Dominica Quasimodogeniti in 1783, but it would be handy to have the functionality in Gramps. Maybe the is would be another gramplet?

We can easily create a function that works like: get_date_from_liturgical("Dominica Quasimodogeniti", 1783). But where could we put that in the UI? I don’t think the calendar widget is the right place, and I’m working to try to simplify Gramps overall complexity.

Perhaps we could create the DateGramplet (to rule them all) that packages up all of the great date functions that we have (date math, conversions, liturgical lookups, etc.).

(As an aside, with the Gramps Assistant and the proposed function, you could simply ask it “When was Dominica Quasimodogeniti in 1783?”… no UI needed.)

3 Likes

(Even better: "Who in my family tree was born around the Dominica Quasimodogeniti in 1783?”)

1 Like

There is a Custom holiday set feature in Gramps. However, I have never understood the practical application of the holidays.xml.

It would be nice to display as ‘Dominica Quasimodogeniti, 1783’ but calculate using the Unix Epoch value. (This is even more complicated because 1783 was observed according to the Gregorian calendar in most of Europe, but on the Julian calendar in Britain and its American colonies.) Showing the original value as entered in the records would reduce the potential for double-conversions of those dates.

This question piques my interest as I have a similar Calendar problem: the Pennsylvania Quaker colony refused to use Pagan month names and weekday names. They would have used “27 Eighth Month 1730” or “27 8mo. 1730” or “27 viii 1730 o.s.” for “27 Oct 1730 (Julian)”.

In my family, there are a lot of “Quaker Dates” (both Old Style and New Style, although Pennsylvania Quakers were sometimes ragged in adopting Gregorian calendar from the Julian). And if I record the Old Style Quaker date as converted to the more familiar pagan New Style, there is a good chance of double conversions. But if the date is stored with the Quaker Date as a Text string, it cannot be used for date calculations/statistics.

“Dominica Quasimodogeniti” is a church-calendar name for a Sunday, not a fixed civil date. It means the Second Sunday of Easter (or, 1st Sunday after Easter; Quasimodo Geniti; Low Sunday), and its date changes each year because Easter itself changes each year.
In old parish registers, priests often wrote dates by feast day or Sunday name instead of writing a modern calendar date. So an entry might say something like “Dominica Quasimodogeniti” instead of “April 8, 1783,” and you have to convert that liturgical label into the actual date for that specific year.

My first contribution to Gramps was the Calendar report (more than 21 years ago!), and I still print these out every year and give them to my family. The holidays.xml is there for those that want to customize the holidays that show up on the calendar report.

3 Likes

This often gets overlooked when a new translation is added.

1 Like

That would tend to explain why I hadn’t noticed it. And there are no representative screen captures in the wiki for those calendars either. So I grabbed one to be included.  [ done ] 

Here’s a capture of part of the Web Calendar Report for January 2021. (In the US, every 4th January has the most (3) Federal holidays of any month: New Years, MLK day on 3rd Monday, and Inauguration Day on the 20th.) Holidays seem not very noticeable.

I can skip the “Full year at a Glance” since they have no indicators on the either.

It seems we are way off topic. But holidays can be formatted however you like. I use bold italic and they stand out very nicely.

Maybe not so far off-topic as it first seems.

possible integration in the Event Editor

Perhaps the holidays.xml might be integrated into the date field parser? So instead of duplicating data in multiple files, Gramps just reuses an existing file? Like the /gramps/plugins/lib/libholiday.py calculates a date.

Alternatively, augment the Date Selection dialog

@SNoiraud has a nice upgrade to the calendar gramplets with Pull 2209. And kindly extended the enhancement to the Date Selection dialog:

Perhaps the Text comment: could have a parser (similar to the Lat/Long coordinates field in the Place Editor or the “Date in Place” parser in the Data Entry addon Gramplet) to look up Holiday phrases in the holidays.xml for the Country of the Place and calculate a date value? (Perhaps with a way to displace the Text comment but use the value for calculations?)

So entering Remembrance Sunday 1995 for an Event in Blackpool, North West England, England, United Kingdom would look up the Holidays in England, find Remembrance Sunday is the 2nd Sunday in November and associate that Date string with the 12 November 1995 date value.

England subsection of the holidays.xml:

  ...
  <country name="England">
    <date name="New Year's Day" value="*/1/1" type="national" />
    <date name="Bank Holiday" value="*/1/1" offset="+1" if="dow(y, m, d) == 7" type="national" />
    <date name="Bank Holiday" value="*/1/1" offset="+2" if="dow(y, m, d) == 6" type="national" />
    <date name="Good Friday" value="> easter(y)" offset="-2" type="national" />
    <date name="Easter Monday" value="> easter(y)" offset="+1" type="national" />
    <date name="May Bank Holiday" value="*/1/mon/may" type="national" />
    <date name="Spring Bank Holiday" value="*/-1/mon/may" if="y != 2012" type="national" />
    <date name="Spring Bank Holiday" value="2012/6/4" type="national" />
    <date name="Diamond Jubilee" value="2012/6/5" type="national" />
    <date name="Summer Bank Holiday" value="*/-1/mon/aug" type="national" />
    <date name="Christmas Day" value="*/dec/25" type="national" />
    <date name="Boxing Day" value="*/dec/26" type="national" />
    <date name="Bank Holiday" value="*/dec/25" offset="+2" if="dow(y, m, d) > 5" type="national" />
    <date name="Bank Holiday" value="*/dec/26" offset="+2" if="dow(y, m, d) > 5" type="national" />
    <date name="BST starts" value="*/-1/sun/mar" type="informational" />
    <date name="BST ends" value="*/-1/sun/oct" type="informational" />
    <date name="Valentine's Day" value="*/2/14" type="secular" />
    <date name="Shrove Tuesday" value="> easter(y)" offset="-47" type="religious" />
    <date name="Ash Wednesday" value="> easter(y)" offset="-46" type="religious" />
    <date name="Easter Sunday" value="> easter(y)" type="religious" />
    <date name="April Fool's Day" value="*/4/1" type="secular" />
    <date name="St. George's Day" value="*/4/23" type="secular" />
    <date name="Mothering Sunday" value="> easter(y)" offset="-21" type="secular" />
    <date name="Fathers' Day" value="*/3/sun/jun" type="secular" />
    <date name="Halloween" value="*/10/31" type="secular" />
    <date name="Guy Fawkes Night" value="*/11/5" type="secular" />
    <date name="Armistice Day" value="*/11/11" type="secular" />
    <date name="Remembrance Sunday" value="*/2/sun/nov" type="secular" />
  </country>
    ...

I suspect that using SoundEx, Metaphone, Double Metaphone, or NYSIIS (for more fuzzy matching) might reduce the frustration with typos.

1 Like

I think that should be in a “convert dates” gramplet…

If it is made modular, there could be added different calendars as people needed them…

or maybe by using this library?

1 Like