File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959mainFrame = None
6060
6161if version_year < 2022 :
62- def __getattr__ (name ):
63- if name == "isInMessageBox" :
64- log .warning (
65- "gui.isInMessageBox is deprecated and will be removed in 2022.1."
66- "Consult the changes for developers in 2022.1 for advice on alternatives."
67- )
68- return _isInMessageBox ()
69- raise AttributeError (f"module { __name__ } has no attribute { name } " )
70-
62+ # Like other module level constants, this must be used as follows (#13011):
63+ # import gui; doSomething(gui.isInMessageBox)
64+ # from gui import isInMessageBox; doSomething(isInMessageBox)
65+ isInMessageBox = False
7166
7267class MainFrame (wx .Frame ):
7368
Original file line number Diff line number Diff line change 55# This file is covered by the GNU General Public License.
66# See the file COPYING for more details.
77
8+ from buildVersion import version_year
89import threading
910from typing import Optional
1011import wx
@@ -33,9 +34,12 @@ def messageBox(
3334 @return: Same as for wx.MessageBox.
3435 """
3536 from gui import mainFrame
37+ import gui
3638 global _messageBoxCounter
3739 with _messageBoxCounterLock :
3840 _messageBoxCounter += 1
41+ if version_year < 2022 :
42+ gui .isInMessageBox = True
3943 try :
4044 if not parent :
4145 mainFrame .prePopup ()
@@ -45,4 +49,6 @@ def messageBox(
4549 finally :
4650 with _messageBoxCounterLock :
4751 _messageBoxCounter -= 1
52+ if version_year < 2022 :
53+ gui .isInMessageBox = isInMessageBox ()
4854 return res
You can’t perform that action at this time.
0 commit comments