In ScriptWidget, keep the name of the script between two calls.

This commit is contained in:
Jean-Paul Chaput 2016-02-27 12:29:51 +01:00
parent 0f1775a77c
commit de401b13d9
4 changed files with 16 additions and 6 deletions

View File

@ -112,6 +112,7 @@ namespace Hurricane {
, _toolInterrupt (false) , _toolInterrupt (false)
, _flags (0) , _flags (0)
, _updateState (ExternalEmit) , _updateState (ExternalEmit)
, _pyScriptName ()
{ {
setObjectName( "viewer" ); setObjectName( "viewer" );
menuBar()->setObjectName ( _getAbsWidgetPath("") ); menuBar()->setObjectName ( _getAbsWidgetPath("") );
@ -893,7 +894,7 @@ namespace Hurricane {
void CellViewer::runScriptWidget () void CellViewer::runScriptWidget ()
{ ScriptWidget::runScript( this, getCell() ); } { ScriptWidget::runScript( this, _pyScriptName, getCell() ); }
string CellViewer::_getString () const string CellViewer::_getString () const

View File

@ -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 ); ScriptWidget* dialog = new ScriptWidget ( parent );
bool doRunScript = (dialog->exec() == Accepted); dialog->setScriptName( scriptName );
QString scriptName = dialog->getScriptName ();
bool doRunScript = (dialog->exec() == Accepted);
scriptName = dialog->getScriptName ();
delete dialog; delete dialog;
if (not doRunScript) return; if (not doRunScript) return;

View File

@ -193,7 +193,7 @@ namespace Hurricane {
bool _toolInterrupt; bool _toolInterrupt;
unsigned int _flags; unsigned int _flags;
UpdateState _updateState; UpdateState _updateState;
QString _pyScriptName;
}; };

View File

@ -30,8 +30,9 @@ namespace Hurricane {
class ScriptWidget : public QDialog { class ScriptWidget : public QDialog {
Q_OBJECT; Q_OBJECT;
public: public:
static void runScript ( QWidget* parent, Cell* ); static void runScript ( QWidget* parent, QString& scriptName, Cell* );
const QString getScriptName () const; const QString getScriptName () const;
void setScriptName ( QString scriptName );
protected: protected:
ScriptWidget ( QWidget* parent=NULL ); ScriptWidget ( QWidget* parent=NULL );
protected: protected: