2007-03-26 Zsolt Foldvari <zfoldvar@users.sourceforge.net>

* src/Editors/_EditNote.py (save): pass the handle to the callback
	instead of the object itself.
	* src/DisplayTabs/_NoteTab.py: pass the add and edit callback functions
	to EditNote; side button tooltips.



svn: r8318
This commit is contained in:
Zsolt Foldvari 2007-03-26 21:06:17 +00:00
parent dfed629290
commit 6aad932574
3 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2007-03-26 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/Editors/_EditNote.py (save): pass the handle to the callback
instead of the object itself.
* src/DisplayTabs/_NoteTab.py: pass the add and edit callback functions
to EditNote; side button tooltips.
2007-03-25 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_ReportOptions.py: Remove get_display_format (not used)
* src/ReportBase/_BareReportDialog.py:

View File

@ -49,10 +49,16 @@ class NoteTab(EmbeddedList):
_HANDLE_COL = 2
_MSG = {
'add' : _('Create and add a new note'),
'del' : _('Remove the existing note'),
'edit' : _('Edit the selected note'),
}
_column_names = [
(_('Type'), 0, 100),
(_('Preview'), 1, 200),
]
]
def __init__(self, dbstate, uistate, track, data):
self.data = data
@ -74,7 +80,7 @@ class NoteTab(EmbeddedList):
def add_button_clicked(self, obj):
note = RelLib.Note()
try:
EditNote(self.dbstate, self.uistate, [], note)
EditNote(self.dbstate, self.uistate, [], note, self.add_callback)
except Errors.WindowActiveError:
pass
@ -88,7 +94,8 @@ class NoteTab(EmbeddedList):
if handle:
note = self.dbstate.db.get_note_from_handle(handle)
try:
EditNote(self.dbstate, self.uistate, [], note)
EditNote(self.dbstate, self.uistate, [], note,
self.edit_callback)
except Errors.WindowActiveError:
pass

View File

@ -33,7 +33,6 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------
import gtk
import pango
#-------------------------------------------------------------------------
#
@ -46,6 +45,7 @@ import Config
from _EditPrimary import EditPrimary
from MarkupText import EditorBuffer
from GrampsWidgets import *
from RelLib import Note
#-------------------------------------------------------------------------
#
@ -56,7 +56,7 @@ class EditNote(EditPrimary):
def __init__(self, state, uistate, track, note, callback=None):
"""
Creates an EditPerson window. Associates a person with the window.
Creates an EditNote window. Associates a note with the window.
"""
EditPrimary.__init__(self, state, uistate, track, note,
state.db.get_note_from_handle, callback)
@ -66,7 +66,7 @@ class EditNote(EditPrimary):
Returns an empty Person object for comparison for changes. This
is used by the base class (EditPrimary)
"""
return RelLib.Note()
return Note()
def get_menu_title(self):
if self.obj.get_handle():
@ -209,7 +209,7 @@ class EditNote(EditPrimary):
start = buffer.get_start_iter()
stop = buffer.get_end_iter()
text = buffer.get_text(start, stop)
print text
log.debug(text)
self.obj.set(text)
else:
log.debug("NOTE OBJ DOES NOT EXIST")
@ -239,7 +239,7 @@ class EditNote(EditPrimary):
self.db.transaction_commit(trans, _("Edit Note"))
if self.callback:
self.callback(self.obj)
self.callback(self.obj.get_handle())
self.close()
def _cleanup_on_exit(self):