Skip to content
Snippets Groups Projects
Commit a0435baa authored by AlQuemist's avatar AlQuemist
Browse files

SampleView: prevent GUI crash if the no Python script is selected or the script is empty

parent 2fed8d1a
No related branches found
No related tags found
1 merge request!2618Fix problems of PyCore
...@@ -143,8 +143,11 @@ void SampleView::setToolbarActions(QToolBar* toolbar) ...@@ -143,8 +143,11 @@ void SampleView::setToolbarActions(QToolBar* toolbar)
import_sample_action->setToolTip( import_sample_action->setToolTip(
"Import sample from a Python script that contains a function that returns a multi-layer"); "Import sample from a Python script that contains a function that returns a multi-layer");
toolbar->addAction(import_sample_action); toolbar->addAction(import_sample_action);
connect(import_sample_action, &QAction::triggered, connect(import_sample_action, &QAction::triggered, [this] {
[this] { m_set->add_item(IO::Py::importMultiLayer()); }); SampleItem* sample_item = IO::Py::importMultiLayer();
if (sample_item)
m_set->add_item(sample_item);
});
#endif #endif
auto* choose_from_library_action = new QAction("Examples", this); auto* choose_from_library_action = new QAction("Examples", this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment