/** * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved. * * This file is part of the QCAD project. * * QCAD is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * QCAD is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with QCAD. */ include("scripts/library.js"); include("scripts/File/File.js"); include("scripts/EAction.js") /** * \class NewFile * \brief Creates a new document. * \ingroup ecma_file */ function OpenProject(guiAction) { File.call(this, guiAction); } OpenProject.prototype = new File(); OpenProject.includeBasePath = includeBasePath; /** * \param isOpen True if new is called from a file open function. */ OpenProject.prototype.beginEvent = function() { var appWin = EAction.getMainWindow(); var fileDialog = new QFileDialog(appWin); fileDialog.fileMode = QFileDialog.Directory; if (!fileDialog.exec()) { destr(fileDialog); EAction.activateMainWindow(); return; } var selectDir = fileDialog.selectedFiles(); var projectPath = selectDir[0]; // 所选工程为xxx // EAction.handleUserMessage("select project is: " + projectPath); QMessageBox.information(appWin, qsTr("提示"), qsTr("选择的工程为:" + projectPath)); RSettings.setValue("OpenProject/Current", projectPath); RSettings.setValue("OpenDisplayFile/PMFile", ""); RSettings.setValue("OpenDisplayFile/ZDMFile", ""); // 拷贝参数配置文件 var srcFilePath = OpenProject.includeBasePath + "/para.ini"; var dstFilePath = projectPath + "/para.ini"; var paraFile = new QFile(dstFilePath); if(!paraFile.exists()){ QFile.copy(srcFilePath, dstFilePath); } var di1 = getAssignDocumentInterface(1); var document1 = getAssignDocument(1); var ids = document1.queryAllEntities(); var op = new RDeleteObjectsOperation(); for (i=0; i