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 test_ip_to_int_conversion(self): for ip in ip_generator(50000): num = convert_ip_to_int(ip) self.failIf(num < 0) self.assertEqual(ip, convert_int_to_ip(num))