X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fwx%2FListBooks.py;h=c3dc7cb347fbec9e2e42d4409792a6d863fd7bb3;hb=9f269c21f91b1865ffe2c8bfdab4974d26c97295;hp=4252c2a45df0697750faf1183b94852e9ddd4415;hpb=5f579825e3839c6bb754f6d53590b125c72034c7;p=m_librarian.git diff --git a/m_librarian/wx/ListBooks.py b/m_librarian/wx/ListBooks.py index 4252c2a..c3dc7cb 100644 --- a/m_librarian/wx/ListBooks.py +++ b/m_librarian/wx/ListBooks.py @@ -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: @@ -193,13 +193,20 @@ class ListBooksPanel(GridPanel): except Exception as e: self.report_error(str(e)) else: - if not found_books: + if found_books: + self.report_success(u'Книги сохранены.') + else: self.report_error(u'Не выбрано книг для сохранения.') + def report_success(self, message): + wx.MessageBox( + message, caption='m_Librarian download finished', + style=wx.OK, parent=self.Parent) + 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 +214,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()