Exemplo n.º 1
0
    def _load_settings(self, settings):
        try:
            self.uuid = settings['connection']['uuid']
            self.name = settings['connection']['id']
            if 'username' in settings['gsm']:
                self.username = settings['gsm']['username']
            if 'password' in settings['gsm']:
                self.password = settings['gsm']['password']

            self.apn = settings['gsm']['apn']
            self.autoconnect = settings['connection']['autoconnect']
            # DNS
            if 'ipv4' in settings:
                self.static_dns = bool(settings['ipv4']['ignore-auto-dns'])
                if 'dns' in settings['ipv4']:
                    dns = settings['ipv4']['dns']
                    self.primary_dns = dns[0] if len(dns) else None
                    self.secondary_dns = dns[1] if len(dns) > 1 else None

            if 'network-type' in settings['gsm']:
                self.network_type = settings['gsm']['network-type']

            if 'band' in settings['gsm']:
                self.band = settings['gsm']['band']

        except KeyError, e:
            logger.error("Missing required key '%s' in %s" % (settings, e))
Exemplo n.º 2
0
    def setup_view(self, view):
        self.view['profile_name_entry'].set_text(self.model.name)
        self.view['username_entry'].set_text(self.model.username)
        self.view.set_network_mode(self.model.network_type)
        self.view.set_band(self.model.band)
        self.view['apn_entry'].set_text(self.model.apn)
        self.view['static_dns_check'].set_active(self.model.static_dns)
        if self.model.primary_dns:
            dns1 = convert_int_to_ip(self.model.primary_dns)
            self.view['primary_dns_entry'].set_text(dns1)
        if self.model.secondary_dns:
            dns2 = convert_int_to_ip(self.model.secondary_dns)
            self.view['secondary_dns_entry'].set_text(dns2)

        if self.model.static_dns:
            self.view.enable_static_dns()

        if not self.model.password:
            try:
                self.model.load_password()
            except KeyringNoMatchError, e:
                logger.error("Error while loading connection password: %s" % e)
                title = _("Error while getting connection password")
                details = _("NoMatchError: No password was retrieved "
                            "from connection, please set one again")
                show_error_dialog(title, details)
                return
Exemplo n.º 3
0
 def _send_pin_eb(self, e):
     logger.error("SendPin failed %s" % get_error_msg(e))
     pin_errors = [E.GEN_ERROR, E.PIN_ERROR]
     if e.get_dbus_name() in pin_errors:
         # setting pin_required = True doesn't works and we have
         # to break MVC and ask the controller directly
         self.ctrl.ask_for_pin()
     else:
         logger.error("Unknown error while "
                      "authenticating %s" % get_error_msg(e))
Exemplo n.º 4
0
    def _network_register_eb(self, error):
        logger.error("Error while registering to home network %s" % error)
        try:
            self.net_error = E.error_to_human(error)
        except KeyError:
            self.net_error = error

        # fake a +CREG: 0,3
        self._get_regstatus_cb((3, None, None))
        # registration failed, stop the throbber
        self.ctrl.view.stop_throbber()
Exemplo n.º 5
0
 def property_operator_value_change(self, model, old, new):
     if new == _('Unknown Network'):
         logger.error("Unknown operator received, using profile name...")
         profiles_model = self.model.preferences_model.profiles_model
         try:
             profile = profiles_model.get_active_profile()
         except RuntimeError:
             self.view.operator_changed(new)
         else:
             self.view.operator_changed(profile.name)
     else:
         self.view.operator_changed(new)
Exemplo n.º 6
0
    def _on_connect_eb(self, e):
        logger.error("_on_connect_eb: %s" % e)
        self.view.set_disconnected()
        if self.apb:
            self.apb.close()
            self.apb = None

        if 'NoReply' in get_error_msg(e) and self._ignore_no_reply:
            # do not show NoReply exception as we were expecting it
            self._ignore_no_reply = False
        elif 'TypeError' in get_error_msg(e) and self._ignore_no_reply:
            # do not show TypeError exception as we were expecting it
            # as ActivateConnection returns None instead of an object
            # path.
            self._ignore_no_reply = False
        else:
            title = _('Failed connection attempt')
            show_error_dialog(title, get_error_msg(e))
Exemplo n.º 7
0
 def _on_disconnect_eb(self, e):
     logger.error("_on_disconnect_eb: %s" % e)
     self.model.stop_stats_tracking()
     if self.apb:
         self.apb.close()
         self.apb = None
Exemplo n.º 8
0
 def _send_puk_eb(self, e):
     logger.error("SendPuk failed: %s" % get_error_msg(e))
Exemplo n.º 9
0
 def _get_devices_eb(self, error):
     logger.error(error)
     # connecting to signals is safe now
     self._connect_to_signals()
Exemplo n.º 10
0
 def errback(failure):
     msg = "Error while getting IMSI for device %s"
     logger.error(msg % self.device_opath)
     callback(None)
Exemplo n.º 11
0
 def quit_eb(e):
     logger.error("Error while removing device: %s" % get_error_msg(e))
     quit_cb()