diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 98e483fa5..da569502d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -2,6 +2,12 @@ * src/EditPerson.py: Swap menu/submenu labels. * src/EventEdit.py: Menu label fixes. + * src/DisplayState.py: Simplify ID generation for UIManager. + * src/EditPerson.py: Use id(self) instead of self. + * src/EditPlace.py: Use id(self) instead of self. + * src/EditSource.py: Use id(self) instead of self. + * src/EventEdit.py: Use id(self) instead of self. + 2005-12-22 Don Allingham * src/AddrEdit.py: More window management * src/AttrEdit.py: More window management diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index 6b8101f1e..9d5ea022e 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -297,14 +297,14 @@ class GrampsWindowManager: pass return f - def generate_id(self,win_id): - return str(win_id).replace(' ','-')[1:-1] + def generate_id(self,item): + return str(item.window_id) def display_menu_list(self,data,action_data,mlist): i = mlist[0] - idval = self.generate_id(i.window_id) + idval = self.generate_id(i) data.write('' % idval) - data.write('' % self.generate_id(i.window_id)) + data.write('' % idval) action_data.append(("M:"+idval,None,i.submenu_label,None,None,None)) action_data.append((idval,None,i.menu_label,None,None, @@ -315,15 +315,14 @@ class GrampsWindowManager: if type(i) == list: self.display_menu_list(data,action_data,i) else: - idval = self.generate_id(i.window_id) + idval = self.generate_id(i) data.write('' - % self.generate_id(i.window_id)) + % self.generate_id(i)) action_data.append((idval,None,i.menu_label,None,None, self.call_back_factory(i))) data.write('') def build_windows_menu(self): - if self.active != DISABLED: self.uimanager.remove_ui(self.active) self.uimanager.remove_action_group(self.action_group) diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 0c22e6a56..4dfeb3e9b 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -456,11 +456,11 @@ class EditPerson(DisplayState.ManagedWindow): win_menu_label = _("New Person") return (_('Edit Person'),win_menu_label) - def build_window_key(self,obj): - if obj: - win_key = obj.get_handle() + def build_window_key(self,person): + if person: + return person.get_handle() else: - win_key = self + return id(self) def set_list_dnd(self,obj, get, begin, receive): obj.drag_dest_set(gtk.DEST_DEFAULT_ALL, [DdTargets.NAME.target()], diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index 939b3a76b..af90983a0 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -267,7 +267,7 @@ class EditPlace(DisplayState.ManagedWindow): if place: return place.get_handle() else: - return self + return id(self) def build_menu_names(self,place): win_menu_label = place.get_title() diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 45e2a46a1..07e5321d6 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -335,7 +335,7 @@ class EditSource(DisplayState.ManagedWindow): if source: return source.get_handle() else: - return self + return id(self) def build_menu_names(self,source): if source: diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 37a2379bb..e1d9224bd 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -282,7 +282,7 @@ class EventEditor(DisplayState.ManagedWindow): if obj: win_key = obj.get_handle() else: - win_key = self + win_key = id(self) def on_delete_event(self,obj,b): self.gladeif.close() @@ -577,7 +577,7 @@ class EventRefEditor(DisplayState.ManagedWindow): if self.event: return self.event.get_handle() else: - return self + return id(self) def on_help_clicked(self,obj): pass