本文整理汇总了Python中urwid.Frame.keypress方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.keypress方法的具体用法?Python Frame.keypress怎么用?Python Frame.keypress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类urwid.Frame
的用法示例。
在下文中一共展示了Frame.keypress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keypress
# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import keypress [as 别名]
def keypress(self, size, key):
""" Signal binding for NodeViewMode
Keys:
* F5 - Refreshes the node list
"""
if key == 'f5':
self.ticks_left = 0
return Frame.keypress(self, size, key)
示例2: Client
# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import keypress [as 别名]
#.........这里部分代码省略.........
This event is triggered by the ``IRC`` Protocol Component when we have
received an IRC Numberic Event from server we are connected to.
"""
if numeric == ERR_NICKNAMEINUSE:
self.fire(NICK("{0:s}_".format(args[0])))
elif numeric in (RPL_ENDOFMOTD, ERR_NOMOTD):
self.fire(JOIN(self.ircchannel))
@handler("stopped", channel="*")
def _on_stopped(self, component):
self.screen.stop()
@handler("generate_events")
def _on_generate_events(self, event):
event.reduce_time_left(0)
size = self.screen.get_cols_rows()
if not select(
self.screen.get_input_descriptors(), [], [], 0.1)[0] == []:
timeout, keys, raw = self.screen.get_input_nonblocking()
for k in keys:
if k == "window resize":
size = self.screen.get_cols_rows()
continue
elif k == "enter":
self.processCommand(self.input.get_edit_text())
self.input.set_edit_text("")
continue
self.top.keypress(size, k)
self.input.set_edit_text(self.input.get_edit_text() + k)
self.update_screen(size)
def unknownCommand(self, command):
self.lines.append(Text("Unknown command: %s" % command))
def syntaxError(self, command, args, expected):
self.lines.append(
Text("Syntax error ({0:s}): {1:s} Expected: {2:s}".format(
command, args, expected)
)
)
def processCommand(self, s): # noqa
match = CMD_REGEX.match(s)
if match is not None:
command = match.groupdict()["command"]
if not match.groupdict()["args"] == "":
tokens = match.groupdict()["args"].split(" ")
else:
tokens = []
fn = "cmd" + command.upper()
if hasattr(self, fn):
f = getattr(self, fn)
if callable(f):
args, vargs, kwargs, default = getargspec(f)
args.remove("self")