From 554c46acf4b5a46dc7778b0542bb476b6850f503 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 16 Dec 2003 00:37:47 +0000 Subject: [PATCH] * src/places.glade: Add format controls for notes. * src/imagesel.glade: Add format controls for notes. * src/EditPlace.py: Add note format support. * src/ImageSelect.py: Add note format support. * src/EditPerson.py: Clean up note format support. * src/Marriage.py: Add note format support. svn: r2526 --- ChangeLog | 6 + src/EditPerson.py | 17 +-- src/EditPlace.py | 13 +- src/ImageSelect.py | 52 +++++++- src/Marriage.py | 18 ++- src/imagesel.glade | 292 ++++++++++++++++++++++++++++++++++++++------- src/places.glade | 135 ++++++++++++++++++--- 7 files changed, 458 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dd020cbd..71342ab75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ * src/AttrEdit.py: Add note format support. * src/EventEdit.py: Add note format support. * src/EditSource.py: Add note format support. + * src/places.glade: Add format controls for notes. + * src/imagesel.glade: Add format controls for notes. + * src/EditPlace.py: Add note format support. + * src/ImageSelect.py: Add note format support. + * src/EditPerson.py: Clean up note format support. + * src/Marriage.py: Add note format support. 2003-12-14 Alex Roitman * src/dialog.glade: Add format controls for notes. diff --git a/src/EditPerson.py b/src/EditPerson.py index f76ed3015..dc8981199 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1023,8 +1023,7 @@ class EditPerson: unknown = self.is_unknown.get_active() text = self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE) - flowed = self.flowed.get_active() - preform = self.preform.get_active() + format = self.preform.get_active() idval = self.gid.get_text() changed = 0 @@ -1085,9 +1084,7 @@ class EditPerson: changed = 1 if text != self.person.getNote() or self.lists_changed: changed = 1 - if flowed and self.person.getNoteFormat() != 0: - changed = 1 - elif preform and self.person.getNoteFormat() != 1 : + if format != self.person.getNoteFormat(): changed = 1 if self.lds_not_loaded == 0: @@ -1509,12 +1506,10 @@ class EditPerson: self.person.setNote(text) Utils.modified() - flowed = self.flowed.get_active() - preform = self.preform.get_active() - if flowed and self.person.getNoteFormat() != 0: - self.person.setNoteFormat(0) - elif preform and self.person.getNoteFormat() != 1 : - self.person.setNoteFormat(1) + format = self.preform.get_active() + if format != self.person.getNoteFormat(): + self.person.setNoteFormat(format) + Utils.modified() if self.complete.get_active() != self.person.getComplete(): self.person.setComplete(self.complete.get_active()) diff --git a/src/EditPlace.py b/src/EditPlace.py index aa684109c..9ff4e4218 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -150,11 +150,17 @@ class EditPlace: self.gallery_label = self.top_window.get_widget("galleryPlaceEdit") self.inet_label = self.top_window.get_widget("inetPlaceEdit") self.refs_label = self.top_window.get_widget("refsPlaceEdit") + self.flowed = self.top_window.get_widget("place_flowed") + self.preform = self.top_window.get_widget("place_preform") self.note_buffer = self.note.get_buffer() if place.getNote(): self.note_buffer.set_text(place.getNote()) Utils.bold_label(self.notes_label) + if place.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) if self.place.getPhotoList(): Utils.bold_label(self.gallery_label) @@ -285,7 +291,8 @@ class EditPlace: note = self.note_buffer.get_text(self.note_buffer.get_start_iter(), self.note_buffer.get_end_iter(),gtk.FALSE) - mloc = self.place.get_main_location() + format = self.preform.get_active() + mloc = self.place.get_main_location() self.set(self.city,mloc.get_city,mloc.set_city) self.set(self.parish,mloc.get_parish,mloc.set_parish) @@ -308,6 +315,10 @@ class EditPlace: self.place.setNote(note) Utils.modified() + if format != self.place.getNoteFormat(): + self.place.setNoteFormat(format) + Utils.modified() + self.update_lists() if self.callback: diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 49147a4df..f4cae9d95 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -674,6 +674,11 @@ class LocalMediaProperties: self.attr_list = self.change_dialog.get_widget("attr_list") titles = [(_('Attribute'),0,150),(_('Value'),0,100)] + self.attr_label = self.change_dialog.get_widget("attr_local") + self.notes_label = self.change_dialog.get_widget("notes_local") + self.flowed = self.change_dialog.get_widget("flowed") + self.preform = self.change_dialog.get_widget("preform") + self.atree = ListModel.ListModel(self.attr_list,titles, self.on_attr_list_select_row, self.on_update_attr_clicked) @@ -696,14 +701,24 @@ class LocalMediaProperties: mt = Utils.get_mime_description(mtype) self.change_dialog.get_widget("type").set_text(mt) - self.change_dialog.get_widget("notes").get_buffer().set_text(self.photo.getNote()) + self.notes = self.change_dialog.get_widget("notes") + if self.photo.getNote(): + self.notes.get_buffer().set_text(self.photo.getNote()) + Utils.bold_label(self.notes_label) + if self.photo.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) + self.change_dialog.signal_autoconnect({ "on_cancel_clicked" : Utils.destroy_passed_object, "on_ok_clicked" : self.on_ok_clicked, "on_apply_clicked" : self.on_apply_clicked, "on_add_attr_clicked": self.on_add_attr_clicked, + "on_notebook_switch_page": self.on_notebook_switch_page, "on_update_attr_clicked": self.on_update_attr_clicked, "on_delete_attr_clicked" : self.on_delete_attr_clicked, + "on_help_clicked" : self.on_help_clicked, }) self.redraw_attr_list() @@ -714,23 +729,43 @@ class LocalMediaProperties: d = [attr.getType(),attr.getValue()] iter = self.atree.add(d,attr) self.amap[str(attr)] = iter + if self.alist: + Utils.bold_label(self.attr_label) + else: + Utils.unbold_label(self.attr_label) + def on_notebook_switch_page(self,obj,junk,page): + t = self.notes.get_buffer() + text = t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE) + if text: + Utils.bold_label(self.notes_label) + else: + Utils.unbold_label(self.notes_label) + def on_apply_clicked(self, obj): priv = self.change_dialog.get_widget("private").get_active() - t = self.change_dialog.get_widget("notes").get_buffer() + t = self.notes.get_buffer() text = t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE) note = self.photo.getNote() + format = self.preform.get_active() if text != note or priv != self.photo.getPrivacy(): self.photo.setNote(text) self.photo.setPrivacy(priv) self.parent.lists_changed = 1 Utils.modified() + if format != self.photo.getNoteFormat(): + self.photo.setNoteFormat(format) + Utils.modified() if self.lists_changed: self.photo.setAttributeList(self.alist) self.parent.lists_changed = 1 Utils.modified() + def on_help_clicked(self, obj): + """Display the relevant portion of GRAMPS manual""" + gnome.help_display('gramps-manual','gramps-edit-complete') + def on_ok_clicked(self, obj): self.on_apply_clicked(obj) Utils.destroy_passed_object(obj) @@ -806,6 +841,8 @@ class GlobalMediaProperties: self.attr_label = self.change_dialog.get_widget("attrGlobal") self.notes_label = self.change_dialog.get_widget("notesGlobal") self.refs_label = self.change_dialog.get_widget("refsGlobal") + self.flowed = self.change_dialog.get_widget("global_flowed") + self.preform = self.change_dialog.get_widget("global_preform") titles = [(_('Attribute'),0,150),(_('Value'),1,100)] @@ -824,9 +861,13 @@ class GlobalMediaProperties: self.update_info() self.change_dialog.get_widget("type").set_text(Utils.get_mime_description(mtype)) - self.notes.get_buffer().set_text(self.object.getNote()) if self.object.getNote(): + self.notes.get_buffer().set_text(self.object.getNote()) Utils.bold_label(self.notes_label) + if self.object.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) self.change_dialog.signal_autoconnect({ "on_cancel_clicked" : Utils.destroy_passed_object, @@ -889,7 +930,6 @@ class GlobalMediaProperties: else: Utils.unbold_label(self.attr_label) - def button_press(self,obj): store,iter = self.refmodel.selection.get_selected() if not iter: @@ -947,10 +987,14 @@ class GlobalMediaProperties: text = t.get_text(t.get_start_iter(),t.get_end_iter(),gtk.FALSE) desc = self.descr_window.get_text() note = self.object.getNote() + format = self.preform.get_active() if text != note or desc != self.object.getDescription(): self.object.setNote(text) self.object.setDescription(desc) Utils.modified() + if format != self.object.getNoteFormat(): + self.object.setNoteFormat(format) + Utils.modified() if self.lists_changed: self.object.setAttributeList(self.alist) Utils.modified() diff --git a/src/Marriage.py b/src/Marriage.py index fb3792a71..c10790ae2 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -159,6 +159,9 @@ class Marriage: self.notes_label = self.get_widget("notesMarriage") self.lds_label = self.get_widget("ldsMarriage") + self.flowed = self.get_widget("mar_flowed") + self.preform = self.get_widget("mar_preform") + self.elist = family.getEventList()[:] self.alist = family.getAttributeList()[:] self.lists_changed = 0 @@ -228,9 +231,13 @@ class Marriage: # set notes data self.notes_buffer = self.notes_field.get_buffer() - self.notes_buffer.set_text(family.getNote()) if family.getNote(): + self.notes_buffer.set_text(family.getNote()) Utils.bold_label(self.notes_label) + if family.getNoteFormat() == 1: + self.preform.set_active(1) + else: + self.flowed.set_active(1) self.sourcetab = Sources.SourceTab(self.srcreflist,self, self.top,self.window,self.slist, @@ -425,8 +432,12 @@ class Marriage: text = 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 text != self.family.getNote(): changed = 1 + if format != self.family.getNoteFormat(): + changed = 1 if self.lists_changed: changed = 1 @@ -521,6 +532,11 @@ class Marriage: self.family.setNote(text) Utils.modified() + format = self.preform.get_active() + if format != self.family.getNoteFormat(): + self.family.setNoteFormat(format) + Utils.modified() + if self.complete.get_active() != self.family.getComplete(): self.family.setComplete(self.complete.get_active()) Utils.modified() diff --git a/src/imagesel.glade b/src/imagesel.glade index 0d68ebfac..3ff17b01a 100644 --- a/src/imagesel.glade +++ b/src/imagesel.glade @@ -411,6 +411,19 @@ + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + -11 + + + 0 @@ -746,31 +759,131 @@ GTK_POS_TOP False False + - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + False + 0 - + True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + True + True + + + + + + 12 + True + 2 + 3 + False + 12 + 24 + + + + True + <b>Format</b> + True + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 3 + 0 + 1 + fill + + + + + + + True + Multiple spaces, tabs, and single line breaks are replaced with single spaces. Two consecutive line breaks mark a new paragraph. + True + _Flowed + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 1 + 2 + + + + + + + + True + Formatting is preserved, except for the leading whitespace. Multiple spaces, tabs, and all line breaks are respected. + True + _Preformatted + True + GTK_RELIEF_NORMAL + False + False + True + flowed + + + 2 + 3 + 1 + 2 + + + + + + + 0 + False + True + @@ -780,9 +893,9 @@ - + True - <b>Notes</b> + Notes False True GTK_JUSTIFY_CENTER @@ -1070,9 +1183,9 @@ - + True - <b>Attributes</b> + Attributes False True GTK_JUSTIFY_CENTER @@ -1882,29 +1995,128 @@ - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + False + 0 - + True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + True + True + + + + + + 12 + True + 2 + 3 + False + 12 + 24 + + + + True + <b>Format</b> + True + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 3 + 0 + 1 + fill + + + + + + + True + Multiple spaces, tabs, and single line breaks are replaced with single spaces. Two consecutive line breaks mark a new paragraph. + True + _Flowed + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 1 + 2 + + + + + + + + True + Formatting is preserved, except for the leading whitespace. Multiple spaces, tabs, and all line breaks are respected. + True + _Preformatted + True + GTK_RELIEF_NORMAL + False + False + True + global_flowed + + + 2 + 3 + 1 + 2 + + + + + + + 0 + False + True + diff --git a/src/places.glade b/src/places.glade index 9906e6e62..3d2435663 100644 --- a/src/places.glade +++ b/src/places.glade @@ -1196,29 +1196,128 @@ - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + False + 0 - + True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + True + True + + + + + + 12 + True + 2 + 3 + False + 12 + 24 + + + + True + <b>Format</b> + True + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 3 + 0 + 1 + fill + + + + + + + True + Multiple spaces, tabs, and single line breaks are replaced with single spaces. Two consecutive line breaks mark a new paragraph. + True + _Flowed + True + GTK_RELIEF_NORMAL + True + False + True + + + 1 + 2 + 1 + 2 + + + + + + + + True + Formatting is preserved, except for the leading whitespace. Multiple spaces, tabs, and all line breaks are respected. + True + _Preformatted + True + GTK_RELIEF_NORMAL + False + False + True + place_flowed + + + 2 + 3 + 1 + 2 + + + + + + + 0 + False + True +