From d64c85c78598c984e7e468903fde25fb55e23883 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 4 Jan 2024 19:33:10 +0300 Subject: [PATCH] Feat(wx/search): Search authors [skip ci] --- m_librarian/wx/SearchPanel.py | 8 +++++++- scripts/ml-wx.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/m_librarian/wx/SearchPanel.py b/m_librarian/wx/SearchPanel.py index 26fb666..11633b3 100644 --- a/m_librarian/wx/SearchPanel.py +++ b/m_librarian/wx/SearchPanel.py @@ -1,6 +1,9 @@ # coding: utf-8 import wx +from ..search import search_authors_raw + +_search_types = ['start', 'substring', 'full'] class SearchPanel(wx.Panel): @@ -38,5 +41,8 @@ class SearchPanel(wx.Panel): def SearchAuthors(self, event): search_authors = self.search_authors.GetValue() - search_substr = self.search_substr.GetSelection() + search_substr = _search_types[self.search_substr.GetSelection()] search_case = self.search_case.GetValue() + if search_case is False: + search_case = None + search_authors_raw(search_authors, search_substr, search_case) diff --git a/scripts/ml-wx.py b/scripts/ml-wx.py index a482068..c0a6b46 100755 --- a/scripts/ml-wx.py +++ b/scripts/ml-wx.py @@ -1,12 +1,15 @@ #! /usr/bin/env python import sys + +from m_librarian.db import open_db from m_librarian.wx.Application import Application def main(): if len(sys.argv) > 1: sys.exit("This program doesn't accept any arguments") + open_db() app = Application() app.MainLoop() -- 2.39.2