2005-04-07 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/gramps_main.py: correct type signature for 'active-changed' signal. * src/GrampsDBCallback.py: improve the error reporting. svn: r4318
This commit is contained in:
parent
d23b249b9d
commit
0c112b11eb
@ -1,3 +1,7 @@
|
|||||||
|
2005-04-07 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
|
* src/gramps_main.py: correct type signature for 'active-changed' signal.
|
||||||
|
* src/GrampsDBCallback.py: improve the error reporting.
|
||||||
|
|
||||||
2005-04-06 Don Allingham <don@gramps-project.org>
|
2005-04-06 Don Allingham <don@gramps-project.org>
|
||||||
* src/FamilyView.py: keep track of local person during update, connect
|
* src/FamilyView.py: keep track of local person during update, connect
|
||||||
active-changed signal
|
active-changed signal
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import traceback
|
import traceback
|
||||||
|
import inspect
|
||||||
|
|
||||||
log = sys.stderr.write
|
log = sys.stderr.write
|
||||||
|
|
||||||
@ -326,29 +327,45 @@ class GrampsDBCallback(object):
|
|||||||
# Check signal exists
|
# Check signal exists
|
||||||
if signal_name not in self.__signal_map.keys():
|
if signal_name not in self.__signal_map.keys():
|
||||||
self._log("Warning: attempt to emit to unknown signal: %s\n"
|
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
|
return
|
||||||
|
|
||||||
# type check arguments
|
# type check arguments
|
||||||
arg_types = self.__signal_map[signal_name]
|
arg_types = self.__signal_map[signal_name]
|
||||||
if arg_types == None and len(args) > 0:
|
if arg_types == None and len(args) > 0:
|
||||||
self._log("Warning: signal emitted with "\
|
self._log("Warning: signal emitted with "
|
||||||
"wrong number of args: %s\n" % str(signal_name))
|
"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
|
return
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
if len(args) != len(arg_types):
|
if len(args) != len(arg_types):
|
||||||
self._log("Warning: signal emitted with "\
|
self._log("Warning: signal emitted with "
|
||||||
"wrong number of args: %s\n" % str(signal_name))
|
"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
|
return
|
||||||
|
|
||||||
if arg_types != None:
|
if arg_types != None:
|
||||||
for i in range(0,len(arg_types)):
|
for i in range(0,len(arg_types)):
|
||||||
if not isinstance(args[i],arg_types[i]):
|
if not isinstance(args[i],arg_types[i]):
|
||||||
self._log("Warning: signal emitted with "\
|
self._log("Warning: signal emitted with "
|
||||||
"wrong arg types: %s\n" % (str(signal_name),))
|
"wrong arg types: %s\n"
|
||||||
self._log(" arg passed was: %s, type should be: %s\n"
|
" from: file: %s\n"
|
||||||
% (args[i],repr(arg_types[i])))
|
" 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
|
return
|
||||||
|
|
||||||
if signal_name in self.__callback_map.keys():
|
if signal_name in self.__callback_map.keys():
|
||||||
|
@ -110,7 +110,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
|
|||||||
|
|
||||||
__signals__ = {
|
__signals__ = {
|
||||||
'database-changed' : (GrampsDbBase.GrampsDbBase,),
|
'database-changed' : (GrampsDbBase.GrampsDbBase,),
|
||||||
'active-changed' : (str,),
|
'active-changed' : (unicode,),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self,args):
|
def __init__(self,args):
|
||||||
|
Loading…
Reference in New Issue
Block a user