Skip to content

Commit ea0c268

Browse files
committed
Fix feature sorting in combo-boxes
Sort features alphabetically in the features combo-box. * In `src/napari_clusters_plotter/_algorithm_widget.py`, sort features alphabetically before adding them to `feature_selection_widget` in `_on_update_layer_selection` method. * In `src/napari_clusters_plotter/_new_plotter_widget.py`, sort features alphabetically before adding them to the combo-boxes for x, y, and hue axes in `_update_feature_selection` method. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/BiAPoL/napari-clusters-plotter/tree/v0.9.0?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 2005e38 commit ea0c268

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/napari_clusters_plotter/_algorithm_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _on_update_layer_selection(self, layer):
135135
]
136136
)
137137
self.feature_selection_widget.clear()
138-
self.feature_selection_widget.addItems(features_to_add.columns)
138+
self.feature_selection_widget.addItems(sorted(features_to_add.columns))
139139
self._update_features()
140140

141141
@property

src/napari_clusters_plotter/_new_plotter_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _update_feature_selection(
327327
self._selectors[dim].clear()
328328

329329
for dim in ["x", "y", "hue"]:
330-
self._selectors[dim].addItems(self.common_columns)
330+
self._selectors[dim].addItems(sorted(self.common_columns))
331331

332332
# it should always be possible to select no color
333333
self._selectors["hue"].addItem("None")

0 commit comments

Comments
 (0)