From d920d5f78c9e9deef1e3b029a135bca4ce37a20d Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 24 Feb 2005 01:40:40 +0000 Subject: [PATCH] * src/DbPrompter.py: catch zero length filename * src/FamilyView.py: fixed selection of spouse's parents * src/gramps_main.py: update display after loading data svn: r4086 --- gramps2/ChangeLog | 3 +++ gramps2/src/DbPrompter.py | 18 +++++++++++++----- gramps2/src/FamilyView.py | 8 ++++---- gramps2/src/gramps_main.py | 3 ++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d18f4daf2..6a936b8a6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -10,6 +10,9 @@ find_icon * various: replace the deprecated gtk.TRUE/gtk.FALSE with True/False + * src/DbPrompter.py: catch zero length filename + * src/FamilyView.py: fixed selection of spouse's parents + * src/gramps_main.py: update display after loading data 2005-02-22 Don Allingham * src/gramps.glade: use ComboBox instead of ComboBoxEntry diff --git a/gramps2/src/DbPrompter.py b/gramps2/src/DbPrompter.py index 5174c666e..d7f1fedd2 100644 --- a/gramps2/src/DbPrompter.py +++ b/gramps2/src/DbPrompter.py @@ -90,10 +90,11 @@ class DbPrompter: top.hide() if response == gtk.RESPONSE_OK: if new.get_active(): - prompter = NewNativeDbPrompter(self.parent,self.parent_window) + prompter = NewNativeDbPrompter(self.parent, + self.parent_window) else: - prompter = ExistingDbPrompter(self.parent,self.parent_window) - + prompter = ExistingDbPrompter(self.parent, + self.parent_window) if prompter.chooser(): break elif response == gtk.RESPONSE_CANCEL: @@ -183,11 +184,18 @@ class ExistingDbPrompter: response = choose.run() if response == gtk.RESPONSE_OK: filename = choose.get_filename() + if len(filename) == 0: + return False filetype = get_mime_type(filename) (the_path,the_file) = os.path.split(filename) choose.destroy() - if open_native(self.parent,filename,filetype): - return True + try: + if open_native(self.parent,filename,filetype): + return True + except: + QuestionDialog.ErrorDialog( + _("Could not open file: %s") % filename) + return False # The above native formats did not work, so we need to # look up the importer for this format diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index d2feccec5..c262c751a 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -883,12 +883,12 @@ class FamilyView: self.load_family(self.family) def ap_parents_clicked(self,obj): - self.change_families(self.person) + self.change_families(self.person, self.ap_selection) def sp_parents_clicked(self,obj): - self.change_families(self.selected_spouse) + self.change_families(self.selected_spouse, self.sp_selection) - def change_families(self,person): + def change_families(self,person,select): if not person: return plist = person.get_parent_family_handle_list() @@ -898,7 +898,7 @@ class FamilyView: if len(plist) == 1: family_handle,m,r = plist[0] else: - model, node = self.ap_selection.get_selected() + model, node = select.get_selected() path = model.get_path(node) family_handle,m,r = plist[path[0]] family = self.parent.db.get_family_from_handle(family_handle) diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index f728b4405..5756fcdd6 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -1012,7 +1012,7 @@ class Gramps: self.source_view.change_db(self.db) self.media_view.change_db(self.db) - def update_display(self,changed): + def update_display(self,changed=True): """Incremental display update, update only the displayed page""" page = self.views.get_current_page() if page == PERSON_VIEW: @@ -1128,6 +1128,7 @@ class Gramps: self.gtop.get_widget('tools_menu').set_sensitive(not self.db.readonly) self.gtop.get_widget('tools').set_sensitive(not self.db.readonly) self.goto_active_person() + self.update_display() return 1 def save_media(self,filename):