diff --git a/ChangeLog b/ChangeLog index f50c48df6..9995dcf68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-02-20 Don Allingham + * src/GrampsCfg.py: refactoring + * src/gen/utils/test/callback_test.py: refactoring + * src/gen/utils/callback.py: refactoring + * src/gen/utils/longop.py: refactoring + * src/gen/utils/__init__.py: refactoring + * src/gen/db/base.py: refactoring + * src/gen/Makefile.am: refactoring + * src/DisplayState.py: refactoring + * src/DbState.py: refactoring + * src/PluginUtils/_MenuOptions.py: refactoring + * src/ListModel.py: refactoring + * src/BaseDoc.py: refactoring + 2008-02-20 Brian Matherly * src/plugins/Verify.py: 0001792: Tools->Utilities->Verify the Data (exclude married names) diff --git a/src/BaseDoc.py b/src/BaseDoc.py index 348959327..5c799db14 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -187,11 +187,13 @@ class PaperSize: # #------------------------------------------------------------------------ class PaperStyle: - """Define the various options for a sheet of paper. + """ + Define the various options for a sheet of paper. """ def __init__(self, size, orientation, lmargin=2.54, rmargin=2.54, tmargin=2.54, bmargin=2.54): - """Create a new paper style. + """ + Create a new paper style. @param size: size of the new style @type size: PaperSize @@ -215,7 +217,8 @@ class PaperStyle: self.__bmargin = bmargin def get_size(self): - """Return the size of the paper. + """ + Return the size of the paper. @returns: object indicating the paper size @rtype: PaperSize @@ -224,7 +227,8 @@ class PaperStyle: return self.__size def get_orientation(self): - """Return the orientation of the page. + """ + Return the orientation of the page. @returns: PAPER_PORTRIAT or PAPER_LANDSCAPE @rtype: int @@ -233,7 +237,8 @@ class PaperStyle: return self.__orientation def get_usable_width(self): - """Return the width of the page area in centimeters. + """ + Return the width of the page area in centimeters. The value is the page width less the margins. @@ -241,7 +246,8 @@ class PaperStyle: return self.__size.get_width() - (self.__rmargin + self.__lmargin) def get_usable_height(self): - """Return the height of the page area in centimeters. + """ + Return the height of the page area in centimeters. The value is the page height less the margins. @@ -249,7 +255,8 @@ class PaperStyle: return self.__size.get_height() - (self.__tmargin + self.__bmargin) def get_right_margin(self): - """Return the right margin. + """ + Return the right margin. @returns: Right margin in centimeters @rtype: float @@ -258,7 +265,8 @@ class PaperStyle: return self.__rmargin def get_left_margin(self): - """Return the left margin. + """ + Return the left margin. @returns: Left margin in centimeters @rtype: float @@ -267,7 +275,8 @@ class PaperStyle: return self.__lmargin def get_top_margin(self): - """Return the top margin. + """ + Return the top margin. @returns: Top margin in centimeters @rtype: float @@ -276,7 +285,8 @@ class PaperStyle: return self.__tmargin def get_bottom_margin(self): - """Return the bottom margin. + """ + Return the bottom margin. @returns: Bottom margin in centimeters @rtype: float diff --git a/src/DbState.py b/src/DbState.py index be0e8730a..108401fbb 100644 --- a/src/DbState.py +++ b/src/DbState.py @@ -23,10 +23,10 @@ Provides the database state class """ from gen.db import GrampsDbBase -from gen.utils import GrampsDBCallback +from gen.utils import Callback import Config -class DbState(GrampsDBCallback): +class DbState(Callback): """ Provides a class to encapsulate the state of the database.. """ @@ -42,7 +42,7 @@ class DbState(GrampsDBCallback): Initalize the state with an empty (and useless) GrampsDbBase. This is just a place holder until a real DB is assigned. """ - GrampsDBCallback.__init__(self) + Callback.__init__(self) self.db = GrampsDbBase() self.open = False self.active = None diff --git a/src/DisplayState.py b/src/DisplayState.py index 869c663da..33b5695f5 100644 --- a/src/DisplayState.py +++ b/src/DisplayState.py @@ -64,7 +64,7 @@ DISABLED = -1 # History manager # #------------------------------------------------------------------------- -class History(gen.utils.GrampsDBCallback): +class History(gen.utils.Callback): """ History manages the objects of a certain type that have been viewed, with ability to go back, or forward. When accessing an object, it should be pushed on the History. @@ -76,7 +76,7 @@ class History(gen.utils.GrampsDBCallback): } def __init__(self): - gen.utils.GrampsDBCallback.__init__(self) + gen.utils.Callback.__init__(self) self.clear() def clear(self): @@ -293,7 +293,7 @@ class WarnHandler(RotateHandler): top.run() top.destroy() -class DisplayState(gen.utils.GrampsDBCallback): +class DisplayState(gen.utils.Callback): __signals__ = { 'filters-changed' : (str, ), @@ -310,7 +310,7 @@ class DisplayState(gen.utils.GrampsDBCallback): self.uimanager = uimanager self.progress_monitor = progress_monitor self.window = window - gen.utils.GrampsDBCallback.__init__(self) + gen.utils.Callback.__init__(self) self.status = status self.status_id = status.get_context_id('GRAMPS') self.progress = progress diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index c4bf9253e..fd537296e 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -132,6 +132,7 @@ class DisplayNameEditor(ManagedWindow.ManagedWindow): return (_(" Name Editor"), _("Preferences")) class GrampsPreferences(ManagedWindow.ManagedWindow): + def __init__(self, uistate, dbstate): self.dbstate = dbstate ManagedWindow.ManagedWindow.__init__(self, uistate, [], GrampsPreferences) diff --git a/src/ListModel.py b/src/ListModel.py index 8fd47d6d5..ef2711fca 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -96,6 +96,14 @@ class ListModel: self.double_click = event_func self.tree.connect('event', self.__button_press) + def __build_image_column(self, cnum, name, renderer, column): + renderer = gtk.CellRendererPixbuf() + column = gtk.TreeViewColumn(name[0], renderer) + column.add_attribute(renderer, 'pixbuf', cnum) + renderer.set_property('height', const.THUMBSCALE / 2) + return renderer, column + + def __build_columns(self, dlist): """ Builds the columns based of the data in dlist @@ -114,10 +122,7 @@ class ListModel: column = gtk.TreeViewColumn(name[0], renderer) column.add_attribute(renderer, 'active', cnum) elif name[0] and name[3] == IMAGE: - renderer = gtk.CellRendererPixbuf() - column = gtk.TreeViewColumn(name[0], renderer) - column.add_attribute(renderer, 'pixbuf', cnum) - renderer.set_property('height', const.THUMBSCALE/2) + renderer, column = self.__build_image_column(cnum, name, renderer, column) else: renderer = gtk.CellRendererText() renderer.set_fixed_height_from_font(True) diff --git a/src/PluginUtils/_MenuOptions.py b/src/PluginUtils/_MenuOptions.py index 6a5f5c6c0..e7800f313 100644 --- a/src/PluginUtils/_MenuOptions.py +++ b/src/PluginUtils/_MenuOptions.py @@ -34,7 +34,7 @@ import gen.utils # Option class # #------------------------------------------------------------------------- -class Option(gen.utils.GrampsDBCallback): +class Option(gen.utils.Callback): """ This class serves as a base class for all options. All Options must minimally provide the services provided by this class. Options are allowed @@ -54,7 +54,7 @@ class Option(gen.utils.GrampsDBCallback): @type value: The type will depend on the type of option. @return: nothing """ - gen.utils.GrampsDBCallback.__init__(self) + gen.utils.Callback.__init__(self) self.__value = value self.__label = label self.__help_str = "" diff --git a/src/gen/Makefile.am b/src/gen/Makefile.am index c9228b18f..383295161 100644 --- a/src/gen/Makefile.am +++ b/src/gen/Makefile.am @@ -3,7 +3,11 @@ # but that is not necessarily portable. # If not using GNU make, then list all .py files individually -SUBDIRS = proxy db lib utils +SUBDIRS = \ + proxy\ + db\ + lib\ + utils pkgdatadir = $(datadir)/@PACKAGE@/gen diff --git a/src/gen/db/base.py b/src/gen/db/base.py index 0a863baa2..4fa75ab18 100644 --- a/src/gen/db/base.py +++ b/src/gen/db/base.py @@ -49,7 +49,7 @@ LOG = logging.getLogger(".GrampsDb") #------------------------------------------------------------------------- from gen.lib import (MediaObject, Person, Family, Source, Event, Place, Repository, Note, GenderStats, Researcher) -from gen.utils.callback import GrampsDBCallback +from gen.utils.callback import Callback from iterator import CursorIterator #------------------------------------------------------------------------- @@ -119,7 +119,7 @@ class GrampsDbBookmarks: def insert(self, pos, item): self.bookmarks.insert(pos, item) -class GrampsDbBase(GrampsDBCallback): +class GrampsDbBase(Callback): """ GRAMPS database object. This object is a base class for all database interfaces. @@ -181,7 +181,7 @@ class GrampsDbBase(GrampsDBCallback): be created. """ - GrampsDBCallback.__init__(self) + Callback.__init__(self) self.set_person_id_prefix('I%04d') self.set_object_id_prefix('O%04d') diff --git a/src/gen/utils/__init__.py b/src/gen/utils/__init__.py index 338ec2e4e..e76f655c1 100644 --- a/src/gen/utils/__init__.py +++ b/src/gen/utils/__init__.py @@ -21,5 +21,5 @@ from dbutils import * from progressmon import ProgressMonitor from longop import LongOpStatus -from callback import GrampsDBCallback +from callback import Callback diff --git a/src/gen/utils/callback.py b/src/gen/utils/callback.py index 698f6b00b..c0648bdb5 100644 --- a/src/gen/utils/callback.py +++ b/src/gen/utils/callback.py @@ -8,7 +8,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -36,7 +36,6 @@ or the UI code. """ import sys -import os import types import traceback import inspect @@ -49,28 +48,28 @@ log = sys.stderr.write # #------------------------------------------------------------------------- -class GrampsDBCallback(object): +class Callback(object): """ - Callback and signal support for non-gtk parts of gramps. + Callback and signal support objects. Declaring signals ================= Classes that want to emit signals need to inherit from the - GrampsDBCallback class and ensure that its __init__ method + DBCallback class and ensure that its __init__ method is called. They then need to declare the signals that they can emit and the types of each callbacks arguments. For example:: - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { - 'test-signal' : (int,), + 'test-signal' : (int, ), 'test-noarg' : None } def __init__(self): - GrampsDBCallback.__init__(self) + Callback.__init__(self) The type signature is a tuple of types or classes. The type checking code uses the isinstance method to check that the @@ -90,7 +89,7 @@ class GrampsDBCallback(object): Signals are emitted using the emit method. e.g.:: def emit_signal(self): - self.emit('test-signal',(1,)) + self.emit('test-signal', (1, )) The parameters are passed as a tuple so a single parameter must be passed as a 1 element tuple. @@ -147,25 +146,25 @@ class GrampsDBCallback(object): ============================= Signals can be blocked on a per instance bassis or they can be blocked - for all instances of the GrampsDBCallback class. disable_signals() can + for all instances of the Callback class. disable_signals() can be used to block the signals for a single instance and disable_all_signals() can be used to block signals for the class: e.g.:: - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { - 'test-signal' : (int,), + 'test-signal' : (int, ), 'test-noarg' : None } def __init__(self): - GrampsDBCallback.__init__(self) + Callback.__init__(self) def emit_signal(self): - self.emit('test-signal',(1,)) + self.emit('test-signal', (1, )) t = TestSignals() @@ -178,15 +177,15 @@ class GrampsDBCallback(object): t.enable_signals() # block all signals - GrampsDBCallback.disable_all_signals() + Callback.disable_all_signals() ... # unblock all signals - GrampsDBCallback.enable_all_signals() + Callback.enable_all_signals() - Any signals emited whilst signals are blocked will be lost. + Any signals emitted whilst signals are blocked will be lost. Debugging signal callbacks @@ -197,7 +196,7 @@ class GrampsDBCallback(object): lots of logging information. To switch on logging for a single instance call self.enable_logging(), to switch it off again call self.disable_logging(). To switch on logging for all instance - you can toggle GrampsDBCallback.__LOG_ALL to True. + you can toggle Callback.__LOG_ALL to True. """ @@ -205,15 +204,8 @@ class GrampsDBCallback(object): # any class derived from this class. This should be toggled using # the class methods, dissable_all_signals() and enable_all_signals(). __BLOCK_ALL_SIGNALS = False + __LOG_ALL = False - - # If this is True logging will be turned on for all instances - # whether or not instance based logging is enabled. - try: - __LOG_ALL = int(os.environ.get('GRAMPS_SIGNAL',"0")) == 1 - except: - __LOG_ALL = False - def __init__(self): self.__enable_logging = False # controls whether lots of debug # information will be produced. @@ -222,7 +214,7 @@ class GrampsDBCallback(object): self.__callback_map = {} # dictionary containing all the connected # callback functions. The keys are the # signal names and the values are tuples - # of the form (key,bound_method), where + # of the form (key, bound_method), where # the key is unique within the instance # and the bound_method is the callback # that will be called when the signal is @@ -232,7 +224,7 @@ class GrampsDBCallback(object): # signal names and the values are tuples # containing the list of types of the arguments # that the callback methods must accept. - self._current_key = 0 # counter to give a unique key to each callback. + self._current_key = 0 # counter to give a unique key to each callback self._current_signals = [] # list of all the signals that are currently # being emitted by this instance. This is # used to prevent recursive emittion of the @@ -261,17 +253,17 @@ class GrampsDBCallback(object): # Build a signal dict from the list of signal dicts for s in trav(self.__class__): - for (k,v) in s.items(): + for (k, v) in s.items(): if self.__signal_map.has_key(k): # signal name clash - sys.err.write("Warning: signal name clash: %s\n" % str(k)) + sys.stderr.write("Warning: signal name clash: %s\n" % str(k)) self.__signal_map[k] = v # self.__signal_map now contains the connonical list # of signals that this instance can emit. - self._log("registed signals: \n %s\n" % - "\n ".join([ "%s: %s" % (k,v) for (k,v) + self._log("registered signals: \n %s\n" % + "\n ".join([ "%s: %s" % (k, v) for (k, v) in self.__signal_map.items() ])) @@ -295,12 +287,12 @@ class GrampsDBCallback(object): self._current_key += 1 self._log("Connecting callback to signal: " "%s with key: %s\n" - % (signal_name,str(self._current_key))) - self.__callback_map[signal_name].append((self._current_key,callback)) + % (signal_name, str(self._current_key))) + self.__callback_map[signal_name].append((self._current_key, callback)) return self._current_key - def disconnect(self,key): + def disconnect(self, key): """ Disconnect a callback. """ @@ -308,11 +300,11 @@ class GrampsDBCallback(object): # Find the key in the callback map. for signal_name in self.__callback_map.keys(): for cb in self.__callback_map[signal_name]: - (skey,fn) = cb + (skey, fn) = cb if skey == key: # delete the callback from the map. self._log("Disconnecting callback from signal" - ": %s with key: %s\n" % (signal_name, + ": %s with key: %s\n" % (signal_name, str(key))) self.__callback_map[signal_name].remove(cb) @@ -323,7 +315,7 @@ class GrampsDBCallback(object): arguments that match the types declared for the signals signature. """ # Check that signals are not blocked - if GrampsDBCallback.__BLOCK_ALL_SIGNALS or \ + if self.__BLOCK_ALL_SIGNALS or \ self.__block_instance_signals: return @@ -333,36 +325,36 @@ class GrampsDBCallback(object): " from: file: %s\n" " line: %d\n" " func: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4])) + % ((str(signal_name), ) + inspect.stack()[1][1:4])) return # check that the signal is not already being emitted. This prevents - # against recursive signal emmissions. + # against recursive signal emissions. if signal_name in self._current_signals: self._warn("Signal recursion blocked. " "Signals was : %s\n" " from: file: %s\n" " line: %d\n" " func: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4])) + % ((str(signal_name), ) + inspect.stack()[1][1:4])) return try: self._current_signals.append(signal_name) # check that args is a tuple. This is a common programming error. - if not (isinstance(args,tuple) or args == None): + if not (isinstance(args, tuple) or args == None): self._warn("Signal emitted with argument that is not a tuple.\n" " emit() takes two arguments, the signal name and a \n" " tuple that contains the arguments that are to be \n" " passed to the callbacks. If you are passing a signal \n" " argument it must be done as a single element tuple \n" - " e.g. emit('my-signal',(1,)) \n" + " e.g. emit('my-signal', (1, )) \n" " signal was: %s\n" " from: file: %s\n" " line: %d\n" " func: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4])) + % ((str(signal_name), ) + inspect.stack()[1][1:4])) return # type check arguments @@ -373,7 +365,7 @@ class GrampsDBCallback(object): " from: file: %s\n" " line: %d\n" " func: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4])) + % ((str(signal_name), ) + inspect.stack()[1][1:4])) return if len(args) > 0: @@ -383,42 +375,36 @@ class GrampsDBCallback(object): " from: file: %s\n" " line: %d\n" " func: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4])) + % ((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]): + for i in range(0, len(arg_types)): + if not isinstance(args[i], arg_types[i]): self._warn("Signal emitted with " "wrong arg types: %s\n" " from: file: %s\n" " line: %d\n" " func: %s\n" " arg passed was: %s, type of arg passed %s, type should be: %s\n" - % ((str(signal_name),) + inspect.stack()[1][1:4] +\ - (args[i],repr(type(args[i])),repr(arg_types[i])))) + % ((str(signal_name), ) + inspect.stack()[1][1:4] +\ + (args[i], repr(type(args[i])), repr(arg_types[i])))) return if signal_name in self.__callback_map.keys(): - self._log("emmitting signal: %s\n" % (signal_name,)) + self._log("emitting signal: %s\n" % (signal_name, )) # Don't bother if there are no callbacks. - for (key,fn) in self.__callback_map[signal_name]: - self._log("Calling callback with key: %s\n" % (key,)) + for (key, fn) in self.__callback_map[signal_name]: + self._log("Calling callback with key: %s\n" % (key, )) try: - if type(fn) == tuple: # call class method - cb[0](fn[1],*args) - elif type(fn) == types.FunctionType or \ - type(fn) == types.MethodType: # call func - fn(*args) -# try: -# fn(*args) -# except Errors.DbError: -# display_error() + if type(fn) == types.FunctionType or \ + type(fn) == types.MethodType: # call func + fn(*args) else: self._warn("Badly formed entry in callback map.\n") except: - self._warn("Exception occured in callback function.\n" - "%s" % ("".join(traceback.format_exception(*sys.exc_info())),)) + self._warn("Exception occurred in callback function.\n" + "%s" % ("".join(traceback.format_exception(*sys.exc_info())), )) finally: self._current_signals.remove(signal_name) @@ -431,7 +417,6 @@ class GrampsDBCallback(object): def enable_signals(self): self.__block_instance_signals = False - # logging methods def disable_logging(self): @@ -440,36 +425,26 @@ class GrampsDBCallback(object): def enable_logging(self): self.__enable_logging = True - def _log(self,msg): - if GrampsDBCallback.__LOG_ALL or self.__enable_logging: + def _log(self, msg): + if self.__LOG_ALL or self.__enable_logging: log("%s: %s" % (self.__class__.__name__, str(msg))) - def _warn(self,msg): + def _warn(self, msg): log("Warning: %s: %s" % (self.__class__.__name__, str(msg))) # # Class methods # - def __disable_all_signals(self): - GrampsDBCallback.__BLOCK_ALL_SIGNALS = True + @classmethod + def log_all(cls, enable): + cls.__LOG_ALL = enable - disable_all_signals = classmethod(__disable_all_signals) - - def __enable_all_signals(self): - GrampsDBCallback.__BLOCK_ALL_SIGNALS = False + @classmethod + def disable_all_signals(cls): + cls.__BLOCK_ALL_SIGNALS = True - enable_all_signals = classmethod(__enable_all_signals) - - -# def display_error(): -# from QuestionDialog import ErrorDialog -# ErrorDialog( -# _('Database error'), -# _('A problem as been detected in your database. ' -# 'This is probably caused by opening a database that was ' -# 'created with one transaction setting when the database was ' -# 'created with another, or by moving a non-portable database ' -# 'to a different machine.')) - + @classmethod + def enable_all_signals(cls): + cls.__BLOCK_ALL_SIGNALS = False diff --git a/src/gen/utils/longop.py b/src/gen/utils/longop.py index 47bb7ddbb..b9fb5fa22 100644 --- a/src/gen/utils/longop.py +++ b/src/gen/utils/longop.py @@ -1,8 +1,8 @@ import time -from callback import GrampsDBCallback +from callback import Callback -class LongOpStatus(GrampsDBCallback): +class LongOpStatus(Callback): """LongOpStatus provides a way of communicating the status of a long running operations. The intended use is that when a long running operation is about to start it should create an instance of this class and emit @@ -19,7 +19,7 @@ class LongOpStatus(GrampsDBCallback): Example usage: - class MyClass(GrampsDBCallback): + class MyClass(Callback): __signals__ = { 'op-start' : object @@ -80,7 +80,7 @@ class LongOpStatus(GrampsDBCallback): the operation. @type can_cancel: """ - GrampsDBCallback.__init__(self) + Callback.__init__(self) self._msg = msg self._total_steps = total_steps # don't allow intervals less that 1 diff --git a/src/gen/utils/test/callback_test.py b/src/gen/utils/test/callback_test.py index d4ef60daf..57bbe367b 100644 --- a/src/gen/utils/test/callback_test.py +++ b/src/gen/utils/test/callback_test.py @@ -3,13 +3,13 @@ import unittest from test import test_util as tu tu.path_append_parent() -from gen.utils import GrampsDBCallback +from gen.utils import Callback -class TestGrampsDBCallback(unittest.TestCase): +class TestCallback(unittest.TestCase): def test_simple(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-signal' : (int,) @@ -30,7 +30,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_exception_catch(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-signal' : (int,) @@ -68,7 +68,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_disconnect(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-signal' : (int,) @@ -95,7 +95,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_noargs(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-noargs' : None @@ -115,7 +115,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_no_callback(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-noargs' : None @@ -126,7 +126,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_subclassing(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-signal' : (int,) } @@ -155,7 +155,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_signal_block(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-signal' : (int,) @@ -172,11 +172,11 @@ class TestGrampsDBCallback(unittest.TestCase): assert len(rl) == 1, "No signal emitted" assert rl[0] == 1, "Wrong argument recieved" - GrampsDBCallback.disable_all_signals() + Callback.disable_all_signals() t.emit('test-signal',(1,)) assert len(rl) == 1, "Signal emitted while class blocked" - GrampsDBCallback.enable_all_signals() + Callback.enable_all_signals() t.emit('test-signal',(1,)) assert len(rl) == 2, "Signals not class unblocked" @@ -190,7 +190,7 @@ class TestGrampsDBCallback(unittest.TestCase): def test_type_checking(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { 'test-int' : (int,), 'test-list': (list,), @@ -238,10 +238,10 @@ class TestGrampsDBCallback(unittest.TestCase): def test_recursion_block(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { - 'test-recursion' : (GrampsDBCallback,) + 'test-recursion' : (Callback,) } def fn(cb): @@ -265,12 +265,12 @@ class TestGrampsDBCallback(unittest.TestCase): def test_multisignal_recursion_block(self): - class TestSignals(GrampsDBCallback): + class TestSignals(Callback): __signals__ = { - 'test-top' : (GrampsDBCallback,), - 'test-middle' : (GrampsDBCallback,), - 'test-bottom' : (GrampsDBCallback,) + 'test-top' : (Callback,), + 'test-middle' : (Callback,), + 'test-bottom' : (Callback,) } def top(cb):