diff --git a/main.py b/main.py index 05d72b1..7c43227 100644 --- a/main.py +++ b/main.py @@ -14,7 +14,6 @@ ChannelProvider = NewType('ChannelProvider', ChannelProvider) class Cast(wx.Frame): - m_selected_chromecast = None def __init__(self, *args, **kw): """__init__. @@ -22,6 +21,8 @@ class Cast(wx.Frame): :param kw: """ super().__init__(*args, **kw) + self.m_selected_chromecast = None + self.SetSizeHints(480,480,maxW=480) self.m_index = 0 self.m_chromecast_thr = threading.Thread(target=self.get_chromecasts, args=(), @@ -45,9 +46,12 @@ class Cast(wx.Frame): for channel in self.m_channels: for item in channel.get_items(): - title = wx.StaticText(self.m_panel, -1, item['title']) + title = wx.StaticText(self.m_panel, -1) + title.SetLabelMarkup("{}".format(item['title'])) description = wx.StaticText(self.m_panel, -1, item['description']) + + description.Wrap(478) bitmap = item['thumbnail'] btn = wx.BitmapButton(self.m_panel, id=self.m_index, @@ -58,8 +62,10 @@ class Cast(wx.Frame): self.m_sizer.Add(title) self.m_sizer.Add(btn) self.m_sizer.Add(description) + self.m_sizer.AddSpacer(10) self.m_index = self.m_index + 1 self.m_panel.SetSizer(self.m_sizer) + self.m_sizer.Fit(self) self.m_panel.Layout() 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(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.Bind( wx.EVT_BUTTON, @@ -103,6 +109,7 @@ class Cast(wx.Frame): self.Bind(wx.media.EVT_MEDIA_FINISHED, self.show_list) self.load_uri(uri) self.m_panel.SetSizer(self.m_sizer) + self.m_sizer.Fit(self) self.m_panel.Layout() self.m_panel.ScrollChildIntoView(self.m_control) @@ -118,6 +125,7 @@ class Cast(wx.Frame): set_chromecast(event, chromecast, muri)) self.m_sizer.Add(btn) self.m_panel.SetSizer(self.m_sizer) + self.m_sizer.Fit(self) self.m_panel.Layout() def set_chromecast(self, event, chromecast, uri):