Some errors during development hang Gramps. Putting all in try block to avoid this
svn: r22420
This commit is contained in:
parent
25c5e6fbc8
commit
2b5d7efdce
@ -300,35 +300,49 @@ def __startgramps(errors, argparser):
|
|||||||
Main startup function started via GObject.timeout_add
|
Main startup function started via GObject.timeout_add
|
||||||
First action inside the gtk loop
|
First action inside the gtk loop
|
||||||
"""
|
"""
|
||||||
from .dialog import ErrorDialog
|
try:
|
||||||
#handle first existing errors in GUI fashion
|
from .dialog import ErrorDialog
|
||||||
if errors:
|
#handle first existing errors in GUI fashion
|
||||||
for error in errors:
|
if errors:
|
||||||
ErrorDialog(error[0], error[1])
|
for error in errors:
|
||||||
Gtk.main_quit()
|
ErrorDialog(error[0], error[1])
|
||||||
sys.exit(1)
|
Gtk.main_quit()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if argparser.errors:
|
if argparser.errors:
|
||||||
for error in argparser.errors:
|
for error in argparser.errors:
|
||||||
ErrorDialog(error[0], error[1])
|
ErrorDialog(error[0], error[1])
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# add gui logger
|
# add gui logger
|
||||||
from .logger import RotateHandler, GtkHandler
|
from .logger import RotateHandler, GtkHandler
|
||||||
form = logging.Formatter(fmt="%(relativeCreated)d: %(levelname)s: "
|
form = logging.Formatter(fmt="%(relativeCreated)d: %(levelname)s: "
|
||||||
"%(filename)s: line %(lineno)d: %(message)s")
|
"%(filename)s: line %(lineno)d: %(message)s")
|
||||||
# Create the log handlers
|
# Create the log handlers
|
||||||
rh = RotateHandler(capacity=20)
|
rh = RotateHandler(capacity=20)
|
||||||
rh.setFormatter(form)
|
rh.setFormatter(form)
|
||||||
# Only error and critical log records should
|
# Only error and critical log records should
|
||||||
# trigger the GUI handler.
|
# trigger the GUI handler.
|
||||||
gtkh = GtkHandler(rotate_handler=rh)
|
gtkh = GtkHandler(rotate_handler=rh)
|
||||||
gtkh.setFormatter(form)
|
gtkh.setFormatter(form)
|
||||||
gtkh.setLevel(logging.ERROR)
|
gtkh.setLevel(logging.ERROR)
|
||||||
l = logging.getLogger()
|
l = logging.getLogger()
|
||||||
l.addHandler(rh)
|
l.addHandler(rh)
|
||||||
l.addHandler(gtkh)
|
l.addHandler(gtkh)
|
||||||
|
|
||||||
|
except:
|
||||||
|
#make sure there is a clean exit if there is an error in above steps
|
||||||
|
quit_now = True
|
||||||
|
exit_code = 1
|
||||||
|
LOG.error(_(
|
||||||
|
"\nGramps failed to start. Please report a bug about this.\n"
|
||||||
|
"This could be because of an error in a (third party) View on startup.\n"
|
||||||
|
"To use another view, don't load a Family Tree, change view, and then load"
|
||||||
|
" your Family Tree.\n"
|
||||||
|
"You can also change manually the startup view in the gramps.ini file \n"
|
||||||
|
"by changing the last-view parameter.\n"
|
||||||
|
), exc_info=True)
|
||||||
|
|
||||||
# start GRAMPS, errors stop the gtk loop
|
# start GRAMPS, errors stop the gtk loop
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user