Add closebutton and fix button sizes

main
Micke Nordin 3 years ago
parent d9cd63dc80
commit 3c5cf92da1
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -19,6 +19,7 @@ BTN_HEIGHT = 40
SPACER_HEIGHT = 10
BM_BTN_STYLE = wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.TOP
BTN_STYLE = wx.BORDER_NONE | wx.BU_AUTODRAW | wx.BU_EXACTFIT | wx.BU_NOTEXT
class Cast(wx.Frame):
def __init__(self, *args, **kw):
@ -83,6 +84,9 @@ class Cast(wx.Frame):
def show_provider_list(self, _) -> None:
self.m_sizer.Clear(delete_windows=True)
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
closebtn = wx.Button(self.m_panel, -1, label="Close", size=(WIDTH, BTN_HEIGHT))
closebtn.Bind(wx.EVT_BUTTON, lambda event: self.Destroy())
self.m_sizer.Add(closebtn)
provider_index = 0
for provider in self.m_providers:
bitmap = provider.get_logo_as_bitmap()
@ -93,8 +97,8 @@ class Cast(wx.Frame):
self.m_panel.SetupScrolling()
self.m_panel.SetSizer(self.m_sizer)
self.Fit()
self.Layout()
self.m_sizer.Fit(self)
self.m_sizer.Layout()
def show_channel_list(self, _, provider_index) -> None:
self.m_selected_provider_index = provider_index
@ -113,8 +117,8 @@ class Cast(wx.Frame):
self.m_panel.SetupScrolling()
self.m_panel.SetSizer(self.m_sizer)
self.Fit()
self.Layout()
self.m_sizer.Fit(self)
self.m_sizer.Layout()
def show_video_list(self, _, index=0) -> None:
self.m_sizer.Clear(delete_windows=True)
@ -154,8 +158,8 @@ class Cast(wx.Frame):
#self.m_sizer.AddStretchSpacer()
self.m_panel.SetupScrolling()
self.m_panel.SetSizer(self.m_sizer)
self.Fit()
self.Layout()
self.m_sizer.Fit(self)
self.m_sizer.Layout()
def show_player(self, _, uri, provider_index: int):
"""
@ -214,20 +218,20 @@ class Cast(wx.Frame):
self.load_uri(uri)
self.m_panel.SetupScrolling()
self.m_panel.SetSizer(self.m_sizer)
self.Fit()
self.Layout()
self.m_sizer.Fit(self)
self.m_sizer.Layout()
self.m_panel.ScrollChildIntoView(self.m_control)
def select_chromecast(self, _, uri, provider_index):
self.m_sizer.Clear(delete_windows=True)
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
cancel_btn = wx.Button(self.m_panel, -1, "Cancel")
cancel_btn = wx.Button(self.m_panel, -1, "Cancel", size=(WIDTH, BTN_HEIGHT), style=wx.BU_EXACTFIT)
cancel_btn.Bind(
wx.EVT_BUTTON,
lambda event, index=provider_index: self.show_video_list(event, index),
)
self.m_sizer.Add(cancel_btn, wx.ALIGN_CENTER_VERTICAL)
self.m_sizer.Add(cancel_btn) #, wx.ALIGN_CENTER_VERTICAL)
for cast in self.m_chromecasts:
friendly_name = cast.cast_info.friendly_name
btn = wx.Button(self.m_panel, id=-1, label=friendly_name, size=(WIDTH, BTN_HEIGHT))
@ -237,11 +241,11 @@ class Cast(wx.Frame):
event, chromecast, muri, index
),
)
self.m_sizer.Add(btn, wx.ALIGN_CENTER_VERTICAL)
self.m_sizer.Add(btn)#, wx.ALIGN_CENTER_VERTICAL)
self.m_panel.SetupScrolling()
self.m_panel.SetSizer(self.m_sizer)
self.Fit()
self.Layout()
self.m_sizer.Fit(self)
self.m_sizer.Layout()
def set_chromecast(self, event, chromecast, uri, provider_index):
self.m_selected_chromecast = chromecast

Loading…
Cancel
Save