* src/TipOfDay.py: Catch exceptions when parsing the tips file.

svn: r9344
This commit is contained in:
Martin Hawlisch 2007-11-13 07:38:36 +00:00
parent fc46116056
commit a73c35757d
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2007-11-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/TipOfDay.py: Catch exceptions when parsing the tips file.
2007-11-12 Gary Burton <gary.burton@zen.co.uk>
* src/ScratchPad.py: fixed a crash when building tooltip. Not enough
place holders in format string

View File

@ -29,7 +29,7 @@ Handles the Tip of the Day dialog
# standard python modules
#
#-------------------------------------------------------------------------
from xml.parsers.expat import ParserCreate
from xml.parsers.expat import ParserCreate,ExpatError
from xml.sax.saxutils import escape
from random import Random
from gettext import gettext as _
@ -50,6 +50,7 @@ import gtk
import const
import Config
import ManagedWindow
from QuestionDialog import ErrorDialog
#-------------------------------------------------------------------------
#
@ -79,7 +80,14 @@ class TipOfDay(ManagedWindow.ManagedWindow):
close = xml.get_widget('close')
close.connect("clicked", self.close_cb)
tparser = TipParser()
try:
tparser = TipParser()
except (IOError,ExpatError), e:
self.close()
ErrorDialog(
_("Failed to display tip of the day"),
_("Unable to read the tips from external file.\n\n%s")%e)
return
self.tip_list = tparser.get()
self.new_index = range(len(self.tip_list))