From 67589b5defc876b46e9620677a76372db0ec558d Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 13 Jan 2022 19:10:38 +0100 Subject: [PATCH] Fix border around buttonsizer --- src/Utils/__init__.py | 12 ++++++------ src/main.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Utils/__init__.py b/src/Utils/__init__.py index 930e21d..a373530 100644 --- a/src/Utils/__init__.py +++ b/src/Utils/__init__.py @@ -18,7 +18,7 @@ from Items import Item HEIGHT = int(1440 / 2) BTN_HEIGHT = 40 -SIZE = wx.Size(100, 68) +SIZE = wx.Size(68,100) MYPATH = path.dirname(path.abspath(__file__)) SCREEN_WIDTH = int(720 / 2) 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, str], 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 bitmap_or_str.startswith('http'): # 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, bitmap, style=btn_style, - size=bitmap.GetSize()) + size=wx.Size(100,68)) 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, wx.ID_ANY, text, style=wx.BORDER_NONE | wx.BU_AUTODRAW, - size=wx.Size(SCREEN_WIDTH - SIZE.GetWidth(), + size=wx.Size(SCREEN_WIDTH - 100, SIZE.GetHeight())) 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_text) diff --git a/src/main.py b/src/main.py index da155f7..46862e9 100644 --- a/src/main.py +++ b/src/main.py @@ -226,7 +226,7 @@ class Cast(wx.Frame): label="Close", size=(WIDTH, BTN_HEIGHT)) 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 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, provider.get_name(), callback) - self.m_sizer.Add(btn_sizer) + self.m_sizer.Add(btn_sizer,0,wx.ALL,1) provider_index += 1 self.m_panel.SetupScrolling(rate_y=SCROLL_RATE, scrollToTop=True)