]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(wx/ListBooks): Move download button to a separate panel
authorOleg Broytman <phd@phdru.name>
Mon, 15 Jul 2024 18:20:53 +0000 (21:20 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 18 Jul 2024 14:28:11 +0000 (17:28 +0300)
[skip ci]

m_librarian/wx/ListBooks.py

index 359bd64b1987c16833a9a76fbb0cbe598f2055ac..dc797861fa55ad62919c244a71689617c0a7bf52 100644 (file)
@@ -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)