From 6f25f478977c6309fa4e23c4028d4ea834fbb1ee Mon Sep 17 00:00:00 2001 From: Richard Taylor Date: Thu, 7 Apr 2005 08:18:43 +0000 Subject: [PATCH] 2005-04-07 Richard Taylor * src/gramps_main.py: correct type signature for 'active-changed' signal. * src/GrampsDBCallback.py: improve the error reporting. svn: r4318 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GrampsDBCallback.py | 35 ++++++++++++++++++++++++--------- gramps2/src/gramps_main.py | 2 +- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index aea03c339..dda6f6f15 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-04-07 Richard Taylor + * src/gramps_main.py: correct type signature for 'active-changed' signal. + * src/GrampsDBCallback.py: improve the error reporting. + 2005-04-06 Don Allingham * src/FamilyView.py: keep track of local person during update, connect active-changed signal diff --git a/gramps2/src/GrampsDBCallback.py b/gramps2/src/GrampsDBCallback.py index 3d4084a88..63e906f55 100644 --- a/gramps2/src/GrampsDBCallback.py +++ b/gramps2/src/GrampsDBCallback.py @@ -38,6 +38,7 @@ import sys import types import traceback +import inspect log = sys.stderr.write @@ -326,29 +327,45 @@ class GrampsDBCallback(object): # Check signal exists if signal_name not in self.__signal_map.keys(): self._log("Warning: attempt to emit to unknown signal: %s\n" - % str(signal_name)) + " from: file: %s\n" + " line: %d\n" + " func: %s\n" + % ((str(signal_name),) + inspect.stack()[1][1:4])) return # type check arguments arg_types = self.__signal_map[signal_name] if arg_types == None and len(args) > 0: - self._log("Warning: signal emitted with "\ - "wrong number of args: %s\n" % str(signal_name)) + self._log("Warning: signal emitted with " + "wrong number of args: %s\n" + " from: file: %s\n" + " line: %d\n" + " func: %s\n" + % ((str(signal_name),) + inspect.stack()[1][1:4])) return if len(args) > 0: if len(args) != len(arg_types): - self._log("Warning: signal emitted with "\ - "wrong number of args: %s\n" % str(signal_name)) + self._log("Warning: signal emitted with " + "wrong number of args: %s\n" + " from: file: %s\n" + " line: %d\n" + " func: %s\n" + % ((str(signal_name),) + inspect.stack()[1][1:4])) return if arg_types != None: for i in range(0,len(arg_types)): if not isinstance(args[i],arg_types[i]): - self._log("Warning: signal emitted with "\ - "wrong arg types: %s\n" % (str(signal_name),)) - self._log(" arg passed was: %s, type should be: %s\n" - % (args[i],repr(arg_types[i]))) + self._log("Warning: signal emitted with " + "wrong arg types: %s\n" + " from: file: %s\n" + " line: %d\n" + " func: %s\n" + % ((str(signal_name),) + inspect.stack()[1][1:4])) + + self._log(" arg passed was: %s, type of arg passed %s, type should be: %s\n" + % (args[i],repr(type(args[i])),repr(arg_types[i]))) return if signal_name in self.__callback_map.keys(): diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index c9f9fcdd3..c62bbcb28 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -110,7 +110,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): __signals__ = { 'database-changed' : (GrampsDbBase.GrampsDbBase,), - 'active-changed' : (str,), + 'active-changed' : (unicode,), } def __init__(self,args):