当前位置: 首页>>代码示例>>Python>>正文


Python npyscreen.FormBaseNew方法代码示例

本文整理汇总了Python中npyscreen.FormBaseNew方法的典型用法代码示例。如果您正苦于以下问题:Python npyscreen.FormBaseNew方法的具体用法?Python npyscreen.FormBaseNew怎么用?Python npyscreen.FormBaseNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在npyscreen的用法示例。


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

示例1: create

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import FormBaseNew [as 别名]
def create(self):
        """ Override method for creating FormBaseNew form """
        self.add_handlers({'^T': self.quit, '^Q': self.quit})
        self.services_tft = self.add(npyscreen.TitleFixedText,
                                     name='No services running.',
                                     value='')
        services = Services(self.core, external=self.external)
        if services:
            self.services_tft.hidden = True
            for service in services:
                value = ''
                for val in service[1]:
                    value += val+', '
                self.add(npyscreen.TitleFixedText,
                         name=service[0],
                         value=value[:-2]) 
开发者ID:CyberReboot,项目名称:vent,代码行数:18,代码来源:services.py

示例2: create

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import FormBaseNew [as 别名]
def create(self):
        """ Override method for creating FormBaseNew form """
        self.add_handlers({'^T': self.quit, '^Q': self.quit,
                           '^V': self.toggle_view})
        self.add(npyscreen.TitleFixedText, name=self.action['title'], value='')
        response = self.action['api_action'].inventory(choices=['repos',
                                                                'tools',
                                                                'images',
                                                                'built',
                                                                'running'])
        if response[0]:
            inventory = response[1]
            if len(inventory['repos']) == 0:
                value = 'No tools were found.\n'
            else:
                value = 'Tools for all groups found:\n'
            tools = None
            if inventory['tools']:
                tools = inventory['tools']

            for repo in inventory['repos']:
                s_value = ''
                repo_name = repo.rsplit('/', 2)[1:]
                if len(repo_name) == 1:
                    repo_name = repo.split('/')
                if tools:
                    p_value = '\n  Plugin: ' + repo + '\n'
                    for tool in tools:
                        t_name = tool.split(':')
                        if (t_name[0] == repo_name[0] and
                                t_name[1] == repo_name[1]):
                            s_value += '    ' + tools[tool] + '\n      Built: '
                            s_value += inventory['built'][tool] + '\n'
                            s_value += '      Image name: '
                            s_value += inventory['images'][tool] + '\n'
                            s_value += '      Status: '
                            s_value += inventory['running'][tool] + '\n'
                if s_value:
                    value += p_value + s_value
        else:
            value = 'There was an issue with ' + self.action['name']
            value += ' retrieval:\n' + str(response[1])
            value += '\nPlease see vent.log for more details.'
        self.all_tools = value.split('\n')
        self.display_val = self.add(npyscreen.Pager, values=value.split('\n')) 
开发者ID:CyberReboot,项目名称:vent,代码行数:47,代码来源:inventory.py


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