Skip to content
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

Improve the backlinks (References) gramplets #1832

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

stevenyoungs
Copy link
Contributor

The backlinks gramplet (called References in the UI) is great for finding linked objects. It also allows direct editing of the object by double clicking. However, if you want to make the linked object the active object, you have to go to the relevant object-type view (e.g. Families), and re-find the object.
This enhancement allows the active object to be set directly from the References gramplet. This is currently a two-step process

  1. select the row
    image

  2. press the middle mouse button (anywhere within the gramplet)
    The selected object will be made the active object of that type.
    In the above example, Family F0403 will be made the active family.
    It works for all object types, not just families
    image

Teach the set of backlinks (References) gramplets how to set the active object.
Usage: select the row of the object you want to make active, then middle mouse button
@stevenyoungs
Copy link
Contributor Author

I'd welcome suggestions on how to make this feature more discoverable.
There is no indication to users that this capability exists. The same criticism can be levelled at the Family editor dialog, where middle click on a child, brings up the person editor. It took me a few years to discover this!

@dsblank
Copy link
Member

dsblank commented Dec 26, 2024

Very nice!

Regarding making the functionality more discoverable, some ideas:

  • underline the items
  • use a different color
  • use a different font
  • give message on hover

@emyoulation
Copy link
Contributor

emyoulation commented Dec 26, 2024

In some other features, there is a left selecting action, a left double-click action, a center-click action and a right-click context menu.

And the context menu normally includes the left and center click actions.

https://gramps-project.org/wiki/index.php/Gramps_5.2_Wiki_Manual_-_Keybindings#Context_menu

The experimental CardView addons included not only extensive use of the center mouse button but also preferences GUI for swapping the actions for mouse buttons. It also uses modifier click.

https://github.com/cdhorn/CardView/blob/master/README.md

@emyoulation
Copy link
Contributor

emyoulation commented Dec 26, 2024

give message on hover

Given that some hover tooltip message boxes can be quite large and obscure the click or drag handles, there needs to be a way to suppress the tooltips too. (i.e., moving the mouse pointer upwards does not pop tooltips over the data that you are moving towards. But downwards movement has problematic tooltips obscuring data.)

Tooltips popping up can really impede expert users' ability to see the genealogical data and interact with their mouse GUI.

@stevenyoungs
Copy link
Contributor Author

I'll add a simple context menu with Edit and Make Active options

@emyoulation
Copy link
Contributor

Note that one of the big uses of the References is drag'n'drop to the clipboard. (Although the copy keybinding is not supported.)

Can anyone point me towards where a context menu for the 'ref' clipboard objects should be added to the clipboard code? The objects have context menus (which include options like 'make active' or make a custom filter) but the ref objects are lacking that.

So a context menu that merely added the referenced object to the Clipboard would be a workaround.

@emyoulation
Copy link
Contributor

emyoulation commented Dec 26, 2024

I'll add a simple context menu with Edit and Make Active options

I'll add mention of the button actions to the wiki. And link to it from the Gramps Glossary.

Maybe a 'Help' context menu item pointing to the Glossary item makes sense?

https://gramps-project.org/wiki/index.php/Gramps_Glossary#references_tab

The link in the Glossary goes to a wiki placeholder. It will be re‐directed to a better article:
https://gramps-project.org/wiki/index.php/References#Using_the_References_tab

@stevenyoungs
Copy link
Contributor Author

I've added a simple context menu to help with discoverability.

image

@stevenyoungs stevenyoungs changed the title Set the active object from the backlinks (References) gramplet Improve the backlinks (References) gramplet Dec 26, 2024
@stevenyoungs
Copy link
Contributor Author

Note that one of the big uses of the References is drag'n'drop to the clipboard. (Although the copy keybinding is not supported.)

Can anyone point me towards where a context menu for the 'ref' clipboard objects should be added to the clipboard code? The objects have context menus (which include options like 'make active' or make a custom filter) but the ref objects are lacking that.

I've added drag support to the References gramplet. You can now drag a row from this gramplet and drop it onto the clipboard.
Once the object is on the clipboard you can then drag it as usual. The video below demonstrates by dragging a Person reference from a Family object onto the clipboard

Recording.2024-12-26.193840.mp4

What doesn't work, and I don't know why yet, is dragging from the Reference gramplet directly to an editor window. For example, drag the same person as above, and drop it onto a new Family editor window and the person is not added to the family. Drag the person from the clipboard into the same family editor window and it works as expected.

@stevenyoungs
Copy link
Contributor Author

What doesn't work, and I don't know why yet, is dragging from the Reference gramplet directly to an editor window. For example, drag the same person as above, and drop it onto a new Family editor window and the person is not added to the family. Drag the person from the clipboard into the same family editor window and it works as expected.

I think I can answer my own question: I am providing data in the format DdTargets.HANDLE_LIST whereas I suspect the EditFamily dialog wants data in the format DdTargets.PERSON_LINK

Is there any documentation on the workings of drag and drop within gramps?

@emyoulation
Copy link
Contributor

In her Forms addon redevelopment, Renée asked a similar and was referred to the CardView addons since drag'n'drop is implemented so extensively there. (Including the ability to drop citations on closed object to cite that source.)

She found it well organized as a reference.

https://gramps.discourse.group/t/plans-to-update-forms-addon-over-the-2024-summer/5274/153

Set a more appropriate  drag source target  for the selected object
Disable drag if nothing is selected or the type of the selected object is not supported
@stevenyoungs
Copy link
Contributor Author

Drag of objects from the References gramplet is now working as expected for all windows, not just the clipboard.
This required passing a different target data type for each object type.
I believe I've added support all object types that can be returned by db.find_backlink_handles. If I missed any, they can easily be added to Backlinks.__obj2target

@stevenyoungs stevenyoungs changed the title Improve the backlinks (References) gramplet Improve the backlinks (References) gramplets Dec 27, 2024
@emyoulation
Copy link
Contributor

A thread in Discourse discusses an edge case for citation shared References.

https://gramps.discourse.group/t/reverse-lookups-of-citation-references/4177

In this edge case, it is difficult (or impossible) to determine which non-primary object the Citation was referencing from within the GUI.

Does this ambiguity affect the drag'n'drop ref object drop to the clipboard?

@stevenyoungs
Copy link
Contributor Author

Does this ambiguity affect the drag'n'drop ref object drop to the clipboard?

Thanks for finding that thread @emyoulation.
I just tested the scenario:

  1. start a new database
  2. create a new citation
  3. create a new person and add the citation from step 1
  4. add an Age attribute to the person and add the citation from step 1 to the attribute
  5. switch to the citation view and select the citation from step 1
  6. add the references gramplet

The only reference listed in the References gramplet is the Person created in step 2. The Age attribute from step 4 is not listed and therefore does not cause any problem for the drag and drop code proposed in this PR.

The References gramplet relies on self.dbstate.db.find_backlink_handles to discover the references to display.

If there is no active object when the References gramplet is first viewed, the "sd" column is visible. fix this, and give the column a clearer name
Unify the implementation of the following methods in the BackLinks class
* db_changed
* update_has_data
* main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants