Skip to content

Commit

Permalink
Merge pull request #176 from ignamv/master
Browse files Browse the repository at this point in the history
PR: Don't warn about bindings change if user did not specify a binding
  • Loading branch information
ccordoba12 authored Mar 5, 2019
2 parents 8fc23ce + ce5264a commit 203be8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qtpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class PythonQtWarning(Warning):
# Names of the expected PySide2 api
PYSIDE2_API = ['pyside2']

# Detecting if a binding was specified by the user
binding_specified = QT_API in os.environ

# Setting a default value for QT_API
os.environ.setdefault(QT_API, 'pyqt5')

Expand Down Expand Up @@ -206,7 +209,7 @@ class PythonQtWarning(Warning):

# If a correct API name is passed to QT_API and it could not be found,
# switches to another and informs through the warning
if API != initial_api:
if API != initial_api and binding_specified:
warnings.warn('Selected binding "{}" could not be found, '
'using "{}"'.format(initial_api, API), RuntimeWarning)

Expand Down

0 comments on commit 203be8a

Please sign in to comment.