Add a "Recent" sub-menu

An “Easter Egg” (unique to the Select Object dialog, aka Shared Object Selector) can be used to scroll the focus to the selected “Recent Item”. ( @SNoiraud shared this useful secret several years ago. Thanks again Serge!)

In the following screen capture, the Recent Items contains 2 entries. If the Page 23 item is selected, the grouped “All possible citations” source is expanded and the record is selected but the focus does not scroll to the selected citation row.

But, if you click the Clear button, the focus scrolls to the selected item. (That’s the Easter Egg. You could use the Find to navigate the focus to a known nearby record, Clear the Find parameters to browse the nearby records.)

However, the new Recent Items has broken the rest of that Easter Egg. A 2nd click would reset the focus to the top of the list.
On the 3 Hierarchical lists (citations, People, places), it would’ve been nice if each click moved to the top … but only up 1-level in the hierarchy. But that is not how the Clear has worked in the past.

Also of note, this Easter Egg is not available when the Find feature is disabled in the Select Object dialog. (Which is whenever the object exceeds a certain count. The Find and Clear features are gone forever in my 50K person selector.)

Either way, this enhancement could fulfill an existing feature request:

  • 0005024: By default, to display [Last Recent Used] and [bookmarked] objects on selectors

I was using the Recent Items selector in the FilterParams to change the shared parameter in 2 rules. I complicated the situation by loading a different tree after spawning the FilterParams dialog. (The Example.gramps tree didn’t have enough generations in the pedigree for the test.)

At first, it seems that it might have been due to double-clicking (or triple-clicking) the person in the Recent Items too fast… before the Select Person dialog finished populating.

But the error popped again when repeating very slowly and using the select with OK button instead of a double-click

6288466: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "/app/lib/python3.11/site-packages/gramps/gui/editors/filtereditor.py", line 353, in button_press
    self.set_text(val.get_gramps_id())
  File "/app/lib/python3.11/site-packages/gramps/gui/editors/filtereditor.py", line 393, in set_text
    name = self.name_from_gramps_id(val)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/gramps/gui/editors/filtereditor.py", line 360, in name_from_gramps_id
    person = self.db.get_person_from_gramps_id(gramps_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/gramps/gen/db/generic.py", line 1380, in get_person_from_gramps_id
    data = self._get_raw_person_from_id_data(gramps_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/gramps/gen/db/generic.py", line 1773, in _get_raw_person_from_id_data
    return self._get_raw_from_id_data(PERSON_KEY, gramps_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/gramps/plugins/db/dbapi/dbapi.py", line 1010, in _get_raw_from_id_data
    self.dbapi.execute(sql, [gramps_id])
  File "/app/lib/python3.11/site-packages/gramps/plugins/db/dbapi/sqlite.py", line 136, in execute
    self.__cursor.execute(*args, **kwargs)
sqlite3.ProgrammingError: Cannot operate on a closed database.

There’s another place in the Core that has a winnowed Person Selector.

The Complete Individual Report and the Birthday and Anniversary Report have a Share icon (“Select a different person” tooltip) that opens a Person Selector dialog for the Filter Person … where the initial option is the collapsed Grouped by Surname hierarchy Bookmarked Persons list. Clicking the Show All checkbox shows the whole tree. (The Filter Person and its Share icon is disabled unless a filter is selected. e.g., “Entire Database” filter dims that option.)
With this addon, there’s also a Recent Items section.

Maybe this GUI could be standardized and simplified?

The Show all checkbox became a Show: labeled pop-up menu. It could offer “Recent Items” (flat list), a “Bookmarked items” (flat list) and “Entire Tree” (hierarchical list) selection… that is remembered between selector dialogs. Note that some features are gender specific (Select Father or Mother). Those might have an additional default selection of “Males (or Females) of Entire Tree”

Since I destroyed my PC’s motherboard, I’m finally getting Gramps to work again.
I wanted to install the addon from kkujansuu but I keep getting error messages.

I’m particularly interested in the Recent items addon.
Is anyone using it with the current Gramps version on Win 11?

Woody

Good question!

It is in my top-5 most useful data-entry addons. Recent Items makes it almost painless to add Places and Sources to new Events! But I am using v0.9.0 of Recent Items on Gramps 5.2.3 on Fedora 37. I also use all the other Isotammi tools. So maybe that is a factor.

@kku has completed his experiment with this add-on. So there are not likely to be improvements.

What kind of errors?

1 Like

Hi,
sorry its my foult. I did copie only the “recent-items” folder into the plugin folder and not the Gramps Master Folder.

I´m so tired this days, sorry.

Woody

OK. I am glad if it works now for you. Let me know if you have more feedback. I could also improve this if there is a need…

1 Like

Thank you, that’s very kind of you. I now have time to work with Gramps again.
I may come back to that. :smiling_face_with_three_hearts:

1 Like

Kari, I really, REALLY like this feature. (Thank you!)

In the other thread, you suggested that it would be better rolled into the core.

But consider the benefits that this is a library plug-in.

Because users who don’t like the feature can disable via the Plug-in Manager rather than add another Preferences item. This is ideal for an option that is an on/off switch (as opposed to multiple choice or customizable) and almost never is changed.

2 Likes

Yes, that is a good point!

Hello,
I’m tripping over my own feet again.
After switching from Windows version 24H2 back to 23H2, I reinstalled Gramps 5.2.3.
Also the Gramps Master addons from @kku .
I copied the entire Gramps Master folder into the Gramps plugin folder.
When I now call up a person, the following error message appears.

750748: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
 File "C:\Program Files\GrampsAIO64-5.2.3\gramps\gui\editors\editperson.py", line 986, in save
 self._do_close()
 File "C:\Program Files\GrampsAIO64-5.2.3\gramps\plugins\gramps-master\addons\recent-items\recent-items.py", line 355, in new_do_close
 update_recent_items(self, dbid, self.obj)
 File "C:\Program Files\GrampsAIO64-5.2.3\gramps\plugins\gramps-master\addons\recent-items\recent-items.py", line 139, in update_recent_items
 with open(fname, "w") as f:
 ^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\GrampsAIO64-5.2.3\\gramps\\plugins\\gramps-master\\addons\\recent-items\\recent-items.json'
What did i do wrong?

Nobody has any idea where the error is?

It looks to me as though the addon was installed into the main program’s plugins folder, not the one in the Gramps User Directory.

So Gramps doesn’t have permission to change code in its own directory.

1 Like

Argh!!!
Thanks, that was the mistake…

1 Like

This looks interesting. Could anyone give some installation instructions?
@kku @emyoulation ?

It is a manual install and there is a paragraph about Manually installed Addons in the wiki.

GitHub offers a “Download ZIP” option… but only at the Repository level. (If the repository has multiple addons or multiple .gpr.py entries in an individual addon, then the Isotammi ZipInstall addon tool will not work.)

1 Like

Thanks. I had cloned the repository, and verified that copying the recent-items into plugin directory didn’t work.
I will study the link you provided

It may not be in the interface where you expect. It is a GENERAL plugin that modifies the interface of the Share or Object Selector dialogs. And until the some objects have been browsed, added or shared; the 6 most Recent_Items cache (for each category of each tree) is not populated. So it adds nothing to the interface. Select a couple objects and suddenly… wow!

See Add a "Recent" sub-menu - #7 by emyoulation