4 from ..__version__ import __version__
5 from .session_config import get_session_config
8 class MainWindow(wx.Frame):
11 MenuBar = wx.MenuBar()
12 self.SetMenuBar(MenuBar)
15 exit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы")
16 self.Bind(wx.EVT_MENU, self.OnQuit, exit)
17 MenuBar.Append(file_menu, u"&Файл")
19 about_menu = wx.Menu()
20 about = about_menu.Append(wx.ID_ABOUT,
21 u"&О m_Librarian", u"О m_Librarian")
22 self.Bind(wx.EVT_MENU, self.OnAbout, about)
23 MenuBar.Append(about_menu, u"&О программе")
25 self.Bind(wx.EVT_SIZE, self.OnSize)
27 def OnQuit(self, event):
30 def OnAbout(self, event):
31 aboutInfo = wx.adv.AboutDialogInfo()
32 aboutInfo.SetName(u'm_Librarian')
33 aboutInfo.SetVersion(__version__)
34 aboutInfo.SetDescription(
35 u'Библиотекарь для библиотек LibRusEc/Flibusta')
36 aboutInfo.AddDeveloper(u'Олег Бройтман')
37 aboutInfo.SetWebSite(u'https://phdru.name/Software/Python/m_librarian/')
38 aboutInfo.SetCopyright(u'(C) 2023 Олег Бройтман')
39 aboutInfo.SetLicense(u'GPL')
40 wx.adv.AboutBox(aboutInfo)
42 def OnSize(self, event):
43 """Save window size in the session config"""
44 size = event.GetSize()
45 session_config = get_session_config()
46 session_config.set('main_window', 'width', str(size.width))
47 session_config.set('main_window', 'height', str(size.height))
49 event.Skip() # Call other handlers
51 class Application(wx.App):
54 frame = MainWindow(None, -1, u"m_Librarian")
57 self.SetTopWindow(frame)