New keystroke: ctrl+shift+return for stopping audio playback

This commit is contained in:
Manuel Cortez 2016-02-19 17:36:19 -06:00
parent 4acf363f3e
commit 64c8b7c3dc
2 changed files with 9 additions and 2 deletions

View File

@ -59,6 +59,7 @@ class baseBuffer(object):
widgetUtils.connect_event(self.tab.list.list, widgetUtils.KEYPRESS, self.get_event) widgetUtils.connect_event(self.tab.list.list, widgetUtils.KEYPRESS, self.get_event)
def get_event(self, ev): def get_event(self, ev):
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown() and ev.ShiftDown(): event = "pause_audio"
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "play_audio" if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "play_audio"
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post" elif ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post"
elif ev.GetKeyCode() == wx.WXK_F5: event = "volume_down" elif ev.GetKeyCode() == wx.WXK_F5: event = "volume_down"
@ -93,6 +94,9 @@ class baseBuffer(object):
else: else:
pub.sendMessage("open-post", post_object=post, controller_="postController") pub.sendMessage("open-post", post_object=post, controller_="postController")
def pause_audio(self, *args, **kwargs):
player.player.pause()
class feedBuffer(baseBuffer): class feedBuffer(baseBuffer):
def get_items(self, no_next=True): def get_items(self, no_next=True):

View File

@ -35,8 +35,11 @@ class audioPlayer(object):
self.stream.stop() self.stream.stop()
def pause(self): def pause(self):
if self.stream != None and self.stream.is_playing == True: if self.stream != None:
self.stream.pause() if self.stream.is_playing == True:
self.stream.pause()
else:
self.stream.play()
@property @property
def volume(self): def volume(self):