當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.get_available_simulators方法代碼示例

本文整理匯總了Python中chiptools.core.project.Project.get_available_simulators方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.get_available_simulators方法的具體用法?Python Project.get_available_simulators怎麽用?Python Project.get_available_simulators使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在chiptools.core.project.Project的用法示例。


在下文中一共展示了Project.get_available_simulators方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: CommandLine

# 需要導入模塊: from chiptools.core.project import Project [as 別名]
# 或者: from chiptools.core.project.Project import get_available_simulators [as 別名]

#.........這裏部分代碼省略.........
                "Please specify a library and entity.\n" +
                "Example: (Cmd) simulate my_library.my_entity [tool_name]"
            )
            return
        self.project.simulate(library, entity, gui=True, tool_name=tool_name)

    @wraps_do_commands
    def do_clean(self, command):
        """Clear the file cache"""
        # Delete libraries from the simulation area
        simpath = self.project.get_simulation_directory()
        if simpath is None:
            log.error('No simulation path is set, aborting operation.')
            return
        log.info('Cleaning simulation folder: ' + simpath)
        for tool_name in self.project.cache.get_tool_names():
            for libname in self.project.cache.get_libraries(tool_name):
                path = os.path.join(simpath, libname)
                if os.path.exists(path):
                    log.info('Removing ' + path)
                    shutil.rmtree(path)
        log.info('...done')
        self.project.cache.initialise_cache()

    @wraps_do_commands
    def do_pwd(self, command):
        print(
            term.colourise('Working directory: ', fg='yellow') +
            term.colourise('{0}', fg='green').format(os.getcwd())
        )

    @wraps_do_commands
    def do_plugins(self, command):
        simulators = self.project.get_available_simulators()
        synthesisers = self.project.get_available_synthesisers()
        for i, plugin_registry in enumerate([simulators, synthesisers]):
            print(term.yellow(['Simulator Plugins:', 'Synthesis Plugins:'][i]))
            for name, inst in plugin_registry.items():
                plugin_path = sys.modules[inst.__module__].__file__
                plugin_file = os.path.basename(plugin_path)
                print(
                    SEP * 1 + term.darkgray(plugin_file) + '\n' +
                    SEP * 2 + '{:<15}: {:<35}'.format(
                        'Plugin Path',
                        term.green(plugin_path)
                    ) + '\n' +
                    SEP * 2 + '{:<15}: {:<35}'.format(
                        'Name',
                        term.green(str(name))
                    ) + '\n' +
                    SEP * 2 + '{:<15}: {:<35}'.format(
                        'Tool Path',
                        [
                            term.red('(not found) ' + str(inst.path)),
                            term.green(str(inst.path))
                        ][inst.installed]
                    )
                )

    @wraps_do_commands
    def do_show_config(self, command):
        """Print out the project settings"""
        available_simulator_string = ''
        for name, inst in self.project.get_available_simulators().items():
            available_simulator_string += (
                SEP * 2 + '{:<15}: ' +
開發者ID:hoangt,項目名稱:chiptools,代碼行數:70,代碼來源:cli.py


注:本文中的chiptools.core.project.Project.get_available_simulators方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。