diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py
index c932aa7b3..d6f99e223 100644
--- a/gramps/src/ImageSelect.py
+++ b/gramps/src/ImageSelect.py
@@ -130,25 +130,37 @@ class ImageSelect:
GnomeErrorDialog(_("That is not a valid file name."));
return
- type = utils.get_mime_type(filename)
- mobj = Photo()
- if description == "":
- description = os.path.basename(filename)
- mobj.setDescription(description)
- mobj.setMimeType(type)
- self.savephoto(mobj)
+ already_imported = None
+ for o in self.db.getObjectMap().values():
+ if o.getPath() == filename:
+ already_imported = o
+ break
- if type[0:5] == "image":
- if self.external.get_active() == 0:
- name = RelImage.import_media_object(filename,self.path,mobj.getId())
+ if (already_imported):
+ oref = ObjectRef()
+ oref.setReference(already_imported)
+ self.dataobj.addPhoto(oref)
+ self.add_thumbnail(oref)
else:
- if self.external.get_active() == 1:
- name = filename
- RelImage.mk_thumb(filename,self.path,mobj.getId())
- else:
- name = RelImage.import_media_object(filename,self.path,mobj.getId())
+ type = utils.get_mime_type(filename)
+ mobj = Photo()
+ if description == "":
+ description = os.path.basename(filename)
+ mobj.setDescription(description)
+ mobj.setMimeType(type)
+ self.savephoto(mobj)
- mobj.setPath(name)
+ if type[0:5] == "image":
+ if self.external.get_active() == 0:
+ name = RelImage.import_media_object(filename,self.path,mobj.getId())
+ else:
+ if self.external.get_active() == 1:
+ name = filename
+ RelImage.mk_thumb(filename,self.path,mobj.getId())
+ else:
+ name = RelImage.import_media_object(filename,self.path,mobj.getId())
+
+ mobj.setPath(name)
utils.modified()
utils.destroy_passed_object(obj)
@@ -211,8 +223,6 @@ class Gallery(ImageSelect):
oref = ObjectRef()
oref.setReference(photo)
self.dataobj.addPhoto(oref)
- dest = "%s/.thumb/%s.jpg" % (self.db.getSavePath(),photo.getId())
- RelImage.mk_thumb(photo.getPath(),dest,const.thumbScale)
self.add_thumbnail(oref)
#-------------------------------------------------------------------------
diff --git a/gramps/src/PlaceView.py b/gramps/src/PlaceView.py
index e12bf2e8c..8144535e9 100644
--- a/gramps/src/PlaceView.py
+++ b/gramps/src/PlaceView.py
@@ -55,17 +55,17 @@ class PlaceView:
self.place_list.set_column_visibility(10,0)
self.place_list.set_column_visibility(11,0)
self.place_list.set_column_visibility(12,0)
- self.place_list.set_column_visibility(13,0)
self.place_list.connect('button-press-event',self.on_button_press_event)
self.place_list.connect('select-row',self.select_row)
self.active = None
+ self.sort_map = [7,1,8,9,10,11,12]
# Restore the previous sort column
self.sort_col,self.sort_dir = Config.get_sort_cols("place",0,GTK.SORT_ASCENDING)
- self.place_list.set_sort_column(self.sort_col+7)
- self.place_list.set_sort_type(self.sort_dir)
self.set_arrow(self.sort_col)
+ self.place_list.set_sort_column(self.sort_map[self.sort_col])
+ self.place_list.set_sort_type(self.sort_dir)
def load_places(self):
if len(self.place_list.selection) == 0:
@@ -92,7 +92,7 @@ class PlaceView:
parish = mloc.get_parish()
country = mloc.get_country()
self.place_list.append([title,id,parish,city,county,state,country,
- u(title), u(id), u(parish), u(city),
+ u(title), u(parish), u(city),
u(county),u(state), u(country)])
self.place_list.set_row_data(index,src)
index = index + 1
@@ -159,7 +159,7 @@ class PlaceView:
self.sort_col = column
self.set_arrow(column)
self.place_list.set_sort_type(self.sort_direct)
- self.place_list.set_sort_column(self.sort_col + 7)
+ self.place_list.set_sort_column(self.sort_map[self.sort_col])
Config.save_sort_cols("place",self.sort_col,self.sort_direct)
self.place_list.sort()
diff --git a/gramps/src/RelImage.py b/gramps/src/RelImage.py
index 20d3c7590..10fdb2e56 100644
--- a/gramps/src/RelImage.py
+++ b/gramps/src/RelImage.py
@@ -80,6 +80,7 @@ def import_media_object(filename,path,base):
try:
path = "%s/%s" % (thumb,base)
+ print filename,path,const.thumbScale
mk_thumb(filename,path,const.thumbScale)
shutil.copy(filename,name)
except:
diff --git a/gramps/src/SourceView.py b/gramps/src/SourceView.py
index 8737a9d3d..d58020b5b 100644
--- a/gramps/src/SourceView.py
+++ b/gramps/src/SourceView.py
@@ -69,16 +69,20 @@ class SourceView:
self.sort_arrow = [self.title_arrow, self.id_arrow, self.author_arrow]
self.source_list.connect('click-column',self.click_column)
-
self.sort_col,self.sort_dir = Config.get_sort_cols("source",3,GTK.SORT_ASCENDING)
+ if self.sort_col >= len(self.sort_arrow):
+ self.sort_col = 0
+
self.source_list.set_sort_type(self.sort_dir)
self.source_list.set_sort_column(self.sort_map[self.sort_col])
self.set_arrow(self.sort_col)
def set_arrow(self,column):
+
for a in self.sort_arrow:
a.hide()
+ print column
a = self.sort_arrow[column]
a.show()
if self.sort_dir == GTK.SORT_ASCENDING:
diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade
index e0b37eaf7..dedfd452f 100644
--- a/gramps/src/gramps.glade
+++ b/gramps/src/gramps.glade
@@ -1275,6 +1275,45 @@
0
+
+ GtkScrolledWindow
+ scrolledwindow28
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+
+ GnomeCanvas
+ canvas1
+ True
+
+ event
+ on_canvas1_event
+ Sun, 02 Sep 2001 21:58:31 GMT
+
+ False
+ 0
+ 0
+ 100
+ 100
+ 1
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label237
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
GtkVBox
vbox2
@@ -2306,45 +2345,6 @@
0
-
- GtkScrolledWindow
- scrolledwindow28
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_UPDATE_CONTINUOUS
- GTK_UPDATE_CONTINUOUS
-
-
- GnomeCanvas
- canvas1
- True
-
- event
- on_canvas1_event
- Sun, 02 Sep 2001 21:58:31 GMT
-
- False
- 0
- 0
- 100
- 100
- 1
-
-
-
-
- GtkLabel
- Notebook:tab
- label237
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 0
-
-
GtkVBox
vbox33
@@ -2379,7 +2379,7 @@
Thu, 31 May 2001 17:22:45 GMT
5
- 293,60,344,5,5
+ 293,61,306,5,5
GTK_SELECTION_SINGLE
True
GTK_SHADOW_IN
@@ -2683,8 +2683,8 @@
on_place_list_click_column
Tue, 30 Oct 2001 18:18:53 GMT
- 14
- 222,47,102,88,77,80,5,5,5,5,5,5,5,5
+ 13
+ 213,47,107,88,77,80,29,1,1,1,1,1,1
GTK_SELECTION_EXTENDED
True
GTK_SHADOW_IN
@@ -3087,19 +3087,6 @@
-
- GtkLabel
- CList:title
- label276
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 0
-
-
GtkLabel
CList:title
@@ -3628,7 +3615,7 @@
GtkLabel
label266
-
+
GTK_JUSTIFY_CENTER
False
1
diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py
index e18a3e957..a30a95bab 100644
--- a/gramps/src/plugins/ReadGedcom.py
+++ b/gramps/src/plugins/ReadGedcom.py
@@ -184,6 +184,12 @@ class GedcomParser:
self.error_count = 0
self.error_text_obj.set_point(0)
self.error_text_obj.set_word_wrap(0)
+
+ map = const.personalConstantAttributes
+ self.attrs = map.values()
+ self.gedattr = {}
+ for val in map.keys():
+ self.gedattr[map[val]] = val
self.update(self.file_obj,file)
self.code = 0
@@ -563,23 +569,33 @@ class GedcomParser:
elif matches[1] == "EVEN":
event = Event()
self.parse_person_event(event,2)
- if string.strip(event.getName()) == "SSN":
+ n = string.strip(event.getName())
+ if n in self.attrs:
attr = Attribute()
- attr.setType("Social Security Number")
+ attr.setType(self.gedattr[n])
attr.setValue(event.getDescription())
self.person.addAttribute(attr)
else:
self.person.addEvent(event)
else:
event = Event()
- try:
- event.setName(ged2gramps[matches[1]])
- except:
+ n = string.strip(matches[1])
+ if ged2gramps.has_key(n):
+ event.setName(ged2gramps[n])
+ elif self.gedattr.has_key(n):
+ attr = Attribute()
+ attr.setType(self.gedattr[n])
+ attr.setValue(event.getDescription())
+ self.person.addAttribute(attr)
+ self.parse_person_attr(attr,2)
+ continue
+ else:
event.setName(matches[1])
+
+ self.parse_person_event(event,2)
if matches[2] != None:
event.setDescription(matches[2])
self.person.addEvent(event)
- self.parse_person_event(event,2)
def parse_optional_note(self,level):
note = ""
@@ -882,6 +898,54 @@ class GedcomParser:
else:
self.barf(level+1)
+ def parse_person_attr(self,attr,level):
+ note = ""
+ while 1:
+ matches = self.get_next()
+ if int(matches[0]) < level:
+ self.backup()
+ break
+ elif matches[1] == "TYPE":
+ if attr.getType() == "":
+ if ged2gramps.has_key(matches[2]):
+ name = ged2gramps[matches[2]]
+ else:
+ name = matches[2]
+ attr.setName(name)
+ elif matches[1] == ["CAUS", "DATE","TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]:
+ self.ignore_sub_junk(level+1)
+ elif matches[1] == "SOUR":
+ source_ref = SourceRef()
+ if matches[2] and matches[2][0] != "@":
+ self.localref = self.localref + 1
+ ref = "gsr%d" % self.localref
+ s = self.db.findSource(ref,self.smap)
+ source_ref.setBase(s)
+ s.setTitle('Imported Source #%d' % self.localref)
+ s.setNote(matches[2] + self.parse_continue_data(1))
+ self.ignore_sub_junk(2)
+ else:
+ source_ref.setBase(self.db.findSource(matches[2],self.smap))
+ self.parse_source_reference(source_ref,level+1)
+ attr.addSourceRef(source_ref)
+ elif matches[1] == "PLAC":
+ val = matches[2]
+ if attr.getValue() == "":
+ attr.setValue(val)
+ self.ignore_sub_junk(level+1)
+ elif matches[1] == "NOTE":
+ info = matches[2] + self.parse_continue_data(level+1)
+ if note == "":
+ note = info
+ else:
+ note = "\n%s" % info
+ elif matches[1] == "CONC":
+ attr.setValue( "%s %s" % (attr.getValue(), matches[2]))
+ elif matches[1] == "CONT":
+ attr.setValue("%s\n%s" % (attr.getValue(),matches[2]))
+ else:
+ self.barf(level+1)
+
def parse_family_event(self,event,level):
global ged2fam
global ged2gramps