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