2007-05-14 Don Allingham <don@gramps-project.org>

* src/DataViews/_PedigreeView.py: catch errors
	* src/DataViews/_RelationView.py: catch errors
	* src/ReportBase/_ReportDialog.py: catch errors
	* src/ReportBase/_SimpleAccess.py: fix marriage place/date values
	* src/Editors/_EditFamily.py: catch errors
	* src/DisplayTabs/_EmbeddedList.py: catch errors
	* src/plugins/FindDupes.py: catch errors
	* src/plugins/Verify.py: catch errors
	* src/AddMedia.py: fix scale_simple types
	* src/AutoComp.py: pylint fixes
	* src/ImgManip.py: pylint fixes
	* src/LdsUtils.py: new temple types
	* src/DbLoader.py: error types



svn: r8473
This commit is contained in:
Don Allingham 2007-05-15 04:17:12 +00:00
parent 4f675b6768
commit 247e0020ed
15 changed files with 304 additions and 228 deletions

View File

@ -1,3 +1,18 @@
2007-05-14 Don Allingham <don@gramps-project.org>
* src/DataViews/_PedigreeView.py: catch errors
* src/DataViews/_RelationView.py: catch errors
* src/ReportBase/_ReportDialog.py: catch errors
* src/ReportBase/_SimpleAccess.py: fix marriage place/date values
* src/Editors/_EditFamily.py: catch errors
* src/DisplayTabs/_EmbeddedList.py: catch errors
* src/plugins/FindDupes.py: catch errors
* src/plugins/Verify.py: catch errors
* src/AddMedia.py: fix scale_simple types
* src/AutoComp.py: pylint fixes
* src/ImgManip.py: pylint fixes
* src/LdsUtils.py: new temple types
* src/DbLoader.py: error types
2007-05-14 Brian Matherly <brian@gramps-project.org>
* src/plugins/NarrativeWeb.py: 0001044: ReportWeb Site, tab Page Generation
- items in dropdown list do not sort correctly

View File

