Skip to content

Commit

Permalink
[inference/input_store_controller] Restore dropdown after re-entering…
Browse files Browse the repository at this point in the history
… app
  • Loading branch information
GabrielNumworks committed Mar 15, 2024
1 parent 1fa303d commit 1e64c98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/inference/statistic/store/input_store_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,16 @@ void InputStoreController::viewWillAppear() {
}

m_dropdownCell.dropdown()->init();
m_dropdownCell.setMessage(m_statistic->significanceTestType() ==
SignificanceTestType::TwoMeans
? I18n::Message::DataSets
: I18n::Message::DataSet);
Table* tableModel = m_slopeTableCell.tableModel();
if (tableModel->numberOfSeries() == 2) {
m_dropdownCell.dropdown()->selectRow(DropdownDataSource::RowForSeriesPair(
tableModel->seriesAt(0), tableModel->seriesAt(1)));
m_dropdownCell.setMessage(I18n::Message::DataSets);
} else {
assert(tableModel->numberOfSeries() == 1);
m_dropdownCell.dropdown()->selectRow(tableModel->seriesAt(0));
m_dropdownCell.setMessage(I18n::Message::DataSet);
}
for (int row = 0; row < m_dropdownDataSource.numberOfRows(); row++) {
char buffer[] = "Ai/Bi,Aj/Bj";
buffer[0] = listPrefix(0);
Expand Down
3 changes: 3 additions & 0 deletions apps/inference/statistic/store/input_store_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class InputStoreController : public InputCategoricalController,
private:
class DropdownDataSource : public Escher::ExplicitListViewDataSource {
public:
static int RowForSeriesPair(int s1, int s2) {
return s1 == 1 ? 2 : s2 == 1 ? 0 : 1;
}
static int Series1ForRow(int row) { return row == 2 ? 1 : 0; }
static int Series2ForRow(int row) { return row == 0 ? 1 : 2; }

Expand Down

0 comments on commit 1e64c98

Please sign in to comment.