def populate_summary(self):
        dodhcp = self.get_config_dhcp_enable()
        self.widget("summary-name").set_text(self.get_config_name())

        ip = self.get_config_ip4()
        self.widget("summary-ip4-network").set_text(str(ip))
        self.widget("summary-ip4-gateway").set_text(str(ip[1]))
        self.widget("summary-ip4-netmask").set_text(str(ip.netmask()))

        self.widget("label-dhcp-end").set_property("visible", dodhcp)
        self.widget("summary-dhcp-end").set_property("visible", dodhcp)
        if dodhcp:
            start = self.get_config_dhcp_start()
            end = self.get_config_dhcp_end()
            self.widget("summary-dhcp-start").set_text(str(start))
            self.widget("summary-dhcp-end").set_text(str(end))
            self.widget("label-dhcp-start").set_text(_("Start address:"))
            self.widget("label-dhcp-end").show()
            self.widget("summary-dhcp-end").show()
        else:
            self.widget("label-dhcp-start").set_text(_("Status:"))
            self.widget("summary-dhcp-start").set_text(_("Disabled"))

        forward_txt = ""
        dev, mode = self.get_config_forwarding()
        forward_txt = vmmNetwork.pretty_desc(mode, dev)
        self.widget("summary-forwarding").set_text(forward_txt)
    def populate_summary(self):
        dodhcp = self.get_config_dhcp_enable()
        self.widget("summary-name").set_text(self.get_config_name())

        ip = self.get_config_ip4()
        self.widget("summary-ip4-network").set_text(str(ip))
        self.widget("summary-ip4-gateway").set_text(str(ip[1]))
        self.widget("summary-ip4-netmask").set_text(str(ip.netmask()))

        self.widget("label-dhcp-end").set_property("visible", dodhcp)
        self.widget("summary-dhcp-end").set_property("visible", dodhcp)
        if dodhcp:
            start = self.get_config_dhcp_start()
            end = self.get_config_dhcp_end()
            self.widget("summary-dhcp-start").set_text(str(start))
            self.widget("summary-dhcp-end").set_text(str(end))
            self.widget("label-dhcp-start").set_text(_("Start address:"))
            self.widget("label-dhcp-end").show()
            self.widget("summary-dhcp-end").show()
        else:
            self.widget("label-dhcp-start").set_text(_("Status:"))
            self.widget("summary-dhcp-start").set_text(_("Disabled"))

        forward_txt = ""
        dev, mode = self.get_config_forwarding()
        forward_txt = vmmNetwork.pretty_desc(mode, dev)
        self.widget("summary-forwarding").set_text(forward_txt)
    def populate_summary(self):
        self.widget("summary-name").set_text(self.get_config_name())
        self.widget("summary-domain").set_text(self.get_config_domain_name())
        self.widget("summary-ip4-network").set_text("")
        self.widget("summary-ip4-gateway").set_text("")
        self.widget("summary-ip6-network").set_text("")
        self.widget("summary-ip6-gateway").set_text("")

        ip = self.get_config_ip4()
        if ip:
            self.widget("label-ip4-gateway").show()
            self.widget("summary-ip4-gateway").show()
            self.widget("label-ip4-network").set_text(_("Network Address / prefix:"))
            self.widget("summary-ip4-network").set_text(str(ip))
            self.widget("summary-ip4-gateway").set_text(str(ip.network + 1))
        else:
            self.widget("label-ip4-gateway").hide()
            self.widget("summary-ip4-gateway").hide()
            self.widget("label-ip4-network").set_text("IPv4 Network:")
            self.widget("summary-ip4-network").set_text("Not Defined")

        if ip and self.get_config_dhcpv4_enable():
            self.widget("label-dhcp-end").show()
            self.widget("summary-dhcp-end").show()
            start = self.get_config_dhcpv4_start()
            end = self.get_config_dhcpv4_end()
            self.widget("label-dhcp-start").set_text("DHCPv4 Start Address:")
            if start and end:
                self.widget("summary-dhcp-start").set_text(str(start.network))
                self.widget("summary-dhcp-end").set_text(str(end.network))
            else:
                self.widget("summary-dhcp-start").set_text("?")
                self.widget("summary-dhcp-end").set_text("?")
        else:
            self.widget("label-dhcp-end").hide()
            self.widget("summary-dhcp-end").hide()
            self.widget("label-dhcp-start").set_text(_("DHCPv4 Status:"))
            self.widget("summary-dhcp-start").set_text(_("Disabled"))

        if ip and self.get_config_routev4_enable():
            self.widget("label-routev4-network").show()
            self.widget("label-routev4-gateway").show()
            self.widget("summary-routev4-network").show()
            self.widget("summary-routev4-gateway").show()
            self.widget("summary-routev4-network").set_text("")
            self.widget("summary-routev4-gateway").set_text("")
            ntwk = self.get_config_routev4_network()
            try:
                naddr = ipaddr.IPNetwork(ntwk)
            except:
                naddr = None
            gway = self.get_config_routev4_gateway()
            try:
                gaddr = ipaddr.IPNetwork(gway)
            except:
                gaddr = None
            if naddr and gaddr:
                self.widget("summary-routev4-network").set_text(str(naddr))
                self.widget("summary-routev4-gateway").set_text(str(gaddr.network))
        else:
            self.widget("label-routev4-network").hide()
            self.widget("label-routev4-gateway").hide()
            self.widget("summary-routev4-network").hide()
            self.widget("summary-routev4-gateway").hide()

        forward_txt = ""
        dev, mode = self.get_config_forwarding()
        forward_txt = vmmNetwork.pretty_desc(mode, dev)
        self.widget("summary-ipv4-forwarding").set_text(forward_txt)

        ip = self.get_config_ip6()
        if ip:
            self.widget("label-ip6-gateway").show()
            self.widget("summary-ip6-gateway").show()
            self.widget("label-ip6-network").set_text(_("Network Address / prefix:"))
            self.widget("summary-ip6-network").set_text(str(ip))
            self.widget("summary-ip6-gateway").set_text(str(ip.network + 1))
        else:
            self.widget("label-ip6-gateway").hide()
            self.widget("summary-ip6-gateway").hide()
            self.widget("label-ip6-network").set_text(_("IPV6 Network:"))
            self.widget("summary-ip6-network").set_text(_("Not Defined"))


        if ip and self.get_config_dhcpv6_enable():
            self.widget("label-dhcpv6-end").show()
            self.widget("summary-dhcpv6-end").show()
            start = self.get_config_dhcpv6_start()
            end = self.get_config_dhcpv6_end()
            self.widget("label-dhcpv6-start").set_text("DHCPv6 Start Address:")
            if start and end:
                self.widget("summary-dhcpv6-start").set_text(str(start.network))
                self.widget("summary-dhcpv6-end").set_text(str(end.network))
            else:
                self.widget("summary-dhcpv6-start").set_text("?")
                self.widget("summary-dhcpv6-end").set_text("?")
        else:
            self.widget("label-dhcpv6-end").hide()
            self.widget("summary-dhcpv6-end").hide()
            self.widget("label-dhcpv6-start").set_text(_("DHCPv6 Status:"))
            self.widget("summary-dhcpv6-start").set_text(_("Disabled"))

        if ip and self.get_config_routev6_enable():
            self.widget("label-routev6-network").show()
            self.widget("label-routev6-gateway").show()
            self.widget("summary-routev6-network").show()
            self.widget("summary-routev6-gateway").show()
            self.widget("summary-routev6-network").set_text("")
            self.widget("summary-routev6-gateway").set_text("")
            ntwk = self.get_config_routev6_network()
            try:
                naddr = ipaddr.IPNetwork(ntwk)
            except:
                naddr = None
            gway = self.get_config_routev6_gateway()
            try:
                gaddr = ipaddr.IPNetwork(gway)
            except:
                gaddr = None
            if naddr and gaddr:
                self.widget("summary-routev6-network").set_text(str(naddr))
                self.widget("summary-routev6-gateway").set_text(str(gaddr.network))
        else:
            self.widget("label-routev6-network").hide()
            self.widget("label-routev6-gateway").hide()
            self.widget("summary-routev6-network").hide()
            self.widget("summary-routev6-gateway").hide()


        if ip:
            self.widget("summary-ipv6-forwarding").set_text("Routed network")
        else:
            if self.widget("net-enable-ipv6-networking").get_active():
                self.widget("summary-ipv6-forwarding").set_text("Isolated network, internal routing only")
            else:
                self.widget("summary-ipv6-forwarding").set_text("Isolated network")
Exemple #4
0
    def populate_summary(self):
        self.widget("summary-name").set_text(self.get_config_name())
        self.widget("summary-domain").set_text(self.get_config_domain_name())
        self.widget("summary-ip4-network").set_text("")
        self.widget("summary-ip4-gateway").set_text("")
        self.widget("summary-ip6-network").set_text("")
        self.widget("summary-ip6-gateway").set_text("")

        ip = self.get_config_ip4()
        if ip:
            self.widget("label-ip4-gateway").show()
            self.widget("summary-ip4-gateway").show()
            self.widget("label-ip4-network").set_text(_("Network Address / prefix:"))
            self.widget("summary-ip4-network").set_text(str(ip))
            self.widget("summary-ip4-gateway").set_text(str(ip.network + 1))
        else:
            self.widget("label-ip4-gateway").hide()
            self.widget("summary-ip4-gateway").hide()
            self.widget("label-ip4-network").set_text("IPv4 Network:")
            self.widget("summary-ip4-network").set_text("Not Defined")

        if ip and self.get_config_dhcpv4_enable():
            self.widget("label-dhcp-end").show()
            self.widget("summary-dhcp-end").show()
            start = self.get_config_dhcpv4_start()
            end = self.get_config_dhcpv4_end()
            self.widget("label-dhcp-start").set_text("DHCPv4 Start Address:")
            if start and end:
                self.widget("summary-dhcp-start").set_text(str(start.network))
                self.widget("summary-dhcp-end").set_text(str(end.network))
            else:
                self.widget("summary-dhcp-start").set_text("?")
                self.widget("summary-dhcp-end").set_text("?")
        else:
            self.widget("label-dhcp-end").hide()
            self.widget("summary-dhcp-end").hide()
            self.widget("label-dhcp-start").set_text(_("DHCPv4 Status:"))
            self.widget("summary-dhcp-start").set_text(_("Disabled"))

        if ip and self.get_config_routev4_enable():
            self.widget("label-routev4-network").show()
            self.widget("label-routev4-gateway").show()
            self.widget("summary-routev4-network").show()
            self.widget("summary-routev4-gateway").show()
            self.widget("summary-routev4-network").set_text("")
            self.widget("summary-routev4-gateway").set_text("")
            ntwk = self.get_config_routev4_network()
            try:
                naddr = ipaddr.IPNetwork(ntwk)
            except:
                naddr = None
            gway = self.get_config_routev4_gateway()
            try:
                gaddr = ipaddr.IPNetwork(gway)
            except:
                gaddr = None
            if naddr and gaddr:
                self.widget("summary-routev4-network").set_text(str(naddr))
                self.widget("summary-routev4-gateway").set_text(str(gaddr.network))
        else:
            self.widget("label-routev4-network").hide()
            self.widget("label-routev4-gateway").hide()
            self.widget("summary-routev4-network").hide()
            self.widget("summary-routev4-gateway").hide()

        forward_txt = ""
        dev, mode = self.get_config_forwarding()
        forward_txt = vmmNetwork.pretty_desc(mode, dev)
        self.widget("summary-ipv4-forwarding").set_text(forward_txt)

        ip = self.get_config_ip6()
        if ip:
            self.widget("label-ip6-gateway").show()
            self.widget("summary-ip6-gateway").show()
            self.widget("label-ip6-network").set_text(_("Network Address / prefix:"))
            self.widget("summary-ip6-network").set_text(str(ip))
            self.widget("summary-ip6-gateway").set_text(str(ip.network + 1))
        else:
            self.widget("label-ip6-gateway").hide()
            self.widget("summary-ip6-gateway").hide()
            self.widget("label-ip6-network").set_text(_("IPV6 Network:"))
            self.widget("summary-ip6-network").set_text(_("Not Defined"))


        if ip and self.get_config_dhcpv6_enable():
            self.widget("label-dhcpv6-end").show()
            self.widget("summary-dhcpv6-end").show()
            start = self.get_config_dhcpv6_start()
            end = self.get_config_dhcpv6_end()
            self.widget("label-dhcpv6-start").set_text("DHCPv6 Start Address:")
            if start and end:
                self.widget("summary-dhcpv6-start").set_text(str(start.network))
                self.widget("summary-dhcpv6-end").set_text(str(end.network))
            else:
                self.widget("summary-dhcpv6-start").set_text("?")
                self.widget("summary-dhcpv6-end").set_text("?")
        else:
            self.widget("label-dhcpv6-end").hide()
            self.widget("summary-dhcpv6-end").hide()
            self.widget("label-dhcpv6-start").set_text(_("DHCPv6 Status:"))
            self.widget("summary-dhcpv6-start").set_text(_("Disabled"))

        if ip and self.get_config_routev6_enable():
            self.widget("label-routev6-network").show()
            self.widget("label-routev6-gateway").show()
            self.widget("summary-routev6-network").show()
            self.widget("summary-routev6-gateway").show()
            self.widget("summary-routev6-network").set_text("")
            self.widget("summary-routev6-gateway").set_text("")
            ntwk = self.get_config_routev6_network()
            try:
                naddr = ipaddr.IPNetwork(ntwk)
            except:
                naddr = None
            gway = self.get_config_routev6_gateway()
            try:
                gaddr = ipaddr.IPNetwork(gway)
            except:
                gaddr = None
            if naddr and gaddr:
                self.widget("summary-routev6-network").set_text(str(naddr))
                self.widget("summary-routev6-gateway").set_text(str(gaddr.network))
        else:
            self.widget("label-routev6-network").hide()
            self.widget("label-routev6-gateway").hide()
            self.widget("summary-routev6-network").hide()
            self.widget("summary-routev6-gateway").hide()


        if ip:
            self.widget("summary-ipv6-forwarding").set_text("Routed network")
        else:
            if self.widget("net-enable-ipv6-networking").get_active():
                self.widget("summary-ipv6-forwarding").set_text("Isolated network, internal routing only")
            else:
                self.widget("summary-ipv6-forwarding").set_text("Isolated network")