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

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:


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

This will not help for the original question.
Only for the devel part (possible enhancements).

Proposal should be now more clear. Some additions look like lazy coding. They are only multiples ways (solutions) for an overview. Do not need to blame the style yet! I still do not like when Selectors returns empty list (often at the begin of the session as mru list is also empty and if there is no bookmarks or recent changes). uistate might provide a solution but I did not go too far to avoid any unexpected issue not directly related to Selectors.

Note, was a little bit surprised… I just need more time for tracking down trailing white spaces than really fixing errors on the set of concepts, for this draft! Sure, still need workarounds (Family Editor, skip list with filter, flat and tree base models, rounds with init, etc.) and search keys are disabled. Anyway, few extra lines since the first pull and this should more and less very close to the experimentation done some years ago.

If one wants to test or go further from this version.
First, you can look at modified files against master
(pylint was for whitespace catch…), then:

  1. Donwload zip with changes

  2. maybe need to set the ResourcePath (master branch)? Here my local commands for the run/session, via a console/terminal:

$ cd gramps_cryptic_rebase-Selectors
$ python3 -d "gui.selector"

where $HOME might be /usr/local/lib/python3.8/dist-packages/gramps-5.1.5-py3.8.egg # or 5.1.99, 5.2.0, etc. this should be cosmetic for this testing.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.