From 098feb5ac122b1b15604b9db757d1d8c8caa8ee8 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 15 Jul 2024 21:20:53 +0300 Subject: [PATCH] Feat(wx/ListBooks): Move download button to a separate panel [skip ci] --- m_librarian/wx/ListBooks.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/m_librarian/wx/ListBooks.py b/m_librarian/wx/ListBooks.py index 359bd64..dc79786 100644 --- a/m_librarian/wx/ListBooks.py +++ b/m_librarian/wx/ListBooks.py @@ -156,10 +156,6 @@ class ListBooksPanel(GridPanel): grid.AutoSizeRows() grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnClick) - dnld_button = wx.Button(self, label=u'Скачать') - self.GetSizer().Add(dnld_button, 0, wx.ALIGN_CENTER, 0) - dnld_button.Bind(wx.EVT_BUTTON, self.Download) - def toggleCB(self, row): value = self.grid.GetCellValue(row, 0) if value: @@ -222,6 +218,28 @@ class ListBooksWindow(GridWindow): window_title = u"m_Librarian: Список книг" GridPanelClass = ListBooksPanel + def OnInit(self): + GridWindow.OnInit(self) + self.button_panel = button_panel = wx.Panel(self) + + vsizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(vsizer) + + vsizer.Add(self.panel, 10, wx.EXPAND, 0) + vsizer.Add(button_panel, 1, wx.EXPAND, 0) + + hsizer = wx.BoxSizer(wx.HORIZONTAL) + button_panel.SetSizer(hsizer) + + hsizer.AddStretchSpacer(1) + dnld_button = wx.Button(button_panel, label=u'Скачать') + hsizer.Add(dnld_button, 0, wx.ALIGN_CENTER_VERTICAL, 0) + hsizer.AddStretchSpacer(1) + dnld_button.Bind(wx.EVT_BUTTON, self.OnDownload) + + for panel in self.panel, button_panel: + panel.SetMinSize(wx.Size(100, 100)) + def InitMenu(self): GridWindow.InitMenu(self) -- 2.39.5