Start with fix up of connects to db in relationview.

Fix calling method of signals to a shorter algorithm based on lambda 
func


svn: r13115
This commit is contained in:
Benny Malengier
2009-08-24 21:44:15 +00:00
parent 3d13046fa0
commit 43663bbee7
4 changed files with 72 additions and 117 deletions

View File

@@ -74,7 +74,8 @@ class DbGUIElement(object):
def _connect_db_signals(self):
"""
Convenience method that is called on initialization of DbGUIElement.
Use this to group setup of the callman attribute
Use this to group setup of the callman attribute.
Also called in _change_db method
"""
pass
@@ -85,5 +86,23 @@ class DbGUIElement(object):
normally needed earlier, calling this method does so.
"""
database = self.callman.database
self.callman.disconnect_all()
if database.is_open():
#a closed database has disconnected all signals
self.callman.disconnect_all()
#set a new callback manager
self.callman = CallbackManager(database)
def _change_db(self, database):
"""
Change the database the GUI element works on to database.
This removes all callbacks and all registered handles.
:param database: the new database to connect to
"""
dbold = self.callman.database
if dbold.is_open():
#a closed database has disconnected all signals
self.callman.disconnect_all()
#set a new callback manager on new database
self.callman = CallbackManager(database)
self._connect_db_signals()