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.
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
… #
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:
Empty tree:
This one doesn’t work right yet. The test ALWAYS thinks that there is no Active Person
Tree with people but no Active Person:
How should a gramplet monitor if a Database has been unloaded or loaded?
This gramplet does not reinitialize when either of those 2 event occur… and it needs to do so.
As an aside, Nick suggested changing some of the Grampet’s refresh control code to take advantage of the CallbackManager to make refresh more efficient. (And that will help the other parts of the Gramplet.) However, reading the source suggests that it is supposed to be destroyed when the database is swapped out. So it seems unlikely to have signals I can use for that.
The following old bug report discussed handling certain error conditions when no database is loaded. And implementation of a dummy.db and various refresh problems… including Gramplets that don’t Clear when the database has just been unloaded. The last exchange didn’t mention any patches to make the Gramplets more aware. 0002092: Problems when no database is open
I’ve seen mention of the dummy.db so it seems like at least part of the approach was implemented. But it is hard to tell where things stand now.
However, the Gramplet does show useful information stepping a newbie through if no Tree was originally loaded… or if starting with a blank tree: