X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fwx%2FSearchPanel.py;h=8547c313152fc07f8253e7b0305464ab508db747;hb=1a0cfa4b41817b2f558bb78ced4ce0520bc907d8;hp=6a29ad76dbdc46a7e18bc5bca101a4d917dae9e4;hpb=802497925f78ce64eb678573f62dbf8372afea5e;p=m_librarian.git diff --git a/m_librarian/wx/SearchPanel.py b/m_librarian/wx/SearchPanel.py index 6a29ad7..8547c31 100644 --- a/m_librarian/wx/SearchPanel.py +++ b/m_librarian/wx/SearchPanel.py @@ -1,13 +1,18 @@ # coding: utf-8 import wx +from ..search import search_authors_raw +from .ListAuthors import ListAuthorsWindow + + +_search_types = ['start', 'substring', 'full'] class SearchPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) - self.search_authors_vsizer = search_authors_vsizer = \ + search_authors_vsizer = \ wx.StaticBoxSizer(wx.VERTICAL, self, u'Поиск авторов') self.SetSizer(search_authors_vsizer) @@ -31,10 +36,16 @@ class SearchPanel(wx.Panel): self, label=u'Различать прописные/строчные') search_authors_vsizer.Add(search_case) - self.search_authors_button = search_authors_button = wx.Button( - self, label=u'Искать авторов') + search_authors_button = wx.Button(self, label=u'Искать авторов') search_authors_vsizer.Add(search_authors_button, 0, wx.ALIGN_CENTER, 0) search_authors_button.Bind(wx.EVT_BUTTON, self.SearchAuthors) def SearchAuthors(self, event): - pass + search_authors = self.search_authors.GetValue() + search_substr = _search_types[self.search_substr.GetSelection()] + search_case = self.search_case.GetValue() + if search_case is False: + search_case = None + search_authors_results = \ + search_authors_raw(search_authors, search_substr, search_case) + ListAuthorsWindow(self.Parent, search_authors_results)