當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。