tools: measure touchpad-pressure: prevent division by zero

And make sure the equivalent entry in the measure touch-size is long enough to
overwrite the current status line

https://gitlab.freedesktop.org/libinput/libinput/issues/42

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-06-18 08:38:58 +10:00
parent 734496d972
commit a5700dcf43
2 changed files with 4 additions and 1 deletions

View file

@ -138,7 +138,7 @@ class TouchSequence(object):
def _str_summary(self):
if not self.points:
return "Sequence: no major/minor values recorded"
return "{:78s}".format("Sequence: no major/minor values recorded")
s = "Sequence: major: [{:3d}..{:3d}] ".format(
self.major_range.min, self.major_range.max

View file

@ -105,6 +105,9 @@ class TouchSequence(object):
return self._str_state() if self.is_active else self._str_summary()
def _str_summary(self):
if not self.points:
return "{:78s}".format("Sequence: no pressure values recorded")
s = "Sequence {} pressure: "\
"min: {:3d} max: {:3d} avg: {:3d} median: {:3d} tags:" \
.format(