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


Python urwid.Divider方法代码示例

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


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

示例1: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def __init__(self, topics_btn_list: List[Any], view: Any,
                 stream_button: Any) -> None:
        self.view = view
        self.log = urwid.SimpleFocusListWalker(topics_btn_list)
        self.topics_btn_list = topics_btn_list
        self.stream_button = stream_button
        self.focus_index_before_search = 0
        self.list_box = urwid.ListBox(self.log)
        self.topic_search_box = PanelSearchBox(self,
                                               'SEARCH_TOPICS',
                                               self.update_topics)
        self.header_list = urwid.Pile([self.stream_button,
                                       urwid.Divider('─'),
                                       self.topic_search_box])
        super().__init__(self.list_box, header=urwid.LineBox(
            self.header_list, tlcorner='─', tline='', lline='',
            trcorner='─', blcorner='─', rline='',
            bline='─', brcorner='─'
        ))
        self.search_lock = threading.Lock() 
开发者ID:zulip,项目名称:zulip-terminal,代码行数:22,代码来源:views.py

示例2: test_streams_view

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def test_streams_view(self, mocker, streams, pinned, width=40):
        self.view.unpinned_streams = [s for s in streams if s[1] not in pinned]
        self.view.pinned_streams = [s for s in streams if s[1] in pinned]
        stream_button = mocker.patch(VIEWS + '.StreamButton')
        stream_view = mocker.patch(VIEWS + '.StreamsView')
        line_box = mocker.patch(VIEWS + '.urwid.LineBox')
        divider = mocker.patch(VIEWS + '.urwid.Divider')
        mocker.patch(STREAMBUTTON + ".mark_muted")

        left_col_view = LeftColumnView(width, self.view)

        if pinned:
            divider.assert_called_once_with('-')
        else:
            divider.assert_not_called()

        stream_button.assert_has_calls(
            [mocker.call(stream,
                         controller=self.view.controller,
                         width=width,
                         view=self.view,
                         count=1)
             for stream in (self.view.pinned_streams
                            + self.view.unpinned_streams)]) 
开发者ID:zulip,项目名称:zulip-terminal,代码行数:26,代码来源:test_ui_tools.py

示例3: test_main_view_generates_stream_header

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def test_main_view_generates_stream_header(self, mocker, message,
                                               to_vary_in_last_message):
        self.model.stream_dict = {
            5: {
                'color': '#bd6',
            },
        }
        last_message = dict(message, **to_vary_in_last_message)
        msg_box = MessageBox(message, self.model, last_message)
        view_components = msg_box.main_view()
        assert len(view_components) == 3

        assert isinstance(view_components[0], Columns)

        assert isinstance(view_components[0][0], Text)
        assert isinstance(view_components[0][1], Text)
        assert isinstance(view_components[0][2], Divider) 
开发者ID:zulip,项目名称:zulip-terminal,代码行数:19,代码来源:test_ui_tools.py

示例4: get_form_buttons

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def get_form_buttons(self, defaultdata=None, create=False):
        ok = urwid.Button("OK")
        urwid.connect_signal(ok, 'click', self._ok, defaultdata)
        ok = AM(ok, 'selectable', 'butfocus')
        cancel = urwid.Button("Cancel")
        urwid.connect_signal(cancel, 'click', self._cancel)
        cancel = AM(cancel, 'selectable', 'butfocus')
        l = [ok, cancel]
        if create:
            ok_edit = urwid.Button("OK and Edit")
            urwid.connect_signal(ok_edit, 'click', self._ok_and_edit, defaultdata)
            ok_edit = AM(ok_edit, 'selectable', 'butfocus')
            l = [ok, ok_edit, cancel]
        else:
            l = [ok, cancel]
        butgrid = urwid.GridFlow(l, 15, 3, 1, 'center')
        return urwid.Pile([urwid.Divider(), butgrid ], focus_item=1) 
开发者ID:kdart,项目名称:pycopia,代码行数:19,代码来源:widgets.py

示例5: build

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def build(self):
        menulist = []
        # big title
        bt = urwid.BigText("Storage Editor", urwid.HalfBlock5x4Font())
        bt = urwid.Padding(bt, "center", None)
        # primary tables for editing
        self.primlist = [TableItemWidget(s) for s in self._PRIMARY_TABLES]
        for b in self.primlist:
            urwid.connect_signal(b, 'activate', self._select)
        pmenu = urwid.GridFlow(self.primlist, 20, 2, 1, "left")
        # heading blurbs
        subhead = urwid.AttrMap(urwid.Text("Select an object type to view or edit."), "subhead")
        supportsubhead = urwid.AttrMap(urwid.Text("Select a supporting object to view or edit."), "subhead")
        # secondary/support tables
        self.seclist = [TableItemWidget(s) for s in self._SUPPORT_TABLES]
        for b in self.seclist:
            urwid.connect_signal(b, 'activate', self._select)
        smenu = urwid.GridFlow(self.seclist, 25, 1, 0, "left")
        divider = urwid.Divider("-", top=1, bottom=1)
        menulist = [bt, divider, subhead, pmenu, divider, supportsubhead, smenu]
        listbox = urwid.ListBox(urwid.SimpleListWalker(menulist))
        return urwid.Frame(listbox) 
开发者ID:kdart,项目名称:pycopia,代码行数:24,代码来源:widgets.py

示例6: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def __init__(self, user, typing=None, is_read_only=False):
        self.read_only_widget = urwid.Text('You have no power here!', align='center')
        if typing != None:
            top_separator = TextDivider(('is_typing', '{} {} is typing...'.format(
                get_icon('keyboard'),
                typing
            )))
        else:
            top_separator = urwid.Divider('─')
        self.prompt_widget = MessagePrompt(user)
        middle = urwid.WidgetPlaceholder(self.read_only_widget if is_read_only else self.prompt_widget)
        self.body = urwid.Pile([
            urwid.WidgetPlaceholder(top_separator),
            middle,
            urwid.Divider('─')
        ])
        self._typing = typing
        super(MessageBox, self).__init__(self.body, None, {'prompt': 'active_prompt'}) 
开发者ID:haskellcamargo,项目名称:sclack,代码行数:20,代码来源:components.py

示例7: make_failed_view

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def make_failed_view(self):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text('Wrong Answer'), 'hometag')
        columns = urwid.Columns([(17, status_header), (20, status)])
        result_header = urwid.Text('--- Run Code Result: ---', align='center')
        passed_header = urwid.Text('Passed test cases:')
        s = self.result['compare_result']
        passed = urwid.Text('%d/%d' % (s.count('1'), len(s)))
        your_input_header = urwid.Text('Your input:')
        your_input = urwid.Text(self.result['input'])
        your_answer_header = urwid.Text('Your answer:')
        your_answer = urwid.Text(self.result['code_output'])
        expected_answer_header = urwid.Text('Expected answer:')
        expected_answer = urwid.Text(self.result['expected_output'])
        list_items = [
            result_header,
            blank, columns,
            blank, passed_header, passed,
            blank, your_input_header, your_input,
            blank, your_answer_header, your_answer,
            blank, expected_answer_header, expected_answer
        ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
开发者ID:chishui,项目名称:terminal-leetcode,代码行数:27,代码来源:result.py

示例8: make_compile_error_view

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def make_compile_error_view(self):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text('Compile Error'), 'hometag')
        columns = urwid.Columns([(17, status_header), (20, status)])
        column_wrap = urwid.WidgetWrap(columns)
        result_header = urwid.Text('--- Run Code Result: ---', align='center')
        your_input_header = urwid.Text('Your input:')
        your_input = urwid.Text('')
        your_answer_header = urwid.Text('Your answer:')
        your_answer = urwid.Text(self.result['compile_error'])
        expected_answer_header = urwid.Text('Expected answer:')
        expected_answer = urwid.Text('Unkown Error')
        list_items = [
            result_header,
            blank, column_wrap,
            blank, your_input_header, your_input,
            blank, your_answer_header, your_answer,
            blank, expected_answer_header, expected_answer
        ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
开发者ID:chishui,项目名称:terminal-leetcode,代码行数:24,代码来源:result.py

示例9: make_unified_error_view

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def make_unified_error_view(self, error_title):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text(error_title), 'hometag')
        columns = urwid.Columns([(17, status_header), (30, status)])
        column_wrap = urwid.WidgetWrap(columns)
        if 'last_testcase' in self.result:
            result_header = urwid.Text('--- Run Code Result: ---', align='center')
            your_input_header = urwid.Text('Last executed input:')
            your_input = urwid.Text(self.result['last_testcase'])
            list_items = [
                result_header,
                blank, column_wrap,
                blank, your_input_header, your_input,
            ]
        else:
            list_items = [
                result_header,
                blank, column_wrap,
            ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
开发者ID:chishui,项目名称:terminal-leetcode,代码行数:24,代码来源:result.py

示例10: buildThread

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def buildThread(self):
        historyWidgetList = []
        for h in self.uvm.history:
            frame = h[0]
            factory = h[1]
            args = h[2]

            if self.uFilter:
                if self.uFilter in args:
                    hInfo = urwid.Text(f'Frame: {frame}, Info: {args}')
                    hButton = urwid.Button(f'{self.uvm.history.index(h)}: Restore', self.restore)
                    historyWidgetList.append(urwid.LineBox(urwid.Pile([hInfo, urwid.Divider('-'), hButton])))
            else:
                hInfo = urwid.Text(f'Frame: {frame}, Info: {args}')
                hButton = urwid.Button(f'{self.uvm.history.index(h)}: Restore', self.restore)
                historyWidgetList.append(urwid.LineBox(urwid.Pile([hInfo, urwid.Divider('-'), hButton])))

        self.parsedItems = len(historyWidgetList)

        listbox_content = historyWidgetList
        listbox = urwid.ListBox(urwid.SimpleListWalker(listbox_content))

        return listbox 
开发者ID:wtheisen,项目名称:TerminusBrowser,代码行数:25,代码来源:historyFrame.py

示例11: buildThread

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def buildThread(self):
        watcherWidgetList = []
        self.uvm.watcherUpdate(None, None)
        for wT, wTDict in self.uvm.watched.items():
            if 'isArchived' in wTDict:
                wInfo = urwid.Text(f"Board: {wTDict['board']} -- {wTDict['op']} | THREAD ARCHIVED")
            else:
                wInfo = urwid.Text(f"Board: {wTDict['board']} -- {wTDict['op']} | Unread: {wTDict['numReplies']}")

            wButton = urwid.Button(f'View thread: {wT}', self.viewThread)
            dButton = urwid.Button(f'Unwatch thread: {wT}', self.unwatchThread)
            watcherWidgetList.append(urwid.LineBox(urwid.Pile([wInfo, urwid.Divider('-'), wButton, dButton])))

        self.parsedItems = len(watcherWidgetList)

        listbox_content = watcherWidgetList
        listbox = urwid.ListBox(urwid.SimpleListWalker(listbox_content))

        return listbox 
开发者ID:wtheisen,项目名称:TerminusBrowser,代码行数:21,代码来源:watcherFrame.py

示例12: buildFrame

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def buildFrame(self, board):
        '''returns the board widget'''

        threadButtonList = []

        for title, l, s, c, t  in self.titles.items():
            if self.uFilter:
                if re.search(self.uFilter.lower(), title.lower()):
                    threadButton = urwid.Button(str(l), self.changeFrameThread)
                    threadInfo = urwid.Text(self.info_text.format(str(s),str(c)))
                    threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo]
                    threadButtonList.append(urwid.LineBox(urwid.Pile(threadList)))
            else:
                threadButton = urwid.Button(str(l), self.changeFrameThread)
                threadInfo = urwid.Text(self.info_text.format(str(s),str(c)))
                threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo]
                threadButtonList.append(urwid.LineBox(urwid.Pile(threadList)))

        self.parsedItems = len(threadButtonList)
        catalogueButtons = urwid.GridFlow(threadButtonList, 30, 2, 2, 'center')
        listbox = urwid.ListBox(urwid.SimpleListWalker([catalogueButtons]))

        self.uvm.itemCount = len(threadButtonList)
        return [listbox] 
