Skip to content

Commit f956c8c

Browse files
committed
GetMatrixSlice Play/Pause works!!!
Incroyable! #780
1 parent 3a4988e commit f956c8c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Dataflow/Network/Module.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ bool SCIRun::Dataflow::Networks::canReplaceWith(ModuleHandle module, const Modul
700700

701701
void Module::enqueueExecuteAgain()
702702
{
703-
std::cout << "Module " << get_id() << " needs to execute again, signalling now" << std::endl;
704703
executionSelfRequested_();
705704
}
706705

src/Interface/Application/ModuleWidget.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataf
507507
connect(this, SIGNAL(backgroundColorUpdated(const QString&)), this, SLOT(updateBackgroundColor(const QString&)));
508508
theModule_->connectExecutionStateChanged([this](int state) { QtConcurrent::run(boost::bind(&ModuleWidget::updateBackgroundColorForModuleState, this, state)); });
509509

510+
theModule_->connectExecuteSelfRequest([this]() { executeButtonPushed(); });
511+
510512
Core::Preferences::Instance().modulesAreDockable.connectValueChanged(boost::bind(&ModuleWidget::adjustDockState, this, _1));
511513

512514
//TODO: doh, how do i destroy myself?

src/Modules/Math/GetMatrixSlice.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void GetMatrixSlice::setStateDefaults()
5454
void GetMatrixSlice::execute()
5555
{
5656
auto input = getRequiredInput(InputMatrix);
57-
if (needToExecute())
57+
if (needToExecute() || playing_)
5858
{
5959
setAlgoBoolFromState(Parameters::IsSliceColumn);
6060
setAlgoIntFromState(Parameters::SliceIndex);
@@ -63,20 +63,17 @@ void GetMatrixSlice::execute()
6363
auto maxIndex = output.additionalAlgoOutput()->toInt();
6464
get_state()->setValue(Parameters::MaxIndex, maxIndex);
6565

66-
std::cout << "checking play mode" << std::endl;
6766
auto playMode = optional_any_cast_or_default<int>(get_state()->getTransientValue(Parameters::PlayMode));
6867
if (playMode == 1)
6968
{
70-
std::cout << "checking play mode: " << playMode << std::endl;
7169
auto nextIndex = algo().get(Parameters::SliceIndex).toInt() + 1;
72-
std::cout << "setting index to " << nextIndex % (maxIndex + 1) << std::endl;
7370
get_state()->setValue(Parameters::SliceIndex, nextIndex % (maxIndex + 1));
71+
playing_ = true;
7472
enqueueExecuteAgain();
75-
std::cout << "execute enqueued " << std::endl;
7673
}
7774
else if (playMode == 2)
7875
{
79-
std::cout << "execute paused" << std::endl;
76+
playing_ = false;
8077
}
8178
}
8279
}

src/Modules/Math/GetMatrixSlice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ namespace Math {
4848
OUTPUT_PORT(0, OutputMatrix, Matrix);
4949

5050
static const Dataflow::Networks::ModuleLookupInfo staticInfo_;
51+
private:
52+
bool playing_;
5153
};
5254
}}}
5355

0 commit comments

Comments
 (0)