From 7061434703103bb84d01b774d49d2b17498c160f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 22 Sep 2006 12:13:34 -0400 Subject: [PATCH 1/2] Don't traceback on Ctrl+C --- sugar/simulator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sugar/simulator.py b/sugar/simulator.py index b46b9c3c..271d5ed5 100644 --- a/sugar/simulator.py +++ b/sugar/simulator.py @@ -99,7 +99,10 @@ class Bot: self._pservice = PresenceService.get_instance() - gtk.main() + try: + gtk.main() + except KeyboardInterrupt: + pass def add_action(self, action, minutes): self._timeline.add(action, minutes) From 801d02005893601a8037f392bb290038c21bd051 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 22 Sep 2006 12:50:55 -0400 Subject: [PATCH 2/2] Don't die on malformed friends config file --- shell/model/Friends.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/shell/model/Friends.py b/shell/model/Friends.py index b90f9d93..4a2298c5 100644 --- a/shell/model/Friends.py +++ b/shell/model/Friends.py @@ -5,6 +5,7 @@ import gobject from model.BuddyModel import BuddyModel from sugar import env +import logging class Friends(gobject.GObject): __gsignals__ = { @@ -45,12 +46,16 @@ class Friends(gobject.GObject): def load(self): cp = ConfigParser() - if cp.read([self._path]): - for name in cp.sections(): - buddy = BuddyModel() - buddy.set_name(name) - buddy.set_color(cp.get(name, 'color')) - self.add_friend(buddy) + try: + success = cp.read([self._path]) + if success: + for name in cp.sections(): + buddy = BuddyModel() + buddy.set_name(name) + buddy.set_color(cp.get(name, 'color')) + self.add_friend(buddy) + except Exception, exc: + logging.error("Error parsing friends file: %s" % exc) def save(self): cp = ConfigParser()