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


Python urwid.CheckBox方法代码示例

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


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

示例1: edit

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def edit(title):
    try:
        text, verify = wiki.init_edit(title)
        wiki.login()

        newtext = runEditor(text)
        if newtext == text:
            ex.notify('Edit Canceled: No Change')
            return

        def submit(button):
            closeOverlay()
            wiki.commit_edit(newtext, summary.edit_text,
                             minor.get_state(), verify)
            openPage(title)
        def cancel(button):
            closeOverlay()
        summary = urwid.Edit('Summary: ')
        minor = urwid.CheckBox('Minor Edit')
        cancel_button = urwid.Button('Cancel', cancel)
        submit_button = urwid.Button('Submit', submit)
        pile = urwid.Pile([summary, minor, cancel_button, submit_button])
        openOverlay(pile, 'Edit', 'pack')
    except WikiError as e:
        ex.notify('Error: ' + str(e)) 
开发者ID:ids1024,项目名称:wikicurses,代码行数:27,代码来源:main.py

示例2: build

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def build(self):
        self._showeq = urwid.Text("")
        eqi = self._create_equipment_input()
        maxlen = 0
        uutcb = urwid.CheckBox("DUT/UUT", state=False)
        urwid.connect_signal(uutcb, 'change', self._uut_select)
        blist = [AM(uutcb, "important")]
        for role in self._roles:
            label = str(role)
            maxlen = max(len(label), maxlen)
            but = urwid.CheckBox(str(role), state=False)
            urwid.connect_signal(but, 'change', self._multi_select, role)
            blist.append(but)
        roleboxes = urwid.Padding(urwid.GridFlow(blist, maxlen+4, 1, 0, "left"))
        # buttons
        ok, cancel = self.get_form_buttons()
        buts = urwid.Columns([(10, ok), (10, cancel)], dividechars=1, focus_column=0)
        return urwid.ListBox(urwid.SimpleListWalker([eqi, AM(self._showeq, "flagged"), roleboxes, buts])) 
开发者ID:kdart,项目名称:pycopia,代码行数:20,代码来源:widgets.py

示例3: generate_password

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def generate_password(self, originator, args=None):
        self.mode = 'generate'
        if args:
            path, length, symbols, force = args
        else:
            path, length, symbols, force = '', 16, True, False
        if not path and self.current != '.':
            path = self.current + '/'
        self.set_header('GENERATE PASSWORD')
        self._clear_box()
        self.generate_password_path = EditWithEnter(
            ("highlight", "Password Name: "), path, multiline=False,
            enter_handler=self.call_generate)
        self.generate_password_length = urwid.IntEdit("Length: ", default=length)
        self.generate_password_symbols = urwid.CheckBox("Symbols", state=symbols)
        self.generate_password_force = urwid.CheckBox("Overwrite existing passwords with that name", state=force)
        self.box.body.append(self.generate_password_path)
        self.box.body.append(self.generate_password_length)
        self.box.body.append(self.generate_password_symbols)
        self.box.body.append(self.generate_password_force)
        self.box.body.append(ActionButton('GENERATE', self.call_generate))
        self.box.body.append(BackButton('BACK', self.load_dispatch, self.current, self)) 
开发者ID:Kwpolska,项目名称:upass,代码行数:24,代码来源:__main__.py

示例4: playlistitems

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def playlistitems(title):
	global listitems
	bt_sv = urwid.Button("Save")
	urwid.connect_signal(bt_sv, 'click', showmenu)
	bt_ca = urwid.Button("Cancel")
	urwid.connect_signal(bt_ca, 'click', showmenu)
	bt_sa = urwid.Button("Select all")
	urwid.connect_signal(bt_sa, 'click', select_all)
	bt_da = urwid.Button("Deselect all")
	urwid.connect_signal(bt_da, 'click', deselect_all)
	footer = urwid.Columns([bt_sv, bt_sa, bt_da, bt_ca], 1)
	items = []
	for item in playlist_names:
		items.append(urwid.CheckBox(item['name'], is_selected(item['id']), on_state_change=checkbox_callback, user_data=item['id']))
	start.original_widget = TabFrame(urwid.ListBox(urwid.SimpleListWalker(items)), header=urwid.Text("Select Playlists"), footer=footer, focus_part='body')

