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


Python urwid.RadioButton方法代码示例

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


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

示例1: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def __init__(self):
        def selectButton(radio_button, new_state, parameter):
            if new_state:
                closeOverlay()
                self._select(parameter)

        super().__init__(urwid.SimpleFocusListWalker([]))
        buttons = []
        for i, item in enumerate(self._items()):
            if isinstance(item, urwid.Widget):
                self.body.append(item)
                continue
            elif isinstance(item, tuple):
                name, selected, parameter = item
            else:
                parameter = name = item
                selected = False
            self.body.append(urwid.RadioButton(buttons, name, selected,
                                               selectButton, parameter))
            if selected:
                self.set_focus(i) 
开发者ID:ids1024,项目名称:wikicurses,代码行数:23,代码来源:main.py

示例2: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def __init__(self, model, metadata, value, legend=None):
        blist = []
        glist = []
        maxl = 0
        for num, name in types.ValueType.get_choices():
            maxl = max(maxl, len(name))
            b = urwid.RadioButton(blist, name, False, user_data=num)
            b.value = num
            glist.append(AM(b, 'enumbuttn','buttnf'))
        # set the right value
        for b in blist:
            if b.value == value:
                b.state = True
        self.wid = urwid.GridFlow(glist, maxl+4, 1, 0, 'left')
        self.blist = blist
        self.__super.__init__(self._col_creator(metadata, self.wid, legend)) 
开发者ID:kdart,项目名称:pycopia,代码行数:18,代码来源:widgets.py

示例3: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def __init__(self, parent):

        self.text = (
            "{}\n\nDuring the host probes, the available "
            "networks have been autodetected. Networks that are common to all "
            "hosts appear on the left, and networks common to all OSD hosts "
            "are shown on the right.".format(self.title)
        )

        self.public_grp = []
        self.cluster_grp = []
        public_networks = []
        cluster_networks = []

        self.public_buttons = urwid.Pile([urwid.RadioButton(self.public_grp,
                                                            txt)
                                          for txt in public_networks])
        self.cluster_buttons = urwid.Pile([urwid.RadioButton(self.cluster_grp,
                                                             txt)
                                           for txt in cluster_networks])

        self.next_btn = ui_button(callback=self.validate)

        UIBaseClass.__init__(self, parent) 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:26,代码来源:networking.py

示例4: refresh

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def refresh(self):
        """ populate the UI elements from the gathered host data """
        app = self.parent

        public_networks = self._get_public_networks()
        cluster_networks = self._get_cluster_networks()
        if not public_networks:
            app.show_message("Error: Hosts do not share a common subnet "
                             "for the public network")
            return

        if not cluster_networks:
            cluster_networks = public_networks

        self.public_buttons = urwid.Pile([
                                  urwid.RadioButton(self.public_grp, txt)
                                  for txt in public_networks])

        self.cluster_buttons = urwid.Pile([
                                 urwid.RadioButton(self.cluster_grp, txt)
                                 for txt in cluster_networks]) 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:23,代码来源:networking.py

示例5: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def __init__(self, p_todolist):
        self._todolist = p_todolist

        self.titleedit = urwid.Edit("Title: ", "")
        self.sortedit = urwid.Edit("Sort expression: ", "")
        self.groupedit = urwid.Edit("Group expression: ", "")
        self.filteredit = urwid.Edit("Filter expression: ", "")

        radiogroup = []
        self.relevantradio = urwid.RadioButton(radiogroup, "Only show relevant todo items", True)
        self.allradio = urwid.RadioButton(radiogroup, "Show all todo items")

        self.pile = urwid.Pile([
            self.filteredit,
            self.titleedit,
            self.sortedit,
            self.groupedit,
            self.relevantradio,
            self.allradio,
            urwid.Button("Save", lambda _: urwid.emit_signal(self, 'save')),
            urwid.Button("Cancel", lambda _: self.close()),
        ])

        self.reset()

        super().__init__(self.pile)

        urwid.register_signal(ViewWidget, ['save', 'close']) 
开发者ID:bram85,项目名称:topydo,代码行数:30,代码来源:ViewWidget.py

示例6: radio_button

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def radio_button(group, label, fn):
    """ Inheriting radio button of urwid """
    w = urwid.RadioButton(group, label, False, on_state_change=fn)
    w = urwid.AttrWrap(w, 'button normal', 'button select')
    return w 
开发者ID:amanusk,项目名称:s-tui,代码行数:7,代码来源:ui_elements.py

示例7: test_buttons

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def test_buttons(self):
        self.fwstest(urwid.Button(u"hello"))
        self.fwstest(urwid.RadioButton([], u"hello")) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:5,代码来源:test_container.py

示例8: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import RadioButton [as 别名]
def __init__(self, parent):

        software_src_list = ['RH CDN', 'Distro', 'Community']
        osd_types = ['filestore', 'bluestore']
        dmcrypt_settings = ['standard', 'encrypted']

        cfg = parent.cfg

        self.sw_source_group = []
        self.osd_type = []
        self.dmcrypt_group = []

        self.text = (
            "Environment\n\nDefine the types of environment settings that "
            "will determine the way the cluster is installed and configured."
        )

        self.deployment_user = FixedEdit("Deployment User : ", width=8,
                                         valid_chars=self.alphanum)
        self.deployment_user.edit_text = 'root'

        software_buttons = [urwid.RadioButton(self.sw_source_group, txt,
                                              state=False)
                            for txt in software_src_list]
        software_buttons[software_src_list.index(cfg.defaults.sw_src)].state = True
        self.software_sources = urwid.GridFlow(software_buttons,
                                14, 4, 0, align='left')

        osd_buttons = [urwid.RadioButton(self.osd_type, txt,
                                         state=False)
                       for txt in osd_types]
        osd_buttons[osd_types.index(cfg.defaults.osd_objectstore)].state=True
        self.osd_options = urwid.GridFlow(osd_buttons,
                                          14, 4, 0, align='left')

        dmcrypt_buttons = [urwid.RadioButton(self.dmcrypt_group, txt,
                                         state=False)
                       for txt in dmcrypt_settings]
        dmcrypt_buttons[dmcrypt_settings.index(cfg.defaults.dmcrypt)].state = True
        self.dmcrypt_options = urwid.GridFlow(dmcrypt_buttons,
                                          14, 4, 0, align='left')
        self.next_btn = ui_button(callback=self.validate)

        UIBaseClass.__init__(self, parent) 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:46,代码来源:environment.py


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