From af4480bbbcb2e2eb3b23574e4123eba8233b86a2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 3 Mar 2006 00:38:41 +0000 Subject: [PATCH] module renames svn: r6051 --- ChangeLog | 1 + src/DisplayTabs.py | 12 ++--- src/LocEdit.py | 2 +- src/Makefile.am | 3 +- src/NoteEdit.py | 132 --------------------------------------------- 5 files changed, 9 insertions(+), 141 deletions(-) delete mode 100644 src/NoteEdit.py diff --git a/ChangeLog b/ChangeLog index 6743a8d70..7a0949065 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2006-03-02 Don Allingham * src/Makefile.am: adapt to module renames + * src/NoteEdit.py: removed * src/EditAttribute.py: renamed from AttrEdit.py * src/EditAddress.py: renamed from AddrEdit.py * src/DisplayTabs.py: adapt to module renames diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 75010188c..ea18c0c1c 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -1088,11 +1088,11 @@ class LocationEmbedList(EmbeddedList): return ((1,0),(1,1),(1,2),(1,3),(1,4)) def add_button_clicked(self,obj): - import LocEdit + import EditLocation loc = RelLib.Location() try: - LocEdit.LocationEditor(self.dbstate, self.uistate, self.track, - loc, self.add_callback) + EditLocation.EditLocation(self.dbstate, self.uistate, self.track, + loc, self.add_callback) except Errors.WindowActiveError: pass @@ -1103,10 +1103,10 @@ class LocationEmbedList(EmbeddedList): def edit_button_clicked(self,obj): loc = self.get_selected() if loc: - import LocEdit + import EditLocation try: - LocEdit.LocationEditor(self.dbstate, self.uistate, self.track, - loc, self.edit_callback) + EditLocation.EditLocation(self.dbstate, self.uistate, self.track, + loc, self.edit_callback) except Errors.WindowActiveError: pass diff --git a/src/LocEdit.py b/src/LocEdit.py index 645e4b528..e20247174 100644 --- a/src/LocEdit.py +++ b/src/LocEdit.py @@ -45,7 +45,7 @@ from gettext import gettext as _ # LocationEditor class # #------------------------------------------------------------------------- -class LocationEditor(EditSecondary.EditSecondary): +class EditLocation(EditSecondary.EditSecondary): def __init__(self,dbstate,uistate,track,location,callback): EditSecondary.EditSecondary.__init__(self, dbstate, uistate, track, diff --git a/src/Makefile.am b/src/Makefile.am index 563499efb..36ecc63f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -79,7 +79,7 @@ gdir_PYTHON = \ ImgManip.py\ latin_ansel.py\ ListModel.py\ - LocEdit.py\ + EditLocation.py\ locked.png\ MapView.py\ MediaView.py\ @@ -88,7 +88,6 @@ gdir_PYTHON = \ NameDisplay.py\ NameEdit.py\ Navigation.py\ - NoteEdit.py\ Options.py\ PageView.py\ PaperMenu.py\ diff --git a/src/NoteEdit.py b/src/NoteEdit.py deleted file mode 100644 index b6885ea19..000000000 --- a/src/NoteEdit.py +++ /dev/null @@ -1,132 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2000-2004 Donald N. Allingham -# -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# $Id$ - -#------------------------------------------------------------------------- -# -# GTK/Gnome modules -# -#------------------------------------------------------------------------- -import gtk -import gtk.glade - -#------------------------------------------------------------------------- -# -# gramps modules -# -#------------------------------------------------------------------------- -from gettext import gettext as _ -import gc - -import const -import Utils -import Spell - -#------------------------------------------------------------------------- -# -# NoteEditor -# -#------------------------------------------------------------------------- -class NoteEditor: - """Displays a simple text editor that allows a person to edit a note""" - def __init__(self,data,parent,parent_window=None,callback=None, - readonly=False): - - self.parent = parent - self.callback = callback - if data: - if self.parent.child_windows.has_key(data): - self.parent.child_windows[data].present(None) - return - else: - self.win_key = data - else: - self.win_key = self - self.data = data - self.parent_window = parent_window - self.glade = gtk.glade.XML(const.gladeFile,"note_edit") - self.readonly = readonly - self.draw() - - def draw(self): - """Displays the NoteEditor window""" - - self.top = self.glade.get_widget('note_edit') - alt_title = self.glade.get_widget('title_msg') - Utils.set_titles(self.top, alt_title, _('Note Editor')) - - if self.callback: - self.title_entry = self.glade.get_widget('title') - self.title_entry.set_text(self.data.get_description()) - self.title_entry.set_editable(not self.readonly) - else: - self.glade.get_widget('tbox').hide() - - self.entry = self.glade.get_widget('note') - self.entry.get_buffer().set_text(self.data.get_note()) - self.entry.set_editable(not self.readonly) - self.spellcheck = Spell.Spell(self.entry) - - cancel_button = self.glade.get_widget('cancel') - ok_button = self.glade.get_widget('ok') - ok_button.set_sensitive(not self.readonly) - cancel_button.connect("clicked",self.close) - ok_button.connect("clicked",self.on_save_note_clicked) - self.top.connect("delete_event",self.on_delete_event) - - if self.parent_window: - self.top.set_transient_for(self.parent_window) - self.add_itself_to_menu() - - def on_delete_event(self,*obj): - self.remove_itself_from_menu() - gc.collect() - - def close(self,*obj): - self.remove_itself_from_menu() - self.top.destroy() - gc.collect() - - def add_itself_to_menu(self): - self.parent.child_windows[self.win_key] = self - self.parent_menu_item = gtk.MenuItem(_('Note')) - self.parent_menu_item.connect("activate",self.present) - self.parent_menu_item.show() - self.parent.winsmenu.append(self.parent_menu_item) - - def remove_itself_from_menu(self): - del self.parent.child_windows[self.win_key] - 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""" - tbuffer = self.entry.get_buffer() - text = unicode(tbuffer.get_text(tbuffer.get_start_iter(), - tbuffer.get_end_iter(),False)) - if text != self.data.get_note(): - self.data.set_note(text) - if self.callback: - self.data.set_description(self.title_entry.get_text()) - self.callback(self.data) - self.close(obj)