2006-08-25 Zsolt Foldvari <zsolt.foldvari@nokia.com>

* src/GrampsCfg.py: Implement callback mechanism for dynamic name format
	change.
	* src/ViewManager.py (__init__, preferences_activate, change_page):
	Rebuild the active page after name fomat changed by connecting to
	GrampsPreferences' signal



svn: r7262
This commit is contained in:
Zsolt Foldvari 2006-08-25 17:17:37 +00:00
parent 80c7a2e038
commit cafde1e32c
3 changed files with 26 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2006-08-25 Zsolt Foldvari <zsolt.foldvari@nokia.com>
* src/GrampsCfg.py: Implement callback mechanism for dynamic name format
change.
* src/ViewManager.py (__init__, preferences_activate, change_page):
Rebuild the active page after name fomat changed by connecting to
GrampsPreferences' signal
2006-08-24 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsInMemDB.py (undo_data): Add method to take
care of secondary indices on undo/redo;

View File

@ -46,6 +46,7 @@ from RelLib import Name
import ManagedWindow
from GrampsWidgets import *
import QuestionDialog
from GrampsDb import GrampsDBCallback
#-------------------------------------------------------------------------
#
@ -91,9 +92,14 @@ def get_researcher():
#
#
#-------------------------------------------------------------------------
class GrampsPreferences(ManagedWindow.ManagedWindow):
def __init__(self, uistate, dbstate):
class GrampsPreferences(ManagedWindow.ManagedWindow,GrampsDBCallback):
__signals__ = {
'nameformat-changed': None,
}
def __init__(self, uistate, dbstate):
GrampsDBCallback.__init__(self)
ManagedWindow.ManagedWindow.__init__(self,uistate,[],GrampsPreferences)
self.dbstate = dbstate
@ -345,6 +351,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
new_idx = the_list.get_value(the_iter,COL_NUM)
Config.set(Config.NAME_FORMAT,new_idx)
_nd.set_default_format(new_idx)
self.emit('nameformat-changed')
def cb_format_tree_select(self, tree_selection):
"""

View File

@ -190,6 +190,7 @@ class ViewManager:
self.views = []
self.pages = []
self.file_loaded = False
self._prefs = None
self._build_main_window()
self._connect_signals()
self.do_load_plugins()
@ -517,7 +518,9 @@ class ViewManager:
def preferences_activate(self, obj):
try:
GrampsCfg.GrampsPreferences(self.uistate,self.state)
self._prefs = GrampsCfg.GrampsPreferences(self.uistate,self.state)
self._key = self._prefs.connect('nameformat-changed',
self.active_page.build_tree)
except Errors.WindowActiveError:
pass
@ -735,7 +738,11 @@ class ViewManager:
while gtk.events_pending():
gtk.main_iteration()
self.pages[num].change_page()
self.active_page.change_page()
if self._prefs:
self._prefs.disconnect(self._key)
self._key = self._prefs.connect('nameformat-changed',
self.active_page.build_tree)
def import_data(self, obj):
if self.state.db.db_is_open: