Fix Network panel not functioning when Wi-Fi point is within range (#304) (#315)

This commit is contained in:
Vladimir Poleh 2021-11-02 05:51:41 +03:00 committed by GitHub
parent e7e91aee27
commit c7901243cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,8 +33,11 @@ class NetworkPanel(ScreenPanel):
else:
ints = netifaces.interfaces()
if 'lo' in ints:
ints.pop('lo')
self.interfaces = ints[0]
ints.pop(ints.index('lo'))
if (len(ints) > 0):
self.interface = ints[0]
else:
self.interface = 'lo'
res = netifaces.ifaddresses(self.interface)
if netifaces.AF_INET in res and len(res[netifaces.AF_INET]) > 0: