def __init__(self,
                 connection=None,
                 set_button_callback=None,
                 dns_only=False,
                 settings_obj=None,
                 link_local=False):

        gtk.VBox.__init__(self)
        self.tab_name = _("IPv4 settings")
        self.connection = connection
        self.set_button = set_button_callback
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        self.dns_only = dns_only

        # Ip configuration

        self.link_section = Title(_("Link-Local Only"),
                                  toggle_callback=self.link_local_callback,
                                  label_right=True)
        self.ip_table = gtk.Table(3, 2, False)
        self.ip_section = DefaultToggle(_("Automatic IP address"))
        self.ip_section.toggle_on = self.ip_toggle_off
        self.ip_section.toggle_off = self.ip_toggle_on

        self.addr_row = self.__set_row(_("IP Address:"), 0)
        self.mask_row = self.__set_row(_("Subnet Mask:"), 1)
        self.gate_row = self.__set_row(_("Gateway:"), 2)
        self.__table_attach(self.ip_table, self.addr_row, 0)
        self.__table_attach(self.ip_table, self.mask_row, 1)
        self.__table_attach(self.ip_table, self.gate_row, 2)
        self.ip_section.load([self.ip_table])

        #DNS configuration
        self.dns_table = gtk.Table(2, 2, False)
        self.dns_section = DefaultToggle(_("Automatic DNS server address"))
        self.dns_section.toggle_on = self.dns_toggle_off
        self.dns_section.toggle_off = self.dns_toggle_on

        self.master_row = self.__set_row(_("Primary DNS server address:"), 0,
                                         "dns")
        self.slave_row = self.__set_row(_("Slave DNS server address:"), 1,
                                        "dns")

        self.__table_attach(self.dns_table, self.master_row, 0)
        self.__table_attach(self.dns_table, self.slave_row, 1)
        self.dns_section.load([self.dns_table])

        # TODO UI change
        style.draw_background_color(self)
        style.set_table(self.ip_table)
        style.set_table(self.dns_table)

        # Init Settings
        self.ip = ["", "", ""]
        self.dns = ["", ""]
        names = ["ip4", "netmask", "gw"]
        for n in names:
            setattr(self, n + "_flag", False)
        self.pack_start(self.ip_section, False, False)
        self.pack_start(self.dns_section, False, False)
        if link_local:
            self.pack_start(self.link_section, False, False)
        self.reset(connection)
        self.show_all()
    def __init__(self,
                 connection=None,
                 set_button_callback=None,
                 settings_obj=None,
                 link_local=False):

        gtk.VBox.__init__(self)
        self.connection = connection
        self.tab_name = _("IPv6 settings")
        self.set_button = set_button_callback
        # 新增settings_obj变量,用于访问shared_methods.Settings对象
        self.settings_obj = settings_obj

        # Ip configuration
        self.ip_table = gtk.Table(3, 2, False)
        #self.ip_section = SettingSection(_("Automatic get IP address"),text_size=CONTENT_FONT_SIZE, has_seperator=False, always_show=False, revert=True, label_right=True)
        self.link_section = Title(_("Link-Local Only"),
                                  toggle_callback=self.link_local_callback,
                                  label_right=True)
        self.ip_section = DefaultToggle(_("Automatic IP address"))
        self.ip_section.toggle_on = self.ip_toggle_off
        self.ip_section.toggle_off = self.ip_toggle_on

        self.addr_row = self.__set_row(_("IP Address:"), 0)
        self.mask_row = self.__set_row(_("Prefix:"), 1)
        self.gate_row = self.__set_row(_("Gateway:"), 2)

        self.__table_attach(self.ip_table, self.addr_row, 0)
        self.__table_attach(self.ip_table, self.mask_row, 1)
        self.__table_attach(self.ip_table, self.gate_row, 2)
        self.ip_section.load([self.ip_table])

        #DNS configuration
        self.dns_table = gtk.Table(2, 2, False)
        self.dns_section = DefaultToggle(_("Automatic DNS server address"))
        self.dns_section.toggle_on = self.dns_toggle_off
        self.dns_section.toggle_off = self.dns_toggle_on

        self.master_row = self.__set_row(_("Primary DNS server address:"), 0,
                                         "dns")
        self.slave_row = self.__set_row(_("Slave DNS server address:"), 1,
                                        "dns")

        self.__table_attach(self.dns_table, self.master_row, 0)
        self.__table_attach(self.dns_table, self.slave_row, 1)
        self.dns_section.load([self.dns_table])

        # TODO UI change
        style.draw_background_color(self)
        style.set_table(self.ip_table)
        style.set_table(self.dns_table)

        self.show_all()

        self.ip = ["", "", ""]
        self.dns = ["", ""]
        self.setting = None
        self.pack_start(self.ip_section, False, False)
        self.pack_start(self.dns_section, False, False)
        if link_local:
            self.pack_start(self.link_section, False, False)
        self.reset(connection)