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)
, _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

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 );
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;

View File

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

View File

@ -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: