Update
svn: r2882
This commit is contained in:
parent
79aef89b1b
commit
ed8497953e
@ -1626,7 +1626,7 @@ class EditPerson:
|
|||||||
|
|
||||||
def on_name_note_clicked(self,obj):
|
def on_name_note_clicked(self,obj):
|
||||||
import NoteEdit
|
import NoteEdit
|
||||||
NoteEdit.NoteEditor(self.pname,self.window)
|
NoteEdit.NoteEditor(self.pname,self,self.window)
|
||||||
|
|
||||||
def on_ldsbap_source_clicked(self,obj):
|
def on_ldsbap_source_clicked(self,obj):
|
||||||
Sources.SourceSelector(self.lds_baptism.get_source_references(),
|
Sources.SourceSelector(self.lds_baptism.get_source_references(),
|
||||||
@ -1638,7 +1638,7 @@ class EditPerson:
|
|||||||
|
|
||||||
def on_ldsbap_note_clicked(self,obj):
|
def on_ldsbap_note_clicked(self,obj):
|
||||||
import NoteEdit
|
import NoteEdit
|
||||||
NoteEdit.NoteEditor(self.lds_baptism,self.window)
|
NoteEdit.NoteEditor(self.lds_baptism,self,self.window)
|
||||||
|
|
||||||
def on_ldsendow_source_clicked(self,obj):
|
def on_ldsendow_source_clicked(self,obj):
|
||||||
Sources.SourceSelector(self.lds_endowment.get_source_references(),
|
Sources.SourceSelector(self.lds_endowment.get_source_references(),
|
||||||
@ -1650,7 +1650,7 @@ class EditPerson:
|
|||||||
|
|
||||||
def on_ldsendow_note_clicked(self,obj):
|
def on_ldsendow_note_clicked(self,obj):
|
||||||
import NoteEdit
|
import NoteEdit
|
||||||
NoteEdit.NoteEditor(self.lds_endowment,self.window)
|
NoteEdit.NoteEditor(self.lds_endowment,self,self.window)
|
||||||
|
|
||||||
def on_ldsseal_source_clicked(self,obj):
|
def on_ldsseal_source_clicked(self,obj):
|
||||||
Sources.SourceSelector(self.lds_sealing.get_source_references(),
|
Sources.SourceSelector(self.lds_sealing.get_source_references(),
|
||||||
@ -1662,7 +1662,7 @@ class EditPerson:
|
|||||||
|
|
||||||
def on_ldsseal_note_clicked(self,obj):
|
def on_ldsseal_note_clicked(self,obj):
|
||||||
import NoteEdit
|
import NoteEdit
|
||||||
NoteEdit.NoteEditor(self.lds_sealing,self.window)
|
NoteEdit.NoteEditor(self.lds_sealing,self,self.window)
|
||||||
|
|
||||||
def load_person_image(self):
|
def load_person_image(self):
|
||||||
photo_list = self.person.get_photo_list()
|
photo_list = self.person.get_photo_list()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -42,10 +42,12 @@ from gettext import gettext as _
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class NoteEditor:
|
class NoteEditor:
|
||||||
"""Displays a simple text editor that allows a person to edit a note"""
|
"""Displays a simple text editor that allows a person to edit a note"""
|
||||||
def __init__(self,data,parent_window=None):
|
def __init__(self,data,parent,parent_window=None):
|
||||||
|
|
||||||
self.data = data
|
self.data = data
|
||||||
self.parent_window = parent_window
|
self.parent_window = parent_window
|
||||||
|
self.child_windows = []
|
||||||
|
self.parent = parent
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
@ -74,17 +76,39 @@ class NoteEditor:
|
|||||||
|
|
||||||
self.entry.get_buffer().set_text(self.data.get_note())
|
self.entry.get_buffer().set_text(self.data.get_note())
|
||||||
|
|
||||||
self.top.add_button(gtk.STOCK_CANCEL,1)
|
cancel_button = self.top.add_button(gtk.STOCK_CANCEL,1)
|
||||||
self.top.add_button(gtk.STOCK_OK,0)
|
ok_button = self.top.add_button(gtk.STOCK_OK,0)
|
||||||
|
cancel_button.connect("clicked",self.close)
|
||||||
|
ok_button.connect("clicked",self.on_save_note_clicked)
|
||||||
|
self.top.connect("delete_event",self.on_delete_event)
|
||||||
self.top.show_all()
|
self.top.show_all()
|
||||||
|
|
||||||
if self.parent_window:
|
if self.parent_window:
|
||||||
self.top.set_transient_for(self.parent_window)
|
self.top.set_transient_for(self.parent_window)
|
||||||
if self.top.run() == 0:
|
self.parent.child_windows.append(self)
|
||||||
self.on_save_note_clicked()
|
self.add_itself_to_menu()
|
||||||
|
self.top.show()
|
||||||
|
|
||||||
|
def on_delete_event(self,obj,b):
|
||||||
|
self.remove_itself_from_menu()
|
||||||
|
|
||||||
|
def close(self,obj):
|
||||||
|
self.remove_itself_from_menu()
|
||||||
self.top.destroy()
|
self.top.destroy()
|
||||||
|
|
||||||
def on_save_note_clicked(self):
|
def add_itself_to_menu(self):
|
||||||
|
self.parent_menu_item = gtk.MenuItem(_('Note'))
|
||||||
|
self.parent_menu_item.connect("activate",self.present)
|
||||||
|
self.parent_menu_item.show()
|
||||||
|
self.parent.menu.append(self.parent_menu_item)
|
||||||
|
|
||||||
|
def remove_itself_from_menu(self):
|
||||||
|
self.parent_menu_item.destroy()
|
||||||
|
|
||||||
|
def present(self,obj):
|
||||||
|
self.top.present()
|
||||||
|
|
||||||
|
def on_save_note_clicked(self,obj):
|
||||||
"""Saves the note and closes the window"""
|
"""Saves the note and closes the window"""
|
||||||
buffer = self.entry.get_buffer()
|
buffer = self.entry.get_buffer()
|
||||||
text = unicode(buffer.get_text(buffer.get_start_iter(),
|
text = unicode(buffer.get_text(buffer.get_start_iter(),
|
||||||
@ -92,3 +116,4 @@ class NoteEditor:
|
|||||||
if text != self.data.get_note():
|
if text != self.data.get_note():
|
||||||
self.data.set_note(text)
|
self.data.set_note(text)
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
|
self.close(obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user