From 6bd0c10ef2407193b6865ed069002edf0f20adf7 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 25 Apr 2019 09:17:48 -0500 Subject: [PATCH] Removed some old keystrokes no longer needed --- changelog.md | 4 ++++ src/controller/buffers.py | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 2fec32f..4f2327e 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,10 @@ * the audio player module has received some improvements: - When there is something being played, the label of the "play" button, located in all audio buffers, will change automatically to "pause". When pressed, it will pause the song instead of starting the playback again since the beginning. - The last change will work also in the dialog for displaying audio information. Now it's possible to play and pause an audio from such dialog. +* In audio buffers, you will play the focused audio when pressing enter in the item, instead of opening the audio information dialog. +* Removed some old keystrokes in socializer buffers due to better alternatives. The reason for this change is that currently you don't need to be focusing an item in a buffer for being able to use the alternative keystrokes, which makes those a better implementation. + - Control+Enter and control+Shift+Enter: superseeded by Control+P for playing (and pausing) the currently focused audio. + - F5 and F6: superseeded by Alt+down and up arrows for modifying volume. ## changes in version 0.20 (25.04.2019) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index fa9db03..d80d7cc 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -304,11 +304,7 @@ class baseBuffer(object): def get_event(self, ev): """ Parses keyboard input in the ListCtrl and executes the event associated with user keypresses.""" - if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown() and ev.ShiftDown(): event = "pause_audio" - elif 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_F5: event = "volume_down" - elif ev.GetKeyCode() == wx.WXK_F6: event = "volume_up" + if ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post" else: event = None ev.Skip() @@ -629,6 +625,17 @@ class audioBuffer(feedBuffer): if self.name == "me_audio": self.tab.post.Enable(True) + def get_event(self, ev): + if ev.GetKeyCode() == wx.WXK_RETURN: event = "play_audio_from_keystroke" + else: + event = None + ev.Skip() + if event != None: + try: + getattr(self, event)() + except AttributeError: + pass + def connect_events(self): widgetUtils.connect_event(self.tab.play, widgetUtils.BUTTON_PRESSED, self.play_audio) widgetUtils.connect_event(self.tab.play_all, widgetUtils.BUTTON_PRESSED, self.play_all) @@ -644,6 +651,13 @@ class audioBuffer(feedBuffer): pub.sendMessage("play", object=self.session.db[self.name]["items"][selected]) return True + def play_audio_from_keystroke(self, *args, **kwargs): + selected = self.tab.list.get_selected() + if selected == -1: + selected = 0 + pub.sendMessage("play", object=self.session.db[self.name]["items"][selected]) + return True + def play_next(self, *args, **kwargs): selected = self.tab.list.get_selected() if selected < 0: