void OSDocument::showRunManagerPreferences() { openstudio::runmanager::ConfigOptions co(true); openstudio::runmanager::RunManager rm; rm.setConfigOptions(co); rm.showConfigGui(); rm.getConfigOptions().saveQSettings(); emit toolsUpdated(); }
void OSDocument::scanForTools() { openstudio::runmanager::RunManager rm; openstudio::runmanager::ConfigOptions co = rm.getConfigOptions(); co.findTools(true, false, true, true); rm.setConfigOptions(co); rm.showConfigGui(); rm.getConfigOptions().saveQSettings(); emit toolsUpdated(); }
void ApplyMeasureNowDialog::runMeasure() { runmanager::ConfigOptions co(true); if (co.getTools().getAllByName("ruby").tools().size() == 0) { QMessageBox::information(this, "Missing Ruby", "Ruby could not be located.\nOpenStudio will scan for tools.", QMessageBox::Ok); co.findTools(true); openstudio::runmanager::RunManager rm; rm.setConfigOptions(co); rm.showConfigGui(); rm.getConfigOptions().saveQSettings(); emit toolsUpdated(); if (co.getTools().getAllByName("ruby").tools().size() == 0) { QMessageBox::information(this, "Missing Ruby", "Ruby was not located by tool search.\nPlease ensure Ruby correctly installed.\nSimulation aborted.", QMessageBox::Ok); m_mainPaneStackedWidget->setCurrentIndex(m_inputPageIdx); m_timer->stop(); this->okButton()->hide(); this->backButton()->hide(); return; } } m_mainPaneStackedWidget->setCurrentIndex(m_runningPageIdx); m_timer->start(50); this->okButton()->hide(); this->backButton()->hide(); OS_ASSERT(m_model); openstudio::OSAppBase * app = OSAppBase::instance(); m_workingDir = openstudio::toPath(app->currentDocument()->modelTempDir()) / openstudio::toPath("ApplyMeasureNow"); openstudio::path modelPath = m_workingDir / openstudio::toPath("modelClone.osm"); openstudio::path epwPath; // DLM: todo look at how this is done in the run tab removeWorkingDir(); // save cloned model to temp directory m_model->save(modelPath,true); // remove? this is shown only in debug (EW) QString path("Measure Output Location: "); path.append(toQString(m_workingDir)); m_jobPath->setText(path); analysis::RubyMeasure rubyMeasure = m_currentMeasureItem->measure(); // DLM: should be able to assert this bool hasIncompleteArguments = m_currentMeasureItem->hasIncompleteArguments(); OS_ASSERT(!hasIncompleteArguments); runmanager::RubyJobBuilder rjb(*m_bclMeasure, rubyMeasure.arguments()); openstudio::path p = getOpenStudioRubyIncludePath(); QString arg = "-I"; arg.append(toQString(p)); rjb.addToolArgument(arg.toStdString()); openstudio::runmanager::Workflow wf; rjb.addToWorkflow(wf); wf.add(co.getTools()); wf.setInputFiles(modelPath, openstudio::path()); m_job = wf.create(m_workingDir, modelPath); // DLM: you could make rm a class member then you would not have to call waitForFinished here runmanager::RunManager rm; bool queued = rm.enqueue(*m_job, true); OS_ASSERT(queued); std::vector<runmanager::Job> jobs = rm.getJobs(); OS_ASSERT(jobs.size() == 1); rm.waitForFinished (); QTimer::singleShot(0, this, SLOT(displayResults())); }