From 5f04ac3bee9d4ebd331d823cacf19693b2292f6c Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sat, 22 Dec 2018 05:39:21 -0600 Subject: [PATCH] Fixed issues in get_selection() in certian buffers --- src/controller/buffers.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 301ccbc..c0a89df 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -402,8 +402,6 @@ class audioBuffer(feedBuffer): def play_audio(self, *args, **kwargs): selected = self.tab.list.get_selected() - if selected == -1: - return if selected == -1: selected = 0 pub.sendMessage("play-audio", audio_object=self.session.db[self.name]["items"][selected]) @@ -411,9 +409,7 @@ class audioBuffer(feedBuffer): def play_next(self, *args, **kwargs): selected = self.tab.list.get_selected() - if selected == -1: - return - elif selected < 0 or selected == self.tab.list.get_count()-1: + if selected < 0 or selected == self.tab.list.get_count()-1: selected = 0 if self.tab.list.get_count() <= selected+1: newpos = 0 @@ -424,9 +420,7 @@ class audioBuffer(feedBuffer): def play_previous(self, *args, **kwargs): selected = self.tab.list.get_selected() - if selected == -1: - return - elif selected <= 0: + if selected <= 0: selected = self.tab.list.get_count() newpos = selected-1 self.tab.list.select_item(newpos) @@ -434,7 +428,7 @@ class audioBuffer(feedBuffer): def open_post(self, *args, **kwargs): selected = self.tab.list.get_selected() - if selected == 0 or selected == -1: + if selected == -1: return audios = [self.session.db[self.name]["items"][selected]] a = posts.audio(self.session, audios)