def create_ap_actions(aps, active_ap, active_connection, adapter): # pylint: disable=too-many-locals """For each AP in a list, create the string and its attached function (activate/deactivate) """ active_ap_bssid = active_ap.get_bssid() if active_ap is not None else "" names = [ssid_to_utf8(ap) for ap in aps] max_len_name = max([len(name) for name in names]) if names else 0 secs = [ap_security(ap) for ap in aps] max_len_sec = max([len(sec) for sec in secs]) if secs else 0 ap_actions = [] for nm_ap, name, sec in zip(aps, names, secs): bars = NM.utils_wifi_strength_bars(nm_ap.get_strength()) wifi_chars = CONF.get("dmenu", "wifi_chars", fallback=False) if wifi_chars: bars = "".join([wifi_chars[i] for i, j in enumerate(bars) if j == '*']) is_active = nm_ap.get_bssid() == active_ap_bssid compact = CONF.getboolean("dmenu", "compact", fallback=False) if compact: action_name = u"{} {} {}".format(name, sec, bars) else: action_name = u"{:<{}s} {:<{}s} {}".format(name, max_len_name, sec, max_len_sec, bars) if is_active: ap_actions.append(Action(action_name, process_ap, [active_connection, True, adapter], active=True)) else: ap_actions.append(Action(action_name, process_ap, [nm_ap, False, adapter])) return ap_actions
def create_ap_actions(aps, active_ap, active_connection, adapter): # pylint: disable=too-many-locals """For each AP in a list, create the string and its attached function (activate/deactivate) """ active_ap_bssid = active_ap.get_bssid() if active_ap is not None else "" names = [ssid_to_utf8(ap) for ap in aps] max_len_name = max([len(name) for name in names]) if names else 0 secs = [ap_security(ap) for ap in aps] max_len_sec = max([len(sec) for sec in secs]) if secs else 0 ap_actions = [] for nm_ap, name, sec in zip(aps, names, secs): bars = NM.utils_wifi_strength_bars(nm_ap.get_strength()).replace( '*', '◆') is_active = nm_ap.get_bssid() == active_ap_bssid action_name = u"{:<{}s} {:<{}s} {}".format(name, max_len_name, sec, max_len_sec, bars) if is_active: ap_actions.append( Action(action_name, process_ap, [active_connection, True, adapter], active=True)) else: ap_actions.append( Action(action_name, process_ap, [nm_ap, False, adapter])) return ap_actions
def create_ap_actions(aps, active_ap, active_connection, adapter): # pylint: disable=too-many-locals """For each AP in a list, create the string and its attached function (activate/deactivate) """ active_ap_bssid = active_ap.get_bssid() if active_ap is not None else "" names = [ssid_to_utf8(ap) for ap in aps] max_len_name = max([len(name) for name in names]) if names else 0 secs = [ap_security(ap) for ap in aps] max_len_sec = max([len(sec) for sec in secs]) if secs else 0 ap_actions = [] for nm_ap, name, sec in zip(aps, names, secs): bars = NM.utils_wifi_strength_bars(nm_ap.get_strength()) is_active = nm_ap.get_bssid() == active_ap_bssid action_name = u"{:<{}s} {:<{}s} {}".format(name, max_len_name, sec, max_len_sec, bars) if is_active: ap_actions.append(Action(action_name, process_ap, [active_connection, True, adapter], active=True)) else: ap_actions.append(Action(action_name, process_ap, [nm_ap, False, adapter])) return ap_actions
def print_ap_info(ap): strength = ap.get_strength() frequency = ap.get_frequency() print "SSID: %s" % (ssid_to_utf8(ap)) print "BSSID: %s" % (ap.get_bssid()) print "Frequency: %s" % (frequency) print "Channel: %s" % (NM.utils_wifi_freq_to_channel(frequency)) print "Strength: %s %s%%" % (NM.utils_wifi_strength_bars(strength), strength) print
def print_ap_info(ap): strength = ap.get_strength() frequency = ap.get_frequency() flags = ap.get_flags() wpa_flags = ap.get_wpa_flags() rsn_flags = ap.get_rsn_flags() print("SSID: %s" % (ssid_to_utf8(ap))) print("BSSID: %s" % (ap.get_bssid())) print("Frequency: %s" % (frequency)) print("Channel: %s" % (NM.utils_wifi_freq_to_channel(frequency))) print("Mode: %s" % (mode_to_string(ap.get_mode()))) print("Flags: %s" % (flags_to_string(flags))) print("WPA flags: %s" % (security_flags_to_string(wpa_flags))) print("RSN flags: %s" % (security_flags_to_string(rsn_flags))) print("Security: %s" % (flags_to_security(flags, wpa_flags, rsn_flags))) print("Strength: %s %s%%" % (NM.utils_wifi_strength_bars(strength), strength)) print
def print_ap_info(ap): strength = ap.get_strength() frequency = ap.get_frequency() flags = ap.get_flags() wpa_flags = ap.get_wpa_flags() rsn_flags = ap.get_rsn_flags() print "SSID: %s" % (ssid_to_utf8(ap)) print "BSSID: %s" % (ap.get_bssid()) print "Frequency: %s" % (frequency) print "Channel: %s" % (NM.utils_wifi_freq_to_channel(frequency)) print "Mode: %s" % (mode_to_string(ap.get_mode())) print "Flags: %s" % (flags_to_string(flags)) print "WPA flags: %s" % (security_flags_to_string(wpa_flags)) print "RSN flags: %s" % (security_flags_to_string(rsn_flags)) print "Security: %s" % (flags_to_security(flags, wpa_flags, rsn_flags)) print "Strength: %s %s%%" % (NM.utils_wifi_strength_bars(strength), strength) print