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'Олег Бройтман')
47 aboutInfo.SetWebSite(u'https://phdru.name/Software/Python/m_librarian/')
48 aboutInfo.SetCopyright(u'(C) 2023 Олег Бройтман')
49 aboutInfo.SetLicense(u'GPL')
50 wx.adv.AboutBox(aboutInfo)
52 def OnSize(self, event):
53 """Save window size in the session config"""
54 size = event.GetSize()
55 session_config = get_session_config()
56 session_config.set('main_window', 'width', str(size.width))
57 session_config.set('main_window', 'height', str(size.height))
59 event.Skip() # Call other handlers
61 class Application(wx.App):
65 self.SetTopWindow(frame)