예제 #1
0
 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())
     self._item.pythonPath = str(self.txtPythonPath.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
     project['pythonPath'] = self._item.pythonPath
     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()
예제 #2
0
 def _delete_file(self):
     item = self.currentItem()
     val = QMessageBox.question(self, 'Delete File',
             'Do you want to delete the following file: '\
             + item.path, QMessageBox.Yes, QMessageBox.No)
     if val == QMessageBox.Yes:
         manage_files.delete_file(item.path, str(item.text(0)))
         self.removeItemWidget(item, 0)