def set_defaults(self, widget=None, event=None): """ Put some default values into entries to help the user out. """ ipAddress = self.txt_ip.get_text() netmask = self.txt_netmask gateway = self.txt_gateway ip_parts = misc.IsValidIP(ipAddress) if ip_parts: if stringToNone(gateway.get_text()) is None: gateway.set_text('.'.join(ip_parts[0:3]) + '.1') if stringToNone(netmask.get_text()) is None: netmask.set_text('255.255.255.0') elif ipAddress != "": error(None, "Invalid IP Address Entered.")
def reset_static_checkboxes(self): if stringToNone(self.txt_ip.get_text()): self.chkbox_static_ip.set_active(True) self.chkbox_static_dns.set_active(True) self.chkbox_static_dns.set_sensitive(False) else: self.chkbox_static_ip.set_active(False) self.chkbox_static_dns.set_active(False) self.chkbox_static_dns.set_sensitive(True) if stringToNone(self.txt_dns_1.get_text()): self.chkbox_static_dns.set_active(True) else: self.chkbox_static_dns.set_active(False) self.toggle_ip_checkbox() self.toggle_dns_checkbox() self.toggle_global_dns_checkbox()