From 6d5598173ca131683d73b9771bbd23c03bdc7bfd Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 12 Nov 2006 03:12:57 +0000 Subject: [PATCH] 2006-11-11 Don Allingham * src/Config/_GrampsConfigKeys.py: add saving of family editor size * src/Editors/_EditFamily.py: add saving of family editor size * src/DisplayTabs/_GalleryTab.py: Catch possible exception * src/glade/gramps.glade: add saving of family editor size * src/DbLoader.py: Display error message on RUNRECOVERY error * src/DisplayTabs/_AddrEmbedList.py: make labels more consistent (#513) svn: r7616 --- ChangeLog | 8 ++++++++ src/Config/_GrampsConfigKeys.py | 4 ++++ src/DbLoader.py | 14 ++++++++++++-- src/DisplayTabs/_GalleryTab.py | 23 +++++++++++++---------- src/Editors/_EditFamily.py | 12 ++++++++++++ src/glade/gramps.glade | 28 ---------------------------- 6 files changed, 49 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7180254e..bfa3bc3bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-11 Don Allingham + * src/Config/_GrampsConfigKeys.py: add saving of family editor size + * src/Editors/_EditFamily.py: add saving of family editor size + * src/DisplayTabs/_GalleryTab.py: Catch possible exception + * src/glade/gramps.glade: add saving of family editor size + * src/DbLoader.py: Display error message on RUNRECOVERY error + 2006-11-11 Martin Hawlisch * test/GrampsDb/GrampsDbTestBase.py: Provide a callback to db.load(). Hmmm, that worked without sometime back. @@ -7,6 +14,7 @@ definition. 2006-11-10 Don Allingham + * src/DisplayTabs/_AddrEmbedList.py: make labels more consistent (#513) * src/GrampsDb/_ReadGedcom.py: handle GedcomError properly * src/DisplayModels/_BaseModel.py: handle add properly with filters diff --git a/src/Config/_GrampsConfigKeys.py b/src/Config/_GrampsConfigKeys.py index 2212dc0a4..99986f901 100644 --- a/src/Config/_GrampsConfigKeys.py +++ b/src/Config/_GrampsConfigKeys.py @@ -39,6 +39,8 @@ DATE_FORMAT = ('preferences','date-format', 1) DONT_ASK = ('interface','dont-ask', 0) HEIGHT = ('interface','height', 1) WIDTH = ('interface','width', 1) +FAM_HEIGHT = ('interface','height', 1) +FAM_WIDTH = ('interface','width', 1) FILTER = ('interface','filter', 0) FPREFIX = ('preferences','fprefix', 2) EPREFIX = ('preferences','eprefix', 2) @@ -99,6 +101,8 @@ default_value = { DONT_ASK : False, HEIGHT : 500, WIDTH : 775, + FAM_HEIGHT : 500, + FAM_WIDTH : 700, FILTER : False, FPREFIX : 'F%04d', EPREFIX : 'E%04d', diff --git a/src/DbLoader.py b/src/DbLoader.py index 52f4c58d7..aade65b90 100644 --- a/src/DbLoader.py +++ b/src/DbLoader.py @@ -30,7 +30,7 @@ Handling of loading new/existing databases. # #------------------------------------------------------------------------- import os -from bsddb.db import DBAccessError +from bsddb.db import DBAccessError, DBRunRecoveryError, DBPageNotFoundError from gettext import gettext as _ import logging log = logging.getLogger(".") @@ -422,7 +422,17 @@ class DbLoader: os.chdir(os.path.dirname(filename)) except: print "could not change directory" - except DBAccessError, msg: + except DBRunRecoveryError, msg: + QuestionDialog.ErrorDialog( + _("Low level database corruption detected"), + _("GRAMPS has detected a problem in the underlying " + "Berkeley database. Please exit the program, and GRAMPS " + "will attempt to run the recovery repair operation " + "the next time you open this database. If this " + "problem persists, create a new database, import " + "from a backup database, and report the problem to " + "gramps-bugs@lists.sourceforge.net.")) + except (DBAccessError, DBPageNotFoundError), msg: QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename, str(msg[1])) diff --git a/src/DisplayTabs/_GalleryTab.py b/src/DisplayTabs/_GalleryTab.py index 118be9dcc..2d13396c6 100644 --- a/src/DisplayTabs/_GalleryTab.py +++ b/src/DisplayTabs/_GalleryTab.py @@ -303,19 +303,22 @@ class GalleryTab(ButtonTab): # get the selected object, returning if not is defined - reflist = self.iconlist.get_selected_items() - obj = self.media_list[reflist[0][0]] + try: + reflist = self.iconlist.get_selected_items() + obj = self.media_list[reflist[0][0]] - if not obj: + if not obj: + return + + # pickle the data, and build the tuple to be passed + value = (self._DND_TYPE.drag_type, id(self), obj, self.find_index(obj)) + data = pickle.dumps(value) + + # pass as a string (8 bits) + sel_data.set(sel_data.target, 8, data) + except IndexError: return - # pickle the data, and build the tuple to be passed - value = (self._DND_TYPE.drag_type, id(self), obj, self.find_index(obj)) - data = pickle.dumps(value) - - # pass as a string (8 bits) - sel_data.set(sel_data.target, 8, data) - def drag_data_received(self, widget, context, x, y, sel_data, info, time): """ Handle the standard gtk interface for drag_data_received. diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 7e16edf96..32918daf9 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -441,6 +441,11 @@ class EditFamily(EditPrimary): self.set_window(self.top.get_widget("family_editor"), None,_('Family Editor')) + # restore window size + width = Config.get(Config.FAM_WIDTH) + height = Config.get(Config.FAM_HEIGHT) + self.window.set_default_size(width, height) + self.fbirth = self.top.get_widget('fbirth') self.fdeath = self.top.get_widget('fdeath') @@ -459,6 +464,7 @@ class EditFamily(EditPrimary): self.mbox = self.top.get_widget('mbox') self.fbox = self.top.get_widget('fbox') + self.window.show() def _connect_signals(self): self.define_ok_button(self.top.get_widget('ok'), self.save) @@ -882,3 +888,9 @@ class EditFamily(EditPrimary): self.db.transaction_commit(trans,_("Edit Family")) self.close() + + def _cleanup_on_exit(self): + (width, height) = self.window.get_size() + Config.set(Config.FAM_WIDTH, width) + Config.set(Config.FAM_HEIGHT, height) + Config.sync() diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index f232ff04f..ab06671c2 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -582,13 +582,10 @@ - True GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False - 700 - 500 True False True @@ -672,31 +669,6 @@ False 12 - - - True - <span size="larger" weight="bold">Family Editor</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - True