* src/TipOfDay.py: Catch exceptions when parsing the tips file.
svn: r9344
This commit is contained in:
parent
fc46116056
commit
a73c35757d
@ -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>
|
2007-11-12 Gary Burton <gary.burton@zen.co.uk>
|
||||||
* src/ScratchPad.py: fixed a crash when building tooltip. Not enough
|
* src/ScratchPad.py: fixed a crash when building tooltip. Not enough
|
||||||
place holders in format string
|
place holders in format string
|
||||||
|
@ -29,7 +29,7 @@ Handles the Tip of the Day dialog
|
|||||||
# standard python modules
|
# standard python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from xml.parsers.expat import ParserCreate
|
from xml.parsers.expat import ParserCreate,ExpatError
|
||||||
from xml.sax.saxutils import escape
|
from xml.sax.saxutils import escape
|
||||||
from random import Random
|
from random import Random
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
@ -50,6 +50,7 @@ import gtk
|
|||||||
import const
|
import const
|
||||||
import Config
|
import Config
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -79,7 +80,14 @@ class TipOfDay(ManagedWindow.ManagedWindow):
|
|||||||
close = xml.get_widget('close')
|
close = xml.get_widget('close')
|
||||||
close.connect("clicked", self.close_cb)
|
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.tip_list = tparser.get()
|
||||||
|
|
||||||
self.new_index = range(len(self.tip_list))
|
self.new_index = range(len(self.tip_list))
|
||||||
|
Loading…
Reference in New Issue
Block a user