diff --git a/src/AbiWordDoc.py b/src/AbiWordDoc.py index d1f1fc0c8..f4652dacf 100644 --- a/src/AbiWordDoc.py +++ b/src/AbiWordDoc.py @@ -27,7 +27,7 @@ import const import string try: - import PIL + import Image no_pil = 0 except: no_pil = 1 @@ -79,10 +79,10 @@ class AbiWordDoc(TextDoc): tag = string.replace(base,'.','_') if no_pil: - cmd = "%s -size %dx%d %s %s" % (const.convert,width,height,file,base) + cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,base) os.system(cmd) else: - im = PIL.Image.open(file) + im = Image.open(file) im.thumbnail((width,height)) im.save(base,"PNG") diff --git a/src/EditPerson.glade b/src/EditPerson.glade index db3272f70..7e58e4d2a 100644 --- a/src/EditPerson.glade +++ b/src/EditPerson.glade @@ -2569,11 +2569,6 @@ editPerson Sun, 10 Dec 2000 03:48:37 GMT - - text_changed - on_photolist_text_changed - Sun, 10 Dec 2000 15:12:13 GMT - button_press_event on_photolist_button_press_event diff --git a/src/EditPerson.py b/src/EditPerson.py index d03716424..048e99482 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -79,7 +79,8 @@ class EditPerson: self.surname_list = surname_list self.callback = callback self.path = db.getSavePath() - + self.not_loaded = 1 + self.top_window = libglade.GladeXML(const.editPersonFile, "editPerson") # widgets @@ -123,7 +124,6 @@ class EditPerson: self.is_female = self.get_widget("genderFemale") self.selectedIcon = -1 - self.currentImages = [] self.top_window.signal_autoconnect({ "on_eventAddBtn_clicked" : on_event_add_clicked, @@ -210,7 +210,10 @@ class EditPerson: # load photos into the photo window photo_list = person.getPhotoList() if len(photo_list) != 0: - self.load_photo(photo_list[0].getPath()) + thumb = self.db.getSavePath() + os.sep + ".thumb" + \ + os.sep + "i%d.jpg" % self.person.getId() + RelImage.check_thumb(photo_list[0].getPath(),thumb,const.picWidth) + self.load_photo(thumb) # set notes data self.notes_field.set_point(0) @@ -386,33 +389,27 @@ class EditPerson: #------------------------------------------------------------------------- # - # add_thumbnail - Scale the image and add it to the IconList. Currently, - # there seems to be a problem with either GdkImlib. A reference has to be - # kept to the image, or it gets lost. This is supposed to be a known - # imlib problem + # add_thumbnail - Scale the image and add it to the IconList. # #------------------------------------------------------------------------- def add_thumbnail(self,photo): + src = photo.getPath() + thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \ + os.path.basename(src) - image2 = RelImage.scale_image(photo.getPath(),const.thumbScale) + RelImage.check_thumb(src,thumb,const.thumbScale) - self.currentImages.append(image2) - self.photo_list.append_imlib(image2,photo.getDescription()) + self.photo_list.append(thumb,photo.getDescription()) #------------------------------------------------------------------------- # - # load_images - clears the currentImages list to free up any cached - # Imlibs. Then add each photo in the person's list of photos to the + # load_images - add each photo in the person's list of photos to the # photolist window. # #------------------------------------------------------------------------- def load_images(self): - if len(self.person.getPhotoList()) == 0: return - - self.currentImages = [] - self.photo_list.freeze() self.photo_list.clear() for photo in self.person.getPhotoList(): @@ -427,8 +424,7 @@ class EditPerson: # #------------------------------------------------------------------------- def load_photo(self,photo): - image2 = RelImage.scale_image(photo,const.picWidth) - self.get_widget("personPix").load_imlib(image2) + self.get_widget("personPix").load_file(photo) #------------------------------------------------------------------------- # @@ -840,8 +836,10 @@ def on_event_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_switch_page(obj,a,page): - if page == 6: - obj.get_data(EDITPERSON).load_images() + edit_obj = obj.get_data(EDITPERSON) + if page == 6 and edit_obj.not_loaded: + edit_obj.not_loaded = 0 + edit_obj.load_images() #------------------------------------------------------------------------- # @@ -884,7 +882,12 @@ def on_primary_photo_clicked(obj): photolist[selectedIcon-i] = photolist[selectedIcon-i-1] photolist[0] = savePhoto edit_person_obj.load_images() - edit_person_obj.load_photo(savePhoto) + + thumb = edit_person_obj.db.getSavePath() + os.sep + ".thumb" + os.sep + \ + "i%d" % edit_person_obj.person.getId() + + mk_thumb(savePhoto,thumb,const.picWidth) + edit_person_obj.load_photo(thumb) utils.modified() #------------------------------------------------------------------------- diff --git a/src/EditSource.py b/src/EditSource.py index a34446263..6f09fd659 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -53,18 +53,29 @@ import RelImage _ = intl.gettext +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- +INDEX = "i" +SOURCE = "s" + class EditSource: def __init__(self,source,db,func): self.source = source self.db = db self.callback = func + self.path = db.getSavePath() + self.not_loaded = 1 + self.selectedIcon = -1 + self.currentImages = [] self.top_window = libglade.GladeXML(const.gladeFile,"sourceEditor") self.title = self.top_window.get_widget("source_title") self.author = self.top_window.get_widget("author") self.pubinfo = self.top_window.get_widget("pubinfo") - self.pubinfo = self.top_window.get_widget("pubinfo") self.note = self.top_window.get_widget("source_note") self.title.set_text(source.getTitle()) @@ -75,17 +86,63 @@ class EditSource: self.note.insert_defaults(source.getNote()) self.note.set_word_wrap(1) + self.photo_list = self.top_window.get_widget("photolist") + self.top_window.signal_autoconnect({ "destroy_passed_object" : utils.destroy_passed_object, + "on_photolist_select_icon" : on_photo_select_icon, + "on_photolist_button_press_event" : on_photolist_button_press_event, + "on_switch_page" : on_switch_page, + "on_addphoto_clicked" : on_add_photo_clicked, + "on_deletephoto_clicked" : on_delete_photo_clicked, "on_sourceapply_clicked" : on_source_apply_clicked }) self.top = self.top_window.get_widget("sourceEditor") - self.top.set_data("o",self) + self.top.set_data(SOURCE,self) + if self.source.getId() == -1: + self.top_window.get_widget("add_photo").set_sensitive(0) + self.top_window.get_widget("delete_photo").set_sensitive(0) + + #------------------------------------------------------------------------- + # + # add_thumbnail - Scale the image and add it to the IconList. + # + #------------------------------------------------------------------------- + def add_thumbnail(self,photo): + src = photo.getPath() + thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \ + os.path.basename(src) + + RelImage.check_thumb(src,thumb,const.thumbScale) + + self.photo_list.append(thumb,photo.getDescription()) + + #------------------------------------------------------------------------- + # + # load_images - clears the currentImages list to free up any cached + # Imlibs. Then add each photo in the source's list of photos to the + # photolist window. + # + #------------------------------------------------------------------------- + def load_images(self): + if len(self.source.getPhotoList()) == 0: + return + self.photo_list.freeze() + self.photo_list.clear() + for photo in self.source.getPhotoList(): + self.add_thumbnail(photo) + self.photo_list.thaw() + +#----------------------------------------------------------------------------- +# +# +# +#----------------------------------------------------------------------------- def on_source_apply_clicked(obj): - edit = obj.get_data("o") + edit = obj.get_data(SOURCE) title = edit.title.get_text() author = edit.author.get_text() pubinfo = edit.pubinfo.get_text() @@ -100,7 +157,7 @@ def on_source_apply_clicked(obj): utils.modified() if pubinfo != edit.source.getPubInfo(): - edit.source.sePubInfo(pubinfo) + edit.source.setPubInfo(pubinfo) utils.modified() if note != edit.source.getNote(): @@ -110,4 +167,222 @@ def on_source_apply_clicked(obj): utils.destroy_passed_object(edit.top) edit.callback(edit.source) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_switch_page(obj,a,page): + src = obj.get_data(SOURCE) + if page == 2 and src.not_loaded: + src.not_loaded = 0 + src.load_images() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_photo_select_icon(obj,iconNumber,event): + obj.get_data(SOURCE).selectedIcon = iconNumber + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_delete_photo_clicked(obj): + edit_source_obj = obj.get_data(SOURCE) + icon = edit_source_obj.selectedIcon + + if icon == -1: + return + photolist = edit_source_obj.source.getPhotoList() + edit_source_obj.photo_list.remove(icon) + del photolist[edit_source_obj.selectedIcon] + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_add_photo_clicked(obj): + + edit_source = obj.get_data(SOURCE) + + image_select = libglade.GladeXML(const.imageselFile,"imageSelect") + + edit_source.isel = image_select + + image_select.signal_autoconnect({ + "on_savephoto_clicked" : on_savephoto_clicked, + "on_name_changed" : on_name_changed, + "destroy_passed_object" : utils.destroy_passed_object + }) + + edit_source.fname = image_select.get_widget("fname") + edit_source.add_image = image_select.get_widget("image") + edit_source.external = image_select.get_widget("private") + image_select.get_widget("imageSelect").set_data(SOURCE,edit_source) + image_select.get_widget("imageSelect").show() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_savephoto_clicked(obj): + edit_source_obj = obj.get_data(SOURCE) + image_select = edit_source_obj.isel + + filename = image_select.get_widget("photosel").get_full_path(0) + description = image_select.get_widget("photoDescription").get_text() + + if os.path.exists(filename) == 0: + return + + prefix = "s" + str(edit_source_obj.source.getId()) + if edit_source_obj.external.get_active() == 1: + if os.path.isfile(filename): + name = filename + else: + return + else: + name = RelImage.import_photo(filename,edit_source_obj.path,prefix) + if name == None: + return + + photo = Photo() + photo.setPath(name) + photo.setDescription(description) + + edit_source_obj.source.addPhoto(photo) + edit_source_obj.add_thumbnail(photo) + + utils.modified() + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_photolist_button_press_event(obj,event): + + myobj = obj.get_data(SOURCE) + icon = myobj.selectedIcon + if icon == -1: + return + + if event.button == 3: + photo = myobj.source.getPhotoList()[icon] + menu = GtkMenu() + item = GtkTearoffMenuItem() + item.show() + view = GtkMenuItem(_("View Photo")) + view.set_data("m",myobj) + view.connect("activate",on_view_photo) + view.show() + edit = GtkMenuItem(_("Edit Photo")) + edit.set_data("m",myobj) + edit.connect("activate",on_edit_photo) + edit.show() + change = GtkMenuItem(_("Edit Description")) + change.set_data("m",myobj) + change.connect("activate",on_change_description) + change.show() + menu.append(item) + menu.append(view) + menu.append(edit) + menu.append(change) + if photo.getPrivate() == 0: + private = GtkMenuItem(_("Convert to private copy")) + private.set_data("m",myobj) + private.connect("activate",on_convert_to_private) + private.show() + menu.append(private) + menu.popup(None,None,None,0,0) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_convert_to_private(obj): + edit_source_obj = obj.get_data("m") + photo = edit_source_obj.source.getPhotoList()[edit_source_obj.selectedIcon] + + prefix = "i" + str(edit_source_obj.source.getId()) + name = RelImage.import_photo(photo.getPath(),edit_source_obj.path,prefix) + + photo.setPath(name) + photo.setPrivate(1) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_view_photo(obj): + myobj = obj.get_data("m") + photo = myobj.source.getPhotoList()[myobj.selectedIcon] + type = gnome.mime.type(photo.getPath()) + + prog = string.split(gnome.mime.get_value(type,'view')) + args = [] + for val in prog: + if val == "%f": + args.append(photo.getPath()) + else: + args.append(val) + + if os.fork() == 0: + os.execvp(args[0],args) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_edit_photo(obj): + myobj = obj.get_data("m") + photo = myobj.source.getPhotoList()[myobj.selectedIcon] + if os.fork() == 0: + os.execvp(const.editor,[const.editor, photo.getPath()]) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_change_description(obj): + myobj = obj.get_data("m") + photo = myobj.source.getPhotoList()[myobj.selectedIcon] + window = libglade.GladeXML(const.imageselFile,"dialog1") + + text = window.get_widget("text") + text.set_text(photo.getDescription()) + + image2 = RelImage.scale_image(photo.getPath(),200.0) + window.get_widget("photo").load_imlib(image2) + window.get_widget("dialog1").set_data("p",photo) + window.get_widget("dialog1").set_data("t",text) + window.get_widget("dialog1").set_data("m",obj.get_data("m")) + window.signal_autoconnect({ + "on_cancel_clicked" : utils.destroy_passed_object, + "on_ok_clicked" : on_ok_clicked, + "on_apply_clicked" : on_apply_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_name_changed(obj): + edit_person = obj.get_data(SOURCE) + file = edit_person.fname.get_text() + if os.path.isfile(file): + image = RelImage.scale_image(file,const.thumbScale) + edit_person.add_image.load_imlib(image) diff --git a/src/GrampsParser.py b/src/GrampsParser.py index 9e0b14d60..0dcd3b61e 100644 --- a/src/GrampsParser.py +++ b/src/GrampsParser.py @@ -69,6 +69,7 @@ class GrampsParser(handler.ContentHandler): self.scomments_list = [] self.note_list = [] + self.use_p = 0 self.in_note = 0 self.in_attribute = 0 self.in_old_attr = 0 @@ -398,6 +399,8 @@ class GrampsParser(handler.ContentHandler): photo.setPrivate(0) if self.in_family == 1: self.family.addPhoto(photo) + if self.in_source == 1: + self.source.addPhoto(photo) else: self.person.addPhoto(photo) @@ -609,7 +612,12 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def stop_stext(self,tag): - self.source_ref.setText(fix_spaces(tag)) + if self.use_p: + self.use_p = 0 + note = fix_spaces(self.stext_list) + else: + note = tag + self.source_ref.setText(note) #--------------------------------------------------------------------- # @@ -617,7 +625,12 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def stop_scomments(self,tag): - self.source_ref.setComments(fix_spaces(self.scomments_list)) + if self.use_p: + self.use_p = 0 + note = fix_spaces(self.scomments_list) + else: + note = tag + self.source_ref.setComments(note) #--------------------------------------------------------------------- # @@ -658,16 +671,23 @@ class GrampsParser(handler.ContentHandler): #--------------------------------------------------------------------- def stop_note(self,tag): self.in_note = 0 + if self.use_p: + self.use_p = 0 + note = fix_spaces(self.note_list) + else: + note = tag if self.in_address == 1: - self.address.setNote(fix_spaces(self.note_list)) - elif self.in_source_ref == 1: - self.source_ref.setNote(fix_spaces(self.note_list)) + self.address.setNote(note) + if self.in_attribute == 1: + self.attribute.setNote(note) + elif self.in_source == 1: + self.source.setNote(note) elif self.in_event == 1: - self.event.setNote(fix_spaces(self.note_list)) + self.event.setNote(note) elif self.in_people == 1: - self.person.setNote(fix_spaces(self.note_list)) + self.person.setNote(note) elif self.in_family == 1: - self.family.setNote(fix_spaces(self.note_list)) + self.family.setNote(note) self.note_list = [] #--------------------------------------------------------------------- @@ -749,6 +769,7 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def stop_ptag(self,tag): + self.use_p = 1 if self.in_note: self.note_list.append(tag) elif self.in_stext: diff --git a/src/Marriage.py b/src/Marriage.py index 6d5cbe391..542a2e1bb 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -70,7 +70,6 @@ class Marriage: self.path = db.getSavePath() self.selectedIcon = 0 - self.currentImages = [] self.top = libglade.GladeXML(const.marriageFile,"marriageEditor") self.top.signal_autoconnect({ @@ -149,10 +148,13 @@ class Marriage: #------------------------------------------------------------------------- def add_thumbnail(self,photo): - image2 = RelImage.scale_image(photo.getPath(),const.thumbScale) + src = photo.getPath() + thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \ + os.path.basename(src) - self.currentImages.append(image2) - self.photo_list.append_imlib(image2,photo.getDescription()) + RelImage.check_thumb(src,thumb,const.thumbScale) + + self.photo_list.append(thumb,photo.getDescription()) #------------------------------------------------------------------------- # @@ -165,9 +167,6 @@ class Marriage: if len(self.family.getPhotoList()) == 0: return - - self.currentImages = [] - self.photo_list.freeze() self.photo_list.clear() for photo in self.family.getPhotoList(): diff --git a/src/OpenOfficeDoc.py b/src/OpenOfficeDoc.py index a00147c66..35619d1e8 100644 --- a/src/OpenOfficeDoc.py +++ b/src/OpenOfficeDoc.py @@ -27,7 +27,7 @@ from latin_utf8 import latin_to_utf8 import const try: - import PIL + import Image no_pil = 0 except: no_pil = 1 @@ -425,10 +425,10 @@ class OpenOfficeDoc(TextDoc): base = os.path.basename(file) image_name = self.tempdir + os.sep + "Pictures" + os.sep + base if no_pil: - cmd = "%s -size %dx%d '%s' '%s'" % (const.convert,width,height,file,image_name) + cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,width,height,file,image_name) os.system(cmd) else: - im = PIL.Image.open(file) + im = Image.open(file) im.thumbnail((width,height)) im.save(name,"JPEG") diff --git a/src/PdfDoc.py b/src/PdfDoc.py index 6e1b3b8ea..7d10c2de7 100644 --- a/src/PdfDoc.py +++ b/src/PdfDoc.py @@ -30,7 +30,7 @@ import reportlab.lib.styles from latin_utf8 import latin_to_utf8 try: - import PIL.Image + import Image no_pil = 0 except: no_pil = 1 @@ -215,7 +215,7 @@ class PdfDoc(TextDoc): def add_photo(self,name,x,y): if no_pil == 0: - im = PIL.Image.open(name) + im = Image.open(name) nx,ny = im.size scale = float(y)/float(nx) diff --git a/src/RelImage.py b/src/RelImage.py index be80921eb..15df08453 100644 --- a/src/RelImage.py +++ b/src/RelImage.py @@ -31,7 +31,7 @@ from gnome.ui import * _ = intl.gettext try: - import PIL.Image + import Image no_pil = 0 except: no_pil = 1 @@ -56,7 +56,15 @@ def import_photo(filename,path,prefix): if os.path.exists(name) == 0: break + thumb = path+os.sep+".thumb" + if not os.path.exists(thumb): + os.mkdir(thumb) + try: + path = thumb + os.sep + base + + mk_thumb(filename,path,const.thumbScale) + if type == "image/jpeg": shutil.copy(filename,name) else: @@ -64,7 +72,7 @@ def import_photo(filename,path,prefix): cmd = "%s '%s' '%s'" % (const.convert,filename,name) os.system(cmd) else: - PIL.Image.open(filename).save(name) + Image.open(filename).save(name) except: return None @@ -91,4 +99,38 @@ def scale_image(path,size): image2 = image1.clone_scaled_image(int(scale*width), int(scale*height)) return image2 +#------------------------------------------------------------------------- +# +# scale_image +# +#------------------------------------------------------------------------- +def mk_thumb(source,dest,size): + + dir = os.path.dirname(dest) + if not os.path.exists(dir): + os.mkdir(dir) + + if no_pil: + cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,size,size,source,dest) + print cmd + os.system(cmd) + else: + im = Image.open(source) + im.thumbnail((size,size)) + im.save(dest,"JPEG") + +#------------------------------------------------------------------------- +# +# scale_image +# +#------------------------------------------------------------------------- +def check_thumb(source,dest,size): + if not os.path.isfile(source): + return + if not os.path.isfile(dest): + mk_thumb(source,dest,size) + elif os.path.getmtime(source) > os.path.getmtime(dest): + mk_thumb(source,dest,size) + + diff --git a/src/RelLib.py b/src/RelLib.py index 5ffa03189..bb01b30d4 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -620,6 +620,8 @@ class Source: self.pubinfo = "" self.callno = "" self.note = Note() + self.photoList = [] + self.id = -1 def setId(self,newId): self.id = newId @@ -627,6 +629,12 @@ class Source: def getId(self): return self.id + def addPhoto(self,photo): + self.photoList.append(photo) + + def getPhotoList(self): + return self.photoList + def setTitle(self,title): self.title = title diff --git a/src/Sources.py b/src/Sources.py index 972ba6829..41a42b82d 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -106,7 +106,11 @@ class SourceEditor: typeMenu.append(menuitem) index = 1 save = 0 - self.base = self.source_ref.getBase() + if self.source_ref: + self.base = self.source_ref.getBase() + else: + self.base = None + for src in self.db.getSourceMap().values(): if src == self.base: save = index @@ -155,6 +159,10 @@ def on_sourceok_clicked(obj): src_edit = obj.get_data(SOURCEDISP) current_source_ref = src_edit.active_entry.getSourceRef() + if current_source_ref == None: + current_source_ref = SourceRef() + src_edit.active_entry.setSourceRef(current_source_ref) + if src_edit.active_source != current_source_ref.getBase(): src_edit.active_entry.getSourceRef().setBase(src_edit.active_source) utils.modified() diff --git a/src/WriteXML.py b/src/WriteXML.py index 3487d94bb..659e980a2 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -62,11 +62,8 @@ def fix(line): def writeNote(g,val,note): if not note: return - g.write("<" + val + ">\n") - textlines = string.split(note[:-1],'\n') - - for line in textlines: - g.write("

