Example #1
0
ScriptItem::ScriptItem(const openstudio::path& path,
                       OSItemType type,
                       QWidget * parent)
  : OSItem(scriptToItemId(path), type, parent),
    m_removed(false),
    m_scriptInfo(path, true, false)
{
  setText(openstudio::toQString(path.filename()));
  setLeftPixmap(QPixmap(":/images/icon_scripts.png"));
  if (boost::regex_search(toString(itemId().sourceId()),boost::regex("resource"))) {
    m_scriptInfo.isUserScript = false;
  }
  else {
    try {
      m_scriptInfo = runmanager::RubyJobBuilder::updateArgumentsFromDb(m_scriptInfo);
    } catch (const runmanager::ScriptDetectionError &e) {
      // Nothing to display here in the constructor
      m_scriptInfo = e.scriptInfo;
    }
  }


  std::shared_ptr<OSDocument> osDoc = OSAppBase::instance()->currentDocument();
  connect(this, &ScriptItem::argChanged, osDoc.get(), &OSDocument::markAsModified);
}
void ScriptFolderListView::addScriptToFolder(const openstudio::path &t_path, const openstudio::path& folder_name)
{
  openstudio::path folder = m_rootPath / folder_name;
  boost::filesystem::create_directories(folder);
  openstudio::path filename = folder / t_path.filename();
  filename = iterateFileName(filename);
  boost::filesystem::copy_file(t_path, filename, boost::filesystem::copy_option::overwrite_if_exists);
  

  ScriptsListView *lv = m_scriptsListViews[folder];
  if (lv)
  {
    lv->updateData();
  }
}
Example #3
0
FileReference::FileReference(const openstudio::path& p)
  : m_uuid(createUUID()),
    m_versionUUID(createUUID()),
    m_name(toString(p)),
    m_displayName(toString(p.filename())),
    m_path(completeAndNormalize(p)),
    m_timestampLast(),
    m_checksumCreate(checksum(m_path)),
    m_checksumLast(m_checksumCreate)
{
  try {
    m_fileType = FileReferenceType(getFileExtension(p));
  }
  catch (...) {
    m_fileType = FileReferenceType::Unknown;
  }
  update(openstudio::path());
}