Skip to content

Commit

Permalink
Merge pull request #159 from abstractfactory/fix158
Browse files Browse the repository at this point in the history
Fix #158
  • Loading branch information
mottosso authored Nov 21, 2016
2 parents ea2eae8 + c563a98 commit b305f2b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
self.__modified__ = list() # Existing members modified in some way

# Below members are set dynamically on import relative the original binding.
self.__version__ = "0.6.4"
self.__version__ = "0.6.5"
self.__qt_version__ = "0.0.0"
self.__binding__ = "None"
self.__binding_version__ = "0.0.0"
Expand Down Expand Up @@ -189,6 +189,7 @@ def _pyqt4():

import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic


_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
Expand Down Expand Up @@ -403,7 +404,11 @@ def init():
__name__: binding,

# Fix #133, `from Qt.QtWidgets import QPushButton`
__name__ + ".QtWidgets": binding.QtWidgets
__name__ + ".QtWidgets": binding.QtWidgets,

# Fix #158 `import Qt.QtCore;Qt.QtCore.Signal`
__name__ + ".QtCore": binding.QtCore,
__name__ + ".QtGui": binding.QtGui,

})

Expand Down
19 changes: 15 additions & 4 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,28 @@ def test_import_from_qtwidgets():
assert QPushButton.__name__ == "QPushButton", QPushButton


def test_i158_qtcore_direct_import():
"""import Qt.QtCore works on all bindings
This addresses issue #158
"""

import Qt.QtCore
assert hasattr(Qt.QtCore, "Signal")


def test_translate_arguments():
"""Arguments of QtCompat.translate are correct
QtCompat.translate is a shim over the PySide, PyQt4 and PyQt5
equivalent with an interface like the one found in PySide2.
Reference: https://doc.qt.io/qt-5/qcoreapplication.html#translate
"""

import Qt

# This will run on each binding
result = Qt.QtCompat.translate("CustomDialog", # context
"Status", # sourceText
Expand Down

0 comments on commit b305f2b

Please sign in to comment.