@ -59,8 +59,6 @@ import Mime
import GrampsDisplay
import ManagedWindow
_last_directory = None
#-------------------------------------------------------------------------
#
# AddMediaObject
@ -71,8 +69,10 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
Displays the Add Media Dialog window, allowing the user to select
a media object from the file system, while providing a description.
"""
last_directory = None
def __init__(self,dbstate, uistate, track):
def __init__(self, dbstate, uistate, track):
"""
Creates and displays the dialog box
@ -81,8 +81,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"imageSelect","gramps")
self.dbase = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile, "imageSelect", "gramps")
self.set_window(
self.glade.get_widget("imageSelect"),
@ -92,11 +92,11 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
self.description = self.glade.get_widget("photoDescription")
self.image = self.glade.get_widget("image")
self.file_text = self.glade.get_widget("fname")
if _last_directory and os.path.isdir(_last_directory):
self.file_text.set_current_folder(_last_directory)
if self.last_directory and os.path.isdir(self.last_directory):
self.file_text.set_current_folder(self.last_directory)
self.internal = self.glade.get_widget('internal')
self.internal.connect('toggled',self.internal_toggled)
self.internal.connect('toggled', self.internal_toggled)
self.relpath = self.glade.get_widget('relpath')
self.temp_name = ""
self.object = None
@ -106,23 +106,27 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
self.show()
def build_menu_names(self, obj):
return(_('Select media object'),None)
"""
Build the menu name for the window manager
"""
return(_('Select media object'), None)
def internal_toggled(self, obj):
"""
Toggles the file_text icon.
"""
self.file_text.set_sensitive(not obj.get_active())
def on_help_imagesel_clicked(self,obj):
def on_help_imagesel_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('gramps-edit-quick')
self.val = self.window.run()
self.window.run()
def save(self):
"""
Callback function called with the save button is pressed.
A new media object is created, and added to the database.
"""
global _last_directory
description = unicode(self.description.get_text())
if self.internal.get_active():
@ -136,10 +140,10 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
full_file = filename
if self.relpath.get_active():
p = self.db.get_save_path()
if not os.path.isdir(p):
p = os.path.dirname(p)
filename = Utils.relative_path(filename,p)
pname = self.dbase.get_save_path()
if not os.path.isdir(pname):
pname = os.path.dirname(pname)
filename = Utils.relative_path(filename, pname)
if os.path.exists(filename) == 0:
msgstr = _("Cannot import %s")
@ -156,29 +160,28 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
mobj.set_mime_type(mtype)
name = filename
mobj.set_path(name)
_last_directory = os.path.dirname(filename)
self.last_directory = os.path.dirname(filename)
mobj.set_handle(Utils.create_id())
if not mobj.get_gramps_id():
mobj.set_gramps_id(self.db.find_next_object_gramps_id())
trans = self.db.transaction_begin()
mobj.set_gramps_id(self.dbase.find_next_object_gramps_id())
trans = self.dbase.transaction_begin()
self.object = mobj
self.db.commit_media_object(mobj,trans)
self.db.transaction_commit(trans,_("Add Media Object"))
self.dbase.commit_media_object(mobj, trans)
self.dbase.transaction_commit(trans, _("Add Media Object"))
def on_name_changed(self,*obj):
def on_name_changed(self, *obj):
"""
Called anytime the filename text window changes. Checks to
see if the file exists. If it does, the imgae is loaded into
the preview window.
"""
fn = self.file_text.get_filename()
if not fn:
fname = self.file_text.get_filename()
if not fname:
return
filename = unicode(fn, sys.getfilesystemencoding())
filename = unicode(fname, sys.getfilesystemencoding())
basename = os.path.basename(filename)
(root,ext) = os.path.splitext(basename)
(root, ext) = os.path.splitext(basename)
old_title = unicode(self.description.get_text())
if old_title == '' or old_title == self.temp_name:
@ -189,12 +192,15 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
if filename:
mtype = Mime.get_type(filename)
if mtype and mtype.startswith("image"):
image = scale_image(filename,const.thumbScale)
image = scale_image(filename, const.thumbScale)
else:
image = Mime.find_mime_type_pixbuf(mtype)
self.image.set_from_pixbuf(image)
def run(self):
"""
Run the dialog, returning the selected object.
"""
while True:
val = self.window.run()
@ -214,7 +220,10 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
# scale_image
#
#-------------------------------------------------------------------------
def scale_image(path,size):
def scale_image(path, size):
"""
Scales the image to the specified size
"""
title_msg = _("Cannot display %s") % path
detail_msg = _('GRAMPS is not able to display the image file. '
@ -225,7 +234,7 @@ def scale_image(path,size):
width = image1.get_width()
height = image1.get_height()
scale = size / float(max(width,height))
scale = size / float(max(width, height))
return image1.scale_simple(int(scale*width), int(scale*height),
gtk.gdk.INTERP_BILINEAR)
except:

View File

@ -42,7 +42,7 @@ log = logging.getLogger(".AutoComp")
#-------------------------------------------------------------------------
import gtk
def fill_combo(combo,data_list):
def fill_combo(combo, data_list):
store = gtk.ListStore(str)
for data in data_list:
@ -57,7 +57,7 @@ def fill_combo(combo,data_list):
completion.set_text_column(0)
combo.child.set_completion(completion)
def fill_entry(entry,data_list):
def fill_entry(entry, data_list):
store = gtk.ListStore(str)
for data in data_list:
@ -70,7 +70,7 @@ def fill_entry(entry,data_list):
completion.set_text_column(0)
entry.set_completion(completion)
def fill_option_text(combobox,data):
def fill_option_text(combobox, data):
store = gtk.ListStore(str)
for item in data:
if item:
@ -80,8 +80,7 @@ def fill_option_text(combobox,data):
def get_option(combobox):
store = combobox.get_model()
return store.get_value(combobox.get_active_iter(),0)
return store.get_value(combobox.get_active_iter(), 0)
#-------------------------------------------------------------------------
#
@ -118,7 +117,7 @@ class StandardCustomSelector:
(active_key,mapping[active_key]) tuple.
"""
def __init__(self,mapping,cbe=None,custom_key=None,active_key=None,
def __init__(self, mapping, cbe=None, custom_key=None, active_key=None,
additional=None):
"""
Constructor for the StandardCustomSelector class.
@ -141,7 +140,7 @@ class StandardCustomSelector:
self.additional = additional
# make model
self.store = gtk.ListStore(int,str)
self.store = gtk.ListStore(int, str)
# fill it up using mapping
self.fill()
@ -152,7 +151,7 @@ class StandardCustomSelector:
self.selector.set_model(self.store)
self.selector.set_text_column(1)
else:
self.selector = gtk.ComboBoxEntry(self.store,1)
self.selector = gtk.ComboBoxEntry(self.store, 1)
if self.active_key != None:
self.selector.set_active(self.active_index)
@ -169,7 +168,7 @@ class StandardCustomSelector:
index = 0
for key in keys:
if key != self.custom_key:
self.store.append(row=[key,self.mapping[key]])
self.store.append(row=[key, self.mapping[key]])
if key == self.active_key:
self.active_index = index
index = index + 1
@ -188,13 +187,13 @@ class StandardCustomSelector:
self.active_index = index
index = index + 1
def by_value(self,f,s):
def by_value(self, first, second):
"""
Method for sorting keys based on the values.
"""
fv = self.mapping[f]
sv = self.mapping[s]
return locale.strcoll(fv,sv)
fvalue = self.mapping[first]
svalue = self.mapping[second]
return locale.strcoll(fvalue, svalue)
def get_values(self):
"""
@ -203,60 +202,59 @@ class StandardCustomSelector:
@return: Returns (int,str) tuple corresponding to the selection.
@rtype: tuple
"""
ai = self.selector.get_active_iter()
if ai:
i = self.store.get_value(ai,0)
s = self.store.get_value(ai,1)
if s != self.mapping[i]:
s = self.selector.child.get_text().strip()
active_iter = self.selector.get_active_iter()
if active_iter:
int_val = self.store.get_value(active_iter, 0)
str_val = self.store.get_value(active_iter, 1)
if str_val != self.mapping[int_val]:
str_val = self.selector.child.get_text().strip()
else:
i = self.custom_key
s = self.selector.child.get_text().strip()
if s in self.mapping.values():
int_val = self.custom_key
str_val = self.selector.child.get_text().strip()
if str_val in self.mapping.values():
for key in self.mapping.keys():
if s == self.mapping[key]:
i = key
if str_val == self.mapping[key]:
int_val = key
break
else:
i = self.custom_key
return (i,s)
int_val = self.custom_key
return (int_val, str_val)
def set_values(self,val):
def set_values(self, val):
"""
Set values according to given tuple.
@param val: (int,str) tuple with the values to set.
@type val: tuple
"""
i,s = val
i, s = val
if i in self.mapping.keys() and i != self.custom_key:
self.store.foreach(self.set_int_value,i)
self.store.foreach(self.set_int_value, i)
elif self.custom_key != None:
self.selector.child.set_text(s)
else:
print "StandardCustomSelector.set(): Option not available:", val
def set_int_value(self,model,path,iter,val):
if model.get_value(iter,0) == val:
def set_int_value(self, model, path, iter, val):
if model.get_value(iter, 0) == val:
self.selector.set_active_iter(iter)
return True
return False
#-------------------------------------------------------------------------
#
# Testing code below this point
#
#-------------------------------------------------------------------------
if __name__ == "__main__":
def here(obj,event):
def here(obj, event):
print s.get_values()
gtk.main_quit()
s = StandardCustomSelector({0:'abc',1:'abd',2:'bbe'},None,0,1)
s.set_values((2,'bbe'))
s = StandardCustomSelector({0:'abc', 1:'abd', 2:'bbe' }, None, 0, 1)
s.set_values((2, 'bbe'))
w = gtk.Dialog()
w.child.add(s.selector)
w.connect('delete-event',here)
w.connect('delete-event', here)
w.show_all()
gtk.main()

View File

@ -61,6 +61,7 @@ from Editors import EditPerson, EditFamily
from DdTargets import DdTargets
import cPickle as pickle
from QuestionDialog import RunDatabaseRepair
#-------------------------------------------------------------------------
#
@ -601,11 +602,14 @@ class PedigreeView(PageView.PersonNavView):
all handling of visibility is now in rebuild_trees, see that for more
information.
"""
active = self.dbstate.get_active_person()
if active:
self.rebuild_trees(active.handle)
else:
self.rebuild_trees(None)
try:
active = self.dbstate.get_active_person()
if active:
self.rebuild_trees(active.handle)
else:
self.rebuild_trees(None)
except AttributeError, msg:
RunDatabaseRepair(str(msg))
def change_db(self,db):
"""

View File

@ -1033,6 +1033,9 @@ class RelationshipView(PageView.PersonNavView):
from Editors import EditFamily
family = RelLib.Family()
person = self.dbstate.active
if not person:
return
if person.gender == RelLib.Person.MALE:
family.set_father_handle(person.handle)
@ -1094,6 +1097,9 @@ class RelationshipView(PageView.PersonNavView):
family = RelLib.Family()
person = self.dbstate.active
if not person:
return
ref = RelLib.ChildRef()
ref.ref = person.handle
family.add_child_ref(ref)

View File

@ -453,6 +453,9 @@ class DbLoader:
os.chdir(os.path.dirname(filename))
except:
print "could not change directory"
except OSError, msg:
QuestionDialog.ErrorDialog(
_("Could not open file: %s") % filename, str(msg))
except DBRunRecoveryError, msg:
QuestionDialog.ErrorDialog(
_("Low level database corruption detected"),

View File

@ -401,7 +401,13 @@ class EmbeddedList(ButtonTab):
Rebuilds the data in the database by creating a new model,
using the build_model function passed at creation time.
"""
self.model = self.build_model(self.get_data(), self.dbstate.db)
try:
self.model = self.build_model(self.get_data(), self.dbstate.db)
except AttributeError, msg:
from QuestionDialog import RunDatabaseRepair
RunDatabaseRepair(str(msg))
return
self.tree.set_model(self.model)
self._set_label()
self._selection_changed()

View File

@ -255,8 +255,11 @@ class ChildEmbedList(EmbeddedList):
if ref.ref == handle:
p = self.dbstate.db.get_person_from_handle(handle)
n = NameDisplay.displayer.display(p)
EditChildRef(n, self.dbstate, self.uistate, self.track,
ref, self.child_ref_edited)
try:
EditChildRef(n, self.dbstate, self.uistate, self.track,
ref, self.child_ref_edited)
except Errors.WindowActiveError, msg:
pass
break
def edit_child_button_clicked(self, obj):
@ -792,7 +795,12 @@ class EditFamily(EditPrimary):
len(self.obj.get_child_ref_list()) == 0
def save(self,*obj):
try:
self.__do_save()
except db.DBRunRecoveryError, msg:
QuestionDialog.RunDatabaseRepair(msg[1])
def __do_save(self):
self.ok_button.set_sensitive(False)
self.in_save = True

View File

@ -84,7 +84,7 @@ class ImgManip:
def fmt_scale_data(self, x, y, cnv):
fd, dest = tempfile.mkstemp()
scaled = self.img.scale_simple(x, y, gtk.gdk.INTERP_BILINEAR)
scaled = self.img.scale_simple(int(x), int(y), gtk.gdk.INTERP_BILINEAR)
scaled.save(dest,cnv)
fh = open(dest,mode='rb')
data = fh.read()

View File

@ -20,148 +20,153 @@
# $Id$
#-------------------------------------------------------------------------
#Updated LDS Temple Codes from:
#http://www.geocities.com/rgpassey/temple/abclist.htm
#Confirmed against Temple Codes list recieved from Raliegh Temple
#Last update: 1/12/02
#-------------------------------------------------------------------------
temples = (
# Temple Name , Code , [Old Codes...]
("Aba, Nigeria" , "ABA", ),
("Accra, Ghana" , "ACCRA", ),
("Adelaide, Australia" , "ADELA", ),
("Albuquerque, New Mexico" , "ALBUQ", ),
("Anchorage, Alaska" , "ANCHO", ),
("Apia, Samoa" , "APIA", "AP"),
("Asuncion, Paraguay" , "ASUNC", ),
("Atlanta, Georgia" , "ATLAN", "AT"),
("Baton Rouge, Louisiana" , "BROUG", ),
("Bern, Switzerland" , "SWISS", "SW"),
("Billings, Montana" , "BILLI", ),
("Birmingham, Alabama" , "BIRMI", ),
("Bismarck, North Dakota" , "BISMA", ),
("Bogota, Columbia" , "BOGOT", "BG"),
("Boise, Idaho" , "BOISE", "BO"),
("Boston, Massachusetts" , "BOSTO", ),
("Bountiful, Utah" , "BOUNT", ),
("Brisban, Australia" , "BRISB", ),
("Buenos Aires, Argentina" , "BAIRE", "BA"),
("Campinas, Brazil" , "CAMPI", ),
("Caracas, Venezuela" , "CARAC", ),
("Cardston, Alberta" , "ALBER", "AL", "ALBR"),
("Chicago, Illinois" , "CHICA", "CH"),
("Ciudad Juarez, Chihuahua" , "CIUJU", ),
("Cochabamba, Boliva" , "COCHA", ),
("Colonia Juarez, Chihuahua" , "COLJU", ),
("Columbia, South Carolina" , "COLSC", ),
("Columbia River, Washington" , "CRIVE", ),
("Columbus, Ohio" , "COLUM", ),
("Copenhagen, Denmark" , "COPEN", ),
("Curitiba, Brazil" , "CURIT", ),
("Manhattan, New York" , "MANHA", ),
("Panama City, Panama" , "PCITY", ),
("Dallas, Texas" , "DALLA", "DA"),
("Denver, Colorado" , "DENVE", "DV"),
("Detroit, Michigan" , "DETRO", ),
("Edmonton, Alberta" , "EDMON", ),
("Frankfurt, Germany" , "FRANK", "FR"),
("Fresno, California" , "FRESN", ),
("Freiberg, Germany" , "FREIB", "FD"),
("Fukuoka, Japan" , "FUKUO", ),
("Guadalajara, Jalisco" , "GUADA", ),
("Guatamala City, Guatamala" , "GUATE", "GA"),
("Guayaquil, Ecuador" , "GUAYA", "GY"),
("Halifax, Noca Scotia" , "HALIF", ),
("Hamilton, New Zealand" , "NZEAL", "NZ"),
("Harrison, New York" , "NYORK", ),
("Hartford, Connecticut" , "HARTF", ),
("Helsinki, Finland" , "HELSI", ),
("Hermosillo, Sonora" , "HERMO", ),
("Hong Kong, China" , "HKONG", ),
("Houston, Texas" , "HOUST", ),
("Idaho Falls, Idaho" , "IFALL", ),
("Johannesburg, South Africa" , "JOHAN", "JO"),
("Jordan River, Utah" , "JRIVE", "JR"),
("Kialua Kona, Hawaii" , "KONA", ),
("Kiev, Ukraine" , "KIEV", ),
("Laie, Hawaii" , "HAWAI", "HA"),
("Las Vegas, Nevada" , "LVEGA", "LV"),
("Lima, Peru" , "LIMA" , "LI"),
("Logan, Utah" , "LOGAN", "LG"),
("London, England" , "LONDO", "LD"),
("Los Angeles, California" , "LANGE", "LA"),
("Louisville, Kentucky" , "LOUIS", ),
("Lubbock, Texas" , "LUBBO", ),
("Madrid, Spain" , "MADRI", ),
("Manila, Philippines" , "MANIL", "MA"),
("Manti, Utah" , "MANTI", "MT"),
("Medford, Oregon" , "MEDFO", ),
("Melbourne, Australia" , "MELBO", ),
("Melphis, Tennessee" , "MEMPH", ),
("Merida, Yucatan" , "MERID", ),
("Mesa, Arizona" , "ARIZO", "AZ"),
("Mexico City, Mexico" , "MEXIC", "MX"),
("Monterrey, Nuevo Leon" , "MONTE", ),
("Montevideo, Uruguay" , "MNTVD", ),
("Monticello, Utah" , "MONTI", ),
("Montreal, Quebec" , "MONTR", ),
("Mt. Timpanogos, Utah" , "MTIMP", ),
("Nashville, Tennessee" , "NASHV", ),
("Nauvoo, Illinois" , "NAUVO", ),
("Nauvoo, Illinois (New)," , "NAUV2", ),
("Newport Beach, California" , "NBEAC", ),
("Nuku'alofa, Tonga" , "NUKUA", "TG"),
("Oakland, California" , "OAKLA", "OK"),
("Oaxaca, Oaxaca" , "OAKAC", ),
("Ogden, Utah" , "OGDEN", "OG"),
("Oklahoma City, Oklahoma" , "OKLAH", ),
("Orlando, Florida" , "ORLAN", ),
("Palmayra, New York" , "PALMY", ),
("Papeete, Tahiti" , "PAPEE", "TA"),
("Perth, Australia" , "PERTH", ),
("Portland, Oregon" , "PORTL", "PT"),
("Porto Alegre, Brazil" , "PALEG", ),
("Preston, England" , "PREST", ),
("Provo, Utah" , "PROVO", "PV"),
("Raleigh, North Carolina" , "RALEI", ),
("Recife, Brazil" , "RECIF", ),
("Redlands, California" , "REDLA", ),
("Regina, Saskatchewan" , "REGIN", ),
("Reno, Nevada" , "RENO", ),
("Sacramento, California" , "SACRA", ),
("St. George, Utah" , "SGEOR", "SG"),
("St. Louis, Missouri" , "SLOUI", ),
("St. Paul, Minnesota" , "SPMIN", ),
("Salt Lake City, Utah" , "SLAKE", "SL"),
("San Diego, California" , "SDIEG", "SA"),
("San Antonio, Texas" , "SANTO", ),
("San Jose, Costa Rica" , "SJOSE", ),
("Santiago, Chile" , "SANTI", "SN"),
# Temple Name , Code , [Old Codes...]
("Aba, Nigeria" , "ABA", ),
("Accra, Ghana" , "ACCRA", ),
("Adelaide, Australia" , "ADELA", ),
("Albuquerque, New Mexico" , "ALBUQ", ),
("Anchorage, Alaska" , "ANCHO", ),
("Apia, Samoa" , "APIA", "SAMOA", "AP"),
("Asuncion, Paraguay" , "ASUNC", ),
("Atlanta, Georgia" , "ATLAN", "AT"),
("Baton Rouge, Louisiana" , "BROUG", ),
("Bern, Switzerland" , "SWISS", "SW"),
("Billings, Montana" , "BILLI", ),
("Birmingham, Alabama" , "BIRMI", ),
("Bismarck, North Dakota" , "BISMA", ),
("Bogota, Columbia" , "BOGOT", "BG"),
("Boise, Idaho" , "BOISE", "BO"),
("Boston, Massachusetts" , "BOSTO", ),
("Bountiful, Utah" , "BOUNT", ),
("Brisbane, Australia" , "BRISB", ),
("Buenos Aires, Argentina" , "BAIRE", "BA"),
("Campinas, Brazil" , "CAMPI", ),
("Caracas, Venezuela" , "CARAC", ),
("Cardston, Alberta" , "ALBER", "AL", "ALBR"),
("Cebu, Philippines" , "CEBU", ),
("Chicago, Illinois" , "CHICA", "CH"),
("Ciudad Juarez, Mexico" , "CIUJU", ),
("Cochabamba, Boliva" , "COCHA", ),
("Colonia Juarez, Chihuahua, Mexico" , "COLJU", ),
("Columbia, South Carolina" , "COLSC", ),
("Columbia River, Washington" , "CRIVE", ),
("Columbus, Ohio" , "COLUM", ),
("Copenhagen, Denmark" , "COPEN", ),
("Curitiba, Brazil" , "CURIT", ),
("Dallas, Texas" , "DALLA", "DA"),
("Denver, Colorado" , "DENVE", "DV"),
("Detroit, Michigan" , "DETRO", ),
("Draper, Utah" , "DRAPE", ),
("Edmonton, Alberta" , "EDMON", ),
("Frankfurt, Germany" , "FRANK", "FR"),
("Freiberg, Germany" , "FREIB", "FD"),
("Fresno, California" , "FRESN", ),
("Fukuoka, Japan" , "FUKUO", ),
("Guadalajara, Mexico" , "GUADA", ),
("Guatemala City, Guatemala" , "GUATE", "GA", "GU"),
("Guayaquil, Ecuador" , "GUAYA", "GY"),
("Halifax, Nova Scotia" , "HALIF", ),
("Hamilton, New Zealand" , "NZEAL", "NZ"),
("Harrison, New York" , "HARRI", "NYORK"),
("Hartford, Connecticut" , "HARTF", ),
("Helsinki, Finland" , "HELSI", ),
("Hermosillo, Sonora, Mexico" , "HERMO", ),
("Hong Kong, China" , "HKONG", ),
("Houston, Texas" , "HOUST", ),
("Idaho Falls, Idaho" , "IFALL", "IF"),
("Johannesburg, South Africa" , "JOHAN", "JO"),
("Jordan River, Utah" , "JRIVE", "JR"),
("Kona, Hawaii" , "KONA", ),
("Kiev, Ukraine" , "KIEV", ),
("Kirtland, Ohio" , "KIRTL", ),
("Laie, Hawaii" , "HAWAI", "HA"),
("Las Vegas, Nevada" , "LVEGA", "LV"),
("Lima, Peru" , "LIMA" , "LI"),
("Logan, Utah" , "LOGAN", "LG"),
("London, England" , "LONDO", "LD"),
("Los Angeles, California" , "LANGE", "LA"),
("Louisville, Kentucky" , "LOUIS", ),
("Lubbock, Texas" , "LUBBO", ),
("Madrid, Spain" , "MADRI", ),
("Manhattan, New York" , "MANHA", ),
("Manila, Philippines" , "MANIL", "MA"),
("Manti, Utah" , "MANTI", "MT"),
("Medford, Oregon" , "MEDFO", ),
("Melbourne, Australia" , "MELBO", ),
("Memphis, Tennessee" , "MEMPH", ),
("Merida, Mexico" , "MERID", ),
("Mesa, Arizona" , "ARIZO", "AZ"),
("Mexico City, Mexico" , "MEXIC", "MX"),
("Monterrey, Mexico" , "MONTE", ),
("Montevideo, Uruguay" , "MNTVD", ),
("Monticello, Utah" , "MONTI", ),
("Montreal, Quebec" , "MONTR", ),
("Mt. Timpanogos, Utah" , "MTIMP", ),
("Nashville, Tennessee" , "NASHV", ),
("Nauvoo, Illinois" , "NAUVO", "NV"),
("Nauvoo, Illinois (New)" , "NAUV2", ),
("Newport Beach, California" , "NBEAC", ),
("Nuku'alofa, Tonga" , "NUKUA", "TG"),
("Oakland, California" , "OAKLA", "OK"),
("Oaxaca, Mexico" , "OAXAC", ),
("Ogden, Utah" , "OGDEN", "OG"),
("Oklahoma City, Oklahoma" , "OKLAH", ),
("Oquirrh Mountain, Utah" , "OMOUN", ),
("Orlando, Florida" , "ORLAN", ),
("Palmyra, New York" , "PALMY", ),
("Panama City, Panama" , "PANAM", ),
("Papeete, Tahiti" , "PAPEE", "TA"),
("Perth, Australia" , "PERTH", ),
("Portland, Oregon" , "PORTL", "PT"),
("Porto Alegre, Brazil" , "PALEG", ),
("Preston, England" , "PREST", ),
("Provo, Utah" , "PROVO", "PV"),
("Quetzaltenango, Guatemala" , "QUETZ", ),
("Raleigh, North Carolina" , "RALEI", ),
("Recife, Brazil" , "RECIF", ),
("Redlands, California" , "REDLA", ),
("Regina, Saskatchewan" , "REGIN", ),
("Reno, Nevada" , "RENO", ),
("Rexburg, Idaho" , "REXBU", ),
("Sacramento, California" , "SACRA", ),
("St. George, Utah" , "SGEOR", "SG"),
("St. Louis, Missouri" , "SLOUI", ),
("St. Paul, Minnesota" , "SPMIN", ),
("Salt Lake City, Utah" , "SLAKE", "SL"),
("San Antonio, Texas" , "SANTO", ),
("San Diego, California" , "SDIEG", "SA"),
("San Jose, Costa Rica" , "SJOSE", ),
("Santiago, Chile" , "SANTI", "SN"),
("Santo Domingo, Dominican Republic" , "SDOMI", ),
("Sao Paulo, Brazil" , "SPAUL", "SP"),
("Seattle, Washington" , "SEATT", "SE"),
("Seoul, South Korea" , "SEOUL", "SO"),
("Snowflake, Arizona" , "SNOWF", ),
("Spokane, Washington" , "SPOKA", ),
("Stockholm, Sweden" , "STOCK", "ST"),
("Suva, Fiji" , "SUVA", ),
("Sydney, Australia" , "SYDNE", "SD"),
("Taipei, Taiwan" , "TAIPE", "TP"),
("Tampico, Tamaulipas" , "TAMPI", ),
("The Hague, Netherlands" , "HAGUE", ),
("Tokyo, Japan" , "TOKYO", "TK"),
("Toronto, Ontario" , "TORNO", "TR"),
("Tuxtla Gutierrez, Chiapas" , "TGUTI", ),
("Vera Cruz, Vera Cruz" , "VERAC", ),
("Vernal, Utah" , "VERNA", ),
("Villahermosa, Tabasco" , "VILLA", ),
("Washington, D.C." , "WASHI", "WA"),
("Winter Quarters, Nebraska" , "WINTE", ),
("Sao Paulo, Brazil" , "SPAUL", "SP"),
("Seattle, Washington" , "SEATT", "SE"),
("Seoul, South Korea" , "SEOUL", "SO"),
("Snowflake, Arizona" , "SNOWF", ),
("Spokane, Washington" , "SPOKA", ),
("Stockholm, Sweden" , "STOCK", "ST"),
("Suva, Fiji" , "SUVA", ),
("Sydney, Australia" , "SYDNE", "SD"),
("Taipei, Taiwan" , "TAIPE", "TP"),
("Tampico, Mexico" , "TAMPI", ),
("Tegucigalpa, Honduras" , "TEGUC", ),
("The Hague, Netherlands" , "HAGUE", ),
("Tokyo, Japan" , "TOKYO", "TK"),
("Toronto, Ontario" , "TORON", "TORNO", "TR"),
("Tuxtla Gutierrez, Mexico" , "TGUTI", ),
("Twin Falls, Idaho" , "TFALL", "TWINF"),
("Vancouver, British Columbia" , "VANCO", ),
("Veracruz, Mexico" , "VERAC", ),
("Vernal, Utah" , "VERNA", ),
("Villahermosa, Mexico" , "VILLA", ),
("Washington, D.C." , "WASHI", "WA"),
("Winter Quarters, Nebraska" , "WINTE", "WQUAR"),
#Other Places, Not temples.
("Endowment House" , "EHOUS", "EH"),
("President's Office" , "POFFI", ),
# Other places. Not temples.
("Endowment House" , "EHOUS", "EH"),
("President's Office" , "POFFI", "PO"),
("Historian's Office" , "HOFFI", "HO"),
("Other" , "OTHER", ),
)
temple_codes = {}

View File

@ -49,7 +49,7 @@ import Errors
import Utils
import const
from QuestionDialog import ErrorDialog, OptionDialog
from QuestionDialog import ErrorDialog, OptionDialog, RunDatabaseRepair
from _Constants import CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, \
CATEGORY_VIEW, CATEGORY_CODE, CATEGORY_WEB, standalone_categories
@ -658,6 +658,8 @@ def report(dbstate,uistate,person,report_class,options_class,
ErrorDialog(m1,m2)
except Errors.DatabaseError,msg:
ErrorDialog(_("Report could not be created"),str(msg))
except AttributeError,msg:
RunDatabaseRepair(str(msg))
except:
log.error("Failed to run report.", exc_info=True)
break

View File

@ -30,6 +30,7 @@ import Utils
from BasicUtils import NameDisplay
from ReportBase import ReportUtils
from RelLib import EventType
class SimpleAccess:
"""
@ -314,10 +315,13 @@ class SimpleAccess:
if family:
reflist = family.get_event_ref_list()
if reflist:
ref = reflist[0].ref
event = self.dbase.get_event_from_handle(ref)
place_handle = event.get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle)
elist = [ self.dbase.get_event_from_handle(ref.ref)
for ref in reflist ]
events = [ evnt for evnt in elist
if int(evnt.get_type()) == EventType.MARRIAGE ]
if events:
place_handle = events[0].get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle)
return u''
def marriage_date(self, person):
@ -341,11 +345,14 @@ class SimpleAccess:
if family:
reflist = family.get_event_ref_list()
if reflist:
ref = reflist[0].ref
event = self.dbase.get_event_from_handle(ref)
date_obj = event.get_date_object()
if date_obj:
return DateHandler.displayer.display(date_obj)
elist = [ self.dbase.get_event_from_handle(ref.ref)
for ref in reflist ]
events = [ evnt for evnt in elist
if int(evnt.get_type()) == EventType.MARRIAGE ]
if events:
date_obj = events[0].get_date_object()
if date_obj:
return DateHandler.displayer.display(date_obj)
return u''
def children(self, obj):

View File

@ -161,7 +161,12 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
def on_merge_ok_clicked(self,obj):
threshold = self.menu.get_menu().get_active().get_data("v")
self.use_soundex = int(self.soundex_obj.get_active())
self.find_potentials(threshold)
try:
self.find_potentials(threshold)
except AttributeError, msg:
import QuestionDialog
QuestionDialog.RunDatabaseRepair(str(msg))
return
self.options.handler.options_dict['threshold'] = threshold
self.options.handler.options_dict['soundex'] = self.use_soundex

View File

@ -329,14 +329,20 @@ class Verify(Tool.Tool, ManagedWindow, UpdateCallback):
self.uistate.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
self.uistate.progress.show()
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
vr.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
try:
vr.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
except AttributeError:
pass
self.run_tool(cli=False)
self.uistate.progress.hide()
self.uistate.window.window.set_cursor(None)
self.window.window.set_cursor(None)
vr.window.window.set_cursor(None)
try:
vr.window.window.set_cursor(None)
except AttributeError:
pass
self.reset()
# Save options

View File

@ -27,3 +27,5 @@ def run(database, document, person):
sd.paragraph("%-12s\t%-12s\t%s" % (sa.event_type(event),
sa.event_date(event),
sa.event_place(event)))
sd.paragraph("Marriage %s" % sa.marriage_place(person))