2007-07-23 Don Allingham <don@gramps-project.org>

* src/plugins/ExtractCity.py: fix encoding

2007-07-23  Jérôme <romjerome@yahoo.fr>


svn: r8762
This commit is contained in:
Don Allingham 2007-07-23 19:49:48 +00:00
parent 8847fd3acd
commit afa6670eb6
2 changed files with 314 additions and 310 deletions

View File

@ -1,4 +1,7 @@
2007-07-23 Jérôme <romjerome@yahoo.fr>
2007-07-23 Don Allingham <don@gramps-project.org>
* src/plugins/ExtractCity.py: fix encoding
2007-07-23 Jérôme <romjerome@yahoo.fr>
* src/plugins/ExtractCity.py: Add French cities
2007-07-23 Brian Matherly <brian@gramps-project.org>

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
@ -45,302 +46,303 @@ import gtk.glade
#
#-------------------------------------------------------------------------
import ManagedWindow
import GrampsDisplay
from PluginUtils import Tool, register_tool
import Utils
CITY_STATE = re.compile("^(.+),\s*([\w\s\.]+),?(\s+[\d-])?")
CITY_STATE = re.compile("^(.+),\s*([\w\s\.]+),?\s*([\d-])?")
COUNTRY = ( _("United States of America"), _("Canada"), _("France"))
COUNTRY = ( _(u"United States of America"), _(u"Canada"), _(u"France"))
STATE_MAP = {
"AL" : ("Alabama", 0),
"AL." : ("Alabama", 0),
"ALABAMA" : ("Alabama", 0),
"AK" : ("Alaska" , 0),
"AK." : ("Alaska" , 0),
"ALASKA" : ("Alaska" , 0),
"AS" : ("American Samoa", 0),
"AS." : ("American Samoa", 0),
"AMERICAN SAMOA" : ("American Samoa", 0),
"AZ" : ("Arizona", 0),
"AZ." : ("Arizona", 0),
"ARIZONA" : ("Arizona", 0),
"AR" : ("Arkansas" , 0),
"AR." : ("Arkansas" , 0),
"ARKANSAS" : ("Arkansas" , 0),
"ARK." : ("Arkansas" , 0),
"ARK" : ("Arkansas" , 0),
"CA" : ("California" , 0),
"CA." : ("California" , 0),
"CALIFORNIA" : ("California" , 0),
"CO" : ("Colorado" , 0),
"COLO" : ("Colorado" , 0),
"COLO." : ("Colorado" , 0),
"COLORADO" : ("Colorado" , 0),
"CT" : ("Connecticut" , 0),
"CT." : ("Connecticut" , 0),
"CONNECTICUT" : ("Connecticut" , 0),
"DE" : ("Delaware" , 0),
"DE." : ("Delaware" , 0),
"DELAWARE" : ("Delaware" , 0),
"DC" : ("District of Columbia" , 0),
"D.C." : ("District of Columbia" , 0),
"DC." : ("District of Columbia" , 0),
"DISTRICT OF COLUMBIA" : ("District of Columbia" , 0),
"FL" : ("Florida" , 0),
"FL." : ("Florida" , 0),
"FLA" : ("Florida" , 0),
"FLA." : ("Florida" , 0),
"FLORIDA" : ("Florida" , 0),
"GA" : ("Georgia" , 0),
"GA." : ("Georgia" , 0),
"GEORGIA" : ("Georgia" , 0),
"GU" : ("Guam" , 0),
"GU." : ("Guam" , 0),
"GUAM" : ("Guam" , 0),
"HI" : ("Hawaii" , 0),
"HI." : ("Hawaii" , 0),
"HAWAII" : ("Hawaii" , 0),
"ID" : ("Idaho" , 0),
"ID." : ("Idaho" , 0),
"IDAHO" : ("Idaho" , 0),
"IL" : ("Illinois" , 0),
"IL." : ("Illinois" , 0),
"ILLINOIS" : ("Illinois" , 0),
"ILL" : ("Illinois" , 0),
"ILL." : ("Illinois" , 0),
"ILLS" : ("Illinois" , 0),
"ILLS." : ("Illinois" , 0),
"IN" : ("Indiana" , 0),
"IN." : ("Indiana" , 0),
"INDIANA" : ("Indiana" , 0),
"IA" : ("Iowa" , 0),
"IA." : ("Iowa" , 0),
"IOWA" : ("Iowa" , 0),
"KS" : ("Kansas" , 0),
"KS." : ("Kansas" , 0),
"KANSAS" : ("Kansas" , 0),
"KY" : ("Kentucky" , 0),
"KY." : ("Kentucky" , 0),
"KENTUCKY" : ("Kentucky" , 0),
"LA" : ("Louisiana" , 0),
"LA." : ("Louisiana" , 0),
"LOUISIANA" : ("Louisiana" , 0),
"ME" : ("Maine" , 0),
"ME." : ("Maine" , 0),
"MAINE" : ("Maine" , 0),
"MD" : ("Maryland" , 0),
"MD." : ("Maryland" , 0),
"MARYLAND" : ("Maryland" , 0),
"MA" : ("Massachusetts" , 0),
"MA." : ("Massachusetts" , 0),
"MASSACHUSETTS" : ("Massachusetts" , 0),
"MI" : ("Michigan" , 0),
"MI." : ("Michigan" , 0),
"MICH." : ("Michigan" , 0),
"MICH" : ("Michigan" , 0),
"MN" : ("Minnesota" , 0),
"MN." : ("Minnesota" , 0),
"MINNESOTA" : ("Minnesota" , 0),
"MS" : ("Mississippi" , 0),
"MS." : ("Mississippi" , 0),
"MISSISSIPPI" : ("Mississippi" , 0),
"MO" : ("Missouri" , 0),
"MO." : ("Missouri" , 0),
"MISSOURI" : ("Missouri" , 0),
"MT" : ("Montana" , 0),
"MT." : ("Montana" , 0),
"MONTANA" : ("Montana" , 0),
"NE" : ("Nebraska" , 0),
"NE." : ("Nebraska" , 0),
"NEBRASKA" : ("Nebraska" , 0),
"NV" : ("Nevada" , 0),
"NV." : ("Nevada" , 0),
"NEVADA" : ("Nevada" , 0),
"NH" : ("New Hampshire" , 0),
"NH." : ("New Hampshire" , 0),
"N.H." : ("New Hampshire" , 0),
"NEW HAMPSHIRE" : ("New Hampshire" , 0),
"NJ" : ("New Jersey" , 0),
"NJ." : ("New Jersey" , 0),
"N.J." : ("New Jersey" , 0),
"NEW JERSEY" : ("New Jersey" , 0),
"NM" : ("New Mexico" , 0),
"NM." : ("New Mexico" , 0),
"NEW MEXICO" : ("New Mexico" , 0),
"NY" : ("New York" , 0),
"N.Y." : ("New York" , 0),
"NY." : ("New York" , 0),
"NEW YORK" : ("New York" , 0),
"NC" : ("North Carolina" , 0),
"NC." : ("North Carolina" , 0),
"N.C." : ("North Carolina" , 0),
"NORTH CAROLINA" : ("North Carolina" , 0),
"ND" : ("North Dakota" , 0),
"ND." : ("North Dakota" , 0),
"N.D." : ("North Dakota" , 0),
"NORTH DAKOTA" : ("North Dakota" , 0),
"OH" : ("Ohio" , 0),
"OH." : ("Ohio" , 0),
"OHIO" : ("Ohio" , 0),
"OK" : ("Oklahoma" , 0),
"OKLA" : ("Oklahoma" , 0),
"OKLA." : ("Oklahoma" , 0),
"OK." : ("Oklahoma" , 0),
"OKLAHOMA" : ("Oklahoma" , 0),
"OR" : ("Oregon" , 0),
"OR." : ("Oregon" , 0),
"OREGON" : ("Oregon" , 0),
"PA" : ("Pennsylvania" , 0),
"PA." : ("Pennsylvania" , 0),
"PENNSYLVANIA" : ("Pennsylvania" , 0),
"PR" : ("Puerto Rico" , 0),
"PUERTO RICO" : ("Puerto Rico" , 0),
"RI" : ("Rhode Island" , 0),
"RI." : ("Rhode Island" , 0),
"R.I." : ("Rhode Island" , 0),
"RHODE ISLAND" : ("Rhode Island" , 0),
"SC" : ("South Carolina" , 0),
"SC." : ("South Carolina" , 0),
"S.C." : ("South Carolina" , 0),
"SOUTH CAROLINA" : ("South Carolina" , 0),
"SD" : ("South Dakota" , 0),
"SD." : ("South Dakota" , 0),
"S.D." : ("South Dakota" , 0),
"SOUTH DAKOTA" : ("South Dakota" , 0),
"TN" : ("Tennessee" , 0),
"TN." : ("Tennessee" , 0),
"TENNESSEE" : ("Tennessee" , 0),
"TENN." : ("Tennessee" , 0),
"TENN" : ("Tennessee" , 0),
"TX" : ("Texas" , 0),
"TX." : ("Texas" , 0),
"TEXAS" : ("Texas" , 0),
"UT" : ("Utah" , 0),
"UT." : ("Utah" , 0),
"UTAH" : ("Utah" , 0),
"VT" : ("Vermont" , 0),
"VT." : ("Vermont" , 0),
"VERMONT" : ("Vermont" , 0),
"VI" : ("Virgin Islands" , 0),
"VIRGIN ISLANDS" : ("Virgin Islands" , 0),
"VA" : ("Virginia" , 0),
"VA." : ("Virginia" , 0),
"VIRGINIA" : ("Virginia" , 0),
"WA" : ("Washington" , 0),
"WA." : ("Washington" , 0),
"WASHINGTON" : ("Washington" , 0),
"WV" : ("West Virginia" , 0),
"WV." : ("West Virginia" , 0),
"W.V." : ("West Virginia" , 0),
"WEST VIRGINIA" : ("West Virginia" , 0),
"WI" : ("Wisconsin" , 0),
"WI." : ("Wisconsin" , 0),
"WISCONSIN" : ("Wisconsin" , 0),
"WY" : ("Wyoming" , 0),
"WY." : ("Wyoming" , 0),
"WYOMING" : ("Wyoming" , 0),
"AB" : ("Alberta", 1),
"AB." : ("Alberta", 1),
"ALBERTA" : ("Alberta", 1),
"BC" : ("British Columbia", 1),
"BC." : ("British Columbia", 1),
"B.C." : ("British Columbia", 1),
"MB" : ("Manitoba", 1),
"MB." : ("Manitoba", 1),
"MANITOBA" : ("Manitoba", 1),
"NB" : ("New Brunswick", 1),
"N.B." : ("New Brunswick", 1),
"NB." : ("New Brunswick", 1),
"NEW BRUNSWICK" : ("New Brunswick", 1),
"NL" : ("Newfoundland and Labrador", 1),
"NL." : ("Newfoundland and Labrador", 1),
"N.L." : ("Newfoundland and Labrador", 1),
"NEWFOUNDLAND" : ("Newfoundland and Labrador", 1),
"NEWFOUNDLAND AND LABRADOR" : ("Newfoundland and Labrador", 1),
"LABRADOR" : ("Newfoundland and Labrador", 1),
"NT" : ("Northwest Territories", 1),
"NT." : ("Northwest Territories", 1),
"N.T." : ("Northwest Territories", 1),
"NORTHWEST TERRITORIES" : ("Northwest Territories", 1),
"NS" : ("Nova Scotia", 1),
"NS." : ("Nova Scotia", 1),
"N.S." : ("Nova Scotia", 1),
"NOVA SCOTIA" : ("Nova Scotia", 1),
"NU" : ("Nunavut", 1),
"NU." : ("Nunavut", 1),
"NUNAVUT" : ("Nunavut", 1),
"ON" : ("Ontario", 1),
"ON." : ("Ontario", 1),
"ONTARIO" : ("Ontario", 1),
"PE" : ("Prince Edward Island", 1),
"PE." : ("Prince Edward Island", 1),
"PRINCE EDWARD ISLAND" : ("Prince Edward Island", 1),
"QC" : ("Quebec", 1),
"QC." : ("Quebec", 1),
"QUEBEC" : ("Quebec", 1),
"SK" : ("Saskatchewan", 1),
"SK." : ("Saskatchewan", 1),
"SASKATCHEWAN" : ("Saskatchewan", 1),
"YT" : ("Yukon", 1),
"YT." : ("Yukon", 1),
"YUKON" : ("Yukon", 1),
"ALSACE" : ("Alsace", 2),
"ALS" : ("ALS-Alsace", 2),
"AQUITAINE" : ("Aquitaine", 2),
"AQU" : ("AQU-Aquitaine", 2),
"AUVERGNE" : ("Auvergne", 2),
"AUV" : ("AUV-Auvergne", 2),
"BOURGOGNE" : ("Bourgogne", 2),
"BOU" : ("BOU-Bourgogne", 2),
"BRETAGNE" : ("Bretagne", 2),
"BRE" : ("BRE-Bretagne", 2),
"CENTRE" : ("Centre - Val de Loire", 2),
"CEN" : ("CEN-Centre - Val de Loire", 2),
"CHAMPAGNE" : ("Champagne-Ardennes", 2),
"CHA" : ("CHA-Champagne-Ardennes", 2),
"CORSE" : ("Corse", 2),
"COR" : ("COR-Corse", 2),
"FRANCHE-COMTE" : ("Franche-Comté", 2),
"FCO" : ("FCO-Franche-Comté", 2),
"ILE DE FRANCE" : ("Ile de France", 2),
"IDF" : ("IDF-Ile de France", 2),
"LIMOUSIN" : ("Limousin", 2),
"LIM" : ("LIM-Limousin", 2),
"LORRAINE" : ("Lorraine", 2),
"LOR" : ("LOR-Lorraine", 2),
"LANGUEDOC" : ("Languedoc-Roussillon", 2),
"LRO" : ("LRO-Languedoc-Roussillon", 2),
"MIDI PYRENEE" : ("Midi-Pyrénée", 2),
"MPY" : ("MPY-Midi-Pyrénée", 2),
"HAUTE NORMANDIE": ("Haute Normandie", 2),
"NOH" : ("NOH-Haute Normandie", 2),
"BASSE NORMANDIE": ("Basse Normandie", 2),
"NOB" : ("NOB-Basse Normandie", 2),
"NORD PAS CALAIS": ("Nord-Pas de Calais", 2),
"NPC" : ("NPC-Nord-Pas de Calais", 2),
"PROVENCE" : ("Provence-Alpes-Côte d'Azur", 2),
"PCA" : ("PCA-Provence-Alpes-Côte d'Azur", 2),
"POITOU-CHARENTES": ("Poitou-Charentes", 2),
"PCH" : ("PCH-Poitou-Charentes", 2),
"PAYS DE LOIRE" : ("Pays de Loire", 2),
"PDL" : ("PDL-Pays de Loire", 2),
"PICARDIE" : ("Picardie", 2),
"PIC" : ("PIC-Picardie", 2),
"RHONE-ALPES" : ("Rhône-Alpes", 2),
"RAL" : ("RAL-Rhône-Alpes", 2),
"AOM" : ("AOM-Autres Territoires d'Outre-Mer", 2),
"COM" : ("DOM-Collectivité Territoriale d'Outre-Mer", 2),
"DOM" : ("DOM-Départements d'Outre-Mer", 2),
"TOM" : ("TOM-Territoires d'Outre-Mer", 2),
u"AL" : (u"Alabama", 0),
u"AL." : (u"Alabama", 0),
u"ALABAMA" : (u"Alabama", 0),
u"AK" : (u"Alaska" , 0),
u"AK." : (u"Alaska" , 0),
u"ALASKA" : (u"Alaska" , 0),
u"AS" : (u"American Samoa", 0),
u"AS." : (u"American Samoa", 0),
u"AMERICAN SAMOA": (u"American Samoa", 0),
u"AZ" : (u"Arizona", 0),
u"AZ." : (u"Arizona", 0),
u"ARIZONA" : (u"Arizona", 0),
u"AR" : (u"Arkansas" , 0),
u"AR." : (u"Arkansas" , 0),
u"ARKANSAS" : (u"Arkansas" , 0),
u"ARK." : (u"Arkansas" , 0),
u"ARK" : (u"Arkansas" , 0),
u"CA" : (u"California" , 0),
u"CA." : (u"California" , 0),
u"CALIFORNIA" : (u"California" , 0),
u"CO" : (u"Colorado" , 0),
u"COLO" : (u"Colorado" , 0),
u"COLO." : (u"Colorado" , 0),
u"COLORADO" : (u"Colorado" , 0),
u"CT" : (u"Connecticut" , 0),
u"CT." : (u"Connecticut" , 0),
u"CONNECTICUT" : (u"Connecticut" , 0),
u"DE" : (u"Delaware" , 0),
u"DE." : (u"Delaware" , 0),
u"DELAWARE" : (u"Delaware" , 0),
u"DC" : (u"District of Columbia" , 0),
u"D.C." : (u"District of Columbia" , 0),
u"DC." : (u"District of Columbia" , 0),
u"DISTRICT OF COLMBIA" : (u"District of Columbia" , 0),
u"FL" : (u"Florida" , 0),
u"FL." : (u"Florida" , 0),
u"FLA" : (u"Florida" , 0),
u"FLA." : (u"Florida" , 0),
u"FLORIDA" : (u"Florida" , 0),
u"GA" : (u"Georgia" , 0),
u"GA." : (u"Georgia" , 0),
u"GEORGIA" : (u"Georgia" , 0),
u"GU" : (u"Guam" , 0),
u"GU." : (u"Guam" , 0),
u"GUAM" : (u"Guam" , 0),
u"HI" : (u"Hawaii" , 0),
u"HI." : (u"Hawaii" , 0),
u"HAWAII" : (u"Hawaii" , 0),
u"ID" : (u"Idaho" , 0),
u"ID." : (u"Idaho" , 0),
u"IDAHO" : (u"Idaho" , 0),
u"IL" : (u"Illinois" , 0),
u"IL." : (u"Illinois" , 0),
u"ILLINOIS" : (u"Illinois" , 0),
u"ILL" : (u"Illinois" , 0),
u"ILL." : (u"Illinois" , 0),
u"ILLS" : (u"Illinois" , 0),
u"ILLS." : (u"Illinois" , 0),
u"IN" : (u"Indiana" , 0),
u"IN." : (u"Indiana" , 0),
u"INDIANA" : (u"Indiana" , 0),
u"IA" : (u"Iowa" , 0),
u"IA." : (u"Iowa" , 0),
u"IOWA" : (u"Iowa" , 0),
u"KS" : (u"Kansas" , 0),
u"KS." : (u"Kansas" , 0),
u"KANSAS" : (u"Kansas" , 0),
u"KY" : (u"Kentucky" , 0),
u"KY." : (u"Kentucky" , 0),
u"KENTUCKY" : (u"Kentucky" , 0),
u"LA" : (u"Louisiana" , 0),
u"LA." : (u"Louisiana" , 0),
u"LOUISIANA" : (u"Louisiana" , 0),
u"ME" : (u"Maine" , 0),
u"ME." : (u"Maine" , 0),
u"MAINE" : (u"Maine" , 0),
u"MD" : (u"Maryland" , 0),
u"MD." : (u"Maryland" , 0),
u"MARYLAND" : (u"Maryland" , 0),
u"MA" : (u"Massachusetts" , 0),
u"MA." : (u"Massachusetts" , 0),
u"MASSACHUSETTS" : (u"Massachusetts" , 0),
u"MI" : (u"Michigan" , 0),
u"MI." : (u"Michigan" , 0),
u"MICH." : (u"Michigan" , 0),
u"MICH" : (u"Michigan" , 0),
u"MN" : (u"Minnesota" , 0),
u"MN." : (u"Minnesota" , 0),
u"MINNESOTA" : (u"Minnesota" , 0),
u"MS" : (u"Mississippi" , 0),
u"MS." : (u"Mississippi" , 0),
u"MISSISSIPPI" : (u"Mississippi" , 0),
u"MO" : (u"Missouri" , 0),
u"MO." : (u"Missouri" , 0),
u"MISSOURI" : (u"Missouri" , 0),
u"MT" : (u"Montana" , 0),
u"MT." : (u"Montana" , 0),
u"MONTANA" : (u"Montana" , 0),
u"NE" : (u"Nebraska" , 0),
u"NE." : (u"Nebraska" , 0),
u"NEBRASKA" : (u"Nebraska" , 0),
u"NV" : (u"Nevada" , 0),
u"NV." : (u"Nevada" , 0),
u"NEVADA" : (u"Nevada" , 0),
u"NH" : (u"New Hampshire" , 0),
u"NH." : (u"New Hampshire" , 0),
u"N.H." : (u"New Hampshire" , 0),
u"NEW HAMPSHIRE" : (u"New Hampshire" , 0),
u"NJ" : (u"New Jersey" , 0),
u"NJ." : (u"New Jersey" , 0),
u"N.J." : (u"New Jersey" , 0),
u"NEW JERSEY" : (u"New Jersey" , 0),
u"NM" : (u"New Mexico" , 0),
u"NM." : (u"New Mexico" , 0),
u"NEW MEXICO" : (u"New Mexico" , 0),
u"NY" : (u"New York" , 0),
u"N.Y." : (u"New York" , 0),
u"NY." : (u"New York" , 0),
u"NEW YORK" : (u"New York" , 0),
u"NC" : (u"North Carolina" , 0),
u"NC." : (u"North Carolina" , 0),
u"N.C." : (u"North Carolina" , 0),
u"NORTH CAROLINA": (u"North Carolina" , 0),
u"ND" : (u"North Dakota" , 0),
u"ND." : (u"North Dakota" , 0),
u"N.D." : (u"North Dakota" , 0),
u"NORTH DAKOTA" : (u"North Dakota" , 0),
u"OH" : (u"Ohio" , 0),
u"OH." : (u"Ohio" , 0),
u"OHIO" : (u"Ohio" , 0),
u"OK" : (u"Oklahoma" , 0),
u"OKLA" : (u"Oklahoma" , 0),
u"OKLA." : (u"Oklahoma" , 0),
u"OK." : (u"Oklahoma" , 0),
u"OKLAHOMA" : (u"Oklahoma" , 0),
u"OR" : (u"Oregon" , 0),
u"OR." : (u"Oregon" , 0),
u"OREGON" : (u"Oregon" , 0),
u"PA" : (u"Pennsylvania" , 0),
u"PA." : (u"Pennsylvania" , 0),
u"PENNSYLVANIA" : (u"Pennsylvania" , 0),
u"PR" : (u"Puerto Rico" , 0),
u"PUERTO RICO" : (u"Puerto Rico" , 0),
u"RI" : (u"Rhode Island" , 0),
u"RI." : (u"Rhode Island" , 0),
u"R.I." : (u"Rhode Island" , 0),
u"RHODE ISLAND" : (u"Rhode Island" , 0),
u"SC" : (u"South Carolina" , 0),
u"SC." : (u"South Carolina" , 0),
u"S.C." : (u"South Carolina" , 0),
u"SOUTH CAROLINA": (u"South Carolina" , 0),
u"SD" : (u"South Dakota" , 0),
u"SD." : (u"South Dakota" , 0),
u"S.D." : (u"South Dakota" , 0),
u"SOUTH DAKOTA" : (u"South Dakota" , 0),
u"TN" : (u"Tennessee" , 0),
u"TN." : (u"Tennessee" , 0),
u"TENNESSEE" : (u"Tennessee" , 0),
u"TENN." : (u"Tennessee" , 0),
u"TENN" : (u"Tennessee" , 0),
u"TX" : (u"Texas" , 0),
u"TX." : (u"Texas" , 0),
u"TEXAS" : (u"Texas" , 0),
u"UT" : (u"Utah" , 0),
u"UT." : (u"Utah" , 0),
u"UTAH" : (u"Utah" , 0),
u"VT" : (u"Vermont" , 0),
u"VT." : (u"Vermont" , 0),
u"VERMONT" : (u"Vermont" , 0),
u"VI" : (u"Virgin Islands" , 0),
u"VIRGIN ISLANDS": (u"Virgin Islands" , 0),
u"VA" : (u"Virginia" , 0),
u"VA." : (u"Virginia" , 0),
u"VIRGINIA" : (u"Virginia" , 0),
u"WA" : (u"Washington" , 0),
u"WA." : (u"Washington" , 0),
u"WASHINGTON" : (u"Washington" , 0),
u"WV" : (u"West Virginia" , 0),
u"WV." : (u"West Virginia" , 0),
u"W.V." : (u"West Virginia" , 0),
u"WEST VIRGINIA" : (u"West Virginia" , 0),
u"WI" : (u"Wisconsin" , 0),
u"WI." : (u"Wisconsin" , 0),
u"WISCONSIN" : (u"Wisconsin" , 0),
u"WY" : (u"Wyoming" , 0),
u"WY." : (u"Wyoming" , 0),
u"WYOMING" : (u"Wyoming" , 0),
u"AB" : (u"Alberta", 1),
u"AB." : (u"Alberta", 1),
u"ALBERTA" : (u"Alberta", 1),
u"BC" : (u"British Columbia", 1),
u"BC." : (u"British Columbia", 1),
u"B.C." : (u"British Columbia", 1),
u"MB" : (u"Manitoba", 1),
u"MB." : (u"Manitoba", 1),
u"MANITOBA" : (u"Manitoba", 1),
u"NB" : (u"New Brunswick", 1),
u"N.B." : (u"New Brunswick", 1),
u"NB." : (u"New Brunswick", 1),
u"NEW BRUNSWICK" : (u"New Brunswick", 1),
u"NL" : (u"Newfoundland and Labrador", 1),
u"NL." : (u"Newfoundland and Labrador", 1),
u"N.L." : (u"Newfoundland and Labrador", 1),
u"NEWFOUNDLAND" : (u"Newfoundland and Labrador", 1),
u"NEWFOUNDLAND AND LABRADOR" : (u"Newfoundland and Labrador", 1),
u"LABRADOR" : (u"Newfoundland and Labrador", 1),
u"NT" : (u"Northwest Territories", 1),
u"NT." : (u"Northwest Territories", 1),
u"N.T." : (u"Northwest Territories", 1),
u"NORTHWEST TERRITORIES" : (u"Northwest Territories", 1),
u"NS" : (u"Nova Scotia", 1),
u"NS." : (u"Nova Scotia", 1),
u"N.S." : (u"Nova Scotia", 1),
u"NOVA SCOTIA" : (u"Nova Scotia", 1),
u"NU" : (u"Nunavut", 1),
u"NU." : (u"Nunavut", 1),
u"NUNAVUT" : (u"Nunavut", 1),
u"ON" : (u"Ontario", 1),
u"ON." : (u"Ontario", 1),
u"ONTARIO" : (u"Ontario", 1),
u"PE" : (u"Prince Edward Island", 1),
u"PE." : (u"Prince Edward Island", 1),
u"PRINCE EDWARD ISLAND" : (u"Prince Edward Island", 1),
u"QC" : (u"Quebec", 1),
u"QC." : (u"Quebec", 1),
u"QUEBEC" : (u"Quebec", 1),
u"SK" : (u"Saskatchewan", 1),
u"SK." : (u"Saskatchewan", 1),
u"SASKATCHEWAN" : (u"Saskatchewan", 1),
u"YT" : (u"Yukon", 1),
u"YT." : (u"Yukon", 1),
u"YUKON" : (u"Yukon", 1),
u"ALSACE" : (u"Alsace", 2),
u"ALS" : (u"ALS-Alsace", 2),
u"AQUITAINE" : (u"Aquitaine", 2),
u"AQU" : (u"AQU-Aquitaine", 2),
u"AUVERGNE" : (u"Auvergne", 2),
u"AUV" : (u"AUV-Auvergne", 2),
u"BOURGOGNE" : (u"Bourgogne", 2),
u"BOU" : (u"BOU-Bourgogne", 2),
u"BRETAGNE" : (u"Bretagne", 2),
u"BRE" : (u"BRE-Bretagne", 2),
u"CENTRE" : (u"Centre - Val de Loire", 2),
u"CEN" : (u"CEN-Centre - Val de Loire", 2),
u"CHAMPAGNE" : (u"Champagne-Ardennes", 2),
u"CHA" : (u"CHA-Champagne-Ardennes", 2),
u"CORSE" : (u"Corse", 2),
u"COR" : (u"COR-Corse", 2),
u"FRANCHE-COMTE" : (u"Franche-Comté", 2),
u"FCO" : (u"FCO-Franche-Comté", 2),
u"ILE DE FRANCE" : (u"Ile de France", 2),
u"IDF" : (u"IDF-Ile de France", 2),
u"LIMOUSIN" : (u"Limousin", 2),
u"LIM" : (u"LIM-Limousin", 2),
u"LORRAINE" : (u"Lorraine", 2),
u"LOR" : (u"LOR-Lorraine", 2),
u"LANGUEDOC" : (u"Languedoc-Roussillon", 2),
u"LRO" : (u"LRO-Languedoc-Roussillon", 2),
u"MIDI PYRENEE" : (u"Midi-Pyrénée", 2),
u"MPY" : (u"MPY-Midi-Pyrénée", 2),
u"HAUTE NORMANDIE": (u"Haute Normandie", 2),
u"NOH" : (u"NOH-Haute Normandie", 2),
u"BASSE NORMANDIE": (u"Basse Normandie", 2),
u"NOB" : (u"NOB-Basse Normandie", 2),
u"NORD PAS CALAIS": (u"Nord-Pas de Calais", 2),
u"NPC" : (u"NPC-Nord-Pas de Calais", 2),
u"PROVENCE" : (u"Provence-Alpes-Côte d'Azur", 2),
u"PCA" : (u"PCA-Provence-Alpes-Côte d'Azur", 2),
u"POITOU-CHARENTES": (u"Poitou-Charentes", 2),
u"PCH" : (u"PCH-Poitou-Charentes", 2),
u"PAYS DE LOIRE" : (u"Pays de Loire", 2),
u"PDL" : (u"PDL-Pays de Loire", 2),
u"PICARDIE" : (u"Picardie", 2),
u"PIC" : (u"PIC-Picardie", 2),
u"RHONE-ALPES" : (u"Rhône-Alpes", 2),
u"RAL" : (u"RAL-Rhône-Alpes", 2),
u"AOM" : (u"AOM-Autres Territoires d'Outre-Mer", 2),
u"COM" : (u"DOM-Collectivité Territoriale d'Outre-Mer", 2),
u"DOM" : (u"DOM-Départements d'Outre-Mer", 2),
u"TOM" : (u"TOM-Territoires d'Outre-Mer", 2),
}
COLS = [
(_('Place title'), 1),
(_('City'), 2),
(_('State'), 3),
(_('Postal code'), 4),
(_('City'), 2),
(_('State'), 3),
(_('Postal code'), 4),
(_('Country'), 5)
]
@ -378,8 +380,8 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
Performs the actual extraction of information
"""
self.progress = Utils.ProgressMeter(_('Checking place titles'),'')
self.progress.set_pass(_('Looking for place fields'),
self.progress = Utils.ProgressMeter(_('Checking place titles'), '')
self.progress.set_pass(_('Looking for place fields'),
len(self.db.get_place_handles()))
self.name_list = []
@ -399,18 +401,18 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
(city, state, postal) = match.groups()
val = " ".join(state.strip().split()).upper()
if state:
new_state = STATE_MAP.get(val.upper())
if new_state:
self.name_list.append(
(handle,
(city, new_state[0], postal, COUNTRY[new_state[1]])))
new_state = STATE_MAP.get(val.upper())
if new_state:
self.name_list.append(
(handle, (city, new_state[0], postal,
COUNTRY[new_state[1]])))
else:
val = " ".join(descr.strip().split()).upper()
new_state = STATE_MAP.get(val)
if new_state:
self.name_list.append(
(handle,
(None, new_state[0], None, COUNTRY[new_state[1]])))
(handle, (None, new_state[0], None,
COUNTRY[new_state[1]])))
self.progress.close()
if self.name_list:
@ -418,7 +420,7 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
else:
self.close()
from QuestionDialog import OkDialog
OkDialog(_('No modifications made'),
OkDialog(_('No modifications made'),
_("No place information could be extracted."))
def display(self):
@ -429,9 +431,9 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.top = gtk.glade.XML(glade_file, "top", "gramps")
window = self.top.get_widget('top')
self.top.signal_autoconnect({
"destroy_passed_object" : self.close,
"on_ok_clicked" : self.on_ok_clicked,
"on_help_clicked" : self.on_help_clicked,
"destroy_passed_object" : self.close,
"on_ok_clicked" : self.on_ok_clicked,
"on_help_clicked" : self.on_help_clicked,
})
self.list = self.top.get_widget("list")
@ -446,13 +448,13 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.model = gtk.ListStore(bool, str, str, str, str, str, str)
r = gtk.CellRendererToggle()
r.connect('toggled',self.toggled)
r.connect('toggled', self.toggled)
c = gtk.TreeViewColumn(_('Select'), r, active=0)
self.list.append_column(c)
for (title, col) in COLS:
self.list.append_column(
gtk.TreeViewColumn(title,
gtk.TreeViewColumn(title,
gtk.CellRendererText(),
text=col))
self.list.set_model(self.model)
@ -463,7 +465,6 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
place = self.db.get_place_from_handle(id)
descr = place.get_title()
loc = place.get_main_location()
handle = self.model.append()
self.model.set_value(handle, 0, True)
@ -483,23 +484,23 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
self.show()
def toggled(self,cell,path_string):
def toggled(self, cell, path_string):
path = tuple([int (i) for i in path_string.split(':')])
row = self.model[path]
row[0] = not row[0]
def build_menu_names(self,obj):
return (self.label,None)
def build_menu_names(self, obj):
return (self.label, None)
def on_help_clicked(self,obj):
def on_help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('tools-db')
def on_ok_clicked(self,obj):
def on_ok_clicked(self, obj):
self.trans = self.db.transaction_begin("", batch=True)
self.db.disable_signals()
changelist = [node for node in self.iter_list
if self.model.get_value(node,0)]
if self.model.get_value(node, 0)]
for change in changelist:
row = self.model[change]
@ -513,10 +514,10 @@ class ExtractCity(Tool.BatchTool, ManagedWindow.ManagedWindow):
if postal:
place.get_main_location().set_city(postal)
if country:
place.get_main_location().set_country(postal)
place.get_main_location().set_country(country)
self.db.commit_place(place, self.trans)
self.db.transaction_commit(self.trans,_("Extract Place data"))
self.db.transaction_commit(self.trans, _("Extract Place data"))
self.db.enable_signals()
self.db.request_rebuild()
self.close()