Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addresses SAM issue 1455 #1498

Merged
merged 18 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions deploy/runtime/startup.lk
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ addconfig('PVWatts Wind FuelCell Battery Hybrid', ['Single Owner', 'Host Develop
addconfig('Photovoltaic Wind Battery Hybrid', ['Single Owner', 'Host Developer']);
addconfig('Generic PVWatts Wind FuelCell Battery Hybrid', ['Single Owner', 'Host Developer']);


// order tech and fin trees
configopt("TechnologyTreeOrder", {'description' = 'Hybrid,Wind,Generic System,Photovoltaic,Geothermal'});

// group names 'tree_parent' for performance models are defined in PopulateTech() in main.cpp
configopt( 'Flat Plate PV', { 'tree_parent'='Photovoltaic', 'long_name'='Detailed PV Model', 'short_name'='Photovoltaic', 'description'='Photovoltaic system using detailed photovoltaic model with separate module and inverter component models' } );
configopt( 'PVWatts', { 'tree_parent'='Photovoltaic','long_name'='PVWatts', 'short_name'='PVWatts', 'description'='Photovoltaic system using basic NREL PVWatts V8 algorithm. Does not do detailed degradation or loss modeling. If those are important, please use pvsamv1.' } );
Expand Down
61 changes: 48 additions & 13 deletions src/casewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ BEGIN_EVENT_TABLE( CaseWindow, wxSplitterWindow )
EVT_MENU(ID_PVUNCERTAINTY, CaseWindow::OnCommand)
EVT_MENU( ID_MACRO, CaseWindow::OnCommand )
EVT_LISTBOX( ID_INPUTPAGELIST, CaseWindow::OnCommand )
EVT_DATAVIEW_SELECTION_CHANGED(ID_TechTree, CaseWindow::OnTechTree)
EVT_DATAVIEW_ITEM_START_EDITING(ID_TechTree, CaseWindow::OnTreeActivated)
EVT_DATAVIEW_ITEM_ACTIVATED(ID_TechTree, CaseWindow::OnTreeActivated)
EVT_DATAVIEW_SELECTION_CHANGED(ID_TechTree, CaseWindow::OnTree)
EVT_DATAVIEW_ITEM_COLLAPSING(ID_TechTree, CaseWindow::OnTreeCollapsing)

// EVT_DATAVIEW_ITEM_START_EDITING(ID_TechTree, CaseWindow::OnTreeActivated)
// EVT_DATAVIEW_ITEM_ACTIVATED(ID_TechTree, CaseWindow::OnTreeActivated)
//EVT_LISTBOX( ID_TechTree, CaseWindow::OnCommand)
EVT_BUTTON( ID_EXCL_BUTTON, CaseWindow::OnCommand )
EVT_LISTBOX( ID_EXCL_RADIO, CaseWindow::OnCommand)
Expand Down Expand Up @@ -626,8 +628,37 @@ bool CaseWindow::GenerateReport( wxString pdffile, wxString templfile, VarValue
return false;
}

void CaseWindow::OnTechTree(wxDataViewEvent&)
void CaseWindow::OnTree(wxDataViewEvent &evt)
{
m_pageFlipper->SetSelection(0);
wxDataViewItem dvi = evt.GetItem();
if (!dvi.IsOk())
return;

if (m_navigationMenu->IsContainer(dvi))
{
if (m_navigationMenu->IsExpanded(dvi))
m_navigationMenu->Collapse(dvi);
else
m_navigationMenu->Expand(dvi);
if (m_currentSelection.IsOk()) {// keep current selection
m_navigationMenu->SetCurrentItem(m_currentSelection);
return;
}
else {// select first child
m_currentSelection = m_navigationMenu->GetNthChild(dvi, 0);
m_navigationMenu->SetCurrentItem(m_currentSelection);
}
}
else {
m_currentSelection = evt.GetItem();
}
wxString title = m_navigationMenu->GetItemText(m_currentSelection);
SwitchToInputPage(title);



/*
m_pageFlipper->SetSelection(0);
if (m_navigationMenu->IsContainer(m_navigationMenu->GetCurrentItem()))
{
Expand Down Expand Up @@ -674,11 +705,6 @@ void CaseWindow::OnTechTree(wxDataViewEvent&)
//m_navigationMenu->Update();
//wxDataViewItemArray dvia;

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

}
else {
Expand All @@ -693,12 +719,21 @@ void CaseWindow::OnTechTree(wxDataViewEvent&)

}
//m_navigationMenu->Update();

*/
}

void CaseWindow::OnTreeActivated(wxDataViewEvent& evt)
void CaseWindow::OnTreeCollapsing(wxDataViewEvent& evt)
{
evt.Veto();
wxDataViewItem dvi = evt.GetItem();
if (dvi.IsOk() && m_navigationMenu->IsContainer(dvi)) {
auto selectedDVI = m_navigationMenu->GetCurrentItem();
if (selectedDVI.IsOk()) {
for (size_t i = 0; i < m_navigationMenu->GetChildCount(dvi); i++) {
if (selectedDVI == m_navigationMenu->GetNthChild(dvi, i))
evt.Veto();
}
}
}
}

void CaseWindow::OnCommand( wxCommandEvent &evt )
Expand Down Expand Up @@ -1481,7 +1516,7 @@ void CaseWindow::UpdateConfiguration()
m_navigationMenu->SetCurrentItem(dvic[0]);
SwitchToInputPage(m_navigationMenu->GetItemText(m_navigationMenu->GetCurrentItem()));
}
m_previousPage = (m_navigationMenu->GetCurrentItem());
m_currentSelection = (m_navigationMenu->GetCurrentItem());

// check for orphaned notes and if any found add to first page per Github issue 796
CheckAndUpdateNotes(inputPageHelpContext);
Expand Down
6 changes: 3 additions & 3 deletions src/casewin.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener
wxStaticText* m_finLabel;
wxMetroButton *m_simButton, *m_resultsButton;
wxMetroDataViewTreeCtrl *m_navigationMenu;
wxDataViewItem m_previousPage;
wxDataViewItem m_currentSelection;

// to allow switching case configurations with P50/P90 and PVUncertainty
wxGridSizer *m_szsims;
Expand All @@ -169,8 +169,8 @@ class CaseWindow : public wxSplitterWindow, CaseEventListener
wxString m_lastPageNoteId;

void OnCommand( wxCommandEvent & );
void OnTechTree(wxDataViewEvent&);
void OnTreeActivated(wxDataViewEvent &evt );
void OnTree(wxDataViewEvent&);
void OnTreeCollapsing(wxDataViewEvent &evt );
virtual void OnCaseEvent( Case *, CaseEvent & );
void OnSubNotebookPageChanged( wxNotebookEvent &evt );

Expand Down
Loading
Loading