From b18c00b923074492df4d68469481e7c599d871d2 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 15 Dec 2003 20:00:47 +0000 Subject: [PATCH] * src/NameEdit.py: Add note format support. * src/AddrEdit.py: Add note format support. * src/AttrEdit.py: Add note format support. * src/EventEdit.py: Add note format support. * src/EditSource.py: Add note format support. svn: r2525 --- ChangeLog | 7 +++++++ src/AddrEdit.py | 14 +++++++++++--- src/AttrEdit.py | 14 +++++++++++--- src/EditSource.py | 13 ++++++++++++- src/EventEdit.py | 18 ++++++++++++++++-- src/NameEdit.py | 17 ++++++++++++++--- 6 files changed, 71 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5365e600..8dd020cbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-15 Alex Roitman + * src/NameEdit.py: Add note format support. + * src/AddrEdit.py: Add note format support. + * src/AttrEdit.py: Add note format support. + * src/EventEdit.py: Add note format support. + * src/EditSource.py: Add note format support. + 2003-12-14 Alex Roitman * src/dialog.glade: Add format controls for notes. * src/marriage.glade: Add format controls for notes. diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 0b38f8894..cfd7f39b5 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -78,6 +78,8 @@ class AddressEditor: self.slist = self.top.get_widget("slist") self.sources_label = self.top.get_widget("sourcesAddr") self.notes_label = self.top.get_widget("noteAddr") + self.flowed = self.top.get_widget("addr_flowed") + self.preform = self.top.get_widget("addr_preform") self.parent = parent self.db = self.parent.db @@ -104,9 +106,13 @@ class AddressEditor: self.postal.set_text(self.addr.getPostal()) self.phone.set_text(self.addr.getPhone()) self.priv.set_active(self.addr.getPrivacy()) - self.note_field.get_buffer().set_text(self.addr.getNote()) if self.addr.getNote(): + self.note_field.get_buffer().set_text(self.addr.getNote()) Utils.bold_label(self.notes_label) + if addr.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) else: self.srcreflist = [] @@ -150,6 +156,7 @@ class AddressEditor: postal = self.postal.get_text() b = self.note_field.get_buffer() note = b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE) + format = self.preform.get_active() priv = self.priv.get_active() if self.addr == None: @@ -157,7 +164,7 @@ class AddressEditor: self.parent.plist.append(self.addr) self.addr.setSourceRefList(self.srcreflist) - self.update(date,street,city,state,country,postal,phone,note,priv) + self.update(date,street,city,state,country,postal,phone,note,format,priv) self.callback(self.addr) def check(self,get,set,data): @@ -167,7 +174,7 @@ class AddressEditor: set(data) self.parent.lists_changed = 1 - def update(self,date,street,city,state,country,postal,phone,note,priv): + def update(self,date,street,city,state,country,postal,phone,note,format,priv): """Compares the data items, and updates if necessary""" d = Date.Date() d.set(date) @@ -183,6 +190,7 @@ class AddressEditor: self.check(self.addr.getPostal,self.addr.setPostal,postal) self.check(self.addr.getPhone,self.addr.setPhone,phone) self.check(self.addr.getNote,self.addr.setNote,note) + self.check(self.addr.getNoteFormat,self.addr.setNoteFormat,format) self.check(self.addr.getPrivacy,self.addr.setPrivacy,priv) def on_switch_page(self,obj,a,page): diff --git a/src/AttrEdit.py b/src/AttrEdit.py index 24ba0cee1..82993b7cd 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -82,6 +82,8 @@ class AttributeEditor: self.priv = self.top.get_widget("priv") self.sources_label = self.top.get_widget("sourcesAttr") self.notes_label = self.top.get_widget("noteAttr") + self.flowed = self.top.get_widget("attr_flowed") + self.preform = self.top.get_widget("attr_preform") self.callback = callback self.alist = list @@ -112,9 +114,13 @@ class AttributeEditor: self.value_field.set_text(attrib.getValue()) self.priv.set_active(attrib.getPrivacy()) - self.note_field.get_buffer().set_text(attrib.getNote()) if attrib.getNote(): + self.note_field.get_buffer().set_text(attrib.getNote()) Utils.bold_label(self.notes_label) + if attrib.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) self.top.signal_autoconnect({ "on_add_src_clicked" : self.add_source, @@ -151,6 +157,7 @@ class AttributeEditor: buf = self.note_field.get_buffer() note = buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE) + format = self.preform.get_active() priv = self.priv.get_active() if not type in self.alist: @@ -165,7 +172,7 @@ class AttributeEditor: self.parent.alist.append(self.attrib) self.attrib.setSourceRefList(self.srcreflist) - self.update(type,value,note,priv) + self.update(type,value,note,format,priv) self.callback(self.attrib) def check(self,get,set,data): @@ -175,12 +182,13 @@ class AttributeEditor: set(data) self.parent.lists_changed = 1 - def update(self,type,value,note,priv): + def update(self,type,value,note,format,priv): """Compares the data items, and updates if necessary""" ntype = const.save_pattr(type) self.check(self.attrib.getType,self.attrib.setType,ntype) self.check(self.attrib.getValue,self.attrib.setValue,value) self.check(self.attrib.getNote,self.attrib.setNote,note) + self.check(self.attrib.getNoteFormat,self.attrib.setNoteFormat,format) self.check(self.attrib.getPrivacy,self.attrib.setPrivacy,priv) def on_switch_page(self,obj,a,page): diff --git a/src/EditSource.py b/src/EditSource.py index 3ae790b02..c4fd2fd17 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -73,6 +73,8 @@ class EditSource: self.gallery_label = self.top_window.get_widget("gallerySourceEditor") self.refs_label = self.top_window.get_widget("refsSourceEditor") self.notes_label = self.top_window.get_widget("notesSourceEditor") + self.flowed = self.top_window.get_widget("source_flowed") + self.preform = self.top_window.get_widget("source_preform") self.refinfo = self.top_window.get_widget("refinfo") @@ -85,6 +87,10 @@ class EditSource: if source.getNote(): self.notes_buffer.set_text(source.getNote()) Utils.bold_label(self.notes_label) + if source.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) if self.source.getPhotoList(): Utils.bold_label(self.gallery_label) @@ -234,7 +240,8 @@ class EditSource: abbrev = self.abbrev.get_text() note = self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE) - + format = self.preform.get_active() + if author != self.source.getAuthor(): self.source.setAuthor(author) Utils.modified() @@ -255,6 +262,10 @@ class EditSource: self.source.setNote(note) Utils.modified() + if format != self.source.getNoteFormat(): + self.source.setNoteFormat(format) + Utils.modified() + self.close(None) if self.callback: diff --git a/src/EventEdit.py b/src/EventEdit.py index 6f3c44aef..91d7f22c5 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -117,6 +117,8 @@ class EventEditor: self.calendar = self.top.get_widget("calendar") self.sources_label = self.top.get_widget("sourcesEvent") self.notes_label = self.top.get_widget("notesEvent") + self.flowed = self.top.get_widget("eventflowed") + self.preform = self.top.get_widget("eventpreform") self.witnesses_label = self.top.get_widget("witnessesEvent") if GrampsCfg.calendar: @@ -156,6 +158,13 @@ class EventEditor: self.priv.set_active(event.getPrivacy()) self.note_field.get_buffer().set_text(event.getNote()) + if event.getNote(): + self.note_field.get_buffer().set_text(event.getNote()) + Utils.bold_label(self.notes_label) + if event.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) else: if def_event: self.name_field.set_text(def_event) @@ -235,6 +244,7 @@ class EventEditor: buf = self.note_field.get_buffer() enote = buf.get_text(buf.get_start_iter(),buf.get_end_iter(),gtk.FALSE) + eformat = self.preform.get_active() edesc = self.descr_field.get_text() epriv = self.priv.get_active() @@ -251,11 +261,11 @@ class EventEditor: self.event.set_witness_list(self.witnesslist) self.parent.elist.append(self.event) - self.update_event(ename,self.date,eplace_obj,edesc,enote,epriv,ecause) + self.update_event(ename,self.date,eplace_obj,edesc,enote,eformat,epriv,ecause) self.parent.redraw_event_list() self.callback(self.event) - def update_event(self,name,date,place,desc,note,priv,cause): + def update_event(self,name,date,place,desc,note,format,priv,cause): if self.event.getPlace() != place: self.event.setPlace(place) self.parent.lists_changed = 1 @@ -272,6 +282,10 @@ class EventEditor: self.event.setNote(note) self.parent.lists_changed = 1 + if self.event.getNoteFormat() != format: + self.event.setNoteFormat(format) + self.parent.lists_changed = 1 + dobj = self.event.getDateObj() self.event.setSourceRefList(self.srcreflist) diff --git a/src/NameEdit.py b/src/NameEdit.py index 29bb1e313..9262d80ad 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -67,6 +67,8 @@ class NameEditor: self.priv = self.top.get_widget("priv") self.sources_label = self.top.get_widget("sourcesName") self.notes_label = self.top.get_widget("noteName") + self.flowed = self.top.get_widget("alt_flowed") + self.preform = self.top.get_widget("alt_preform") types = const.NameTypesMap.keys() types.sort() @@ -109,9 +111,13 @@ class NameEditor: self.suffix_field.set_text(name.getSuffix()) self.type_field.entry.set_text(_(name.getType())) self.priv.set_active(name.getPrivacy()) - self.note_buffer.set_text(name.getNote()) if name.getNote(): + self.note_buffer.set_text(name.getNote()) Utils.bold_label(self.notes_label) + if name.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) if parent_window: self.window.set_transient_for(parent_window) @@ -132,6 +138,7 @@ class NameEditor: suffix = self.suffix_field.get_text() note = self.note_buffer.get_text(self.note_buffer.get_start_iter(), self.note_buffer.get_end_iter(),gtk.FALSE) + format = self.preform.get_active() priv = self.priv.get_active() type = self.type_field.entry.get_text() @@ -147,12 +154,12 @@ class NameEditor: self.name.setSourceRefList(self.srcreflist) - self.update_name(first,last,suffix,title,type,note,priv) + self.update_name(first,last,suffix,title,type,note,format,priv) self.parent.lists_changed = 1 self.callback(self.name) - def update_name(self,first,last,suffix,title,type,note,priv): + def update_name(self,first,last,suffix,title,type,note,format,priv): if self.name.getFirstName() != first: self.name.setFirstName(first) @@ -179,6 +186,10 @@ class NameEditor: self.name.setNote(note) self.parent.lists_changed = 1 + if self.name.getNoteFormat() != format: + self.name.setNoteFormat(format) + self.parent.lists_changed = 1 + if self.name.getPrivacy() != priv: self.name.setPrivacy(priv) self.parent.lists_changed = 1