From 8fe7f45f62ba0da5c842888fdfc7be2cffd97cdc Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Sat, 8 Jan 2022 21:22:02 +0100 Subject: [PATCH] Start working on collapsable pane --- src/main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index b664602..6ef65a8 100644 --- a/src/main.py +++ b/src/main.py @@ -167,12 +167,11 @@ class Cast(wx.Frame): for item in channel.get_items(): # type: ignore inner_sizer = wx.BoxSizer(wx.VERTICAL) + pane_sizer = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(self.m_panel, -1) title.SetLabelMarkup("{}".format( item["title"])) - description = wx.StaticText(self.m_panel, -1, item["description"]) - description.Wrap(WIDTH - 2) bitmap = item["thumbnail"] btn = wx.BitmapButton(self.m_panel, id=self.m_index, @@ -185,7 +184,17 @@ class Cast(wx.Frame): ) inner_sizer.Add(title) inner_sizer.Add(btn) - inner_sizer.Add(description) + collapsable_pane = wx.CollapsiblePane(self.m_panel, wx.ID_ANY, "Details:") + inner_sizer.Add(collapsable_pane, 0, wx.GROW | wx.ALL, 5) + pane_win = collapsable_pane.GetPane() + # now add a test label in the collapsible pane using a sizer to layout it: + description = wx.StaticText(pane_win, -1, item["description"]) + description.Wrap(WIDTH - 2) + + pane_sizer.Add(description, wx.GROW | wx.ALL, 2) + pane_win.SetSizer(pane_sizer) + pane_sizer.SetSizeHints(pane_win) + #inner_sizer.Add(description) self.m_sizer.Add(inner_sizer) self.m_sizer.AddSpacer(SPACER_HEIGHT) self.m_index = self.m_index + 1