Skip to content

Commit

Permalink
Fuel cell startup cleanup, menu select clear on results page, update
Browse files Browse the repository at this point in the history
menu navigation
  • Loading branch information
mjprilliman committed Aug 18, 2023
1 parent 8a9d81d commit 23c0fe5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
4 changes: 2 additions & 2 deletions deploy/runtime/startup.lk
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ function setup_fuel_cell_pages_btm()
function setup_fuel_cell_pages_hybrid()
{
addpage([['Fuel Cell']], {'sidebar'='Fuel Cell', 'help'='fuelcell_fuel_cell', 'bin_name'='FuelCell'});
addpage( [['Fuel Cell Dispatch'],[ 'Fuel Cell Dispatch Manual' ]],
{ 'sidebar'='Fuel Cell Dispatc', 'help'='fuelcell_dispatch', 'bin_name'='FuelCell'} );
addpage( [['Fuel Cell Dispatch', 'Fuel Cell Dispatch Manual' ]],
{ 'sidebar'='Fuel Cell Dispatch', 'help'='fuelcell_dispatch', 'bin_name'='FuelCell'} );
/* addpage( [[ {'name'='Battery Dispatch Automated FOM', 'caption'='Automated'} ],
[{'name'='Battery Dispatch PV Smoothing', 'caption'='PV Smoothing'}],
[ {'name'='Battery Dispatch Custom Time Series', 'caption'='Custom Time Series'} ],
Expand Down
57 changes: 52 additions & 5 deletions src/casewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ CaseWindow::CaseWindow( wxWindow *parent, Case *c )
else {
m_navigationMenu->AppendItem(wxDataViewItem(0), m_pageGroups[j]->SideBarLabel);
}
//Try to start with beginning bin expanded, first page selected

/*if (j > 0 && m_pageGroups[j-1]->BinName != "") bin_name_prev = m_pageGroups[j - 1]->BinName;
if (j == 0 && bin_name != "") {
dvia[page_list.Index(bin_name)] = m_pTech->AppendContainer(wxDataViewItem(0), bin_name.Capitalize());
Expand All @@ -398,6 +400,18 @@ CaseWindow::CaseWindow( wxWindow *parent, Case *c )
}*/

}
if (m_navigationMenu->IsContainer(dvia[0])) {
m_navigationMenu->Expand(dvia[0]);
wxDataViewItemArray dvic;
m_navigationMenu->GetModel()->GetChildren(dvia[0], dvic);
m_navigationMenu->SetCurrentItem(dvic[0]);
}
else if (m_navigationMenu->IsContainer(dvia[1])) {
m_navigationMenu->Expand(dvia[1]);
wxDataViewItemArray dvic;
m_navigationMenu->GetModel()->GetChildren(dvia[1], dvic);
m_navigationMenu->SetCurrentItem(dvic[0]);
}
/*for (int i = 0; i < m_pageGroups.size(); i++) {
bin_name = m_pageGroups[i]->BinName;
if (Ts_lower.Contains(bin_name.Lower()) && bin_name != "") {
Expand Down Expand Up @@ -474,7 +488,20 @@ void CaseWindow::SaveCurrentViewProperties()
bool CaseWindow::RunBaseCase( bool silent, wxString *messages )
{
Simulation &bcsim = m_case->BaseCase();
m_inputPageList->Select( -1 );
m_inputPageList->Select( -1 );
//m_navigationMenu->SetCurrentItem(wxDataViewItem(0));

wxDataViewItemArray dvia;
m_navigationMenu->UnselectAll();
/*
m_navigationMenu->GetModel()->GetChildren(wxDataViewItem(0), dvia);
wxDataViewItem dvi = dvia[0];
m_navigationMenu->GetModel()->GetChildren(dvi, dvia);
m_navigationMenu->SetCurrentItem(dvia[0]);
m_navigationMenu->Collapse(dvi);
*/
//m_navigationMenu->Expand(dvi);


int i_results_page = m_baseCaseResults->GetSelection();
m_baseCaseResults->SetSelection(0);
Expand Down Expand Up @@ -716,16 +743,34 @@ void CaseWindow::OnTechTree(wxDataViewEvent&)
if (m_navigationMenu->IsContainer(m_navigationMenu->GetCurrentItem()))
{

wxDataViewItemArray dvic;
m_navigationMenu->GetModel()->GetChildren(m_navigationMenu->GetCurrentItem(), dvic);
for (int i = 0; i < dvic.Count(); i++) {
if (dvic[1] == m_previousPage)
return;
}
m_navigationMenu->Expand(m_navigationMenu->GetCurrentItem());
wxDataViewItemArray dvia;
m_navigationMenu->SetCurrentItem(m_previousPage);
//wxDataViewItemArray dvia;

/*
m_navigationMenu->GetModel()->GetChildren(m_navigationMenu->GetCurrentItem(), dvia);
SwitchToInputPage(m_navigationMenu->GetItemText(dvia[0]));
if (m_navigationMenu->GetItemText(dvia[0]) != L"")
SwitchToInputPage(m_navigationMenu->GetItemText(dvia[0]));
*/

}
else {
SwitchToInputPage(m_navigationMenu->GetItemText(m_navigationMenu->GetCurrentItem()));
wxDataViewItemArray dvia;
wxDataViewItem parent = m_navigationMenu->GetModel()->GetParent(m_navigationMenu->GetCurrentItem());
m_navigationMenu->GetModel()->GetChildren(parent, dvia);
if (dvia.Count() > 0) {
SwitchToInputPage(m_navigationMenu->GetItemText(m_navigationMenu->GetCurrentItem()));
m_previousPage = m_navigationMenu->GetCurrentItem();
}

}

}

void CaseWindow::OnTreeActivated(wxDataViewEvent& evt)
Expand Down Expand Up @@ -1105,7 +1150,7 @@ bool CaseWindow::SwitchToInputPage( const wxString &name )
wxBusyCursor wait;
// m_inputPagePanel->Freeze();

DetachCurrentInputPage();
//DetachCurrentInputPage();

m_currentGroup = 0;
for( size_t i=0;i<m_pageGroups.size();i++ )
Expand All @@ -1114,6 +1159,8 @@ bool CaseWindow::SwitchToInputPage( const wxString &name )

if ( !m_currentGroup ) return false;

DetachCurrentInputPage();

for( size_t i=0;i<m_currentGroup->Pages.size();i++ )
for( size_t j=0;j<m_currentGroup->Pages[i].size();j++ )
if ( wxUIFormData *form = m_forms.Lookup( m_currentGroup->Pages[i][j].Name ) )
Expand Down
1 change: 1 addition & 0 deletions src/casewin.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener
wxStaticText* m_finLabel;
wxMetroButton *m_simButton, *m_resultsButton;
wxMetroDataViewTreeCtrl *m_navigationMenu;
wxDataViewItem m_previousPage;

// to allow switching case configurations with P50/P90 and PVUncertainty
wxGridSizer *m_szsims;
Expand Down

0 comments on commit 23c0fe5

Please sign in to comment.