[modules/ping] Simplify update logic
This commit is contained in:
parent
9e32cdef5d
commit
e36694c03d
1 changed files with 1 additions and 6 deletions
|
@ -47,9 +47,7 @@ def get_rtt(module, widget):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
widget.set('rtt-unreachable', True)
|
widget.set('rtt-unreachable', True)
|
||||||
|
|
||||||
if widget.get('pending'):
|
core.event.trigger('update', [ module.id ], redraw_only=True)
|
||||||
widget.set('pending', False)
|
|
||||||
core.event.trigger('update-modules', [ module.id ], redraw_only=True)
|
|
||||||
|
|
||||||
class Module(core.module.Module):
|
class Module(core.module.Module):
|
||||||
@core.decorators.every(seconds=60)
|
@core.decorators.every(seconds=60)
|
||||||
|
@ -63,11 +61,8 @@ class Module(core.module.Module):
|
||||||
widget.set('rtt-avg', 0.0)
|
widget.set('rtt-avg', 0.0)
|
||||||
widget.set('rtt-unit', '')
|
widget.set('rtt-unit', '')
|
||||||
widget.set('packet-loss', 0)
|
widget.set('packet-loss', 0)
|
||||||
widget.set('pending', True)
|
|
||||||
|
|
||||||
def rtt(self, widget):
|
def rtt(self, widget):
|
||||||
if widget.get('pending') == True:
|
|
||||||
return 'pending'
|
|
||||||
if widget.get('rtt-unreachable'):
|
if widget.get('rtt-unreachable'):
|
||||||
return '{}: unreachable'.format(widget.get('address'))
|
return '{}: unreachable'.format(widget.get('address'))
|
||||||
return '{}: {:.1f}{} ({}%)'.format(
|
return '{}: {:.1f}{} ({}%)'.format(
|
||||||
|
|
Loading…
Reference in a new issue