use consistent naming of offline state for devices

This commit is contained in:
Daniel Pavel 2013-06-20 14:18:36 +02:00
parent f8369e7c63
commit b2f1786eff
3 changed files with 8 additions and 8 deletions

View File

@ -109,7 +109,7 @@ def _print_receiver(receiver, verbose=False):
def _print_device(dev, verbose=False):
p = dev.protocol
state = '' if p > 0 else 'inactive'
state = '' if p > 0 else 'offline'
if not verbose:
print ("%d: %s [%s:%s]" % (dev.number, dev.name, dev.codename, dev.serial), state)
@ -119,7 +119,7 @@ def _print_device(dev, verbose=False):
print (" Codename :", dev.codename)
print (" Kind :", dev.kind)
if p == 0:
print (" Protocol : unknown (device is inactive)")
print (" Protocol : unknown (device is offline)")
else:
print (" Protocol : HID++ %1.1f" % p)
print (" Polling rate :", dev.polling_rate, "ms")
@ -167,7 +167,7 @@ def _print_device(dev, verbose=False):
else:
print (" Battery status unavailable.")
else:
print (" Battery status is unknown (device is inactive).")
print (" Battery status is unknown (device is offline).")
#
#

View File

@ -88,7 +88,7 @@ try:
n = _notifications[summary] = Notify.Notification()
message = reason or ('unpaired' if dev.status is None else
(str(dev.status) or ('connected' if dev.status else 'inactive')))
(str(dev.status) or ('connected' if dev.status else 'offline')))
# we need to use the filename here because the notifications daemon
# is an external application that does not know about our icon sets

View File

@ -257,19 +257,19 @@ def _generate_tooltip_lines():
if serial is None: # receiver
continue
yield '<b>%s</b>' % name
p = str(status)
if p: # does it have any properties to print?
yield '<b>%s</b>' % name
if status:
yield '\t%s' % p
else:
yield '\t%s <small>(inactive)</small>' % p
yield '\t%s <small>(offline)</small>' % p
else:
if status:
yield '\t<small>no status</small>'
yield '<b>%s</b> <small>no status</small>' % name
else:
yield '\t<small>(inactive)</small>'
yield '<b>%s</b> <small>(offline)</small>' % name
yield ''