|
|
@ -14,7 +14,6 @@ ChannelProvider = NewType('ChannelProvider', ChannelProvider)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Cast(wx.Frame):
|
|
|
|
class Cast(wx.Frame):
|
|
|
|
m_selected_chromecast = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kw):
|
|
|
|
def __init__(self, *args, **kw):
|
|
|
|
"""__init__.
|
|
|
|
"""__init__.
|
|
|
@ -22,6 +21,8 @@ class Cast(wx.Frame):
|
|
|
|
:param kw:
|
|
|
|
:param kw:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
super().__init__(*args, **kw)
|
|
|
|
super().__init__(*args, **kw)
|
|
|
|
|
|
|
|
self.m_selected_chromecast = None
|
|
|
|
|
|
|
|
self.SetSizeHints(480,480,maxW=480)
|
|
|
|
self.m_index = 0
|
|
|
|
self.m_index = 0
|
|
|
|
self.m_chromecast_thr = threading.Thread(target=self.get_chromecasts,
|
|
|
|
self.m_chromecast_thr = threading.Thread(target=self.get_chromecasts,
|
|
|
|
args=(),
|
|
|
|
args=(),
|
|
|
@ -45,9 +46,12 @@ class Cast(wx.Frame):
|
|
|
|
|
|
|
|
|
|
|
|
for channel in self.m_channels:
|
|
|
|
for channel in self.m_channels:
|
|
|
|
for item in channel.get_items():
|
|
|
|
for item in channel.get_items():
|
|
|
|
title = wx.StaticText(self.m_panel, -1, item['title'])
|
|
|
|
title = wx.StaticText(self.m_panel, -1)
|
|
|
|
|
|
|
|
title.SetLabelMarkup("<span weight='bold' >{}</span>".format(item['title']))
|
|
|
|
description = wx.StaticText(self.m_panel, -1,
|
|
|
|
description = wx.StaticText(self.m_panel, -1,
|
|
|
|
item['description'])
|
|
|
|
item['description'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
description.Wrap(478)
|
|
|
|
bitmap = item['thumbnail']
|
|
|
|
bitmap = item['thumbnail']
|
|
|
|
btn = wx.BitmapButton(self.m_panel,
|
|
|
|
btn = wx.BitmapButton(self.m_panel,
|
|
|
|
id=self.m_index,
|
|
|
|
id=self.m_index,
|
|
|
@ -58,8 +62,10 @@ class Cast(wx.Frame):
|
|
|
|
self.m_sizer.Add(title)
|
|
|
|
self.m_sizer.Add(title)
|
|
|
|
self.m_sizer.Add(btn)
|
|
|
|
self.m_sizer.Add(btn)
|
|
|
|
self.m_sizer.Add(description)
|
|
|
|
self.m_sizer.Add(description)
|
|
|
|
|
|
|
|
self.m_sizer.AddSpacer(10)
|
|
|
|
self.m_index = self.m_index + 1
|
|
|
|
self.m_index = self.m_index + 1
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
|
|
|
|
self.m_sizer.Fit(self)
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
|
|
|
|
|
|
|
|
def show_player(self, _, uri):
|
|
|
|
def show_player(self, _, uri):
|
|
|
@ -83,7 +89,7 @@ class Cast(wx.Frame):
|
|
|
|
self.m_sizer.Add(pause_button, (1, 2))
|
|
|
|
self.m_sizer.Add(pause_button, (1, 2))
|
|
|
|
self.m_sizer.Add(back_button, (1, 3))
|
|
|
|
self.m_sizer.Add(back_button, (1, 3))
|
|
|
|
|
|
|
|
|
|
|
|
if self.m_chromecasts and not self.m_selected_chromecast:
|
|
|
|
if not self.m_chromecast_thr.is_alive() and not self.m_selected_chromecast:
|
|
|
|
chromecast_button = wx.Button(self.m_panel, -1, "Cast")
|
|
|
|
chromecast_button = wx.Button(self.m_panel, -1, "Cast")
|
|
|
|
chromecast_button.Bind(
|
|
|
|
chromecast_button.Bind(
|
|
|
|
wx.EVT_BUTTON,
|
|
|
|
wx.EVT_BUTTON,
|
|
|
@ -103,6 +109,7 @@ class Cast(wx.Frame):
|
|
|
|
self.Bind(wx.media.EVT_MEDIA_FINISHED, self.show_list)
|
|
|
|
self.Bind(wx.media.EVT_MEDIA_FINISHED, self.show_list)
|
|
|
|
self.load_uri(uri)
|
|
|
|
self.load_uri(uri)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
|
|
|
|
self.m_sizer.Fit(self)
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.ScrollChildIntoView(self.m_control)
|
|
|
|
self.m_panel.ScrollChildIntoView(self.m_control)
|
|
|
|
|
|
|
|
|
|
|
@ -118,6 +125,7 @@ class Cast(wx.Frame):
|
|
|
|
set_chromecast(event, chromecast, muri))
|
|
|
|
set_chromecast(event, chromecast, muri))
|
|
|
|
self.m_sizer.Add(btn)
|
|
|
|
self.m_sizer.Add(btn)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
|
|
|
|
self.m_sizer.Fit(self)
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
|
|
|
|
|
|
|
|
def set_chromecast(self, event, chromecast, uri):
|
|
|
|
def set_chromecast(self, event, chromecast, uri):
|
|
|
|