def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file), create the main __init__.py and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) name = page.txtName.text() path = os.path.join(page.txtPlace.text(), name) if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return if not os.path.exists(path): os.makedirs(path) project = {} project['name'] = name project['description'] = page.txtDescription.toPlainText() project['license'] = page.cboLicense.currentText() project['venv'] = page.vtxtPlace.text() json_manager.create_ninja_project(path, name, project) try: file_manager.create_init_file(path) except: logger.debug("The __init__ file already exists - Import Sources.") wizard._load_project(path)
def save_properties(self): if self.projectData.name.text().strip() == '': QMessageBox.critical(self, self.tr("Properties Invalid"), self.tr("The Project must have a name.")) return tempName = self._item.name self._item.name = self.projectData.name.text() self._item.description = self.projectData.description.toPlainText() self._item.license = self.projectData.cboLicense.currentText() self._item.mainFile = self.projectExecution.path.text() self._item.url = self.projectData.url.text() self._item.projectType = self.projectData.txtType.text() # FIXME self._item.pythonPath = self.projectExecution.txtPythonPath.text() self._item.PYTHONPATH = self.projectExecution.PYTHONPATH.toPlainText() self._item.additional_builtins = filter( lambda e: e, # remove empty names self.projectExecution.additional_builtins.text().split(' ')) self._item.preExecScript = self.projectExecution.txtPreExec.text() self._item.postExecScript = self.projectExecution.txtPostExec.text() self._item.programParams = self.projectExecution.txtParams.text() self._item.venv = self.projectExecution.txtVenvPath.text() extensions = self.projectData.txtExtensions.text().split(', ') self._item.extensions = tuple(extensions) self._item.indentation = self.projectData.spinIndentation.value() self._item.useTabs = self.projectData.checkUseTabs.isChecked() related = self.projectMetadata.txt_projects.toPlainText() related = [path for path in related.split('\n') if path != ''] self._item.related_projects = related #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['indentation'] = self._item.indentation project['use-tabs'] = self._item.useTabs project['pythonPath'] = self._item.pythonPath # FIXME project['PYTHONPATH'] = self._item.PYTHONPATH project['additional_builtins'] = self._item.additional_builtins project['preExecScript'] = self._item.preExecScript project['postExecScript'] = self._item.postExecScript project['venv'] = self._item.venv project['programParams'] = self._item.programParams project['relatedProjects'] = self._item.related_projects if tempName != self._item.name and \ file_manager.file_exists(self._item.path, tempName + '.nja'): file_manager.delete_file(self._item.path, tempName + '.nja') json_manager.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 != settings.SUPPORTED_EXTENSIONS: self._item._parent._refresh_project(self._item) self._item.update_paths() self.close()
def on_wizard_finish(self, wizard): global PROJECT_TYPE ids = wizard.pageIds() # Manipulate default data for NINJA-IDE projects page = wizard.page(ids[2]) path = unicode(page.txtPlace.text()) if not path: QtGui.QMessageBox.critical( self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['project-type'] = PROJECT_TYPE project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) # Manipulate plugin project data page = wizard.page(ids[1]) # Create a folder to contain all the project data (<path>/<name>/) path = os.path.join(path, name) file_manager.create_folder(path, add_init_file=False) # Create the .nja file json_manager.create_ninja_project(path, name, project) plugin_dict = self.create_descriptor(page, path) self.create_plugin_class(page, path, plugin_dict) # Load the project! wizard._load_project(path)
def on_wizard_finish(self, wizard): """ Called when the user finish the wizard @wizard: QWizard instance """ global PROJECT_TYPE ids = wizard.pageIds() page = wizard.page(ids[1]) path = unicode(page.txtPlace.text()) if not path: QMessageBox.critical(wizard, wizard.tr("Incorrect Location"), wizard.tr("The project couldn\'t be create")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) project["project-type"] = PROJECT_TYPE project["supported-extensions"] = SUPPORTED_EXTENSIONS path = os.path.join(path, name) tx_path = os.path.join(path, 'metamodel.tx') try: # Create initial folder structure file_manager.create_folder(path, add_init_file=True) json_manager.create_ninja_project(path, name, project) self.create_tx_init_file(tx_path) except file_manager.NinjaIOException as e: QMessageBox.critical(wizard, wizard.tr("Error"), str(e)) return False wizard._load_project(path)
def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file), create the main __init__.py and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) name = page.txtName.text() path = os.path.join(page.txtPlace.text(), name) if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return if not os.path.exists(path): os.makedirs(path) project = {} project['name'] = name project['description'] = page.txtDescription.toPlainText() project['license'] = page.cboLicense.currentText() project['venv'] = page.vtxtPlace.text() json_manager.create_ninja_project(path, name, project) try: file_manager.create_init_file(path) except: logger.debug("The __init__ file already exists - Import Sources.") wizard._load_project(path)
def on_wizard_finish(self, wizard): global PROJECT_TYPE ids = wizard.pageIds() # Manipulate default data for NINJA-IDE projects page = wizard.page(ids[2]) path = unicode(page.txtPlace.text()) if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['project-type'] = PROJECT_TYPE project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) # Manipulate plugin project data page = wizard.page(ids[1]) # Create a folder to contain all the project data (<path>/<name>/) path = os.path.join(path, name) file_manager.create_folder(path, add_init_file=False) # Create the .nja file json_manager.create_ninja_project(path, name, project) plugin_dict = self.create_descriptor(page, path) self.create_plugin_class(page, path, plugin_dict) # Load the project! wizard._load_project(path)
def create_layout(self): """ Create set of folders and files required for a basic python project """ # Create project path project_path = os.path.join(self.path, self.name) self._create_path(project_path) # Create a single init file filepath = os.path.join(project_path, "__init__.py") with open(filepath, "w") as base_init: self.init_file(base_init, filepath) # Create a setup.py filepath = os.path.join(project_path, "setup.py") with open(filepath, "w") as base_setup: self.init_file(base_setup, filepath) base_setup.write(SETUP_PY_FILE % self.name) # Create a basic main file filepath = os.path.join(project_path, "main.py") with open(filepath, "w") as base_main: self.init_file(base_main, filepath) base_main.write(BASIC_HELLO % self.name) from ninja_ide.tools import json_manager project = {} project["name"] = self.name project["license"] = self.license_text json_manager.create_ninja_project(project_path, self.name, project)
def create_layout(self, wizard): base_class = wizard.field("base_class") class_name = wizard.field("class_name").title() module = base_class.lower()[1:] # Create project path project_path = os.path.join(self.path, self.name) self._create_path(project_path) # Create main file filepath = os.path.join(project_path, "main.py") with open(filepath, "w") as base_main: self.init_file(base_main, filepath) base_main.write(MAIN.format(module=module, classname=class_name)) # Create widget file filepath = os.path.join(project_path, module + ".py") with open(filepath, "w") as widget_file: self.init_file(widget_file, filepath) widget_file.write( WIDGET.format(baseclass=base_class, classname=class_name)) # Create ninja project file project = {} project["name"] = self.name project["project-type"] = self.category project["mainFile"] = "main.py" json_manager.create_ninja_project(project_path, self.name, project) self._open_project(project_path)
def ChangeOcrDataFolder(self, fileName): #the code goes here! #print fileName dataPath = "" f = open(fileName) for line in f: #print line if "Ocr.Data =" in line or "Ocr.Data=" in line: try: if line.index('#') < line.index('Ocr.Data'): continue except: pass dataPath = line.split('=')[1] dataPath = dataPath.strip() #print dataPath f.close() if dataPath != "": try: jsfile = json_manager.read_json(fileName.replace( ".py", ".nja")) jsfile['ocrdatafolder'] = dataPath.replace("\\\\", "\\") jsfile['ocrdatafolder'] = jsfile['ocrdatafolder'].replace( "\"", "") #print jsfile fileNameWithExtension = os.path.split(fileName)[1] fileNameWithOutExtension = os.path.splitext( fileNameWithExtension)[0] json_manager.create_ninja_project( os.path.split(fileName)[0], fileNameWithOutExtension, jsfile) except: pass
def save_properties(self): if self.projectData.name.text().strip() == '': QMessageBox.critical(self, self.tr("Properties Invalid"), self.tr("The Project must have a name.")) return tempName = self._item.name self._item.name = self.projectData.name.text() self._item.description = self.projectData.description.toPlainText() self._item.license = self.projectData.cboLicense.currentText() self._item.mainFile = self.projectExecution.path.text() self._item.url = self.projectData.url.text() self._item.projectType = self.projectData.txtType.text() # FIXME self._item.pythonPath = self.projectExecution.txtPythonPath.text() self._item.PYTHONPATH = self.projectExecution.PYTHONPATH.toPlainText() self._item.additional_builtins = filter( lambda e: e, # remove empty names self.projectExecution.additional_builtins.text().split(' ')) self._item.preExecScript = self.projectExecution.txtPreExec.text() self._item.postExecScript = self.projectExecution.txtPostExec.text() self._item.programParams = self.projectExecution.txtParams.text() self._item.venv = self.projectExecution.txtVenvPath.text() extensions = self.projectData.txtExtensions.text().split(', ') self._item.extensions = tuple(extensions) self._item.indentation = self.projectData.spinIndentation.value() self._item.useTabs = self.projectData.checkUseTabs.isChecked() related = self.projectMetadata.txt_projects.toPlainText() related = [path for path in related.split('\n') if path != ''] self._item.related_projects = related #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['indentation'] = self._item.indentation project['use-tabs'] = self._item.useTabs project['pythonPath'] = self._item.pythonPath # FIXME project['PYTHONPATH'] = self._item.PYTHONPATH project['additional_builtins'] = self._item.additional_builtins project['preExecScript'] = self._item.preExecScript project['postExecScript'] = self._item.postExecScript project['venv'] = self._item.venv project['programParams'] = self._item.programParams project['relatedProjects'] = self._item.related_projects if tempName != self._item.name and \ file_manager.file_exists(self._item.path, tempName + '.nja'): file_manager.delete_file(self._item.path, tempName + '.nja') json_manager.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 != settings.SUPPORTED_EXTENSIONS: self._item._parent._refresh_project(self._item) self._item.update_paths() self.close()
def create_layout(self, wizard): """ Create set of folders and files required for a basic python project """ # Create project path project_path = os.path.join(self.path, self.name) self._create_path(project_path) # Create a single init file filepath = os.path.join(project_path, "__init__.py") with open(filepath, "w") as base_init: self.init_file(base_init, filepath) # Create a setup.py filepath = os.path.join(project_path, "setup.py") with open(filepath, "w") as base_setup: self.init_file(base_setup, filepath) base_setup.write(SETUP_PY_FILE % self.name) # Create a basic main file filepath = os.path.join(project_path, "main.py") with open(filepath, "w") as base_main: self.init_file(base_main, filepath) base_main.write(BASIC_HELLO % self.name) # Create .nja file project = {} project["name"] = self.name project["project-type"] = self.category project["mainFile"] = "main.py" project["description"] = wizard.field("description") json_manager.create_ninja_project(project_path, self.name, project) # Open project in Explorer self._open_project(project_path)
def ChangeOcrDataFolder(self, fileName): #the code goes here! #print fileName dataPath = "" f = open(fileName) for line in f: #print line if "Ocr.Data =" in line or "Ocr.Data=" in line: try: if line.index('#') < line.index('Ocr.Data'): continue except: pass dataPath = line.split('=')[1] dataPath = dataPath.strip() #print dataPath f.close() if dataPath != "": try: jsfile = json_manager.read_json(fileName.replace(".py", ".nja")) jsfile['ocrdatafolder'] = dataPath.replace("\\\\", "\\") jsfile['ocrdatafolder'] = jsfile['ocrdatafolder'].replace("\"", "") #print jsfile fileNameWithExtension = os.path.split(fileName)[1] fileNameWithOutExtension = os.path.splitext(fileNameWithExtension)[0] json_manager.create_ninja_project(os.path.split(fileName)[0], fileNameWithOutExtension, jsfile) except: pass
def on_wizard_finish(self, wizard): global PROJECT_TYPE ids = wizard.pageIds() # Manipulate default data for NINJA-IDE projects page = wizard.page(ids[2]) 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 = file_manager.create_path(place, folder) if not file_manager.folder_exists(path): file_manager.create_folder(path) project = {} name = unicode(page.txtName.text()) project['name'] = name project['project-type'] = PROJECT_TYPE project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) # Manipulate plugin project data page = wizard.page(ids[1]) json_manager.create_ninja_project(path, name, project) plugin_dict = self.create_descriptor(page, path) self.create_plugin_class(page, path, plugin_dict) # Load the project! wizard._load_project(path)
def create_layout(self, wizard): """ Create set of folders and files required for a basic python project """ # Create project path project_path = os.path.join(self.path, self.name) self._create_path(project_path) # Create a single init file filepath = os.path.join(project_path, "__init__.py") with open(filepath, "w") as base_init: self.init_file(base_init, filepath) # Create a setup.py filepath = os.path.join(project_path, "setup.py") with open(filepath, "w") as base_setup: self.init_file(base_setup, filepath) base_setup.write(SETUP_PY_FILE % self.name) # Create a basic main file filepath = os.path.join(project_path, "main.py") with open(filepath, "w") as base_main: self.init_file(base_main, filepath) base_main.write(BASIC_HELLO % self.name) # Create .nja file project = {} project["name"] = self.name project["project-type"] = self.category project["mainFile"] = "main.py" project["description"] = wizard.filed("description") json_manager.create_ninja_project(project_path, self.name, project) # Open project in Explorer self._open_project(project_path)
def change_log_folder(self): folder = self.explorer_s.get_tree_projects()._get_project_root().path plugin = json_manager.read_ninja_project(folder) self.logFolder = QFileDialog.getExistingDirectory( self, self.tr("Select Log Folder"), plugin["logfolder"]) if self.logFolder != "": plugin["logfolder"] = self.logFolder json_manager.create_ninja_project(folder, plugin["name"], plugin)
def change_log_folder(self): folder = self.explorer_s.get_tree_projects()._get_project_root().path plugin = json_manager.read_ninja_project(folder) self.logFolder = QFileDialog.getExistingDirectory( self, self.tr("Select Log Folder"), plugin["logfolder"]) if self.logFolder != "": plugin["logfolder"] = self.logFolder json_manager.create_ninja_project(folder, plugin["name"], plugin)
def save_properties(self): if unicode(self.projectData.name.text()).strip() == '': QMessageBox.critical(self, self.tr("Properties Invalid"), self.tr("The Project must have a name.")) return tempName = self._item.name self._item.name = unicode(self.projectData.name.text()) self._item.description = unicode( self.projectData.description.toPlainText()) self._item.license = unicode(self.projectData.cboLicense.currentText()) self._item.mainFile = unicode(self.projectExecution.path.text()) self._item.url = unicode(self.projectData.url.text()) self._item.projectType = unicode(self.projectData.txtType.text()) self._item.pythonPath = unicode( self.projectExecution.txtPythonPath.text()) # FIXME self._item.PYTHONPATH = unicode( self.projectExecution.PYTHONPATH.toPlainText()) self._item.preExecScript = unicode( self.projectExecution.txtPreExec.text()) self._item.postExecScript = unicode( self.projectExecution.txtPostExec.text()) self._item.programParams = unicode( self.projectExecution.txtParams.text()) self._item.venv = unicode(self.projectExecution.txtVenvPath.text()) extensions = unicode(self.projectData.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 # FIXME project['PYTHONPATH'] = self._item.PYTHONPATH project['preExecScript'] = self._item.preExecScript project['postExecScript'] = self._item.postExecScript project['venv'] = self._item.venv project['programParams'] = self._item.programParams if tempName != self._item.name and \ file_manager.file_exists(self._item.path, tempName + '.nja'): file_manager.delete_file(self._item.path, tempName + '.nja') json_manager.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 != settings.SUPPORTED_EXTENSIONS: self._item._parent._refresh_project(self._item) self.close()
def test_read_ninja_project(self): path = self.tmpdir project = 'This is My Project' structure = dict(foo='bar') structure = read_ninja_project(path) self.assertEqual(structure, dict()) structure = dict(foo='bar') create_ninja_project(path, project, structure) structure = read_ninja_project(path) assert structure['foo'] == 'bar'
def test_create_ninja_project_with_lot_of_spaces_in_name(self): path = self.tmpdir project = 'This is My Project ' structure = dict(foo='bar') create_ninja_project(path, project, structure) expected_name = 'this_is_my_________project.nja' self.assertTrue(expected_name in os.listdir(path)) with open(os.path.join(path, expected_name), 'r') as fp: content = json.load(fp) assert content['foo'] == 'bar'
def test_read_ninja_project(self): path = self.tmpdir project = 'This is My Project' structure = dict(foo='bar') structure = read_ninja_project(path) self.assertEquals(structure, dict()) structure = dict(foo='bar') create_ninja_project(path, project, structure) structure = read_ninja_project(path) assert structure['foo'] == 'bar'
def test_create_ninja_project_with_lot_of_spaces_in_name(self): path = self.tmpdir project = 'This is My Project ' structure = dict(foo='bar') create_ninja_project(path, project, structure) expected_name = 'this_is_my_________project.nja' self.assertTrue(expected_name in os.listdir(path)) with open(os.path.join(path, expected_name), 'r') as fp: content = json.load(fp) assert content['foo'] == 'bar'
def save_properties(self): if unicode(self.projectData.name.text()).strip() == '': QMessageBox.critical(self, self.tr("Properties Invalid"), self.tr("The Project must have a name.")) return tempName = self._item.name self._item.name = unicode(self.projectData.name.text()) self._item.description = unicode( self.projectData.description.toPlainText()) self._item.license = unicode(self.projectData.cboLicense.currentText()) self._item.mainFile = unicode(self.projectExecution.path.text()) self._item.url = unicode(self.projectData.url.text()) self._item.projectType = unicode(self.projectData.txtType.text()) self._item.pythonPath = unicode( self.projectExecution.txtPythonPath.text()) self._item.preExecScript = unicode( self.projectExecution.txtPreExec.text()) self._item.postExecScript = unicode( self.projectExecution.txtPostExec.text()) self._item.programParams = unicode( self.projectExecution.txtParams.text()) self._item.venv = unicode(self.projectExecution.txtVenvPath.text()) extensions = unicode(self.projectData.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 project['preExecScript'] = self._item.preExecScript project['postExecScript'] = self._item.postExecScript project['venv'] = self._item.venv project['programParams'] = self._item.programParams if tempName != self._item.name and \ file_manager.file_exists(self._item.path, tempName + '.nja'): file_manager.delete_file(self._item.path, tempName + '.nja') json_manager.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 != settings.SUPPORTED_EXTENSIONS: self._item._parent._refresh_project(self._item) self.close()
def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file) and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) path = unicode(page.txtPlace.text()) if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) json_manager.create_ninja_project(path, name, project) wizard._load_project(path)
def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file) and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) path = unicode(page.txtPlace.text()) if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) json_manager.create_ninja_project(path, name, project) wizard._load_project(path)
def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file) and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) name = page.txtName.text() path = page.txtPlace.text() if not path: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn't be create")) return project = {} project["name"] = name project["description"] = page.txtDescription.toPlainText() project["license"] = page.cboLicense.currentText() project["venv"] = page.vtxtPlace.text() project["project-type"] = wizard.option json_manager.create_ninja_project(path, name, project) wizard._load_project(path)
def on_wizard_finish(self, wizard): """ Create the ninja_porject (.nja file) and open the project """ ids = wizard.pageIds() page = wizard.page(ids[1]) name = page.txtName.text() path = page.txtPlace.text() if not path: QMessageBox.critical(self, _translate("PythonProjectHandler", "Incorrect Location"), _translate("PythonProjectHandler", "The project couldn\'t be create")) return project = {} project['name'] = name project['description'] = page.txtDescription.toPlainText() project['license'] = page.cboLicense.currentText() project['venv'] = page.vtxtPlace.text() project['project-type'] = wizard.option json_manager.create_ninja_project(path, name, project) wizard._load_project(path)
def save_project_properties(self): # save project properties project = {} project['name'] = self._name project['description'] = self.description project['url'] = self.url project['license'] = self.license project['mainFile'] = self.main_file project['project-type'] = self.project_type project['supported-extensions'] = self.extensions project['indentation'] = self.indentation project['use-tabs'] = self.use_tabs project['pythonExec'] = self.python_exec # FIXME project['PYTHONPATH'] = self.python_path project['additional_builtins'] = self.additional_builtins project['preExecScript'] = self.pre_exec_script project['postExecScript'] = self.post_exec_script project['venv'] = self.venv project['programParams'] = self.program_params project['relatedProjects'] = self.related_projects if file_manager.file_exists(self.path, self._name + '.nja'): file_manager.delete_file(self.path, self._name + '.nja') json_manager.create_ninja_project(self.path, self._name, project)
def save_project_properties(self): #save project properties project = {} project['name'] = self._name project['description'] = self.description project['url'] = self.url project['license'] = self.license project['mainFile'] = self.main_file project['project-type'] = self.project_type project['supported-extensions'] = self.extensions project['indentation'] = self.indentation project['use-tabs'] = self.use_tabs project['pythonExec'] = self.python_exec # FIXME project['PYTHONPATH'] = self.python_path project['additional_builtins'] = self.additional_builtins project['preExecScript'] = self.pre_exec_script project['postExecScript'] = self.post_exec_script project['venv'] = self.venv project['programParams'] = self.program_params project['relatedProjects'] = self.related_projects if file_manager.file_exists(self.path, self._name + '.nja'): file_manager.delete_file(self.path, self._name + '.nja') json_manager.create_ninja_project(self.path, self._name, project)
def on_wizard_finish(self, wizard): ids = wizard.pageIds() page = wizard.page(ids[1]) place = unicode(page.txtPlace.text()) if not place: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The project couldn\'t be create")) return folder = unicode(page.txtFolder.text()).replace(' ', '_') path = os.path.join(place, folder) try: file_manager.create_folder(path) except: QMessageBox.critical(self, self.tr("Incorrect Location"), self.tr("The folder already exists.")) return project = {} name = unicode(page.txtName.text()) project['name'] = name project['description'] = unicode(page.txtDescription.toPlainText()) project['license'] = unicode(page.cboLicense.currentText()) project['venv'] = unicode(page.vtxtPlace.text()) json_manager.create_ninja_project(path, name, project) self._load_project(path)