* 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.


svn: r5625
This commit is contained in:
Alex Roitman 2005-12-23 20:09:02 +00:00
parent 8aa4a8abde
commit 0d7edcd59e
6 changed files with 20 additions and 15 deletions

View File

@ -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 <don@gramps-project.org>
* src/AddrEdit.py: More window management
* src/AttrEdit.py: More window management

View File

@ -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('<menu action="M:%s">' % idval)
data.write('<menuitem action="%s"/>' % self.generate_id(i.window_id))
data.write('<menuitem action="%s"/>' % 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('<menuitem action="%s"/>'
% 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('</menu>')
def build_windows_menu(self):
if self.active != DISABLED:
self.uimanager.remove_ui(self.active)
self.uimanager.remove_action_group(self.action_group)

View File

@ -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()],

View File

@ -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()

View File

@ -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:

View File

@ -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