Sorting dialogs by last update date / keeping last used sort order

Hi!

I’m using Gramps GrampsAIO64-5.1.3-2 on Windows 10. When entering data, I find I regularly need to sort the “Select Media Object” dialog – twice. The same is true for events and sources.

For example I add a new source on one person’s events. The same source mentions three other people. So I open their records and enter the new events. When adding a source for the event, I want to use the source that was last created/modified. By default when the dialog is opened it is sorted alphabetically. Clicking on the “last update” column header sorts it by last update, but with the oldest entry on the top. Clicking a second time brings the newest entry to the top. I’m doing this a lot, e.g. when adding a group picture to the gallery of all the people on the picture, and it is a bit annoying.

Is there a way that Gramps could either memorize the last used sorting order or that it could be selected in the settings?

Greetings,
Johannes

1 Like

You can drag the recently added object to the clipboard. Then just drag from the clipboard to each of the other targets.

In addition to @emyoulation 's suggestion to copy the Source and/or Citation to the Clipboard, one trick I often use is to temporarily add a tilde (~) to the start of the source title, thus moving it to the top of the source/citation list. This is helpful especially when I am interested in several citations already linked with the source. The source is most often a book with individual page citations already created.

So far I haven’t used the clipboard. It’s definitely a workaround, but I have to remember to open it and put stuff in it. In my view that’s not as practical as simply having a useful default sort order.

You could try experimenting with hacking the Source selector. (The link is to the module on GitHub. The path offset on your local installation will be similar.)

Gramps normally sorts on the 1st column. Dunno what tweak would be needed for swapping the default sort order.

See if a different configuration works consistently & let everyone know the result of your experiments?

@SNoiraud recently enhanced the 5.2 source to remember column width customizations in editors. I do not know if it included selectors. Nor if it included support for customizing row sort order or column ordering.

You need to change the citation selector, because you are selecting citations not sources.
Here is an updated version which sorts by latest change.
Added lines are 43, 63 and 64.

Will that work? It is a grouped Selector so it will sort the most recently Changed Source, ignoring recently changed Citations. Unless the Source rows start having a calculated “Most recent Cite” (aka “Cited”) date field (equal to the largest Citation epoch date), I’m not certain that a solution is possible.

And you cannot use a log-based workaround for repeatedly applied the most recent Citation/Source:

Adding a new Citation record does NOT add it to the “Go” menu for the Citations view. And the Session Log only indicates when the Person level data (selection, creation) was changed. The Undo History has the information… but objects from that list don’t seem to be accessible as a Drag source nor can their Edit Object dialog be opened from there.

Yes you are right, the citations/sources combined selector sorts the sources not citations. A list model is needed for correct sorting. I changed the updated version. It should work now as expected. :smile:

Tbh I think all selectors should use list models instead of tree models.

1 Like

I’ll 2nd that. The tree in the Place Selector is only occasionally helpful. That selector is usable only because it is searchable. I certainly cannot remember which Cemetery is under which county & township. Or which cities are in which counties.

For some reason, the Search is entirely missing from the Person Selector. And the search-as-you-type is too quirky in a tree structure. Most of time, it either gets stuck in a branch of a Tree. Or worse, it times-out & resets itself before yielding any result in Surname tree with thousands of people.

1 Like

I have many Sources that are books of the vital records by community in Massachusetts to the year 1849. The Citations are entered by just the page number. If I were to search for “Page:101” I would get too many entries and I would still need the Source information to select the correct entry.

When you use list views, all lists are sorted on the first column.
If you want to sort them on last update, it’s easy to do without modifying gramps.
1 - select the configure active view.
2 - select the “Last changed” column name
3 - drag the "Last changed"column and drop it in the first position.
4 - click on “Apply” to valid changes.
The result will be as in the snapshot:
sort-columns.1

3 Likes

Gramps selector currently just allows to search one column, but it would be more useful to filter two or three columns in that case e.g. source: title, source: author and citation: page

For me, the periodicals/serials are the most difficult citations to select. Because the citation date is also key for selecting the right citation.

Granted, many newspapers have a volume, and issue number. But it is usually buried on another page that hasn’t been digitally collected. So my citation uses the easily located date as the defining item. (I have hundreds of Page 2, 3 & 5 citations for my hometown newspaper obituaries… which is where they usually published Obits.)

Because of this issue I usually add all data (source name, date/volume and page) in the volume/page field for most sources/citations e.g. "newspaper_name at publish_date, page_number "

I chose not to routinely use a makeshift data format to compensate for a Gramps limitation. (Mostly because it seemed likely that there would be a change in the future and all those fields would have to be found and parsed.) I try to use attributes instead.

During investigations (and experimentations) for GEPS 041: New Selector
I came to the conclusion that more we have columns, more the maintenance becomes complex and we need ressources (memory, CPU, etc.). All this time, for such logical answer! Seriously, true the ‘last change’ column is useful (like the scroll down and sort function) for long list, but not very practical for an every day use.

So, the idea was to have an option for ‘fast filtering’ like on select Person dialog on Family (select spouse or children). So an option for smaller (and smart) list. The first idea was to call Most Recent Used objects (MRU list), this was fine for a long edit session, but it ignores records set some months ago, also we do not always know all citations or events on related tables (DB).

About ‘Search Vs Filtering’, I found the Interactive Search key on Selectors sometimes too limited. The additional feature might be a simple Search keys with regex support.

The concept was clear (that’s really a good thing for me…).

About the fast filter, well do not need to re-invent the wheel: just call “built-in” filter rules.

As far as I remember, need some clean-up, but code was ready for a proof of concept. Code was started from 5.0.0-alpha1 but with additional local changes (pylint, tests, etc.), so you can list changes and fetch changes against 5.0.0-alpha1 tag, but there was only few modified files dedicated/related to GEPS 041, so to avoid conflits, maybe just look at changes from: Gep 041 new selector by romjerome · Pull Request #8 · romjerome/gramps_cryptic_rebase · GitHub

Note, some issues (pylint) might remain on current master branch!
Just made local change on this repo instead of a new branch…
I know bad practice.

If you look at feature request and experimentations, you can see that modifications will only filter by “last update” (today -1!) on Source et Citation Selectors. Low benefit on others objects.

At a glance, maybe I did not test the Selector from EditLink widget/editor, but this could be very cosmetic. Also, I know my limits… I am quite certain that I limited too intrusive (destructive?) code during these experimentations. So, often reverted any sections too complicated or using black magic. If there is an error, it should be easy to fix it.

1 Like

Also an extra customization on Places Selector!
It seems that there was a possible issue around navigation, active object and history.

New feature: by trying to understand most steps during Selectors hacking, found one possible quick improvement…

If selector called, then also look at current active object (if exists) and make the focus on it!

active_handle = uistate.get_active(self.object)
...
BaseSelector.__init__(self, dbstate, uistate, track, sfilter,
                              skip, show_search_bar, active_handle, expand)
1 Like

Perfect steps. A caveat if you’re on MacOS: you may run into this bug in step 3, when dragging the “Last changed” column to the first position:

0012520: [MacOS ]View configuration: Column editor duplicates fields when using drag-n-drop to reorder columns

ok, it seems I get the hand back on my cryptic local rebase and there is now a simplier way (against gramps:master branch) for looking at changes via a draft pull #1343:

I will remove my previous internal link PR#8