Skip to content

Commit

Permalink
Correctly toggle play button when used via keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
innir committed Dec 6, 2020
1 parent 58e06cf commit 57b02fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion bin/gtranscribe
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,16 @@ class gTranscribeWindow:
if self.settings_daemon:
self.settings_daemon.GrabMediaPlayerKeys('gTranscribe', 0)

# pylint: disable=unused-argument
def toggle_play_action(self, action):
"""Toggle play button when activated via shortcut"""
if self.play_action.get_active():
self.play_action.set_active(False)
else:
self.play_action.set_active(True)

def play(self, action):
if action.get_active() or self.play_menu.get_label() == _("Play"):
if action.get_active():
logger.debug('play action triggered')
self.icon_play.set_from_icon_name(Gtk.STOCK_MEDIA_PAUSE, 2)
self.play_menu.set_label(_("Pause"))
Expand Down
2 changes: 1 addition & 1 deletion data/ui/gTranscribe.glade
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
<property name="label" translatable="yes">Play</property>
<property name="use_underline">True</property>
<signal name="activate" handler="play" object="button_play" swapped="no"/>
<signal name="activate" handler="toggle_play_action" swapped="no"/>
<accelerator key="space" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
Expand Down

0 comments on commit 57b02fc

Please sign in to comment.