From 9d232633abaeddd6de87e22c8fc5aaecee58dd4a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 8 Feb 2009 10:17:50 +0000 Subject: [PATCH] Use preformatted correctly in notes. remove non-markup code svn: r11915 --- src/Editors/_EditNote.py | 50 ++-------------------------------------- src/glade/gramps.glade | 2 ++ 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/src/Editors/_EditNote.py b/src/Editors/_EditNote.py index 9425c622a..0ed088ce4 100644 --- a/src/Editors/_EditNote.py +++ b/src/Editors/_EditNote.py @@ -3,6 +3,7 @@ # # Copyright (C) 2000-2006 Donald N. Allingham # 2009 Gary Burton +# 2009 Benny Malengier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -195,7 +196,6 @@ class EditNote(EditPrimary): self.top.get_widget('format'), self.obj.set_format, self.obj.get_format, - on_toggle = self.flow_changed, readonly = self.db.readonly) self.gid = MonitoredEntry( @@ -237,10 +237,10 @@ class EditNote(EditPrimary): self._setup_notebook_tabs(notebook) -# THIS IS THE MARKUP VERSION - enable for markup def build_interface(self): self.texteditor = self.top.get_widget('texteditor') self.texteditor.set_editable(not self.dbstate.db.readonly) + self.texteditor.set_wrap_mode(gtk.WRAP_WORD) # create a formatting toolbar if not self.dbstate.db.readonly: @@ -251,47 +251,11 @@ class EditNote(EditPrimary): # setup initial values for textview and textbuffer if self.obj: self.empty = False - self.flow_changed(self.obj.get_format()) self.texteditor.set_text(self.obj.get_styledtext()) _LOG.debug("Initial Note: %s" % str(self.texteditor.get_text())) else: self.empty = True -# NON-MARKUP VERSION - Disable for markup - #def build_interface(self): - #textbuffer = gtk.TextBuffer() - - #self.text = self.top.get_widget('text') - #self.text.set_editable(not self.dbstate.db.readonly) - #self.text.set_buffer(textbuffer) - - ## setup spell checking interface - #spellcheck = Spell(self.text) - #liststore = gtk.ListStore(gobject.TYPE_STRING) - #cell = gtk.CellRendererText() - #lang_selector = self.top.get_widget('spell') - #lang_selector.set_model(liststore) - #lang_selector.pack_start(cell, True) - #lang_selector.add_attribute(cell, 'text', 0) - #act_lang = spellcheck.get_active_language() - #idx = 0 - #for lang in spellcheck.get_all_languages(): - #lang_selector.append_text(lang) - #if lang == act_lang: - #act_idx = idx - #idx = idx + 1 - #lang_selector.set_active(act_idx) - #lang_selector.connect('changed', self.on_spell_change, spellcheck) - ##lang_selector.set_sensitive(Config.get(Config.SPELLCHECK)) - - ## setup initial values for textview and textbuffer - #if self.obj: - #self.empty = False - #self.flow_changed(self.obj.get_format()) - #textbuffer.set_text(self.obj.get()) - #else: - #self.empty = True - def build_menu_names(self, person): """ Provide the information needed by the base class to define the @@ -309,16 +273,6 @@ class EditNote(EditPrimary): self.obj.set_styledtext(text) _LOG.debug(str(text)) - def flow_changed(self, active): - if active: - # Set the text style to monospace - self.texteditor.set_wrap_mode(gtk.WRAP_NONE) - self.texteditor.modify_font(pango.FontDescription("monospace")) - else: - # Set the text style to normal - self.texteditor.set_wrap_mode(gtk.WRAP_WORD) - self.texteditor.modify_font(pango.FontDescription("normal")) - def save(self, *obj): """Save the data.""" self.ok_button.set_sensitive(False) diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index 3cc0e07b5..cb43a2740 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -15798,6 +15798,8 @@ Very High True + When active the whitespace in your note will be respected in reports. Use this to add formatting layout with spaces, eg a table. +When not checked, notes are automatically cleaned in the reports, which will improve the report layout. True _Preformatted True