- use File open dialog for project
- redraw current Training pattern and weights on project load git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@662 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+20
-12
@@ -528,17 +528,23 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
||||
else if (buttonThatWasClicked == loadButton)
|
||||
{
|
||||
//[UserButtonCode_loadButton] -- add your button handler code here..
|
||||
m_stack = new Stack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
|
||||
m_stack->load(this);
|
||||
m_stack->loadWeights();
|
||||
m_rbmSelect->clear(dontSendNotification);
|
||||
|
||||
for (int id=0; id < m_stack->numLayers(); id++)
|
||||
ScopedPointer<FileChooser>fc = new FileChooser("Open project", m_file.getParentDirectory().getFullPathName(), "*.prj");
|
||||
if (fc->browseForFileToOpen())
|
||||
{
|
||||
m_rbmSelect->addItem(String(id), id+1);
|
||||
}
|
||||
m_rbmSelect->setSelectedId(1, sendNotification);
|
||||
loadTraining();
|
||||
m_file = fc->getResult();
|
||||
projectNameLabel->setText(m_file.getFileNameWithoutExtension(), NotificationType::dontSendNotification);
|
||||
m_stack = new Stack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
|
||||
m_stack->load(this);
|
||||
m_stack->loadWeights();
|
||||
m_rbmSelect->clear(dontSendNotification);
|
||||
|
||||
for (int id=0; id < m_stack->numLayers(); id++)
|
||||
{
|
||||
m_rbmSelect->addItem(String(id), id+1);
|
||||
}
|
||||
m_rbmSelect->setSelectedId(1, sendNotification);
|
||||
loadTraining();
|
||||
}
|
||||
//[/UserButtonCode_loadButton]
|
||||
}
|
||||
else if (buttonThatWasClicked == saveButton)
|
||||
@@ -634,8 +640,8 @@ void MainComponent::sliderValueChanged (Slider* sliderThatWasMoved)
|
||||
else if (sliderThatWasMoved == WeightsSlider)
|
||||
{
|
||||
//[UserSliderCode_WeightsSlider] -- add your slider handling code here..
|
||||
int weightIndex = (int)sliderThatWasMoved->getValue();
|
||||
m_pLayer->redrawWeights(weightIndex);
|
||||
m_weightIndex = (int)sliderThatWasMoved->getValue();
|
||||
m_pLayer->redrawWeights(m_weightIndex);
|
||||
//[/UserSliderCode_WeightsSlider]
|
||||
}
|
||||
else if (sliderThatWasMoved == numGibbsSlider)
|
||||
@@ -755,6 +761,8 @@ void MainComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
|
||||
int index = m_rbmSelect->getSelectedItemIndex();
|
||||
m_pLayer = static_cast<RbmComponent*>(m_stack->getLayer(index));
|
||||
updateControls();
|
||||
m_pLayer->redrawWeights(m_weightIndex);
|
||||
m_pLayer->setTrainingData(m_stack->trainingData().row(m_trainingIndex));
|
||||
//[/UserComboBoxCode_m_rbmSelect]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user