# main menu button handler 
开发者ID:helpsterTee,项目名称:spotify-playlists-2-deezer,代码行数:19,代码来源:spotify-restore.py

示例5: _build_test_selector

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def _build_test_selector(self, include_testcases):
        cb = AM(urwid.CheckBox("Include test cases", False, on_state_change=self._refresh_cb), "selectable", "butfocus")
        gobut = urwid.Button("Go")
        urwid.connect_signal(gobut, 'click', self._runtest)
        gobut = urwid.AttrWrap(gobut, 'selectable', 'butfocus')
        tb = self._get_testtree(include_testcases)
        return urwid.Pile([(1, urwid.Filler(cb)), tb, urwid.Filler(gobut)]) 
开发者ID:kdart,项目名称:pycopia,代码行数:9,代码来源:runner.py

示例6: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def __init__(self, model, metadata, value, legend=None):
        self.wid = urwid.CheckBox(metadata.colname, state=value)
        self.__super.__init__(self._col_creator(metadata, self.wid, legend)) 
开发者ID:kdart,项目名称:pycopia,代码行数:5,代码来源:widgets.py

示例7: _build_list

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def _build_list(self):
        choices = get_related_choices(self.session, self.modelclass, self.metadata, None)
        choices.update(self.currentvalue)
        wlist = []
        current = self.currentvalue
        for pk, cobj in choices.items():
            if pk in current:
                but = urwid.CheckBox(str(cobj), state=True)
            else:
                but = urwid.CheckBox(str(cobj), state=False)
            urwid.connect_signal(but, 'change', self._multi_select, (pk, cobj))
            wlist.append(but)
        return urwid.ListBox(urwid.SimpleListWalker(wlist)) 
开发者ID:kdart,项目名称:pycopia,代码行数:15,代码来源:widgets.py

示例8: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import CheckBox [as 别名]
def __init__(self, app):
        self.app = app
        self.username = urwid.Edit(
            edit_text=settings.get('username', 'play_settings') or ''
        )
        self.password = urwid.Edit(
            mask='*', edit_text=settings.get('password', 'play_settings') or ''
        )
        self.device_id = urwid.Edit(
            edit_text=settings.get('device_id', 'play_settings') or ''
        )
        self.download_tracks = urwid.CheckBox(
            'Download tracks before playback',
            state=settings.get('download_tracks', 'play_settings') or False
        )
        self.equalizer = Equalizer()
        super(SettingsPage, self).__init__([urwid.ListBox(urwid.SimpleListWalker([
            urwid.Text('Settings'),
            urwid.Divider(' '),
            urwid.Text('Username'),
            urwid.AttrWrap(self.username, 'input', 'input_focus'),
            urwid.Divider(' '),
            urwid.Text('Password'),
            urwid.AttrWrap(self.password, 'input', 'input_focus'),
            urwid.Divider(' '),
            urwid.Text('Device ID'),
            urwid.AttrWrap(self.device_id, 'input', 'input_focus'),
            urwid.Divider(' '),
            self.download_tracks,
            urwid.Divider(' '),
            urwid.AttrWrap(urwid.Button(
                'Save', on_press=self.on_save
            ), 'input', 'input_focus'),
            urwid.Divider(u'\u2500'),
            self.equalizer,
        ]))]) 
开发者ID:and3rson,项目名称:clay,代码行数:38,代码来源:settings.py

