Fix border around buttonsizer

main
Micke Nordin 3 years ago
parent 73ffe573fb
commit 67589b5def
Signed by: micke
GPG Key ID: 0DA0A7A5708FE257

@ -18,7 +18,7 @@ from Items import Item
HEIGHT = int(1440 / 2) HEIGHT = int(1440 / 2)
BTN_HEIGHT = 40 BTN_HEIGHT = 40
SIZE = wx.Size(100, 68) SIZE = wx.Size(68,100)
MYPATH = path.dirname(path.abspath(__file__)) MYPATH = path.dirname(path.abspath(__file__))
SCREEN_WIDTH = int(720 / 2) SCREEN_WIDTH = int(720 / 2)
BASEPATH = path.join(str(environ.get("HOME")), '.config/cast') BASEPATH = path.join(str(environ.get("HOME")), '.config/cast')
@ -228,7 +228,7 @@ def import_from_newpipe(filename) -> None:
def make_sized_button(parent_pnl: wx.Panel, bitmap_or_str: Union[wx.Bitmap, def make_sized_button(parent_pnl: wx.Panel, bitmap_or_str: Union[wx.Bitmap,
str], str],
text: str, callback: Callable) -> wx.BoxSizer: text: str, callback: Callable) -> wx.BoxSizer:
btn_sizer = wx.BoxSizer(wx.HORIZONTAL) btn_sizer = wx.StaticBoxSizer(wx.HORIZONTAL,parent_pnl)
if type(bitmap_or_str) == type(str): if type(bitmap_or_str) == type(str):
if bitmap_or_str.startswith('http'): # type: ignore if bitmap_or_str.startswith('http'): # type: ignore
bitmap = make_bitmap_from_url(bitmap_or_str) # type: ignore bitmap = make_bitmap_from_url(bitmap_or_str) # type: ignore
@ -241,18 +241,18 @@ def make_sized_button(parent_pnl: wx.Panel, bitmap_or_str: Union[wx.Bitmap,
wx.ID_ANY, wx.ID_ANY,
bitmap, bitmap,
style=btn_style, style=btn_style,
size=bitmap.GetSize()) size=wx.Size(100,68))
btn_logo.SetToolTip(text) btn_logo.SetToolTip(text)
btn_sizer.Add(btn_logo, 0, wx.BOTTOM | wx.EXPAND | wx.LEFT | wx.TOP, 1) btn_sizer.Add(btn_logo, 0, wx.EXPAND, 1)
btn_text = wx.Button(parent_pnl, btn_text = wx.Button(parent_pnl,
wx.ID_ANY, wx.ID_ANY,
text, text,
style=wx.BORDER_NONE | wx.BU_AUTODRAW, style=wx.BORDER_NONE | wx.BU_AUTODRAW,
size=wx.Size(SCREEN_WIDTH - SIZE.GetWidth(), size=wx.Size(SCREEN_WIDTH - 100,
SIZE.GetHeight())) SIZE.GetHeight()))
btn_text.SetToolTip(text) btn_text.SetToolTip(text)
btn_sizer.Add(btn_text, 0, wx.BOTTOM | wx.RIGHT | wx.TOP | wx.EXPAND, 1) btn_sizer.Add(btn_text, 0, wx.EXPAND, 1)
parent_pnl.Bind(wx.EVT_BUTTON, callback, btn_logo) parent_pnl.Bind(wx.EVT_BUTTON, callback, btn_logo)
parent_pnl.Bind(wx.EVT_BUTTON, callback, btn_text) parent_pnl.Bind(wx.EVT_BUTTON, callback, btn_text)

@ -226,7 +226,7 @@ class Cast(wx.Frame):
label="Close", label="Close",
size=(WIDTH, BTN_HEIGHT)) size=(WIDTH, BTN_HEIGHT))
closebtn.Bind(wx.EVT_BUTTON, lambda event: self.Destroy()) closebtn.Bind(wx.EVT_BUTTON, lambda event: self.Destroy())
self.m_sizer.Add(closebtn) self.m_sizer.Add(closebtn, 0, wx.ALL,1)
provider_index = 0 provider_index = 0
for provider in self.m_providers: for provider in self.m_providers:
@ -236,7 +236,7 @@ class Cast(wx.Frame):
btn_sizer: wx.BoxSizer = make_sized_button(self.m_panel, bitmap, btn_sizer: wx.BoxSizer = make_sized_button(self.m_panel, bitmap,
provider.get_name(), provider.get_name(),
callback) callback)
self.m_sizer.Add(btn_sizer) self.m_sizer.Add(btn_sizer,0,wx.ALL,1)
provider_index += 1 provider_index += 1
self.m_panel.SetupScrolling(rate_y=SCROLL_RATE, scrollToTop=True) self.m_panel.SetupScrolling(rate_y=SCROLL_RATE, scrollToTop=True)

Loading…
Cancel
Save