Skip to content

Commit

Permalink
window: Use Gtk.Widget.add_tick_callback for speech button progress
Browse files Browse the repository at this point in the history
This way the progressbar animation should be smoother
  • Loading branch information
rafaelmardojai committed Sep 5, 2024
1 parent 70c042d commit a530a52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dialect/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,15 +920,15 @@ def _play_audio(self, path: str):
uri = "file://" + path
self.player.set_property("uri", uri)
self.player.set_state(Gst.State.PLAYING)
GLib.timeout_add(50, self._gst_progress_timeout)
self.add_tick_callback(self._gst_progress_timeout)

def _on_gst_message(self, _bus, message: Gst.Message):
if message.type == Gst.MessageType.EOS or message.type == Gst.MessageType.ERROR:
if message.type == Gst.MessageType.ERROR:
logging.error("Some error occurred while trying to play.")
self._speech_reset()

def _gst_progress_timeout(self):
def _gst_progress_timeout(self, _widget, _clock):
if not self.player:
return False

Expand Down

0 comments on commit a530a52

Please sign in to comment.