• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python json_manager.create_ninja_project函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ninja_ide.tools.json_manager.create_ninja_project函数的典型用法代码示例。如果您正苦于以下问题:Python create_ninja_project函数的具体用法?Python create_ninja_project怎么用?Python create_ninja_project使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_ninja_project函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create_layout

 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)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:30,代码来源:python_project_type.py


示例2: ChangeOcrDataFolder

    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
开发者ID:AlexaProjects,项目名称:Alexa2,代码行数:30,代码来源:alexatools.py


示例3: create_layout

 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)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:26,代码来源:__bundled_project_types.py


示例4: on_wizard_finish

    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)
开发者ID:alekibango,项目名称:ninja-ide-plugins,代码行数:32,代码来源:pluginProject.py


示例5: on_wizard_finish

    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)
开发者ID:AlexaProjects,项目名称:Alexa2,代码行数:30,代码来源:pluginProject.py


示例6: save_properties

    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()
开发者ID:jsargiot,项目名称:ninja-ide,代码行数:60,代码来源:project_properties_widget.py


示例7: create_layout

 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)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:25,代码来源:pyqt_project_type.py


示例8: on_wizard_finish

 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)
开发者ID:Hmaal,项目名称:ninja-ide,代码行数:26,代码来源:wizard_new_project.py


示例9: change_log_folder

    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)
开发者ID:AlexaProjects,项目名称:Alexa2,代码行数:10,代码来源:menu.py


示例10: save_properties

    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()
开发者ID:cjdp25,项目名称:ninja-ide,代码行数:52,代码来源:project_properties_widget.py


示例11: test_read_ninja_project

    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'
开发者ID:AlexaProjects,项目名称:Alexa2,代码行数:13,代码来源:test_ninja_project.py


示例12: test_create_ninja_project_with_lot_of_spaces_in_name

    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'
开发者ID:AlexaProjects,项目名称:Alexa2,代码行数:13,代码来源:test_ninja_project.py


示例13: on_wizard_finish

 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)
开发者ID:ntcong,项目名称:ninja-ide,代码行数:19,代码来源:wizard_new_project.py


示例14: on_wizard_finish

 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)
开发者ID:rolandgeider,项目名称:ninja-ide,代码行数:19,代码来源:wizard_new_project.py


示例15: on_wizard_finish

 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)
开发者ID:Salmista-94,项目名称:Ninja_PyQt5,代码行数:20,代码来源:wizard_new_project.py


示例16: save_project_properties

 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)
开发者ID:AnyBucket,项目名称:ninja-ide,代码行数:23,代码来源:nproject.py


示例17: on_wizard_finish

 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)
开发者ID:sanyaade,项目名称:ninja-ide,代码行数:24,代码来源:wizard_new_project.py



注:本文中的ninja_ide.tools.json_manager.create_ninja_project函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python json_manager.parse函数代码示例发布时间:2022-05-27
下一篇:
Python resources.get_shortcut函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap