From de401b13d956ec61a1d9a0c2001f5a26d4f9b8a5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 27 Feb 2016 12:29:51 +0100 Subject: [PATCH] In ScriptWidget, keep the name of the script between two calls. --- hurricane/src/viewer/CellViewer.cpp | 3 ++- hurricane/src/viewer/ScriptWidget.cpp | 14 +++++++++++--- hurricane/src/viewer/hurricane/viewer/CellViewer.h | 2 +- .../src/viewer/hurricane/viewer/ScriptWidget.h | 3 ++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index b1a83889..28403cac 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -112,6 +112,7 @@ namespace Hurricane { , _toolInterrupt (false) , _flags (0) , _updateState (ExternalEmit) + , _pyScriptName () { setObjectName( "viewer" ); menuBar()->setObjectName ( _getAbsWidgetPath("") ); @@ -893,7 +894,7 @@ namespace Hurricane { void CellViewer::runScriptWidget () - { ScriptWidget::runScript( this, getCell() ); } + { ScriptWidget::runScript( this, _pyScriptName, getCell() ); } string CellViewer::_getString () const diff --git a/hurricane/src/viewer/ScriptWidget.cpp b/hurricane/src/viewer/ScriptWidget.cpp index 1718c5f2..f916611a 100644 --- a/hurricane/src/viewer/ScriptWidget.cpp +++ b/hurricane/src/viewer/ScriptWidget.cpp @@ -91,11 +91,19 @@ namespace Hurricane { } - void ScriptWidget::runScript ( QWidget* parent, Cell* cell ) + void ScriptWidget::setScriptName ( QString scriptName ) + { + return _lineEdit->setText( scriptName ); + } + + + void ScriptWidget::runScript ( QWidget* parent, QString& scriptName, Cell* cell ) { ScriptWidget* dialog = new ScriptWidget ( parent ); - bool doRunScript = (dialog->exec() == Accepted); - QString scriptName = dialog->getScriptName (); + dialog->setScriptName( scriptName ); + + bool doRunScript = (dialog->exec() == Accepted); + scriptName = dialog->getScriptName (); delete dialog; if (not doRunScript) return; diff --git a/hurricane/src/viewer/hurricane/viewer/CellViewer.h b/hurricane/src/viewer/hurricane/viewer/CellViewer.h index 291d8966..ec067f3c 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/CellViewer.h @@ -193,7 +193,7 @@ namespace Hurricane { bool _toolInterrupt; unsigned int _flags; UpdateState _updateState; - + QString _pyScriptName; }; diff --git a/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h b/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h index 89d4ac74..86c974f8 100644 --- a/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/ScriptWidget.h @@ -30,8 +30,9 @@ namespace Hurricane { class ScriptWidget : public QDialog { Q_OBJECT; public: - static void runScript ( QWidget* parent, Cell* ); + static void runScript ( QWidget* parent, QString& scriptName, Cell* ); const QString getScriptName () const; + void setScriptName ( QString scriptName ); protected: ScriptWidget ( QWidget* parent=NULL ); protected: