]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/wx/ListBooks.py
Style(wx/books): Fix minor `flake8` warning
[m_librarian.git] / m_librarian / wx / ListBooks.py
index 4252c2a45df0697750faf1183b94852e9ddd4415..534d380eb26ca88defc7f1f86abb8d2044482f99 100644 (file)
@@ -181,7 +181,7 @@ class ListBooksPanel(GridPanel):
         else:
             event.Skip()
 
-    def Download(self, event):
+    def Download(self, event=None):
         book_by_row = self.book_by_row
         found_books = False
         try:
@@ -199,7 +199,7 @@ class ListBooksPanel(GridPanel):
     def report_error(self, error):
         wx.MessageBox(
             error, caption='m_Librarian download error',
-            style=wx.OK|wx.ICON_ERROR, parent=self.Parent)
+            style=wx.OK | wx.ICON_ERROR, parent=self.Parent)
 
 
 class ListBooksWindow(GridWindow):
@@ -207,3 +207,15 @@ class ListBooksWindow(GridWindow):
     session_config_section_name = 'list_books'
     window_title = u"m_Librarian: Список книг"
     GridPanelClass = ListBooksPanel
+
+    def InitMenu(self):
+        GridWindow.InitMenu(self)
+
+        download_menu = wx.Menu()
+        download = download_menu.Append(wx.ID_SAVE,
+                                        u"&Скачать", u"Скачать")
+        self.Bind(wx.EVT_MENU, self.OnDownload, download)
+        self.GetMenuBar().Append(download_menu, u"&Скачать")
+
+    def OnDownload(self, event):
+        self.panel.Download()