本文整理匯總了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()
示例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)])
示例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)
示例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)
示例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)
示例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'})
示例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)
示例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)
示例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)
示例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
示例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
示例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]
示例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])
示例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')
示例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()