Fixed issues in get_selection() in certian buffers
This commit is contained in:
parent
bd05860f11
commit
5f04ac3bee
@ -402,8 +402,6 @@ class audioBuffer(feedBuffer):
|
|||||||
|
|
||||||
def play_audio(self, *args, **kwargs):
|
def play_audio(self, *args, **kwargs):
|
||||||
selected = self.tab.list.get_selected()
|
selected = self.tab.list.get_selected()
|
||||||
if selected == -1:
|
|
||||||
return
|
|
||||||
if selected == -1:
|
if selected == -1:
|
||||||
selected = 0
|
selected = 0
|
||||||
pub.sendMessage("play-audio", audio_object=self.session.db[self.name]["items"][selected])
|
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):
|
def play_next(self, *args, **kwargs):
|
||||||
selected = self.tab.list.get_selected()
|
selected = self.tab.list.get_selected()
|
||||||
if selected == -1:
|
if selected < 0 or selected == self.tab.list.get_count()-1:
|
||||||
return
|
|
||||||
elif selected < 0 or selected == self.tab.list.get_count()-1:
|
|
||||||
selected = 0
|
selected = 0
|
||||||
if self.tab.list.get_count() <= selected+1:
|
if self.tab.list.get_count() <= selected+1:
|
||||||
newpos = 0
|
newpos = 0
|
||||||
@ -424,9 +420,7 @@ class audioBuffer(feedBuffer):
|
|||||||
|
|
||||||
def play_previous(self, *args, **kwargs):
|
def play_previous(self, *args, **kwargs):
|
||||||
selected = self.tab.list.get_selected()
|
selected = self.tab.list.get_selected()
|
||||||
if selected == -1:
|
if selected <= 0:
|
||||||
return
|
|
||||||
elif selected <= 0:
|
|
||||||
selected = self.tab.list.get_count()
|
selected = self.tab.list.get_count()
|
||||||
newpos = selected-1
|
newpos = selected-1
|
||||||
self.tab.list.select_item(newpos)
|
self.tab.list.select_item(newpos)
|
||||||
@ -434,7 +428,7 @@ class audioBuffer(feedBuffer):
|
|||||||
|
|
||||||
def open_post(self, *args, **kwargs):
|
def open_post(self, *args, **kwargs):
|
||||||
selected = self.tab.list.get_selected()
|
selected = self.tab.list.get_selected()
|
||||||
if selected == 0 or selected == -1:
|
if selected == -1:
|
||||||
return
|
return
|
||||||
audios = [self.session.db[self.name]["items"][selected]]
|
audios = [self.session.db[self.name]["items"][selected]]
|
||||||
a = posts.audio(self.session, audios)
|
a = posts.audio(self.session, audios)
|
||||||
|
Loading…
Reference in New Issue
Block a user