From d47ca2efc36e98a3516538b5733083886888e6e9 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 26 Nov 2006 21:18:30 +0000 Subject: [PATCH] * src/Editors/_EditPlace.py: consistent menu and title names * src/Editors/_EditSource.py: consistent menu and title names * src/Editors/_EditPerson.py: consistent menu and title names * src/Editors/_EditMedia.py: consistent menu and title names * src/Editors/_EditRepository.py: consistent menu and title names * src/Editors/_EditFamily.py: consistent menu and title names * src/Editors/_EditEvent.py: consistent menu and title names svn: r7709 --- gramps2/ChangeLog | 7 +++++++ gramps2/src/Editors/_EditEvent.py | 26 ++++++++++++-------------- gramps2/src/Editors/_EditFamily.py | 16 ++++++++++------ gramps2/src/Editors/_EditMedia.py | 21 ++++++++++++--------- gramps2/src/Editors/_EditPerson.py | 21 ++++++++++----------- gramps2/src/Editors/_EditPlace.py | 21 ++++++++++----------- gramps2/src/Editors/_EditRepository.py | 23 +++++++++++++++-------- gramps2/src/Editors/_EditSource.py | 23 ++++++++++------------- 8 files changed, 86 insertions(+), 72 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 13c804f27..4cee8e840 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -4,6 +4,13 @@ * NEWS: Typo. 2006-11-26 Don Allingham + * src/Editors/_EditPlace.py: consistent menu and title names + * src/Editors/_EditSource.py: consistent menu and title names + * src/Editors/_EditPerson.py: consistent menu and title names + * src/Editors/_EditMedia.py: consistent menu and title names + * src/Editors/_EditRepository.py: consistent menu and title names + * src/Editors/_EditFamily.py: consistent menu and title names + * src/Editors/_EditEvent.py: consistent menu and title names * src/docgen/ODFDoc.py: fix registration 2006-11-25 Don Allingham diff --git a/gramps2/src/Editors/_EditEvent.py b/gramps2/src/Editors/_EditEvent.py index e041bddfa..59ae8cad4 100644 --- a/gramps2/src/Editors/_EditEvent.py +++ b/gramps2/src/Editors/_EditEvent.py @@ -75,20 +75,23 @@ class EditEvent(EditPrimary): def empty_object(self): return RelLib.Event() + def get_menu_title(self): + if self.obj.get_handle(): + event_name = self.obj.get_description() + if not event_name: + event_name = str(self.obj.get_type()) + dialog_title = _('Event: %s') % event_name + else: + dialog_title = _('New Event') + return dialog_title + def get_custom_events(self): return self.dbstate.db.get_person_event_types() + \ self.dbstate.db.get_family_event_types() def _local_init(self): self.top = gtk.glade.XML(const.gladeFile, "event_edit","gramps") - - title = self.obj.get_description() - if title: - title = _('Event') + ": " + title - else: - title = _('Event') - - self.set_window(self.top.get_widget("event_edit"), None, title) + self.set_window(self.top.get_widget("event_edit"), None, self.get_menu_title()) self.place = self.top.get_widget('place') self.share_btn = self.top.get_widget('select_place') @@ -197,12 +200,7 @@ class EditEvent(EditPrimary): Config.sync() def build_menu_names(self,event): - if event: - event_name = str(event.get_type()) - submenu_label = _('Event: %s') % event_name - else: - submenu_label = _('New Event') - return (_('Event Editor'),submenu_label) + return (_('Edit Event'), self.get_menu_title()) def help_clicked(self,obj): """Display the relevant portion of GRAMPS manual""" diff --git a/gramps2/src/Editors/_EditFamily.py b/gramps2/src/Editors/_EditFamily.py index 85402aa18..acf33eaa1 100644 --- a/gramps2/src/Editors/_EditFamily.py +++ b/gramps2/src/Editors/_EditFamily.py @@ -428,18 +428,22 @@ class EditFamily(EditPrimary): self.update_mother(mhandle) self.child_list.rebuild() + def get_menu_title(self): + if self.obj.get_handle(): + dialog_title = Utils.family_name(self.obj, self.db, _("New Family")) + dialog_title = _("Family") + ': ' + dialog_title + else: + dialog_title = _("New Family") + return dialog_title + def build_menu_names(self,family): - win_menu_label = Utils.family_name(family,self.db,_("New Family")) - if not win_menu_label.strip(): - win_menu_label = _("New Family") - return (_('Edit Family'), win_menu_label) + return (_('Edit Family'), self.get_menu_title()) def build_interface(self): self.top = gtk.glade.XML(const.gladeFile,"family_editor","gramps") - self.set_window(self.top.get_widget("family_editor"), - None,_('Family Editor')) + self.set_window(self.top.get_widget("family_editor"), None, self.get_menu_title()) # restore window size width = Config.get(Config.FAMILY_WIDTH) diff --git a/gramps2/src/Editors/_EditMedia.py b/gramps2/src/Editors/_EditMedia.py index 9791d6562..49ce56e6c 100644 --- a/gramps2/src/Editors/_EditMedia.py +++ b/gramps2/src/Editors/_EditMedia.py @@ -65,18 +65,22 @@ class EditMedia(EditPrimary): def empty_object(self): return RelLib.MediaObject() + def get_menu_title(self): + if self.obj.get_handle(): + event_name = self.obj.get_description() + if not event_name: + event_name = str(self.obj.get_type()) + dialog_title = _('Media: %s') % event_name + else: + dialog_title = _('New Media') + return dialog_title + def _local_init(self): assert(self.obj) self.glade = gtk.glade.XML(const.gladeFile, "change_global","gramps") - title = self.obj.get_description() - if title: - title = _('Media') + ": " + title - else: - title = _('Media') - - self.set_window(self.glade.get_widget('change_global'), None, title) + self.set_window(self.glade.get_widget('change_global'), None, self.get_menu_title()) width = Config.get(Config.MEDIA_WIDTH) height = Config.get(Config.MEDIA_HEIGHT) self.window.resize(width, height) @@ -169,8 +173,7 @@ class EditMedia(EditPrimary): self.glade.get_widget('vbox').pack_start(notebook,True) def build_menu_names(self,person): - win_menu_label = _("Media Properties") - return (_('Edit Media Object'),win_menu_label) + return (_('Edit Media Object'), self.get_menu_title()) def select_file(self,obj): f = gtk.FileChooserDialog( diff --git a/gramps2/src/Editors/_EditPerson.py b/gramps2/src/Editors/_EditPerson.py index b3fbc83e3..dfb3fe99d 100644 --- a/gramps2/src/Editors/_EditPerson.py +++ b/gramps2/src/Editors/_EditPerson.py @@ -105,6 +105,14 @@ class EditPerson(EditPrimary): """ return RelLib.Person() + def get_menu_title(self): + pname = self.obj.get_primary_name() + if pname.is_empty(): + title = _('New Person') + else: + name = NameDisplay.displayer.display_name(self.pname) + title = _('Person') + ': %s' % name + def _local_init(self): """ Local initialization function. Performs basic initialization, @@ -119,13 +127,7 @@ class EditPerson(EditPrimary): self.load_obj = None self.top = gtk.glade.XML(const.person_glade, "edit_person", "gramps") - if self.pname.is_empty(): - title = _('Person') - else: - name = NameDisplay.displayer.display_name(self.pname) - title = _('Person') + ': %s' % name - - self.set_window(self.top.get_widget("edit_person"), None, title) + self.set_window(self.top.get_widget("edit_person"), None, self.get_menu_title()) width = Config.get(Config.PERSON_WIDTH) height = Config.get(Config.PERSON_HEIGHT) self.window.set_default_size(width, height) @@ -354,10 +356,7 @@ class EditPerson(EditPrimary): Provides the information need by the base class to define the window management menu entries. """ - win_menu_label = self.nd.display(person) - if not win_menu_label.strip(): - win_menu_label = _("New Person") - return (_('Edit Person'), win_menu_label) + return (_('Edit Person'), self.get_menu_title()) def _image_callback(self, ref, obj): """ diff --git a/gramps2/src/Editors/_EditPlace.py b/gramps2/src/Editors/_EditPlace.py index 94cf20e90..e6f16e77e 100644 --- a/gramps2/src/Editors/_EditPlace.py +++ b/gramps2/src/Editors/_EditPlace.py @@ -67,18 +67,20 @@ class EditPlace(EditPrimary): def _local_init(self): self.top = gtk.glade.XML(const.gladeFile,"place_editor","gramps") - title = self.obj.get_title() - if title: - title = _('Place') + ": " + title - else: - title = _('Place') - - self.set_window(self.top.get_widget("place_editor"), None, title) + self.set_window(self.top.get_widget("place_editor"), None, self.get_menu_title()) width = Config.get(Config.PLACE_WIDTH) height = Config.get(Config.PLACE_HEIGHT) self.window.resize(width, height) self.window.show() + def get_menu_title(self): + if self.obj.get_handle(): + title = self.obj.get_title() + dialog_title = _('Place: %s') % title + else: + dialog_title = _('New Place') + return dialog_title + def _connect_signals(self): self.define_ok_button(self.top.get_widget('ok'),self.save) self.define_cancel_button(self.top.get_widget('cancel')) @@ -144,10 +146,7 @@ class EditPlace(EditPrimary): self.db.readonly) def build_menu_names(self,place): - win_menu_label = place.get_title() - if not win_menu_label.strip(): - win_menu_label = _("New Place") - return (win_menu_label, _('Edit Place')) + return (_('Edit Place'), self.get_menu_title()) def _create_tabbed_pages(self): """ diff --git a/gramps2/src/Editors/_EditRepository.py b/gramps2/src/Editors/_EditRepository.py index 2fa3c4b4c..9c271e5d7 100644 --- a/gramps2/src/Editors/_EditRepository.py +++ b/gramps2/src/Editors/_EditRepository.py @@ -57,23 +57,30 @@ class EditRepository(EditPrimary): def empty_object(self): return RelLib.Repository() + def get_menu_title(self): + if self.obj.get_handle(): + title = self.obj.get_name() + if title: + title = _('Repository') + ": " + title + else: + title = _('Repository') + else: + title = _('New Repository') + return title + def _local_init(self): self.glade = gtk.glade.XML(const.gladeFile,"repository_editor","gramps") - title = self.obj.get_name() - print title - if title: - title = _('Repository') + ": " + title - else: - title = _('Repository') - - self.set_window(self.glade.get_widget("repository_editor"), None, title) + self.set_window(self.glade.get_widget("repository_editor"), None, self.get_menu_title()) width = Config.get(Config.REPO_WIDTH) height = Config.get(Config.REPO_HEIGHT) self.window.resize(width, height) self.window.show() + def build_menu_names(self,source): + return (_('Edit Repository'), self.get_menu_title()) + def _setup_fields(self): self.name = MonitoredEntry( diff --git a/gramps2/src/Editors/_EditSource.py b/gramps2/src/Editors/_EditSource.py index 9deb107fe..36710a2d5 100644 --- a/gramps2/src/Editors/_EditSource.py +++ b/gramps2/src/Editors/_EditSource.py @@ -66,19 +66,20 @@ class EditSource(EditPrimary): def empty_object(self): return RelLib.Source() + def get_menu_title(self): + title = self.obj.get_title() + if title: + title = _('Source') + ": " + title + else: + title = _('New Source') + return title + def _local_init(self): assert(self.obj) self.glade = gtk.glade.XML(const.gladeFile,"source_editor","gramps") - title = self.obj.get_title() - if title: - title = _('Source') + ": " + title - else: - title = _('Source') - - self.set_window(self.glade.get_widget("source_editor"), - None, title) + self.set_window(self.glade.get_widget("source_editor"), None, self.get_menu_title()) width = Config.get(Config.SOURCE_WIDTH) height = Config.get(Config.SOURCE_HEIGHT) self.window.resize(width, height) @@ -156,11 +157,7 @@ class EditSource(EditPrimary): self.glade.get_widget('vbox').pack_start(notebook,True) def build_menu_names(self,source): - if source: - label = "Edit Source" - else: - label = "New Source" - return (label, _('Source Editor')) + return (_('Edit Source'), self.get_menu_title()) def save(self,*obj): if self.object_is_empty():