# HG changeset patch # User Erik Grinaker # Date 1138975497 0 # Node ID db3c0183fd5c840238eace348d7e5ec81dcc975a # Parent b8e5c68b39a9ec59a89c034e54b03e643bbde02a ignore errors when automatically reloading file in applet diff -r b8e5c68b39a9ec59a89c034e54b03e643bbde02a -r db3c0183fd5c840238eace348d7e5ec81dcc975a ChangeLog --- a/ChangeLog Thu Feb 02 22:24:40 2006 +0000 +++ b/ChangeLog Fri Feb 03 14:04:57 2006 +0000 @@ -2,6 +2,10 @@ ---------------[ xxxx-xx-xx : 0.4.7 ]--------------- +2006-02-03 Erik Grinaker + + * ignore errors when automatically reloading file in applet + 2006-02-02 Erik Grinaker * added dependencies to README diff -r b8e5c68b39a9ec59a89c034e54b03e643bbde02a -r db3c0183fd5c840238eace348d7e5ec81dcc975a NEWS --- a/NEWS Thu Feb 02 22:24:40 2006 +0000 +++ b/NEWS Fri Feb 03 14:04:57 2006 +0000 @@ -5,6 +5,7 @@ - don't crash when unlocking file - build pyc/pyo files correctly when using DESTDIR with make install - avoid hanging on missing network mounts when opening file +- ignore errors when automatically reloading file in applet 2006-01-26: Revelation 0.4.6 diff -r b8e5c68b39a9ec59a89c034e54b03e643bbde02a -r db3c0183fd5c840238eace348d7e5ec81dcc975a src/lib/datahandler/__init__.py --- a/src/lib/datahandler/__init__.py Thu Feb 02 22:24:40 2006 +0000 +++ b/src/lib/datahandler/__init__.py Fri Feb 03 14:04:57 2006 +0000 @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -from base import HandlerError, DataError, FormatError, PasswordError, VersionError +from base import Error, DataError, FormatError, PasswordError, VersionError from fpm import FPM from gpass import GPass04, GPass05 @@ -50,7 +50,7 @@ ] -class DetectError(Exception): +class DetectError(Error): "Exception for autodetection error" pass diff -r b8e5c68b39a9ec59a89c034e54b03e643bbde02a -r db3c0183fd5c840238eace348d7e5ec81dcc975a src/lib/datahandler/base.py --- a/src/lib/datahandler/base.py Thu Feb 02 22:24:40 2006 +0000 +++ b/src/lib/datahandler/base.py Fri Feb 03 14:04:57 2006 +0000 @@ -23,23 +23,23 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -class HandlerError(Exception): +class Error(Exception): "Base exception for data handler" pass -class DataError(HandlerError): +class DataError(Error): "Exception for invalid data" pass -class FormatError(HandlerError): +class FormatError(Error): "Exception for invalid file formats" pass -class PasswordError(HandlerError): +class PasswordError(Error): "Exception for wrong password" pass -class VersionError(HandlerError): +class VersionError(Error): "Exception for unknown versions" pass diff -r b8e5c68b39a9ec59a89c034e54b03e643bbde02a -r db3c0183fd5c840238eace348d7e5ec81dcc975a src/revelation-applet.in --- a/src/revelation-applet.in Thu Feb 02 22:24:40 2006 +0000 +++ b/src/revelation-applet.in Fri Feb 03 14:04:57 2006 +0000 @@ -264,11 +264,17 @@ "Callback for changed file content" try: - self.file_open(self.datafile.get_file(), self.datafile.get_password()) + self.__file_load(self.datafile.get_file(), self.datafile.get_password()) + + except dialog.CancelError: + pass except datahandler.PasswordError: self.file_close() + except datahandler.Error: + pass + def __cb_file_changed(self, widget, data = None): "Callback for changed data file" @@ -341,6 +347,28 @@ self.entrymenu.hide() + def __file_load(self, file, password = None): + "Loads a data file" + + if file in ( "", None ): + return False + + if dialog.present_unique(dialog.PasswordOpen) == True: + return False + + entrystore = self.datafile.load(file, password, lambda: dialog.run_unique(dialog.PasswordOpen, None, os.path.basename(file))) + + self.entrystore.clear() + self.entrystore.import_entry(entrystore, None) + + self.entrymenu = self.__generate_entrymenu(self.entrystore) + self.locktimer.start(self.config.get("autolock_timeout") * 60) + + self.__close_popups() + + return True + + def __flash_entry(self, color = "#ffbaba", duration = 500): "Flashes the entry with a color" @@ -603,23 +631,7 @@ "Opens a data file" try: - if file in ( "", None ): - return False - - if dialog.present_unique(dialog.PasswordOpen) == True: - return False - - entrystore = self.datafile.load(file, password, lambda: dialog.run_unique(dialog.PasswordOpen, None, os.path.basename(file))) - - self.entrystore.clear() - self.entrystore.import_entry(entrystore, None) - - self.entrymenu = self.__generate_entrymenu(self.entrystore) - self.locktimer.start(self.config.get("autolock_timeout") * 60) - - self.__close_popups() - - return True + return self.__file_load(file, password) except dialog.CancelError: pass