From 04d63561e1d48aca59e3cdf18497acce6b5eceb4 Mon Sep 17 00:00:00 2001 From: Raphael Ackermann Date: Tue, 4 Mar 2008 22:28:59 +0000 Subject: [PATCH] 2008-03-04 Raphael Ackermann * src/Bookmarks.py: 0001770: Bookmark Editor window and deleting entries Set focus on bookmark right above the deleted bookmark * src/gramps.py: comment typo * src/ListModel.py: fix, changed func((param)) to func(param) svn: r10186 --- ChangeLog | 6 ++++++ src/Bookmarks.py | 48 +++++++++++++++++++++++++----------------------- src/ListModel.py | 2 +- src/gramps.py | 2 +- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 360119590..edca5045c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-04 Raphael Ackermann + * src/Bookmarks.py: 0001770: Bookmark Editor window and deleting entries + Set focus on bookmark right above the deleted bookmark + * src/gramps.py: comment typo + * src/ListModel.py: fix, changed func((param)) to func(param) + 2008-03-04 Peter Landgren * src/docgen/HtmlDoc.py: Issues 1875 and 1879# diff --git a/src/Bookmarks.py b/src/Bookmarks.py index 27384886f..92f702125 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -20,7 +20,7 @@ # $Id$ -"Handle bookmarks for the gramps interface" +"Handle bookmarks for the gramps interface." #------------------------------------------------------------------------- # @@ -67,11 +67,11 @@ BTM = '''''' DISABLED = -1 class Bookmarks : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, callback=None): """ - Create a the bookmark editor. + Create the bookmark editor. bookmarks - list of People menu - parent menu to attach users @@ -105,14 +105,13 @@ class Bookmarks : def display(self): """ - - Redraw the display + Redraw the display. """ self.redraw() def undisplay(self): """ - Update the uimanager + Update the uimanager. """ if self.active != DISABLED: self.uistate.uimanager.remove_ui(self.active) @@ -121,12 +120,12 @@ class Bookmarks : self.active = DISABLED def redraw_and_report_change(self): - """Create the pulldown menu and set bookmarks to changed""" + """Create the pulldown menu and set bookmarks to changed.""" self.dbstate.db.report_bm_change() self.redraw() def redraw(self): - """Create the pulldown menu""" + """Create the pulldown menu.""" text = StringIO() text.write(TOP) @@ -166,7 +165,7 @@ class Bookmarks : return make_callback(handle, self.dbstate.change_active_handle) def add(self, person_handle): - """appends the person to the bottom of the bookmarks""" + """Append the person to the bottom of the bookmarks.""" if person_handle not in self.bookmarks.get(): self.bookmarks.append(person_handle) self.redraw_and_report_change() @@ -188,7 +187,7 @@ class Bookmarks : self.redraw_and_report_change() def draw_window(self): - """Draws the bookmark dialog box""" + """Draw the bookmark dialog box.""" title = _("%(title)s - GRAMPS") % {'title': _("Organize Bookmarks")} self.top = gtk.Dialog(title) self.top.set_default_size(400, 350) @@ -230,7 +229,7 @@ class Bookmarks : def edit(self): """ - display the bookmark editor. + Display the bookmark editor. The current bookmarked people are inserted into the namelist, attaching the person object to the corresponding row. The currently @@ -254,7 +253,7 @@ class Bookmarks : self.top.destroy() def delete_clicked(self, obj): - """Remove the current selection from the list""" + """Remove the current selection from the list.""" store, the_iter = self.namemodel.get_selected() if not the_iter: return @@ -262,9 +261,12 @@ class Bookmarks : self.bookmarks.pop(row) self.namemodel.remove(the_iter) self.modified = True + if row > 0: + row = row - 1 + self.namemodel.select_row(row) def up_clicked(self, obj): - """Moves the current selection up one row""" + """Move the current selection up one row.""" row = self.namemodel.get_selected_row() if not row or row == -1: return @@ -277,7 +279,7 @@ class Bookmarks : self.modified = True def down_clicked(self, obj): - """Moves the current selection down one row""" + """Move the current selection down one row.""" row = self.namemodel.get_selected_row() if row + 1 >= self.namemodel.count or row == -1: return @@ -290,7 +292,7 @@ class Bookmarks : self.modified = True def help_clicked(self): - """Display the relevant portion of GRAMPS manual""" + """Display the relevant portion of GRAMPS manual.""" GrampsDisplay.help('gramps-nav') self.response = self.top.run() @@ -307,7 +309,7 @@ class ListBookmarks(Bookmarks): self.goto_handle(handle) class FamilyBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -322,7 +324,7 @@ class FamilyBookmarks(ListBookmarks) : self.dbstate.db.connect('family-delete', self.remove_handles) class EventBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -340,7 +342,7 @@ class EventBookmarks(ListBookmarks) : self.dbstate.db.connect('event-delete', self.remove_handles) class SourceBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, goto_handle) @@ -354,7 +356,7 @@ class SourceBookmarks(ListBookmarks) : self.dbstate.db.connect('source-delete', self.remove_handles) class MediaBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -369,7 +371,7 @@ class MediaBookmarks(ListBookmarks) : self.dbstate.db.connect('media-delete', self.remove_handles) class RepoBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -384,7 +386,7 @@ class RepoBookmarks(ListBookmarks) : self.dbstate.db.connect('repository-delete', self.remove_handles) class PlaceBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -399,7 +401,7 @@ class PlaceBookmarks(ListBookmarks) : self.dbstate.db.connect('place-delete', self.remove_handles) class NoteBookmarks(ListBookmarks) : - "Handle the bookmarks interface for Gramps" + "Handle the bookmarks interface for Gramps." def __init__(self, dbstate, uistate, bookmarks, goto_handle): ListBookmarks.__init__(self, dbstate, uistate, bookmarks, @@ -417,6 +419,6 @@ class NoteBookmarks(ListBookmarks) : def make_callback(handle, function): """ - Builds a unique call to the function with the associated handle + Build a unique call to the function with the associated handle. """ return lambda x: function(handle) diff --git a/src/ListModel.py b/src/ListModel.py index 4e1bfc20f..09909e770 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -308,7 +308,7 @@ class ListModel: """ Selects the item based on path """ - self.selection.select_path((row)) + self.selection.select_path(row) def select_iter(self, node): """ diff --git a/src/gramps.py b/src/gramps.py index 8afec8162..24ce3dd8b 100644 --- a/src/gramps.py +++ b/src/gramps.py @@ -147,7 +147,7 @@ def setup_logging(): l.addHandler(gtkh) l.addHandler(stderrh) - # put a hook on to catch any completly unhandled exceptions. + # put a hook on to catch any completely unhandled exceptions. def exc_hook(type, value, tb): if type == KeyboardInterrupt: # Ctrl-C is not a bug.