Ran publicip.py through black
This commit is contained in:
parent
9a6e61173f
commit
284662a0ba
1 changed files with 16 additions and 13 deletions
|
@ -42,7 +42,7 @@ def update_publicip_information(module):
|
||||||
widget = module.widget()
|
widget = module.widget()
|
||||||
__previous_default_route = None
|
__previous_default_route = None
|
||||||
__current_default_route = None
|
__current_default_route = None
|
||||||
__interval = 5 # Interval between default route change checks
|
__interval = 5 # Interval between default route change checks
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
__current_default_route = netifaces.gateways()["default"][2]
|
__current_default_route = netifaces.gateways()["default"][2]
|
||||||
|
@ -76,6 +76,7 @@ def update_publicip_information(module):
|
||||||
# Wait __interval seconds before checking for default route changes again
|
# Wait __interval seconds before checking for default route changes again
|
||||||
time.sleep(__interval)
|
time.sleep(__interval)
|
||||||
|
|
||||||
|
|
||||||
class Module(core.module.Module):
|
class Module(core.module.Module):
|
||||||
@core.decorators.every(minutes=60)
|
@core.decorators.every(minutes=60)
|
||||||
def __init__(self, config, theme):
|
def __init__(self, config, theme):
|
||||||
|
@ -91,12 +92,12 @@ class Module(core.module.Module):
|
||||||
|
|
||||||
def publicip(self, widget):
|
def publicip(self, widget):
|
||||||
return self._format.format(
|
return self._format.format(
|
||||||
ip = widget.get("public_ip", "-"),
|
ip=widget.get("public_ip", "-"),
|
||||||
country_name = widget.get("country_name", "-"),
|
country_name=widget.get("country_name", "-"),
|
||||||
country_code = widget.get("country_code", "-"),
|
country_code=widget.get("country_code", "-"),
|
||||||
city_name = widget.get("city_name", "-"),
|
city_name=widget.get("city_name", "-"),
|
||||||
coordinates = widget.get("coordinates", "-")
|
coordinates=widget.get("coordinates", "-"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __click_update(self, event):
|
def __click_update(self, event):
|
||||||
util.location.reset()
|
util.location.reset()
|
||||||
|
@ -104,7 +105,9 @@ class Module(core.module.Module):
|
||||||
def update(self):
|
def update(self):
|
||||||
if self.__thread is not None and self.__thread.is_alive():
|
if self.__thread is not None and self.__thread.is_alive():
|
||||||
return
|
return
|
||||||
self.__thread = threading.Thread(target=update_publicip_information, args=(self,))
|
self.__thread = threading.Thread(
|
||||||
|
target=update_publicip_information, args=(self,)
|
||||||
|
)
|
||||||
self.__thread.start()
|
self.__thread.start()
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
|
|
Loading…
Reference in a new issue