Пример #1
0
    def on_apply(self):

        if self.on_query_apply_state() == True:
            dprint("network apply")

            m = Mechanism()
            nap_enable = self.Builder.get_object("nap-enable")
            if nap_enable.props.active:

                r_dnsmasq = self.Builder.get_object("r_dnsmasq")
                if r_dnsmasq.props.active:
                    stype = "DnsMasqHandler"
                else:
                    stype = "DhcpdHandler"

                net_ip = self.Builder.get_object("net_ip")
                net_nat = self.Builder.get_object("net_nat")

                try:
                    m.EnableNetwork(inet_aton(net_ip.props.text), inet_aton("255.255.255.0"), stype)
                except Exception as e:
                    d = NetworkErrorDialog(e)

                    d.run()
                    d.destroy()
                    return
            else:
                m.DisableNetwork()

            self.clear_options()
Пример #2
0
    def on_apply(self):

        if self.on_query_apply_state():
            dprint("network apply")

            m = Mechanism()
            nap_enable = self.Builder.get_object("nap-enable")
            if nap_enable.props.active:

                if self.Builder.get_object("r_dhcpd").props.active:
                    stype = "DhcpdHandler"
                elif self.Builder.get_object("r_dnsmasq").props.active:
                    stype = "DnsMasqHandler"
                elif self.Builder.get_object("r_udhcpd").props.active:
                    stype = "UdhcpdHandler"

                net_ip = self.Builder.get_object("net_ip")

                try:
                    m.EnableNetwork('(ayays)', inet_aton(net_ip.props.text), inet_aton("255.255.255.0"), stype)

                    if not self.Config["nap-enable"]:
                        self.Config["nap-enable"] = True
                except Exception as e:
                    d = NetworkErrorDialog(e, parent=self.widget.get_toplevel())

                    d.run()
                    d.destroy()
                    return
            else:
                self.Config["nap-enable"] = False
                m.DisableNetwork()

            self.clear_options()
Пример #3
0
    def on_apply(self):

        if self.on_query_apply_state() == True:
            dprint("network apply")

            m = Mechanism()
            nap_enable = self.Builder.get_object("nap-enable")
            if nap_enable.props.active:

                r_dnsmasq = self.Builder.get_object("r_dnsmasq")
                if r_dnsmasq.props.active:
                    stype = "DnsMasqHandler"
                else:
                    stype = "DhcpdHandler"

                net_ip = self.Builder.get_object("net_ip")
                net_nat = self.Builder.get_object("net_nat")

                try:
                    m.EnableNetwork(inet_aton(net_ip.props.text),
                                    inet_aton("255.255.255.0"), stype)
                except Exception as e:
                    d = NetworkErrorDialog(e)

                    d.run()
                    d.destroy()
                    return
            else:
                m.DisableNetwork()

            self.clear_options()
Пример #4
0
        def err(excp):
            d = NetworkErrorDialog(
                excp,
                "You might not be able to connect to the Bluetooth network via this machine"
            )
            d.expander.props.margin_left = 9

            d.run()
            d.destroy()
Пример #5
0
        def err(_obj, result, _user_data):
            d = NetworkErrorDialog(
                result,
                "You might not be able to connect to the Bluetooth network via this machine"
            )
            d.expander.props.margin_left = 9

            d.run()
            d.destroy()
Пример #6
0
    def on_apply(self):

        if self.on_query_apply_state():
            logging.info("network apply")

            m = Mechanism()
            nap_enable = self.Builder.get_object("nap-enable")
            if nap_enable.props.active:

                if self.Builder.get_object("r_dhcpd").props.active:
                    stype = "DhcpdHandler"
                elif self.Builder.get_object("r_dnsmasq").props.active:
                    stype = "DnsMasqHandler"
                elif self.Builder.get_object("r_udhcpd").props.active:
                    stype = "UdhcpdHandler"

                net_ip = self.Builder.get_object("net_ip")

                try:
                    m.EnableNetwork(str('(ayays)'),
                                    inet_aton(net_ip.props.text),
                                    inet_aton("255.255.255.0"), stype)

                    if not self.Config["nap-enable"]:
                        self.Config["nap-enable"] = True
                except Exception as e:
                    d = NetworkErrorDialog(e,
                                           parent=self.widget.get_toplevel())

                    d.run()
                    d.destroy()
                    return
            else:
                self.Config["nap-enable"] = False
                m.DisableNetwork()

            self.clear_options()
Пример #7
0
        def err(excp):
            d = NetworkErrorDialog(excp, "You might not be able to connect to the Bluetooth network via this machine")
            d.expander.props.margin_left = 9

            d.run()
            d.destroy()