提交 092930d4 编写于 作者: N nicolargo

Add encryption (issue #937)

上级 e711f7fb
......@@ -111,9 +111,9 @@ critical=90
#wlan0_tx_critical=1000000
#wlan0_tx_log=True
#[wifi]
[wifi]
# Define the list of hidden wireless network interfaces (comma-separated regexp)
#hide=docker.*,lo
hide=lo,docker.*
#[diskio]
# Define the list of hidden disks (comma-separated regexp)
......
......@@ -154,16 +154,16 @@ class Plugin(GlancesPlugin):
# Max size for the interface name
if max_width is not None and max_width >= 23:
# Interface size name = max_width - space for interfaces bitrate
ifname_max_width = max_width - 14
# Interface size name = max_width - space for encyption + quality
ifname_max_width = max_width - 5
else:
ifname_max_width = 9
ifname_max_width = 16
# Build the string message
# Header
msg = '{:{width}}'.format('WIFI', width=ifname_max_width)
ret.append(self.curse_add_line(msg, "TITLE"))
msg = '{:>14}'.format('Quality')
msg = '{:>6}'.format('Quality')
ret.append(self.curse_add_line(msg))
ret.append(self.curse_new_line())
......@@ -174,12 +174,16 @@ class Plugin(GlancesPlugin):
continue
# New hotspot
hotspotname = i['ssid']
# Add the encryption type (if it is available)
if i['encrypted']:
hotspotname = hotspotname + ' {}'.format(i['encryption_type'])
# Cut hotspotname if it is too long
if len(hotspotname) > ifname_max_width:
# Cut hotspotname if it is too long
hotspotname = '_' + hotspotname[-ifname_max_width + 1:]
# Add the new hotspot to the message
msg = '{:{width}}'.format(hotspotname, width=ifname_max_width)
ret.append(self.curse_add_line(msg))
msg = '{:>14}'.format(i['quality'], width=ifname_max_width)
msg = '{:>7}'.format(i['quality'], width=ifname_max_width)
ret.append(self.curse_add_line(msg))
return ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册