* 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
This commit is contained in:
Don Allingham 2005-02-24 01:40:40 +00:00
parent 55a416f422
commit cb8c02aea0
4 changed files with 22 additions and 10 deletions

View File

@ -10,6 +10,9 @@
find_icon find_icon
* various: replace the deprecated gtk.TRUE/gtk.FALSE with * various: replace the deprecated gtk.TRUE/gtk.FALSE with
True/False 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 <dallingham@users.sourceforge.net> 2005-02-22 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps.glade: use ComboBox instead of ComboBoxEntry * src/gramps.glade: use ComboBox instead of ComboBoxEntry

View File

@ -90,10 +90,11 @@ class DbPrompter:
top.hide() top.hide()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
if new.get_active(): if new.get_active():
prompter = NewNativeDbPrompter(self.parent,self.parent_window) prompter = NewNativeDbPrompter(self.parent,
self.parent_window)
else: else:
prompter = ExistingDbPrompter(self.parent,self.parent_window) prompter = ExistingDbPrompter(self.parent,
self.parent_window)
if prompter.chooser(): if prompter.chooser():
break break
elif response == gtk.RESPONSE_CANCEL: elif response == gtk.RESPONSE_CANCEL:
@ -183,11 +184,18 @@ class ExistingDbPrompter:
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = choose.get_filename()
if len(filename) == 0:
return False
filetype = get_mime_type(filename) filetype = get_mime_type(filename)
(the_path,the_file) = os.path.split(filename) (the_path,the_file) = os.path.split(filename)
choose.destroy() choose.destroy()
if open_native(self.parent,filename,filetype): try:
return True 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 # The above native formats did not work, so we need to
# look up the importer for this format # look up the importer for this format

View File

@ -883,12 +883,12 @@ class FamilyView:
self.load_family(self.family) self.load_family(self.family)
def ap_parents_clicked(self,obj): 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): 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: if not person:
return return
plist = person.get_parent_family_handle_list() plist = person.get_parent_family_handle_list()
@ -898,7 +898,7 @@ class FamilyView:
if len(plist) == 1: if len(plist) == 1:
family_handle,m,r = plist[0] family_handle,m,r = plist[0]
else: else:
model, node = self.ap_selection.get_selected() model, node = select.get_selected()
path = model.get_path(node) path = model.get_path(node)
family_handle,m,r = plist[path[0]] family_handle,m,r = plist[path[0]]
family = self.parent.db.get_family_from_handle(family_handle) family = self.parent.db.get_family_from_handle(family_handle)

View File

@ -1012,7 +1012,7 @@ class Gramps:
self.source_view.change_db(self.db) self.source_view.change_db(self.db)
self.media_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""" """Incremental display update, update only the displayed page"""
page = self.views.get_current_page() page = self.views.get_current_page()
if page == PERSON_VIEW: 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_menu').set_sensitive(not self.db.readonly)
self.gtop.get_widget('tools').set_sensitive(not self.db.readonly) self.gtop.get_widget('tools').set_sensitive(not self.db.readonly)
self.goto_active_person() self.goto_active_person()
self.update_display()
return 1 return 1
def save_media(self,filename): def save_media(self,filename):