Skip to content

Commit ecb1433

Browse files
authored
Merge pull request #206 from dgovil/binding-enum
Binding State Enums
2 parents bc6aa7c + 0bcec34 commit ecb1433

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Qt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,11 @@ def _install():
10871087

10881088
_install()
10891089

1090+
# Setup Binding Enum states
1091+
Qt.IsPySide2 = Qt.__binding__ == 'PySide2'
1092+
Qt.IsPyQt5 = Qt.__binding__ == 'PyQt5'
1093+
Qt.IsPySide = Qt.__binding__ == 'PySide'
1094+
Qt.IsPyQt4 = Qt.__binding__ == 'PyQt4'
10901095

10911096
"""Augment QtCompat
10921097

tests.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,15 @@ def test_binding_and_qt_version():
407407
assert Qt.__qt_version__ != "0.0.0", ("Qt version was not populated")
408408

409409

410+
def test_binding_states():
411+
"""Tests to see if the Qt binding enum states are set properly"""
412+
import Qt
413+
assert Qt.IsPySide == binding("PySide")
414+
assert Qt.IsPySide2 == binding("PySide2")
415+
assert Qt.IsPyQt5 == binding("PyQt5")
416+
assert Qt.IsPyQt4 == binding("PyQt4")
417+
418+
410419
def test_cli():
411420
"""Qt.py is available from the command-line"""
412421
env = os.environ.copy()

0 commit comments

Comments
 (0)