Skip to content

Commit

Permalink
add algorithmFailed signal/slot
Browse files Browse the repository at this point in the history
  • Loading branch information
MialLewis committed Oct 10, 2023
1 parent 6ed7167 commit 266b9d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, canvas, toolbar_manager, parent=None):
self.fit_enabled_notifier = GenericObservable()
self.fit_started_notifier = GenericObservable()
self.algorithmStarted.connect(self.fitting_started_slot)
self.algorithmFailed.connect(self.fitting_failed_slot)

def set_output_window_names(self):
"""
Expand Down Expand Up @@ -158,6 +159,13 @@ def fitting_done_slot(self, name):
self.save_current_setup(self.workspaceName())
self.fit_notifier.notify_subscribers([self.get_fitprop()])

@Slot()
def fitting_failed_slot(self):
"""
This is called after Fit fails due to an acception thrown.
"""
self.fit_notifier.notify_subscribers([])

@Slot()
def function_changed_slot(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public slots:
void currentChanged() const;
void functionRemoved();
void algorithmFinished(const QString & /*_t1*/);
void algorithmFailed();
void algorithmStarted(const QString & /*_t1*/);
void workspaceIndexChanged(int index);
void updatePlotSpectrum(int index);
Expand Down
2 changes: 1 addition & 1 deletion qt/widgets/common/src/FitPropertyBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ void FitPropertyBrowser::doFit(int maxIterations) {
QCoreApplication::processEvents();
}
if (!result.error().empty()) {
emit algorithmFinished(QString());
emit algorithmFailed();
}
} catch (const std::exception &e) {
QString msg = "Fit algorithm failed.\n\n" + QString(e.what()) + "\n";
Expand Down

0 comments on commit 266b9d7

Please sign in to comment.