Is there a errorless test for "no database loaded"

Is there a test that Gramplets can use to determine if the dummy database (or no database) is loaded?

The default Dashboard layout includes the “Top Surnames” Gramplet. This causes a statusbar warning when no Tree is loaded in Gramps.

I’d like to experiment with adding some state of the database checking to this Gramplet so it gives a more useful response for newbies… AND so it doesn’t pop a statusbar lightbulb icon. (As with most of the conditions that cause an alert on the Statusbar, the reported message doesn’t suggest a resolution for a non-technical user.)

Rather than reporting Surnames when no Tree is loaded, I’d like it to branch to telling the user that a Tree needs to be loaded or imported so that is could report useful information.

And if no Persons exist in a loaded Tree, I’d like to have a message about that.

A “no database” similar issue is discussed in the following bug report:
https://gramps-project.org/bugs/view.php?id=2092

I’d also like to add the test to the “What’s next?” Gramplet. The first error condition it recognizes is “no home person set”.

The “no database”, “no people record”, and “no active person” conditions ought to pop messages before that.

Test for db open:
if self.dbstate.db.is_open():

Test for people:
people = self.dbstate.db.get_number_of_people()
if not people:

Test for active: Since this Gramplet is not a Person Gramplet, you have to specify what type of object you want to see if active.
active_person = self.get_active(“Person”)
if not active_person: # will be empty string in not active, else person handle
… #

2 Likes

Okay. The What’s Next? gramplet has been modified to start with a series of tests for the Instant Errors every Gramps newbie encounters. The routines use comparisons suggested by @prculley :

No tree database loaded:
image

Empty tree:
image

This one doesn’t work right yet. The test ALWAYS thinks that there is no Active Person
Tree with people but no Active Person:
image

Active Person but no Home Person:
image

The ‘active’ test probably is not working if one of the people views has not been started yet.

1 Like

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