示例9: __init__

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

        self.return_fn = return_fn

        # create the cancel and apply buttons, and put the in an urwid column
        cancel_button = urwid.Button('Cancel', on_press=self.on_cancel)
        cancel_button._label.align = 'center'
        apply_button = urwid.Button('Apply', on_press=self.on_apply)
        apply_button._label.align = 'center'

        if_buttons = urwid.Columns([apply_button, cancel_button])

        self.sensor_status_dict = {}
        sensor_column_list = []
        self.sensor_button_dict = {}
        self.active_sensors = {}
        for source in source_list:
            source_name = source.get_source_name()

            # get the saves sensor visibility list
            if default_source_conf[source_name]:
                # print(str(default_source_conf[source_name]))
                self.sensor_status_dict[source_name] =\
                    copy.deepcopy(default_source_conf[source_name])
            else:
                self.sensor_status_dict[source_name] =\
                    [True] * len(source.get_sensor_list())

            self.sensor_button_dict[source_name] = []
            self.active_sensors[source_name] = []

            # add the title at the head of the checkbox column
            sensor_title_str = source_name
            sensor_title = urwid.Text(
                ('bold text', sensor_title_str), 'center')

            # create the checkbox buttons with the saved visibility
            for sensor, s_tatus in \
                    zip(source.get_sensor_list(),
                        self.sensor_status_dict[source_name]):
                cb = urwid.CheckBox(sensor, s_tatus)
                self.sensor_button_dict[source_name].append(cb)
                self.active_sensors[source_name].append(s_tatus)

            sensor_title_and_buttons = \
                [sensor_title] + self.sensor_button_dict[source_name]
            listw = urwid.SimpleFocusListWalker(sensor_title_and_buttons)

            sensor_column_list.append(urwid.Pile(listw))

        sensor_select_widget = urwid.Columns(sensor_column_list)

        list_temp = [sensor_select_widget, if_buttons]
        listw = urwid.SimpleFocusListWalker(list_temp)
        self.main_window = urwid.LineBox(ViListBox(listw))

        max_height = 6
        for sensor, s_tatus in self.active_sensors.items():
            max_height = max(max_height, len(s_tatus) + 6)

        self.size = max_height, self.MAX_TITLE_LEN 
开发者ID:amanusk,项目名称:s-tui,代码行数:63,代码来源:sensors_menu.py

示例10: __init__

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

        self.text = (
            "{}\n\nClick 'Check' to confirm passwordless is setup. For hosts "
            "that have an AUTHFAIL/NOPASSWD status, enter the root password "
            "and check again.".format(self.title))

        self.check_btn = ui_button(label='Check', align='right',
                                   callback=self.check_access)

        self.enable_password = urwid.CheckBox("Common Password",
                                              state=False,
                                              on_state_change=self.common_pswd_toggle)

        self.common_password = urwid.AttrMap(
                    FixedEdit(edit_text="",
                              multiline=False, width=self.password_length),
                    "title")

        urwid.connect_signal(self.common_password.base_widget,
                             'change',
                             callback=self.common_pswd_change)

        # pending access table elements
        self.pending_table_headings = urwid.Columns([
            (12, urwid.Text('Hostname')),
            (10, urwid.Text('Status')),
            (self.password_length, urwid.Text('Password'))
            ], dividechars=1)
        self.pending_table_title = urwid.Text("Access Pending",
                                              align='center')
        self.pending_table_body = urwid.SimpleListWalker([])
        self.pending_table = urwid.ListBox(self.pending_table_body)

        # ssh ok table elements
        self.sshok_table_title = urwid.Text("Access OK",
                                            align='left')
        self.sshok_table_headings = urwid.Columns([
            (12, urwid.Text('Hostname'))
            ])
        self.sshok_table_body = urwid.SimpleListWalker([])
        self.sshok_table = urwid.ListBox(self.sshok_table_body)

        self.debug = None                   # Unused

        # instance uses a mutex to control updates to the screen when the
        # ssh setup method is called in parallel across each host
        self.table_mutex = threading.Lock()

        UIBaseClass.__init__(self, parent)
        # self.widget_in_focus = 4 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:53,代码来源:host_credentials.py


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