Skip to content

Commit bae156e

Browse files
committed
Silence annoying PyQt5.uic.loadUiType deprecation warnings
These aren't our fault -- they come from the PyQt library itself, so we may as well hide them and avoid the noise. (cherry picked from commit b53d64b)
1 parent 3b233bf commit bae156e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

python/PyQt/PyQt5/uic/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@
2323
# This will get replaced with a git SHA1 when you do a git archive
2424
__revision__ = '$Format:%H$'
2525

26+
import warnings
2627
from PyQt5.uic.Compiler import indenter, compiler
2728
from PyQt5.uic.objcreator import widgetPluginPath
2829
from PyQt5.uic import properties, uiparser, Compiler
2930
from PyQt5.uic import *
31+
32+
__PyQtLoadUiType = loadUiType
33+
34+
35+
def __loadUiType(*args, **kwargs):
36+
with warnings.catch_warnings():
37+
warnings.filterwarnings("ignore", category=DeprecationWarning)
38+
return __PyQtLoadUiType(*args, **kwargs)
39+
40+
41+
loadUiType = __loadUiType

0 commit comments

Comments
 (0)