" + fix(line) + "

\n") + g.write("<" + val + ">") + g.write(fix(note)) g.write("\n") #------------------------------------------------------------------------- @@ -90,7 +87,7 @@ def dump_my_event(g,name,event): date = event.getSaveDate() place = event.getPlace() description = event.getDescription() - if not date and not place and not description: + if not name and not date and not place and not description: return g.write("\n") @@ -123,7 +120,7 @@ def dump_source_ref(g,source_ref): write_line(g,"spage",p) writeNote(g,"scomments",c) writeNote(g,"stext",t) - write_line(g,"sdate",c) + write_line(g,"sdate",d) g.write("\n") #------------------------------------------------------------------------- @@ -283,7 +280,7 @@ def exportData(database, filename, callback): g.write("\n") for attr in person.getAttributeList(): if attr.getSourceRef() or attr.getNote(): - g.write('') + g.write('\n') write_line(g,"attr_type",attr.getType()) write_line(g,"attr_value",attr.getValue()) dump_source_ref(g,attr.getSourceRef()) @@ -358,6 +355,12 @@ def exportData(database, filename, callback): write_line(g,"scallno",source.getCallNumber()) if source.getNote() != "": writeNote(g,"note",source.getNote()) + for photo in source.getPhotoList(): + path = photo.getPath() + if os.path.dirname(path) == fileroot: + path = os.path.basename(path) + g.write("\n") g.write("\n") g.write("\n") diff --git a/src/gramps.glade b/src/gramps.glade index cb6413ff6..0a7b465a3 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -2373,6 +2373,11 @@ on_source_list_select_row Tue, 29 May 2001 21:23:02 GMT
+ + button_press_event + on_source_list_button_press_event + Thu, 31 May 2001 17:22:45 GMT + 2 300,80 GTK_SELECTION_SINGLE @@ -3407,7 +3412,7 @@ Other Gramps - Source Editor GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER - True + False False False False @@ -3519,8 +3524,14 @@ Other GtkNotebook notebook2 450 - 250 + 350 True + + switch_page + on_switch_page + sourceEditor + Thu, 31 May 2001 15:04:55 GMT + True True GTK_POS_TOP @@ -3711,7 +3722,7 @@ Other GtkScrolledWindow scrolledwindow23 GTK_POLICY_NEVER - GTK_POLICY_ALWAYS + GTK_POLICY_AUTOMATIC GTK_UPDATE_CONTINUOUS GTK_UPDATE_CONTINUOUS @@ -3738,7 +3749,101 @@ Other - Placeholder + GtkScrolledWindow + scrolledwindow25 + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkViewport + viewport1 + GTK_SHADOW_IN + + + GtkVBox + vbox34 + False + 0 + + + GnomeIconList + photolist + True + + select_icon + on_photolist_select_icon + sourceEditor + Thu, 31 May 2001 14:39:53 GMT + + + button_press_event + on_photolist_button_press_event + sourceEditor + Thu, 31 May 2001 14:40:04 GMT + + GTK_SELECTION_SINGLE + 100 + 20 + 10 + 5 + False + True + + 0 + True + True + + + + + GtkHButtonBox + hbuttonbox21 + GTK_BUTTONBOX_SPREAD + 30 + 85 + 27 + 7 + 0 + + 0 + False + True + + + + GtkButton + add_photo + True + True + + clicked + on_addphoto_clicked + sourceEditor + Thu, 31 May 2001 14:39:32 GMT + + + GTK_RELIEF_NORMAL + + + + GtkButton + delete_photo + True + True + + clicked + on_deletephoto_clicked + sourceEditor + Thu, 31 May 2001 14:39:16 GMT + + + GTK_RELIEF_NORMAL + + + + diff --git a/src/gramps_main.py b/src/gramps_main.py index 3784591c8..30b792948 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -65,7 +65,9 @@ import utils import Bookmarks import ListColors import Config - +import EditSource +import EditPerson +import Marriage #------------------------------------------------------------------------- # @@ -579,8 +581,6 @@ def new_database_response(val): # #------------------------------------------------------------------------- def marriage_edit(family): - import Marriage - Marriage.Marriage(family,database) #------------------------------------------------------------------------- @@ -669,8 +669,6 @@ def on_source_list_select_row(obj,a,b,c): # #------------------------------------------------------------------------- def on_add_source_clicked(obj): - import EditSource - EditSource.EditSource(Source(),database,new_source_after_edit) #------------------------------------------------------------------------- @@ -687,8 +685,6 @@ def on_delete_source_clicked(obj): # #------------------------------------------------------------------------- def on_edit_source_clicked(obj): - import EditSource - index = obj.get_data("i") if index == -1: return @@ -1603,8 +1599,6 @@ def update_after_edit(person): # #------------------------------------------------------------------------- def load_person(person): - import EditPerson - if person == None: EditPerson.EditPerson(Person(),database,surnameList,\ new_after_edit)