~tualatrix/ubuntu-tweak/0.7.x

« back to all changes in this revision

Viewing changes to ubuntu-tweak

  • Committer: Tualatrix Chou
  • Date: 2012-07-06 12:59:06 UTC
  • Revision ID: tualatrix@gmail.com-20120706125906-ab2zgto7unzlpyre
Try to catch AttributeError: 'NoneType' object has no attribute 'present' error

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
                                           system.APP,
68
68
                                           system.DESKTOP))
69
69
        self.connect('message-received', self.on_message_received)
70
 
 
71
70
    def set_window(self, window):
72
71
        self._window = window
73
72
        self.watch_window(self._window.mainwindow)
75
74
    def on_message_received(self, app, command, message, time):
76
75
        self.log.debug("on_message_received: command: %s, message: %s, time: %s" % (
77
76
            command, message, time))
78
 
        if command == Unique.Command.ACTIVATE:
79
 
            self._window.present()
80
 
            if message.get_text():
81
 
                self._window.select_target_feature(message.get_text())
82
 
        elif command == Unique.Command.OPEN:
83
 
            self._window.do_load_module(message.get_text())
 
77
        try:
 
78
            if command == Unique.Command.ACTIVATE:
 
79
                self._window.present()
 
80
                if message.get_text():
 
81
                    self._window.select_target_feature(message.get_text())
 
82
            elif command == Unique.Command.OPEN:
 
83
                self._window.do_load_module(message.get_text())
 
84
        except Exception, e:
 
85
            self.log.error(e)
84
86
 
85
87
        return False
86
88