本文整理匯總了Python中urwid.Filler方法的典型用法代碼示例。如果您正苦於以下問題:Python urwid.Filler方法的具體用法?Python urwid.Filler怎麽用?Python urwid.Filler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類urwid
的用法示例。
在下文中一共展示了urwid.Filler方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _build_widget
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def _build_widget(self):
applications = self.app.juju.client.applications
total_items = [Instruction("Deployment Information:"), HR()]
tbl = Pile([
Columns([('fixed', 15, Text("Name")),
Text(self.model['name'])]),
Columns([('fixed', 15, Text("Cloud")),
Text(self.model['cloud'])]),
Columns([('fixed', 15, Text("Status")),
Text(self.model['status']['current'])]),
Columns([('fixed', 15, Text("Online")),
Text(self._sanitize_date(
self.model['status']['since']))]),
Columns([('fixed', 15, Text("Applications")),
Text(", ".join(applications.keys()))]),
Columns([('fixed', 15, Text("Machines")),
Text(str(self._total_machines(self.model)))])
])
total_items.append(tbl)
total_items.append(HR())
return Padding.center_80(Filler(Pile(total_items), valign='top'))
示例2: setup_widgets
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def setup_widgets(self):
self.intro_frame = urwid.LineBox(
urwid.Filler(
urwid.Text(('body_text', self.INTRO_MESSAGE.format("")), align=urwid.CENTER),
valign=urwid.MIDDLE,
)
)
self.frame = urwid.Frame(
body=self.intro_frame,
footer=urwid.Text(
[self.FOOTER_START, ('heartbeat_inactive', self.HEARTBEAT_ICON)],
align=urwid.CENTER
)
)
self.loop = urwid.MainLoop(
urwid.AttrMap(self.frame, 'body_text'),
unhandled_input=show_or_exit,
palette=PALETTE,
)
self.list_walker = urwid.SimpleListWalker(self.message_list)
self.list_box = urwid.ListBox(self.list_walker)
urwid.connect_signal(self.list_walker, "modified", self.item_focused)
示例3: show_login
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def show_login(self):
un = self.client.config.get('username')
pw = self.client.config.get('password')
if un and pw:
asyncio.wait_for(
asyncio.ensure_future(self.handle_login({'username':un, 'password':pw}), loop=self.loop),
60.0, loop=self.loop)
else:
un_field = FormField(caption='username: ', name='username')
pw_field = FormField(caption='password: ', name='password', mask='~')
submit_btn = urwid.Button('login! >')
login_form = Form([un_field, pw_field], submit_btn)
def wait_for_login(_):
asyncio.wait_for(
asyncio.ensure_future(self.handle_login(login_form.data), loop=self.loop),
60.0, loop=self.loop)
urwid.connect_signal(submit_btn, 'click', wait_for_login)
self.open_box(urwid.Filler(login_form))
示例4: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def __init__(self, filename):
self.header = urwid.Text(" BINCH: %s" % (filename))
self.disasmblr = Disassembler(filename)
items = self.setup_list(True)
self.disasmlist = DisassembleList(items)
start_index = self.find_index(self.disasmblr.entry)
if start_index != -1:
self.disasmlist.set_focus(start_index)
self.history = list()
self.body = urwid.Padding(self.disasmlist, 'center', 105)
self.body = urwid.Filler(self.body, ('fixed top',1), ('fixed bottom',1))
self.footer = StatusBar("HotKeys -> g: Go to a address | s: Save | d: Remove | enter: Modify | q: Quit", self)
self.view = DisassembleWindow(self,
urwid.AttrWrap(self.body, 'body'),
urwid.AttrWrap(self.header, 'head'),
self.footer)
signals.call_delay.connect(self.sig_call_delay)
示例5: input_screen
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def input_screen(self,button):
#overlay second screen after start case1
txt=urwid.Text("Enter the URL below: ")
url_field=urwid.Edit(caption='', edit_text='', multiline=False,
align='left', wrap='space', allow_tab=False,
edit_pos=None, layout=None, mask=None)
btn=urwid.Button("OK",user_data=None)
url_button = urwid.AttrMap(btn,None,focus_map='reversed')
urwid.connect_signal(btn, 'click', self.input_url,url_field)
wid=urwid.Pile([txt,url_field,url_button])
new=urwid.Filler(urwid.AttrMap(wid, None, focus_map=''))
ok_screen_box=urwid.LineBox(
new, title='', title_align='center',
tlcorner='┌', tline='─', lline='│',
trcorner='┐', blcorner='└', rline='│',
bline='─', brcorner='┘'
)
self.top.original_widget=ok_screen_box
示例6: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def __init__(self, urwidViewManager):
uvm = urwidViewManager
close_button = urwid.Button("that's pretty cool")
urwid.connect_signal(close_button, 'click',
lambda button:self._emit("close"))
historyButtonList = []
for i in uvm.history:
historyButtonList.append(urwid.Button(str(i), uvm.displayThread))
pile = urwid.Pile(historyButtonList)
# pile = urwid.Pile([urwid.Text(
# "^^ I'm attached to the widget that opened me. "
# "Try resizing the window!\n"), close_button])
fill = urwid.Filler(pile)
self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))
示例7: render_page
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def render_page(self):
return urwid.AttrMap(
urwid.Filler(
urwid.Pile([
urwid.Padding(
urwid.Text(self.text),
left=2, right=2),
urwid.Divider(),
urwid.Columns([
urwid.Pile([
urwid.Text("Public Network", align="center"),
urwid.Padding(self.public_buttons,left=4)
]),
urwid.Pile([
urwid.Text("Cluster Network", align="center"),
urwid.Padding(self.cluster_buttons, left=4)
])
]),
urwid.Divider(),
self.next_btn
]),
valign='top', top=1),
'active_step')
示例8: render_page
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [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')
示例9: open_confirm_prompt
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def open_confirm_prompt(self, callback, title="", content="",
yestxt="Yes", notxt="No", align="center"):
def create_cb(bool):
def res(*k, **a):
callback(bool)
self.close_pop_up()
return res
self.open_pop_up(
urwid.Filler(urwid.Text(content, align=align)),
header=urwid.Text(
title, align='center'),
footer=urwid.Columns([
(urwid.Button(yestxt, create_cb(True))),
(urwid.Button(notxt, create_cb(False))),
]),
height=6,
width=50)
self._pop_up.set_focus("footer")
logger.debug("Confirm prompt text: " + str(content))
示例10: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def __init__(self, optimizer):
self.optimizer = optimizer
self.guidanceOptions = copy.deepcopy(optimizer.humanGuidedATPEOptimizer.guidanceOptions)
self.parameterLockedValueEdits = {}
self.parameterMinEdits = {}
self.parameterMaxEdits = {}
self.statusLabels = {}
self.listWalker = urwid.SimpleListWalker(self.generateGrid())
listbox = urwid.ListBox(self.listWalker)
close_button = urwid.Button("Close")
urwid.connect_signal(close_button, 'click',lambda button: self.close())
buttons = urwid.Filler(urwid.Columns([close_button]))
super(HumanGuidancePopup, self).__init__(makeMountedFrame(urwid.Pile([(5, buttons), listbox]), 'Apply Human Guidance'))
self.optimizer = optimizer
示例11: build_intro
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def build_intro(self):
font = urwid.font.Thin6x6Font()
# NB: Padding with width="clip" will convert the fixed BigText widget
# to a flow widget so it can be used in a Pile.
big_text = "Toot {}".format(__version__)
big_text = urwid.BigText(("intro_bigtext", big_text), font)
big_text = urwid.Padding(big_text, align="center", width="clip")
intro = urwid.Pile([
big_text,
urwid.Divider(),
urwid.Text([
"Maintained by ",
("intro_smalltext", "@ihabunek"),
" and contributors"
], align="center"),
urwid.Divider(),
urwid.Text(("intro_smalltext", "Loading toots..."), align="center"),
])
return urwid.Filler(intro)
示例12: gui_clear
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def gui_clear(self):
self.sncli_loop.widget = urwid.Filler(urwid.Text(''))
self.sncli_loop.draw_screen()
示例13: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def __init__(self, p_view, p_title, p_keymap):
self._view = None
self.keymap = p_keymap
# store a state for multi-key shortcuts (e.g. 'gg')
self.keystate = None
# store offset length for postpone command (e.g. '3' for 'p3w')
self._pp_offset = None
self._title_widget = urwid.Text(p_title, align='center')
self.todolist = urwid.SimpleFocusListWalker([])
self.listbox = urwid.ListBox(self.todolist)
self.view = p_view
pile = urwid.Pile([
(1, urwid.Filler(self._title_widget)),
(1, urwid.Filler(urwid.Divider('\u2500'))),
('weight', 1, self.listbox),
])
pile.focus_position = 2
super().__init__(pile)
urwid.register_signal(TodoListWidget, ['execute_command_silent',
'execute_command',
'refresh',
'add_pending_action',
'remove_pending_action',
'repeat_cmd',
'column_action',
'show_keystate',
'toggle_mark',
])
示例14: _keystate_visible
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def _keystate_visible(self, p_enabled):
contents = self.status_line.contents
if p_enabled and len(contents) == 1:
contents.append((urwid.Filler(self.keystate_widget),
('weight', 1, True)))
elif not p_enabled and self._keystate_visible:
del contents[1]
示例15: __init__
# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import Filler [as 別名]
def __init__(self, app, cb):
self.app = app
self.text = Text("deploying...")
_pile = [
Padding.center_79(self.text),
Padding.line_break(""),
Padding.center_20(self.buttons())
]
super().__init__(Filler(Pile(_pile), valign="middle"))