Skip to content

Refactor Relationship Calculator and Add a Searchbar #1882

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

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

Conversation

stevenyoungs
Copy link
Contributor

Refactor the relationship calculator tool

  • now based on SelectPerson
    previously the calculator had it's own implementation of a person tree
  • BaseSelector and SelectPerson classes updated to support modal or modeless operation. All existing use use remains modal
  • Relationship calculator now includes a search bar to aid finding the other person
  • supports changes in active person after the tool is opened
  • supports changes in families and recalculates the relationship
  • handles database change (the current tool crashes)

Related discourse discussion, including user request: https://gramps.discourse.group/t/adding-search-bar-to-select-person-dialog/6845/10?u=stevey

image

@stevenyoungs
Copy link
Contributor Author

Steps to crash the existing relationship calculator tool

  1. open the example database
  2. open the relationship calculator tool
    no need to click anything in the tool
  3. close the database
    the relationship calculator window is still displayed with all people listed
  4. expand a surname in the relationship calculator window

An error similar to the below will be generated

36104: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.2.3\gramps\gui\views\treemodels\treebasemodel.py", line 962, in do_get_value
    val = self._get_value(node.handle, col, node.secondary)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-5.2.3\gramps\gui\views\treemodels\treebasemodel.py", line 979, in _get_value
    data = self.map(handle)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-5.2.3\gramps\gen\db\generic.py", line 1734, in get_raw_person_data
    return self._get_raw_data(PERSON_KEY, handle)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-5.2.3\gramps\plugins\db\dbapi\dbapi.py", line 1002, in _get_raw_data
    self.dbapi.execute(sql, [handle])
  File "C:\Program Files\GrampsAIO64-5.2.3\gramps\plugins\db\dbapi\sqlite.py", line 136, in execute
    self.__cursor.execute(*args, **kwargs)
sqlite3.ProgrammingError: Cannot operate on a closed database.

In Windows AIO at least, there is a never ending stream of errors. The only escape is to kill the gramps process.

@stevenyoungs stevenyoungs force-pushed the relcalc-searchbar branch 2 times, most recently from 36bb022 to 10031e4 Compare January 27, 2025 21:04
@Nick-Hall Nick-Hall added this to the v6.1 milestone Jan 27, 2025
@stevenyoungs stevenyoungs force-pushed the relcalc-searchbar branch 2 times, most recently from 5f58ce1 to cadaa00 Compare January 27, 2025 22:14
- now based on SelectPerson
- includes search bar to aid finding the other person
- supports changes in active person
- handles database change (the previous tool crashes)
@stevenyoungs
Copy link
Contributor Author

rebased

@Call-Me-Dave
Copy link

I use the Relationship Calculator quite often to the point that I'd really like to see this as a Gramplet if possible, does anybody else feel this way or is it just me?

@GeorgeWilmes
Copy link

I use the Relationship Calculator quite often to the point that I'd really like to see this as a Gramplet if possible, does anybody else feel this way or is it just me?

Yes, do you have a particular design in mind? Maybe discussing in Discourse would be better.

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