diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c80bc2..ea586dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.1] - 2024-10-08 + +### Fixed + +- core.DataFrameTableModel: fixed issue with sorting + ## [0.3.0] - 2024-10-08 ### Added @@ -55,6 +61,7 @@ _First release._ - core.ColoredDataFrameTableModel: An extension of DataFrameTableModel providing color-mapped numerical data. - widgets.StatefulButton: A QPushButton that maintains an active/inactive state. +[0.3.1]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.3.1 [0.3.0]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.3.0 [0.2.0]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.2.0 [0.1.2]: https://github.com/int-brain-lab/iblqt/releases/tag/v0.1.2 diff --git a/iblqt/__init__.py b/iblqt/__init__.py index 1ef9198..d4b4079 100644 --- a/iblqt/__init__.py +++ b/iblqt/__init__.py @@ -1,3 +1,3 @@ """A collection of extensions to the Qt framework.""" -__version__ = '0.3.0' +__version__ = '0.3.1' diff --git a/iblqt/core.py b/iblqt/core.py index 838155f..50ebecb 100644 --- a/iblqt/core.py +++ b/iblqt/core.py @@ -225,7 +225,9 @@ def sort(self, column: int, order: Qt.SortOrder = Qt.SortOrder.AscendingOrder): return columnName = self._dataFrame.columns[column] self.layoutAboutToBeChanged.emit() - self._dataFrame.sort_values(by=columnName, ascending=not order, inplace=True) + self._dataFrame.sort_values( + by=columnName, ascending=order == Qt.SortOrder.AscendingOrder, inplace=True + ) self.layoutChanged.emit() diff --git a/tests/test_core.py b/tests/test_core.py index b05dc11..5fab9c3 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -10,14 +10,14 @@ def test_dataframe_model(qtbot): # instantiation / setting of dataframe - df1 = pd.DataFrame({'X': [0, 1, 2], 'Y': ['A', 'B', 'C']}) + df = pd.DataFrame({'X': [0, 1, 2], 'Y': ['A', 'B', 'C']}) model = core.ColoredDataFrameTableModel() assert model.dataFrame.empty - model = core.ColoredDataFrameTableModel(dataFrame=df1) - assert model.dataFrame is not df1 - assert model.dataFrame.equals(df1) + model = core.ColoredDataFrameTableModel(dataFrame=df) + assert model.dataFrame is not df + assert model.dataFrame.equals(df) with qtbot.waitSignal(model.modelReset, timeout=100): - model.dataFrame = df1 + model.dataFrame = df # header data assert model.headerData(-1, Qt.Orientation.Horizontal) is None