def save_properties(self): if str(self.name.text()).strip() == '': QMessageBox.critical(self, 'Properties Invalid', 'The Project must have a name.') return tempName = self._item.name self._item.name = str(self.name.text()) self._item.description = str(self.description.toPlainText()) self._item.license = str(self.cboLicense.currentText()) self._item.mainFile = str(self.path.text()) self._item.url = str(self.url.text()) self._item.projectType = str(self.txtType.text()) extensions = str(self.txtExtensions.text()).split(', ') self._item.extensions = tuple(extensions) #save project properties project = {} project['name'] = self._item.name project['description'] = self._item.description project['url'] = self._item.url project['license'] = self._item.license project['mainFile'] = self._item.mainFile project['project-type'] = self._item.projectType project['supported-extensions'] = self._item.extensions if tempName != self._item.name and \ manage_files.file_exists(self._item.path, tempName + '.nja'): manage_files.delete_file(self._item.path, tempName + '.nja') loader.create_ninja_project(self._item.path, self._item.name, project) self._item.setText(0, self._item.name) self._item.setToolTip(0, self._item.name) if self._item.extensions != manage_files.supported_extensions: self._item._parent._refresh_project(self._item) self.close()
def onWizardFinish(self, wizard): ids = wizard.pageIds() page = wizard.page(ids[1]) place = str(page.txtPlace.text()) if place == '': QMessageBox.critical(self, 'Incorrect Location', 'The project couldn\'t be create') return folder = str(page.txtFolder.text()) path = resources.createpath(place, folder) if not manage_files.folder_exists(path): manage_files.create_folder(path) project = {} name = str(page.txtName.text()) project['name'] = name project['description'] = str(page.txtDescription.toPlainText()) project['license'] = str(page.cboLicense.currentText()) loader.create_ninja_project(path, name, project) self.load_project(path)