Play button in the audio details dialogue now works
This commit is contained in:
parent
b30ad96895
commit
e6eaa8655e
@ -2,9 +2,9 @@
|
||||
import wx
|
||||
import widgetUtils
|
||||
import messages
|
||||
import player
|
||||
import utils
|
||||
import posts
|
||||
import player
|
||||
from wxUI.tabs import home
|
||||
from pubsub import pub
|
||||
from sessionmanager import session
|
||||
@ -101,11 +101,10 @@ class audioBuffer(feedBuffer):
|
||||
|
||||
def play_audio(self, *args, **kwargs):
|
||||
selected = self.tab.list.get_selected()
|
||||
call_threaded(player.player.play, self.session.db[self.name]["items"][selected]["url"])
|
||||
pub.sendMessage("play-audio", audio_object=self.session.db[self.name]["items"][selected]["url"])
|
||||
|
||||
def open_post(self):
|
||||
selected = self.tab.list.get_selected()
|
||||
a = posts.audio(self.session, self.session.db[self.name]["items"][selected])
|
||||
a.dialog.get_response()
|
||||
|
||||
player.setup()
|
@ -3,6 +3,7 @@ import utils
|
||||
import widgetUtils
|
||||
import messages
|
||||
import buffers
|
||||
import player
|
||||
from pubsub import pub
|
||||
from mysc.repeating_timer import RepeatingTimer
|
||||
from mysc.thread_utils import call_threaded
|
||||
@ -20,6 +21,7 @@ class Controller(object):
|
||||
def __init__(self):
|
||||
super(Controller, self).__init__()
|
||||
self.buffers = []
|
||||
player.setup()
|
||||
self.window = mainWindow.mainWindow()
|
||||
self.window.change_status(_(u"Ready"))
|
||||
self.session = session.sessions[session.sessions.keys()[0]]
|
||||
@ -42,6 +44,7 @@ class Controller(object):
|
||||
self.window.add_buffer(audio.tab, _(u"My audios"))
|
||||
pub.subscribe(self.in_post, "posted")
|
||||
pub.subscribe(self.download, "download-file")
|
||||
pub.subscribe(self.play_audio, "play-audio")
|
||||
|
||||
def login(self):
|
||||
self.window.change_status(_(u"Logging in VK"))
|
||||
@ -67,3 +70,6 @@ class Controller(object):
|
||||
|
||||
def download(self, url, filename):
|
||||
call_threaded(utils.download_file, url, filename, self.window)
|
||||
|
||||
def play_audio(self, audio_object):
|
||||
call_threaded(player.player.play, audio_object)
|
||||
|
@ -195,6 +195,7 @@ class audio(postController):
|
||||
self.dialog = postDialogs.audio()
|
||||
self.fill_information()
|
||||
widgetUtils.connect_event(self.dialog.download, widgetUtils.BUTTON_PRESSED, self.download)
|
||||
widgetUtils.connect_event(self.dialog.play, widgetUtils.BUTTON_PRESSED, self.play)
|
||||
|
||||
def fill_information(self):
|
||||
if self.post.has_key("artist"):
|
||||
@ -216,3 +217,6 @@ class audio(postController):
|
||||
path = self.dialog.get_destination_path(f)
|
||||
if path != None:
|
||||
pub.sendMessage("download-file", url=self.post["url"], filename=f)
|
||||
|
||||
def play(self, *args, **kwargs):
|
||||
pub.sendMessage("play-audio", audio_object=self.post["url"])
|
||||
|
Loading…
Reference in New Issue
Block a user