-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from typing import Any | ||
|
||
from qtpy.QtCore import Qt | ||
from qtpy.QtWidgets import ( | ||
QComboBox, | ||
QLabel, | ||
QSizePolicy, | ||
QVBoxLayout, | ||
QWidget, | ||
) | ||
|
||
from cell_gater.model.data_model import DataModel | ||
|
||
|
||
class ScatterWidget(QWidget): | ||
"""Widget for a scatter plot with markers on the x axis and any dtype column on the y axis.""" | ||
|
||
def __init__(self, model: DataModel) -> None: | ||
super().__init__() | ||
|
||
self.setLayout(QVBoxLayout()) | ||
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) | ||
self._model = model | ||
|
||
# Dropdown of samples once directory is loaded | ||
selection_label = QLabel("Select sample:") | ||
self.sample_selection_dropdown = QComboBox() | ||
if len(self.model.samples) > 0: | ||
self.sample_selection_dropdown.addItems(self.model.samples) | ||
self.sample_selection_dropdown.currentTextChanged.connect(self._on_sample_changed) | ||
|
||
self.layout().addWidget(selection_label, 4, 0, Qt.AlignCenter) | ||
self.layout().addWidget(self.sample_selection_dropdown, 4, 1) | ||
|
||
def _on_sample_changed(self): | ||
pass | ||
|
||
def _set_samples_dropdown(self, event: Any) -> None: | ||
"""Set the items for the samples dropdown QComboBox.""" | ||
if (region_props := self.model.regionprops_df) is not None: | ||
self.model.samples = list(region_props["sample_id"].cat.categories) | ||
|
||
# New directory loaded so we reload the dropdown items | ||
self.sample_selection_dropdown.clear() | ||
if len(self.model.samples) > 0: | ||
self.sample_selection_dropdown.addItems([None]) | ||
self.sample_selection_dropdown.addItems(self.model.samples) |