Skip to content

Commit ca71e7e

Browse files
committed
[app] Update progress bar checks #212
1 parent 73774d2 commit ca71e7e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

dvr_scan/app/scan_window.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,17 @@ def _on_processed_frame(self, progress_bar: tqdm, num_events: int):
214214
self._num_events = num_events
215215
self._frames_processed += 1
216216
curr = time.time_ns()
217+
# Update internal state used for UI labels using the progress bar in the scanner.
217218
if (curr - self._last_stats_update_ns) > STATS_UPDATE_RATE_NS:
218219
self._last_stats_update_ns = curr
219220
format_dict = progress_bar.format_dict
220221
format_dict.update(bar_format="{elapsed} {remaining} {rate_fmt}")
221-
# TODO: Why do we sometimes not get enough or too many values here?
222-
#
223-
# The format above should always print a string similar to "NN:NN NN:NN NN.NN frames/s".
224-
# Some extra spaces might be in there. Filter out empty values?
225222
values = tqdm.format_meter(**format_dict).strip().split(" ")
226-
if len(values) != 4:
227-
logger.error(f"[Issue 198] Incorrect meter format: {values}")
228-
# While we determine the underlying cause of the issue, we don't want to stop scanning.
229-
# Filter out empty values, ensure we got enough values, and guarad against too many.
223+
# We have to filter out empty entries after we split by spaces because the meter format
224+
# adds padding spaces to align numbers.
230225
values = list(filter(bool, values))
231-
if len(values) >= 4:
232-
# Update internal state used for UI labels.
233-
(self._elapsed, self._remaining, self._rate, *_) = values
226+
if len(values) == 4:
227+
(self._elapsed, self._remaining, self._rate) = values
234228

235229
def _do_scan(self):
236230
# We'll handle any errors below in the main Tkinter thread.

0 commit comments

Comments
 (0)