3 import wx, wx.adv # noqa: E401 multiple imports on one line
4 from ..__version__ import __version__
5 from .SearchPanel import SearchPanel
6 from .session_config import get_session_config
9 class MainWindow(wx.Frame):
12 session_config = get_session_config()
13 width = session_config.getint('main_window', 'width', 600)
14 height = session_config.getint('main_window', 'height', 400)
15 super(wx.Frame, self).__init__(
16 parent=None, id=-1, title=u"m_Librarian",
17 size=wx.Size(width=width, height=height),
20 self.search_panel = search_panel = SearchPanel(self)
22 self.Bind(wx.EVT_SIZE, self.OnSize)
25 MenuBar = wx.MenuBar()
26 self.SetMenuBar(MenuBar)
29 exit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы")
30 self.Bind(wx.EVT_MENU, self.OnQuit, exit)
31 MenuBar.Append(file_menu, u"&Файл")
33 about_menu = wx.Menu()
34 about = about_menu.Append(wx.ID_ABOUT,
35 u"&О m_Librarian", u"О m_Librarian")
36 self.Bind(wx.EVT_MENU, self.OnAbout, about)
37 MenuBar.Append(about_menu, u"&О программе")
39 def OnQuit(self, event):
42 def OnAbout(self, event):
43 aboutInfo = wx.adv.AboutDialogInfo()
44 aboutInfo.SetName(u'm_Librarian')
45 aboutInfo.SetVersion(__version__)
46 aboutInfo.SetDescription(
47 u'Библиотекарь для библиотек LibRusEc/Flibusta')
48 aboutInfo.AddDeveloper(u'Олег Бройтман')
50 u'https://phdru.name/Software/Python/m_librarian/')
51 aboutInfo.SetCopyright(u'(C) 2023, 2024 Олег Бройтман')
52 aboutInfo.SetLicense(u'GPL')
53 wx.adv.AboutBox(aboutInfo)
55 def OnSize(self, event):
56 """Save window size in the session config"""
57 size = event.GetSize()
58 session_config = get_session_config()
59 session_config.set('main_window', 'width', str(size.width))
60 session_config.set('main_window', 'height', str(size.height))
62 event.Skip() # Call other handlers
65 class Application(wx.App):
69 self.SetTopWindow(frame)