def on_ok_button_clicked(self, widget): self.model.name = self.view['profile_name_entry'].get_text() self.model.username = self.view['username_entry'].get_text() self.model.password = self.view['password_entry'].get_text() mode = self.view['connection_combobox'].get_active_text() band = self.view['band_combobox'].get_active_text() auth = self.view['authentication_combobox'].get_active_text() if mode: self.model.network_pref = MODE_MAP_REV[mode] if band: self.model.band = BAND_MAP_REV[band] if auth: self.model.auth = AUTH_MAP_REV[auth] self.model.apn = self.view['apn_entry'].get_text() self.model.static_dns = self.view['static_dns_check'].get_active() if self.view['static_dns_check'].get_active(): dns1 = self.view['primary_dns_entry'].get_text() dns2 = self.view['secondary_dns_entry'].get_text() if dns1: self.model.primary_dns = convert_ip_to_int(dns1) if dns2: self.model.secondary_dns = convert_ip_to_int(dns2) try: self.model.save() except RuntimeError, e: show_error_dialog(_("Error creating profile"), get_error_msg(e))
def setup_view(self, view): if self.model.name: self.view['profile_name_entry'].set_text(self.model.name) if self.model.username: self.view['username_entry'].set_text(self.model.username) if self.model.apn: self.view['apn_entry'].set_text(self.model.apn) 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['static_dns_check'].set_active(self.model.static_dns) self.view.enable_static_dns() else: self.view['static_dns_check'].set_active(False) if not self.model.password: def load_secrets(secrets): self.model.password = secrets['gsm'].get('passwd', '') self.view['password_entry'].set_text(self.model.password) try: self.model.load_password(load_secrets) 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
def _init_wader_object(self): try: self.obj = self.bus.get_object(WADER_SERVICE, WADER_OBJPATH) except dbus.DBusException, e: title = _("Error while starting wader") details = _("Check that your installation is correct and your " " OS/distro is supported: %s" % e) show_error_dialog(title, details) raise SystemExit()
def smsc_eb(*arg): title = _('No SMSC number') details = _("In order to send a SMS, %s needs to know the number " "of your provider's SMSC. If you do not know the SMSC " "number, contact your customer " "service.") % APP_LONG_NAME dialogs.show_error_dialog(title, details) self.state = IDLE
def on_sms_sent_eb(error): title = _('Error while sending SMS') dialogs.show_error_dialog(title, get_error_msg(error))