Exemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
{
    std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
    CVF_ASSERT(selection.size() > 0);

    RiuMainWindow* mainWindow = RiuMainWindow::instance();
    mainWindow->showProcessMonitorDockPanel();

    RimCalcScript* calcScript = selection[0];

    RiaApplication* app = RiaApplication::instance();
    QString octavePath = app->octavePath();
    if (!octavePath.isEmpty())
    {
        // TODO: Must rename RimCalcScript::absolutePath to absoluteFileName, as the code below is confusing
        // absolutePath() is a function in QFileInfo
        QFileInfo fi(calcScript->absolutePath());
        QString octaveFunctionSearchPath = fi.absolutePath();

        QStringList arguments = app->octaveArguments();
        arguments.append("--path");
        arguments << octaveFunctionSearchPath;
        arguments << calcScript->absolutePath();

        RiaApplication::instance()->launchProcess(octavePath, arguments);
    }
}
Exemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicExecuteScriptFeature::onActionTriggered(bool isChecked)
{
    std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts();
    CVF_ASSERT(selection.size() > 0);

    RiuMainWindow* mainWindow = RiuMainWindow::instance();
    mainWindow->showProcessMonitorDockPanel();

    RimCalcScript* calcScript = selection[0];

    RiaApplication* app = RiaApplication::instance();
    QString octavePath = app->octavePath();
    if (!octavePath.isEmpty())
    {
        QStringList arguments = RimCalcScript::createCommandLineArguments(calcScript->absoluteFileName());

        RiaApplication::instance()->launchProcess(octavePath, arguments);
    }
}