~rmpr/atbswp

c8d3a8246a70f5ac9a4ce006908759718e6efee0 — Mairo Rufus 3 years ago e234894 develop
Use a ProgressDialog to display the recording timer

Before this change we rolled-out our own custom (ugly) widget to display
the time remaining before recording. Now it's a built-in one.
1 files changed, 9 insertions(+), 4 deletions(-)

M atbswp/control.py
M atbswp/control.py => atbswp/control.py +9 -4
@@ 315,11 315,14 @@ class RecordCtrl:
        except:
            self.timer = 0

        if event.GetEventObject().GetValue():
        if event.EventObject.Value:
            if self.timer > 0:
                self.countdown_dialog = CountdownDialog(None, title="Wait for the recording to start", countdown=self.timer)
                self.countdown_dialog = wx.ProgressDialog(title="Wait for the recording to start",
                        message=f"The recording will start in {self.timer} second(s)",
                        style=wx.PD_APP_MODAL)
                self.countdown_dialog.Range = self.timer
                self.wx_timer = wx.Timer(event.GetEventObject())
                event.GetEventObject().Bind(wx.EVT_TIMER, self.update_timer, self.wx_timer)
                event.EventObject.Bind(wx.EVT_TIMER, self.update_timer, self.wx_timer)
                self.wx_timer.Start(1000)
                self.countdown_dialog.ShowModal()



@@ 347,7 350,9 @@ class RecordCtrl:
            self.wx_timer.Stop()
            self.countdown_dialog.Destroy()
        else:
            self.timer = self.countdown_dialog.update_ui()
            time.sleep(1)
            self.timer -= 1
            self.countdown_dialog.Update(self.timer, f"The recording will start in {self.timer} second(s)")


class PlayCtrl: