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> 2007-03-25 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_ReportOptions.py: Remove get_display_format (not used) * src/ReportBase/_ReportOptions.py: Remove get_display_format (not used)
* src/ReportBase/_BareReportDialog.py: * src/ReportBase/_BareReportDialog.py:

View File

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

View File

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