Press return in an audio element in the audio buffer for seeing details about the file
This commit is contained in:
parent
4cf343b91d
commit
8c6e89ba9c
@ -4,6 +4,7 @@ import widgetUtils
|
||||
import messages
|
||||
import player
|
||||
import utils
|
||||
import posts
|
||||
from wxUI.tabs import home
|
||||
from pubsub import pub
|
||||
from sessionmanager import session
|
||||
@ -59,7 +60,7 @@ class baseBuffer(object):
|
||||
|
||||
def get_event(self, ev):
|
||||
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "play_audio"
|
||||
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "open_url"
|
||||
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"
|
||||
else:
|
||||
@ -102,4 +103,9 @@ class audioBuffer(feedBuffer):
|
||||
selected = self.tab.list.get_selected()
|
||||
call_threaded(player.player.play, 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()
|
@ -6,12 +6,12 @@ import widgetUtils
|
||||
import output
|
||||
import wx
|
||||
import webbrowser
|
||||
import utils
|
||||
from pubsub import pub
|
||||
from wxUI.dialogs import postDialogs, urlList
|
||||
from extra import SpellChecker, translator
|
||||
from mysc.thread_utils import call_threaded
|
||||
from wxUI import menus
|
||||
from utils import find_urls
|
||||
|
||||
class postController(object):
|
||||
def __init__(self, session, postObject):
|
||||
@ -187,3 +187,24 @@ class comment(object):
|
||||
lk = self.session.like(self.comment["id"])
|
||||
self.get_likes()
|
||||
|
||||
class audio(postController):
|
||||
def __init__(self, session, postObject):
|
||||
self.session = session
|
||||
self.post = postObject
|
||||
self.dialog = postDialogs.audio()
|
||||
self.fill_information()
|
||||
|
||||
def fill_information(self):
|
||||
if self.post.has_key("artist"):
|
||||
self.dialog.set("artist", self.post["artist"])
|
||||
if self.post.has_key("title"):
|
||||
self.dialog.set("title", self.post["title"])
|
||||
if self.post.has_key("duration"):
|
||||
self.dialog.set("duration", utils.seconds_to_string(self.post["duration"]))
|
||||
self.dialog.set_title(u"{0} - {1}".format(self.post["title"], self.post["artist"]))
|
||||
call_threaded(self.get_lyrics)
|
||||
|
||||
def get_lyrics(self):
|
||||
if self.post.has_key("lyrics_id"):
|
||||
l = self.session.vk.client.audio.getLyrics(lyrics_id=int(self.post["lyrics_id"]))
|
||||
self.dialog.set("lyric", l["text"])
|
@ -102,3 +102,41 @@ class comment(basicPost):
|
||||
self.sizer.Add(actions_box, 0, wx.ALL, 5)
|
||||
self.sizer.Add(self.create_dialog_buttons())
|
||||
self.done()
|
||||
|
||||
class audio(widgetUtils.BaseDialog):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(audio, self).__init__(parent=None, *args, **kwargs)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
lbl_title = wx.StaticText(panel, wx.NewId(), _(u"Title"))
|
||||
self.title = wx.TextCtrl(panel, wx.NewId(), size=(413, -1), style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
titleBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
titleBox.Add(lbl_title, 0, wx.ALL, 5)
|
||||
titleBox.Add(self.title, 0, wx.ALL, 5)
|
||||
sizer.Add(titleBox, 0, wx.ALL, 5)
|
||||
lbl_artist = wx.StaticText(panel, wx.NewId(), _(u"Artist"))
|
||||
self.artist = wx.TextCtrl(panel, wx.NewId(), size=(413, -1), style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
artistBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
artistBox.Add(lbl_artist, 0, wx.ALL, 5)
|
||||
artistBox.Add(self.artist, 0, wx.ALL, 5)
|
||||
sizer.Add(artistBox, 0, wx.ALL, 5)
|
||||
lbl_duration = wx.StaticText(panel, wx.NewId(), _(u"Duration"))
|
||||
self.duration = wx.TextCtrl(panel, wx.NewId(), size=(413, -1), style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
durationBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
durationBox.Add(lbl_duration, 0, wx.ALL, 5)
|
||||
durationBox.Add(self.duration, 0, wx.ALL, 5)
|
||||
sizer.Add(durationBox, 0, wx.ALL, 5)
|
||||
lbl_lyrics = wx.StaticText(panel, wx.NewId(), _(u"Lyric"))
|
||||
self.lyric = wx.TextCtrl(panel, wx.NewId(), size=(500, 500), style=wx.TE_READONLY|wx.TE_MULTILINE)
|
||||
lbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
lbox.Add(lbl_lyrics, 0, wx.ALL, 5)
|
||||
lbox.Add(self.lyric, 0, wx.ALL, 5)
|
||||
sizer.Add(lbox, 0, wx.ALL, 5)
|
||||
self.play = wx.Button(panel, wx.NewId(), _(u"Play"))
|
||||
self.download = wx.Button(panel, wx.NewId(), _(u"Download"))
|
||||
close = wx.Button(panel, wx.ID_CANCEL)
|
||||
bbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
bbox.Add(self.play, 0, wx.ALL, 5)
|
||||
bbox.Add(self.download, 0, wx.ALL, 5)
|
||||
bbox.Add(close, 0, wx.ALL, 5)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user