From 495634c25443d84c3ffb47e520b0fd2f7b7bd360 Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Mon, 13 Jul 2020 23:04:09 +0200 Subject: [PATCH] removed unnecessary try, except --- bin/mpdevil.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bin/mpdevil.py b/bin/mpdevil.py index a34b928..69425fa 100644 --- a/bin/mpdevil.py +++ b/bin/mpdevil.py @@ -3124,17 +3124,14 @@ class SeekBar(Gtk.Box): self.enable() def refresh(self, emitter, elapsed, duration): - try: - if elapsed > duration: # fix display error - elapsed=duration - fraction=(elapsed/duration)*100 - if self.update: - self.scale.set_value(fraction) - self.elapsed.set_text(str(datetime.timedelta(seconds=int(elapsed))).lstrip("0").lstrip(":")) - self.rest.set_text("-"+str(datetime.timedelta(seconds=int(duration-elapsed))).lstrip("0").lstrip(":")) - self.scale.set_fill_level(fraction) - except: - self.disable() + if elapsed > duration: # fix display error + elapsed=duration + fraction=(elapsed/duration)*100 + if self.update: + self.scale.set_value(fraction) + self.elapsed.set_text(str(datetime.timedelta(seconds=int(elapsed))).lstrip("0").lstrip(":")) + self.rest.set_text("-"+str(datetime.timedelta(seconds=int(duration-elapsed))).lstrip("0").lstrip(":")) + self.scale.set_fill_level(fraction) class PlaybackOptions(Gtk.Box): def __init__(self, client, settings):