Пример #1
0
                active_ssid = None

            for ap in aps:
                if active_ssid == ap.get_ssid():
                    active = "*"
                else:
                    active = ""

                rows.append ((str(ap), active))

            rows.sort(lambda x,y:cmp(x[0].lower(), y[0].lower()))
            nmformat.tabular(("SSID", "Active"), rows)

        return 0

nmcommand.register(APListCmd)


class APInfoCmd(nmcommand.NmCommand):

    def name(self):
        return "ap-info"

    def is_basic(self):
        return 1

    def aliases(self):
        return ["ai"]

    def description_short(self):
        return "Get AP properties"
Пример #2
0
        if len(device_list) < 1:
            nmtalk.message("No devices found.")
            return 0

        table_rows = []

        for device in device_list:
            row = (device.get_interface(), str(device), nmdevice.device_state_to_str(device.get_state()))
            table_rows.append(row)

        nmformat.tabular(("Interface", "Type", "State"), table_rows)

        return 0

nmcommand.register(DeviceListCmd)


class DeviceInfoCmd(nmcommand.NmCommand):

    def name(self):
        return "device-info"

    def is_basic(self):
        return 1

    def aliases(self):
        return ["di"]

    def description_short(self):
        return "Get device properties"
Пример #3
0
                manager.sleep(False)
            else:
                nmtalk.message("Networking is already enabled")
        elif new_state == "off" or new_state == "disable" or new_state == "no" or new_state == 0:
            if current_state != nm.MANAGER_STATE_SLEEPING:
                nmtalk.message("Disabling networking")
                manager.sleep(True)
            else:
                nmtalk.message("Networking is already disabled")
        else:
            nmtalk.fatal("Invalid argument '%s'. Please use 'on' or 'off'" % non_option_args[0])

        return 0


nmcommand.register(NetworkEnabledCmd)


class WirelessEnabledCmd(nmcommand.NmCommand):

    def name(self):
        return "wireless-enabled"

    def is_basic(self):
        return 1

    def aliases(self):
        return ["we"]

    def description_short(self):
        return "Query or change wireless status"
Пример #4
0
            if options_dict.has_key("sort-by-type"):
                rows.sort(lambda x,y:cmp(x[1].lower(), y[1].lower()))
            else:
                rows.sort(lambda x,y:cmp(x[0].lower(), y[0].lower()))

            headers = ["Name", "Type"]
            if print_service:
                headers.append("Service type")

            nmformat.tabular(headers, rows)
        else:
            nmtalk.message("No connections found.")

        return 0

nmcommand.register(ConnectionListCmd)


class ConnectionInfoCmd(nmcommand.NmCommand):

    def name(self):
        return "connection-info"

    def is_basic(self):
        return 1

    def aliases(self):
        return ["ci"]

    def description_short(self):
        return "Connection properties"
Пример #5
0
            rows.append(r)

        if rows:
            headers = ["Name", "Status"]
            if print_service:
                headers.append("Service type")

            rows.sort(lambda x,y:cmp(x[0].lower(), y[0].lower()))
            nmformat.tabular(headers, rows)
        else:
            nmtalk.message("No VPN connections found.")

        return 0

nmcommand.register(VpnListCmd)


class VpnConnectCmd(nmcommand.NmCommand):

    def name(self):
        return "vpn-connect"

    def is_basic(self):
        return 1

    def aliases(self):
        return ["vc"]

    def description_short(self):
        return "Connect VPN"