Example #1
0
    def set_error_code(self, error_code):
        '''
        Sets this infobar to show an error to the user

        @param error_code: the code of the error to show. Error codes are
                           listed in BackendSignals
        '''
        self._populate()
        self.connect("response", self._on_error_response)
        backend_name = self.backend.get_human_name()

        if error_code == BackendSignals.ERRNO_AUTHENTICATION:
            self.set_message_type(gtk.MESSAGE_ERROR)
            self.label.set_markup(self.AUTHENTICATION_MESSAGE % backend_name)
            self.add_button(_('Configure synchronization service'),
                            gtk.RESPONSE_ACCEPT)
            self.add_button(_('Ignore'), gtk.RESPONSE_CLOSE)

        elif error_code == BackendSignals.ERRNO_NETWORK:
            if not is_connection_up():
                return
            self.set_message_type(gtk.MESSAGE_WARNING)
            self.label.set_markup(self.NETWORK_MESSAGE % backend_name)
            # FIXME: use gtk stock button instead
            self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)

        elif error_code == BackendSignals.ERRNO_DBUS:
            self.set_message_type(gtk.MESSAGE_WARNING)
            self.label.set_markup(self.DBUS_MESSAGE % backend_name)
            self.add_button(_('Ok'), gtk.RESPONSE_CLOSE)

        self.show_all()
 def test_is_connection_up_dont_throw_exception(self):
     """ is_connection_up() returns a boolean value and
     don't throw any exception """
     self.assertIn(is_connection_up(), [True, False])
 def test_is_connection_up_dont_throw_exception(self):
     """ is_connection_up() returns a boolean value and
     don't throw any exception """
     self.assertIn(is_connection_up(), [True, False])
Example #4
0
 def test_is_connection_up_and_doesnt_throw_exception(self):
     self.assertIn(is_connection_up(), [True, False])
Example #5
0
 def test_is_connection_up_and_doesnt_throw_exception(self):
     self.assertIn(is_connection_up(), [True, False])