]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(wx/search): Search authors
authorOleg Broytman <phd@phdru.name>
Thu, 4 Jan 2024 16:33:10 +0000 (19:33 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 4 Jan 2024 16:33:10 +0000 (19:33 +0300)
[skip ci]

m_librarian/wx/SearchPanel.py
scripts/ml-wx.py

index 26fb666443812d0f7802724b51518486ac67a8f0..11633b3b7a29662229cc6a57ba2f8ea1c4b77aa0 100644 (file)
@@ -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)
index a4820680a4457e2b8c248052dea9578aef05e524..c0a6b467bb7756556377826d3da0f735cde25d4c 100755 (executable)
@@ -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()