The gramps.gen Module¶
The gen module provides packages that are common to all gramps interfaces (gui, cli and web).
Database State¶
Errors¶
Provide Error objects
- class gramps.gen.errors.DatabaseError(value='')[source]¶
Bases:
ExceptionError used to report database errors
- class gramps.gen.errors.DateError(value='')[source]¶
Bases:
ExceptionError used to report Date errors
Might have a .date attribute holding an invalid Date object that triggered the error.
- class gramps.gen.errors.DbError(value)[source]¶
Bases:
ExceptionError used to report BerkeleyDB errors.
TODO
Recent Files¶
Sort¶
Update callback¶
A set of basic utilities that everything in Gramps can depend upon.
The goal is to have this module not depend on any other gramps module. That way, e.g. database classes can safely depend on that without other Gramps baggage.
User¶
The User class provides basic interaction with the user.
- class gramps.gen.user.User(callback=None, error=None, uistate=None, dbstate=None)[source]¶
Bases:
UserBaseAn implementation of the
gen.user.UserBaseclass which supresses output and accepts prompts. This is useful for unit tests.- begin_progress(title, message, steps)[source]¶
Start showing a progress indicator to the user.
Don’t use this method directly, use progress instead.
- Parameters:
title (str) – the title of the progress meter
message (str) – the message associated with the progress meter
steps (int) – the total number of steps for the progress meter. a value of 0 indicates that the ending is unknown and the meter should just show activity.
- Returns:
none
- end_progress()[source]¶
Stop showing the progress indicator to the user.
Don’t use this method directly, use progress instead.
- notify_db_error(error)[source]¶
Notify the user of a DB error.
- Parameters:
error (str) – the error message
- Returns:
none
- notify_db_repair(error)[source]¶
Notify the user their DB might need repair.
- Parameters:
error (str) – the error message
- Returns:
none
- notify_error(title, error='')[source]¶
Notify the user of an error.
- Parameters:
title (str) – the title of the error
error (str) – the error message
- Returns:
none
- prompt(title, message, accept_label, reject_label, parent=None, default_label=None)[source]¶
Prompt the user with a message to select an alternative.
- Parameters:
title (str) – the title of the question, e.g.: “Undo history warning”
message – the message, e.g.: “Proceeding with the tool will erase the undo history. If you think you may want to revert running this tool, please stop here and make a backup of the DB.”
accept_label (str) – what to call the positive choice, e.g.: “Proceed”
reject_label (str) – what to call the negative choice, e.g.: “Stop”
default_label (str or None) – the label of the default
- Returns:
the user’s answer to the question
- Return type:
bool