开发者ID:wtheisen,项目名称:TerminusBrowser,代码行数:26,代码来源:storyFrame.py

示例13: buildFrame

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def buildFrame(self, board):
        '''returns the board widget'''

        threadButtonList = []

        for threadNumber, threadInfo in self.threadsDict.items():
            title = str(threadInfo[0]).replace('-', ' ')
            if self.uFilter:
                if re.search(self.uFilter.lower(), title.lower()):
                    threadButton = urwid.Button(str(threadNumber), self.changeFrameThread)
                    threadInfo = urwid.Text(self.info_text.format(str(threadInfo[1]),str(threadInfo[2])))
                    threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo]
                    threadButtonList.append(urwid.LineBox(urwid.Pile(threadList)))
            else:
                threadButton = urwid.Button(str(threadNumber), self.changeFrameThread)
                threadInfo = urwid.Text(self.info_text.format(str(threadInfo[1]), str(threadInfo[2])))
                threadList = [threadButton, urwid.Divider('-'), urwid.Divider(), urwid.Text(title), urwid.Divider(), urwid.Divider('-'), threadInfo]
                threadButtonList.append(urwid.LineBox(urwid.Pile(threadList)))

        self.parsedItems = len(threadButtonList)
        catalogueButtons = urwid.GridFlow(threadButtonList, 30, 2, 2, 'center')
        listbox = urwid.ListBox(urwid.SimpleListWalker([catalogueButtons]))

        self.uvm.itemCount = len(threadButtonList)
        return urwid.Pile([listbox]) 
开发者ID:wtheisen,项目名称:TerminusBrowser,代码行数:27,代码来源:chanBoardBuilder.py

示例14: render_page

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def render_page(self):

        host_widgets = urwid.Padding(self.host_panels,
                                    left=2, right=2)

        return urwid.AttrMap(
                 urwid.Filler(
                   urwid.Pile([
                               urwid.Padding(urwid.Text(self.text),
                                             left=2, right=2),
                               urwid.Divider(),
                               host_widgets,
                               urwid.Divider(),
                               self.next_btn]),
                   valign='top',top=1),
                 'active_step') 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:18,代码来源:host_definition.py

示例15: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Divider [as 别名]
def __init__(self, app):
        self.app = app
        self.walker = urwid.SimpleListWalker([])
        for log_record in logger.get_logs():
            self._append_log(log_record)
        logger.on_log_event += self._append_log
        self.listbox = urwid.ListBox(self.walker)

        self.debug_data = urwid.Text('')

        super(DebugPage, self).__init__([
            ('pack', self.debug_data),
            ('pack', urwid.Text('')),
            ('pack', urwid.Text('Hit "Enter" to copy selected message to clipboard.')),
            ('pack', urwid.Divider(u'\u2550')),
            self.listbox
        ])

        gp.auth_state_changed += self.update

        self.update() 
开发者ID:and3rson,项目名称:clay,代码行数:23,代码来源:debug.py


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