Skip to content

Commit 7637cd3

Browse files
committed
Fix repeat counter update bug
It fixes repeat counter, which was updating only after play button be toggled off. This bug was introduced after infinite playback crash correction.
1 parent f79d582 commit 7637cd3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

atbswp/control.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ class PlayCtrl:
361361
def __init__(self):
362362
self.count = settings.CONFIG.getint('DEFAULT', 'Repeat Count')
363363
self.infinite = settings.CONFIG.getboolean('DEFAULT', 'Infinite Playback')
364+
self.count_was_updated = False
364365

365366
def play(self, capture, toggle_button):
366367
"""Play the loaded capture."""
@@ -380,6 +381,9 @@ def action(self, event):
380381
toggle_button.Parent.panel.SetFocus()
381382
self.infinite = settings.CONFIG.getboolean('DEFAULT', 'Infinite Playback')
382383
if toggle_button.Value:
384+
if not self.count_was_updated:
385+
self.count = settings.CONFIG.getint('DEFAULT', 'Repeat Count')
386+
self.count_was_updated = True
383387
if TMP_PATH is None or not os.path.isfile(TMP_PATH):
384388
wx.LogError("No capture loaded")
385389
toggle_button.Value = False
@@ -395,7 +399,7 @@ def action(self, event):
395399
self.play_thread.start()
396400
else:
397401
self.play_thread.end()
398-
self.count = settings.CONFIG.getint('DEFAULT', 'Repeat Count')
402+
self.count_was_updated = False
399403
settings.save_config()
400404

401405

0 commit comments

Comments
 (0)