Skip to content

Commit

Permalink
Disable silx deprecation warnings when using PyQt4.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasole committed Jan 7, 2019
1 parent a37e340 commit a9b7bbd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions PyMca5/PyMcaGui/pymca/PyMcaMain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#/*##########################################################################
# Copyright (C) 2004-2018 V.A. Sole, European Synchrotron Radiation Facility
# Copyright (C) 2004-2019 V.A. Sole, European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
Expand Down Expand Up @@ -135,7 +135,13 @@
if hasattr(qt, 'QOpenGLWidget'):
print("Warning: OpenGL backend not fully supported")
try:
# try to import silx prior to import matplotlib
if (sys.version_info < (3,)) and ("PyQt4.QtCore" in sys.modules):
# PyQt4 is the most reliable binding at the ESRF for python 2
import silx
silxLogger = logging.getLogger("silx.DEPRECATION")
silxLogger.setLevel(logging.CRITICAL)
# try to import silx prior to importing matplotlib to prevent
# unnecessary warning
import silx.gui.plot
except:
pass
Expand Down
11 changes: 8 additions & 3 deletions PyMca5/PyMcaGui/pymca/QStackWidget.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#/*##########################################################################
# Copyright (C) 2004-2018 V.A. Sole, European Synchrotron Radiation Facility
# Copyright (C) 2004-2019 V.A. Sole, European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
Expand Down Expand Up @@ -88,8 +88,13 @@
else:
QString = qt.safe_str
try:
# try to import silx prior to importing matplotlib
# to prevent unnecessary warning
if (sys.version_info < (3,)) and ("PyQt4.QtCore" in sys.modules):
# PyQt4 is the most reliable binding at the ESRF for python 2
import silx
silxLogger = logging.getLogger("silx.DEPRECATION")
silxLogger.setLevel(logging.CRITICAL)
# try to import silx prior to importing matplotlib to prevent
# unnecessary warning
import silx.gui.plot
except:
pass
Expand Down

0 comments on commit a9b7bbd

Please sign in to comment.