From 46248ee75fc7a29f47b16bd486788f69c489ffbf Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 25 Aug 2006 23:46:19 +0000 Subject: [PATCH] * src/ViewManager.py (preferences_activate): Use uistate to emit. * src/DisplayState.py (DisplayState.__signals__): Add new signal. * src/GrampsCfg.py (cb_name_changed): Use uistate to emit signal. svn: r7265 --- gramps2/ChangeLog | 3 +++ gramps2/src/DisplayState.py | 1 + gramps2/src/GrampsCfg.py | 14 ++++---------- gramps2/src/ViewManager.py | 16 ++++++++-------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d921e5576..6b7a379c9 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2006-08-25 Alex Roitman + * src/ViewManager.py (preferences_activate): Use uistate to emit. + * src/DisplayState.py (DisplayState.__signals__): Add new signal. + * src/GrampsCfg.py (cb_name_changed): Use uistate to emit signal. * src/plugins/ChangeTypes.py: Clean up type name conversions; work over all the events, regardless of who references them. * src/RelLib/_GrampsType.py (get_standard_names, get_standard_xml): diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index 7debb4e28..52dfc9cfb 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -249,6 +249,7 @@ class DisplayState(GrampsDb.GrampsDBCallback): __signals__ = { 'filters-changed' : (str,), + 'nameformat-changed' : None, } def __init__(self, window, status, progress, warnbtn, uimanager): diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 6ce0e96c1..ff1164cd1 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -46,7 +46,6 @@ from RelLib import Name import ManagedWindow from GrampsWidgets import * import QuestionDialog -from GrampsDb import GrampsDBCallback #------------------------------------------------------------------------- # @@ -92,18 +91,13 @@ def get_researcher(): # # #------------------------------------------------------------------------- -class GrampsPreferences(ManagedWindow.ManagedWindow,GrampsDBCallback): - - __signals__ = { - 'nameformat-changed': None, - } - +class GrampsPreferences(ManagedWindow.ManagedWindow): def __init__(self, uistate, dbstate): - GrampsDBCallback.__init__(self) + ManagedWindow.ManagedWindow.__init__(self,uistate,[],GrampsPreferences) self.dbstate = dbstate - + tlabel = gtk.Label() self.set_window( gtk.Dialog(_('Preferences'), @@ -351,7 +345,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow,GrampsDBCallback): 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') + self.uistate.emit('nameformat-changed') def cb_format_tree_select(self, tree_selection): """ diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index dfbb332f0..13af9aaad 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -189,8 +189,8 @@ class ViewManager: self.active_page = None self.views = [] self.pages = [] + self._key = None self.file_loaded = False - self._prefs = None self._build_main_window() self._connect_signals() self.do_load_plugins() @@ -518,9 +518,9 @@ class ViewManager: def preferences_activate(self, obj): try: - self._prefs = GrampsCfg.GrampsPreferences(self.uistate,self.state) - self._key = self._prefs.connect('nameformat-changed', - self.active_page.build_tree) + GrampsCfg.GrampsPreferences(self.uistate,self.state) + self._key = self.uistate.connect('nameformat-changed', + self.active_page.build_tree) except Errors.WindowActiveError: pass @@ -739,10 +739,10 @@ class ViewManager: gtk.main_iteration() 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) + if self._key: + self.uistate.disconnect(self._key) + self._key = self.uistate.connect('nameformat-changed', + self.active_page.build_tree) def import_data(self, obj): if self.state.db.db_is_open: