From aea2c7ef1f82fa6e056d7e6734817a3f272730fd Mon Sep 17 00:00:00 2001 From: pawel Date: Thu, 5 Oct 2017 10:16:43 +1100 Subject: [PATCH 1/4] updated modeltester to allow QBrush as BackgroundColorRole and TextColorRole (pyQt5) --- pytestqt/modeltest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytestqt/modeltest.py b/pytestqt/modeltest.py index 27d93858..38f6204a 100644 --- a/pytestqt/modeltest.py +++ b/pytestqt/modeltest.py @@ -448,8 +448,8 @@ def _test_data(self): (qt_api.QtCore.Qt.WhatsThisRole, str), (qt_api.QtCore.Qt.SizeHintRole, qt_api.QtCore.QSize), (qt_api.QtCore.Qt.FontRole, qt_api.QtGui.QFont), - (qt_api.QtCore.Qt.BackgroundColorRole, qt_api.QtGui.QColor), - (qt_api.QtCore.Qt.TextColorRole, qt_api.QtGui.QColor), + (qt_api.QtCore.Qt.BackgroundColorRole, (qt_api.QtGui.QColor, qt_api.QtGui.QBrush)), + (qt_api.QtCore.Qt.TextColorRole, (qt_api.QtGui.QColor, qt_api.QtGui.QBrush)), ] # General purpose roles with a fixed expected type @@ -493,7 +493,7 @@ def _on_rows_about_to_be_inserted(self, parent, start, end): self._modelindex_debug(last_index), self._modelindex_debug(next_index), ) - ) + ) last_data = self._model.data(last_index) next_data = self._model.data(next_index) @@ -518,7 +518,7 @@ def _on_rows_inserted(self, parent, start, end): qt_api.extract_from_variant(c.next), qt_api.extract_from_variant(c.last) ) - ) + ) self._debug(" now in rowsInserted: parent {}, size {}, " "next data {!r}, last data {!r}".format( @@ -527,7 +527,7 @@ def _on_rows_inserted(self, parent, start, end): qt_api.extract_from_variant(next_data), qt_api.extract_from_variant(last_data) ) - ) + ) if not qt_api.QtCore.qVersion().startswith('4.'): # Skipping this on Qt4 as the parent changes for some reason: @@ -577,7 +577,7 @@ def _on_rows_about_to_be_removed(self, parent, start, end): self._modelindex_debug(last_index), self._modelindex_debug(next_index), ) - ) + ) last_data = self._model.data(last_index) next_data = self._model.data(next_index) @@ -602,7 +602,7 @@ def _on_rows_removed(self, parent, start, end): qt_api.extract_from_variant(c.next), qt_api.extract_from_variant(c.last) ) - ) + ) self._debug(" now in rowsRemoved: parent {}, size {}, " "next data {!r}, last data {!r}".format( @@ -611,7 +611,7 @@ def _on_rows_removed(self, parent, start, end): qt_api.extract_from_variant(next_data), qt_api.extract_from_variant(last_data) ) - ) + ) if not qt_api.QtCore.qVersion().startswith('4.'): # Skipping this on Qt4 as the parent changes for some reason From 1e05b89ef40b614eb7aeaeac4069d5e3639a457c Mon Sep 17 00:00:00 2001 From: pawel Date: Thu, 5 Oct 2017 10:21:24 +1100 Subject: [PATCH 2/4] fixed indentation to what it was previously --- pytestqt/modeltest.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pytestqt/modeltest.py b/pytestqt/modeltest.py index 38f6204a..8c5b163f 100644 --- a/pytestqt/modeltest.py +++ b/pytestqt/modeltest.py @@ -493,7 +493,7 @@ def _on_rows_about_to_be_inserted(self, parent, start, end): self._modelindex_debug(last_index), self._modelindex_debug(next_index), ) - ) + ) last_data = self._model.data(last_index) next_data = self._model.data(next_index) @@ -518,7 +518,7 @@ def _on_rows_inserted(self, parent, start, end): qt_api.extract_from_variant(c.next), qt_api.extract_from_variant(c.last) ) - ) + ) self._debug(" now in rowsInserted: parent {}, size {}, " "next data {!r}, last data {!r}".format( @@ -527,7 +527,7 @@ def _on_rows_inserted(self, parent, start, end): qt_api.extract_from_variant(next_data), qt_api.extract_from_variant(last_data) ) - ) + ) if not qt_api.QtCore.qVersion().startswith('4.'): # Skipping this on Qt4 as the parent changes for some reason: @@ -577,7 +577,7 @@ def _on_rows_about_to_be_removed(self, parent, start, end): self._modelindex_debug(last_index), self._modelindex_debug(next_index), ) - ) + ) last_data = self._model.data(last_index) next_data = self._model.data(next_index) @@ -602,7 +602,7 @@ def _on_rows_removed(self, parent, start, end): qt_api.extract_from_variant(c.next), qt_api.extract_from_variant(c.last) ) - ) + ) self._debug(" now in rowsRemoved: parent {}, size {}, " "next data {!r}, last data {!r}".format( @@ -611,7 +611,7 @@ def _on_rows_removed(self, parent, start, end): qt_api.extract_from_variant(next_data), qt_api.extract_from_variant(last_data) ) - ) + ) if not qt_api.QtCore.qVersion().startswith('4.'): # Skipping this on Qt4 as the parent changes for some reason From dca91f9c12fb0f295af6a2ef6e15b3c3422affd8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 4 Oct 2017 21:00:25 -0300 Subject: [PATCH 3/4] Explicitly add six as a dependency --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5ac1baa..de5eceaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ dist: trusty env: global: # used by ci-helpers - - CONDA_CHANNELS=conda-forge SETUP_XVFB=true DEPS="pytest tox coveralls" + - CONDA_CHANNELS=conda-forge SETUP_XVFB=true DEPS="pytest tox coveralls six" matrix: - PYTEST_QT_API=pyqt4 PYQT_PACKAGE="pyqt=4.*" PYTHON_VERSION=2.7 @@ -28,7 +28,7 @@ install: # Xvfb / window manager - sudo apt-get install -y xvfb herbstluftwm - # Setup miniconda + # Setup miniconda - git clone --depth 1 git://github.com/astropy/ci-helpers.git - CONDA_DEPENDENCIES="${DEPS} ${PYQT_PACKAGE}" source ci-helpers/travis/setup_conda.sh - source activate test && pip install -e . @@ -41,8 +41,8 @@ before_script: script: - source activate test && catchsegv coverage run --source=pytestqt -m pytest -v tests # for some reason tox doesn't get installed with a u+x flag - - | - chmod u+x /home/travis/miniconda/envs/test/bin/tox + - | + chmod u+x /home/travis/miniconda/envs/test/bin/tox /home/travis/miniconda/envs/test/bin/tox -e lint after_success: From f7264ae8fc24aa194503625c57f5e4decf65098e Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 4 Oct 2017 21:03:03 -0300 Subject: [PATCH 4/4] Update CHANGELOG --- CHANGELOG.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4ea6da1c..b772c9ed 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,13 @@ +2.2.1 +----- + +- ``modeltester`` now accepts ``QBrush`` for ``BackgroundColorRole`` and ``TextColorRole`` (`#189`_). + Thanks `@p0las`_ for the PR. + +.. _#189: https://github.com/pytest-dev/pytest-qt/issues/189 +.. _@p0las: https://github.com/p0las + + 2.2.0 -----