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 super(wx.Frame, self).__init__(
13 parent=None, id=-1, title=u"m_Librarian",
17 self.Bind(wx.EVT_SIZE, self.OnSize)
20 MenuBar = wx.MenuBar()
21 self.SetMenuBar(MenuBar)
24 exit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы")
25 self.Bind(wx.EVT_MENU, self.OnQuit, exit)
26 MenuBar.Append(file_menu, u"&Файл")
28 about_menu = wx.Menu()
29 about = about_menu.Append(wx.ID_ABOUT,
30 u"&О m_Librarian", u"О m_Librarian")
31 self.Bind(wx.EVT_MENU, self.OnAbout, about)
32 MenuBar.Append(about_menu, u"&О программе")
34 def OnQuit(self, event):
37 def OnAbout(self, event):
38 aboutInfo = wx.adv.AboutDialogInfo()
39 aboutInfo.SetName(u'm_Librarian')
40 aboutInfo.SetVersion(__version__)
41 aboutInfo.SetDescription(
42 u'Библиотекарь для библиотек LibRusEc/Flibusta')
43 aboutInfo.AddDeveloper(u'Олег Бройтман')
44 aboutInfo.SetWebSite(u'https://phdru.name/Software/Python/m_librarian/')
45 aboutInfo.SetCopyright(u'(C) 2023 Олег Бройтман')
46 aboutInfo.SetLicense(u'GPL')
47 wx.adv.AboutBox(aboutInfo)
49 def OnSize(self, event):
50 """Save window size in the session config"""
51 size = event.GetSize()
52 session_config = get_session_config()
53 session_config.set('main_window', 'width', str(size.width))
54 session_config.set('main_window', 'height', str(size.height))
56 event.Skip() # Call other handlers
58 class Application(wx.App):
62 self.SetTopWindow(frame)