Skip to content

Commit cc0b8cc

Browse files
committed
Basic disabling works
1 parent e6472d5 commit cc0b8cc

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

src/Dataflow/Network/Module.cc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ bool Module::doExecute() NOEXCEPT
264264

265265
try
266266
{
267-
execute();
267+
if (!isDisabled())
268+
execute();
268269
returnCode = true;
269270
}
270271
catch (const std::bad_alloc&)
@@ -280,14 +281,14 @@ bool Module::doExecute() NOEXCEPT
280281
catch (Core::ExceptionBase& e)
281282
{
282283
/// @todo: this block is repetitive (logging-wise) if the macros are used to log AND throw an exception with the same message. Figure out a reasonable condition to enable it.
283-
if (Core::Logging::Log::get().verbose())
284+
if (Log::get().verbose())
284285
{
285286
std::ostringstream ostr;
286287
ostr << "Caught exception: " << e.typeName() << std::endl << "Message: " << e.what() << std::endl;
287288
error(ostr.str());
288289
}
289290

290-
if (Core::Logging::Log::get().verbose())
291+
if (Log::get().verbose())
291292
{
292293
std::ostringstream ostrExtra;
293294
ostrExtra << boost::diagnostic_information(e) << std::endl;
@@ -323,8 +324,13 @@ bool Module::doExecute() NOEXCEPT
323324
//auto endState = returnCode ? ModuleExecutionState::Completed : ModuleExecutionState::Errored;
324325
auto endState = ModuleExecutionState::Completed;
325326
executionState_->transitionTo(endState);
326-
resetStateChanged();
327-
inputsChanged_ = false;
327+
328+
if (!isDisabled())
329+
{
330+
resetStateChanged();
331+
inputsChanged_ = false;
332+
}
333+
328334
executeEnds_(executionTime, id_);
329335
return returnCode;
330336
}

src/Interface/Application/Connection.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,13 @@ namespace SCIRun
188188
class ConnectionMenu : public QMenu
189189
{
190190
public:
191-
ConnectionMenu(QWidget* parent = 0) : QMenu(parent)
191+
explicit ConnectionMenu(QWidget* parent = nullptr) : QMenu(parent)
192192
{
193193
deleteAction_ = addAction(deleteAction);
194194
addWidgetToExecutionDisableList(deleteAction_);
195195
addAction(insertModuleAction)->setDisabled(true);
196196
disableAction_ = addAction(disableEnableAction);
197+
addWidgetToExecutionDisableList(disableAction_);
197198
notesAction_ = addAction(editNotesAction);
198199
}
199200
~ConnectionMenu()

src/Interface/Application/MainWindowCollaborators.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace Gui {
9999
CORE_SINGLETON( WidgetDisablingService );
100100

101101
private:
102-
WidgetDisablingService() : ne_(0), serviceEnabled_(true) {}
102+
WidgetDisablingService() {}
103103
public Q_SLOTS:
104104
void disableInputWidgets();
105105
void enableInputWidgets();
@@ -116,9 +116,9 @@ namespace Gui {
116116
std::copy(begin, end, std::back_inserter(inputWidgets_));
117117
}
118118
private:
119-
NetworkEditor* ne_;
119+
NetworkEditor* ne_ {nullptr};
120120
std::vector<InputWidget> inputWidgets_;
121-
bool serviceEnabled_;
121+
bool serviceEnabled_ {true};
122122
};
123123

124124
inline void addWidgetToExecutionDisableList(const InputWidget& w)

src/Interface/Application/ModuleWidget.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,8 @@ void ModuleWidget::incomingConnectionStateChanged(bool disabled)
15001500

15011501
Q_EMIT moduleDisabled(disabled_);
15021502

1503+
theModule_->setDisabled(disabled_);
1504+
15031505
for (const auto& output : ports().outputs())
15041506
{
15051507
output->setConnectionsDisabled(disabled_ || disabled);

0 commit comments

Comments
 (0)