* src/Config/_GrampsIniKeys.py: Allow multiple functions to use notify_add

svn: r7145
This commit is contained in:
Brian Matherly 2006-08-09 03:12:15 +00:00
parent b1522eab91
commit 3b7644a3f1
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2006-08-08 Brian Matherly <brian@gramps-project.org>
* src/Config/_GrampsIniKeys.py: Allow multiple functions to use notify_add
2006-08-07 Alex Roitman <shura@gramps-project.org>
* src/DataViews/_RepositoryView.py: Add filter sidebar.
* src/FilterEditor/_ShowResults.py: Support repo filters.

View File

@ -62,7 +62,10 @@ class IniKeyClient:
key = parts[-1]
if section not in self.callbacks:
self.callbacks[section] = {}
self.callbacks[section][key] = func
if key not in self.callbacks[section]:
self.callbacks[section][key] = []
if func not in self.callbacks[section][key]:
self.callbacks[section][key].append(func)
def load_ini(self, filename):
""" Load .ini into dict of dicts, which it returns """
@ -131,7 +134,8 @@ class IniKeyClient:
self.data[key[0]] = {}
self.data[key[0]][key[1]] = str(val)
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
for func in self.callbacks[key[0]][key[1]]:
func(self,0,self.data[key[0]][key[1]],None)
def set_string(self, key, val):
""" Emulates gconf's client method """
@ -139,7 +143,8 @@ class IniKeyClient:
self.data[key[0]] = {}
self.data[key[0]][key[1]] = val
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
for func in self.callbacks[key[0]][key[1]]:
func(self,0,self.data[key[0]][key[1]],None)
def set_int(self, key, val):
""" Emulates gconf's client method """
@ -147,7 +152,8 @@ class IniKeyClient:
self.data[key[0]] = {}
self.data[key[0]][key[1]] = str(val)
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
for func in self.callbacks[key[0]][key[1]]:
func(self,0,self.data[key[0]][key[1]],None)
def suggest_sync(self):
self.save_ini() # save back to default file, if named