X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fwx%2FAWindow.py;h=8c463247bec556c26adc642538ca0a3d0ed4a934;hb=f02f8a6f7fd47bb6ab22966d783a017d821c4609;hp=4621fd49a43c506bbedad2a1c9c4245a2f02a1ba;hpb=f05d832d00b9f9a884583e4c6a240814291c9906;p=m_librarian.git diff --git a/m_librarian/wx/AWindow.py b/m_librarian/wx/AWindow.py index 4621fd4..8c46324 100644 --- a/m_librarian/wx/AWindow.py +++ b/m_librarian/wx/AWindow.py @@ -36,17 +36,26 @@ class AWindow(wx.Frame): self.Show(True) def OnInit(self): + if self.Parent: + self.Parent.Disable() self.InitMenu() if self.session_config_section_name: self.Bind(wx.EVT_SIZE, self.OnSize) + self.Bind(wx.EVT_CLOSE, self.OnClose) def InitMenu(self): MenuBar = wx.MenuBar() self.SetMenuBar(MenuBar) file_menu = wx.Menu() - exit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы") - self.Bind(wx.EVT_MENU, self.OnQuit, exit) + + if self.Parent: + close_win = \ + file_menu.Append(wx.ID_CLOSE, u"&Закрыть", u"Закрыть окно") + self.Bind(wx.EVT_MENU, self.OnCloseCommand, close_win) + + quit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы") + self.Bind(wx.EVT_MENU, self.OnQuit, quit) MenuBar.Append(file_menu, u"&Файл") about_menu = wx.Menu() @@ -55,9 +64,17 @@ class AWindow(wx.Frame): self.Bind(wx.EVT_MENU, self.OnAbout, about) MenuBar.Append(about_menu, u"&О программе") - def OnQuit(self, event): + def OnCloseCommand(self, event): self.Close(True) + def OnClose(self, event): + if self.Parent: + self.Parent.Enable() + event.Skip() # Call other handlers + + def OnQuit(self, event): + wx.GetApp().ExitMainLoop() + def OnAbout(self, event): aboutInfo = wx.adv.AboutDialogInfo() aboutInfo.SetName(u'm_Librarian')