Skip to content

Commit 76b6d92

Browse files
authored
Merge 584aafb into 438f06f
2 parents 438f06f + 584aafb commit 76b6d92

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

source/gui/__init__.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,10 @@
5959
mainFrame = None
6060

6161
if 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

7267
class MainFrame(wx.Frame):
7368

source/gui/message.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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
89
import threading
910
from typing import Optional
1011
import 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

0 commit comments

Comments
 (0)