本文整理汇总了Python中tty.VMIN属性的典型用法代码示例。如果您正苦于以下问题:Python tty.VMIN属性的具体用法?Python tty.VMIN怎么用?Python tty.VMIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tty
的用法示例。
在下文中一共展示了tty.VMIN属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _enterRawMode
# 需要导入模块: import tty [as 别名]
# 或者: from tty import VMIN [as 别名]
def _enterRawMode():
global _inRawMode, _savedRawMode
if _inRawMode:
return
fd = sys.stdin.fileno()
try:
old = tty.tcgetattr(fd)
new = old[:]
except:
log.msg('not a typewriter!')
else:
# iflage
new[0] = new[0] | tty.IGNPAR
new[0] = new[0] & ~(tty.ISTRIP | tty.INLCR | tty.IGNCR | tty.ICRNL |
tty.IXON | tty.IXANY | tty.IXOFF)
if hasattr(tty, 'IUCLC'):
new[0] = new[0] & ~tty.IUCLC
# lflag
new[3] = new[3] & ~(tty.ISIG | tty.ICANON | tty.ECHO | tty.ECHO |
tty.ECHOE | tty.ECHOK | tty.ECHONL)
if hasattr(tty, 'IEXTEN'):
new[3] = new[3] & ~tty.IEXTEN
#oflag
new[1] = new[1] & ~tty.OPOST
new[6][tty.VMIN] = 1
new[6][tty.VTIME] = 0
_savedRawMode = old
tty.tcsetattr(fd, tty.TCSANOW, new)
#tty.setraw(fd)
_inRawMode = 1
示例2: main
# 需要导入模块: import tty [as 别名]
# 或者: from tty import VMIN [as 别名]
def main(raw_args):
parser = argparse.ArgumentParser(
description="Use your keyboard as your phone's keyboard.")
logging_common.AddLoggingArguments(parser)
script_common.AddDeviceArguments(parser)
args = parser.parse_args(raw_args)
logging_common.InitializeLogging(args)
devices = script_common.GetDevices(args.devices, None)
if len(devices) > 1:
raise MultipleDevicesError(devices)
def next_char():
while True:
yield sys.stdin.read(1)
try:
fd = sys.stdin.fileno()
# See man 3 termios for more info on what this is doing.
old_attrs = termios.tcgetattr(fd)
new_attrs = copy.deepcopy(old_attrs)
new_attrs[tty.LFLAG] = new_attrs[tty.LFLAG] & ~(termios.ICANON)
new_attrs[tty.CC][tty.VMIN] = 1
new_attrs[tty.CC][tty.VTIME] = 0
termios.tcsetattr(fd, termios.TCSAFLUSH, new_attrs)
Keyboard(devices[0], next_char())
finally:
termios.tcsetattr(fd, termios.TCSAFLUSH, old_attrs)
return 0
示例3: _enterRawMode
# 需要导入模块: import tty [as 别名]
# 或者: from tty import VMIN [as 别名]
def _enterRawMode():
global _inRawMode, _savedMode
if _inRawMode:
return
fd = sys.stdin.fileno()
try:
old = tty.tcgetattr(fd)
new = old[:]
except:
log.msg('not a typewriter!')
else:
# iflage
new[0] = new[0] | tty.IGNPAR
new[0] = new[0] & ~(tty.ISTRIP | tty.INLCR | tty.IGNCR | tty.ICRNL |
tty.IXON | tty.IXANY | tty.IXOFF)
if hasattr(tty, 'IUCLC'):
new[0] = new[0] & ~tty.IUCLC
# lflag
new[3] = new[3] & ~(tty.ISIG | tty.ICANON | tty.ECHO | tty.ECHO |
tty.ECHOE | tty.ECHOK | tty.ECHONL)
if hasattr(tty, 'IEXTEN'):
new[3] = new[3] & ~tty.IEXTEN
#oflag
new[1] = new[1] & ~tty.OPOST
new[6][tty.VMIN] = 1
new[6][tty.VTIME] = 0
_savedMode = old
tty.tcsetattr(fd, tty.TCSANOW, new)
#tty.setraw(fd)
_inRawMode = 1
示例4: _enterRawMode
# 需要导入模块: import tty [as 别名]
# 或者: from tty import VMIN [as 别名]
def _enterRawMode():
global _inRawMode, _savedMode
if _inRawMode:
return
fd = sys.stdin.fileno()
try:
old = tty.tcgetattr(fd)
new = old[:]
except:
log.msg('not a typewriter!')
else:
# iflage
new[0] = new[0] | tty.IGNPAR
new[0] = new[0] & ~(tty.ISTRIP | tty.INLCR | tty.IGNCR | tty.ICRNL |
tty.IXON | tty.IXANY | tty.IXOFF)
if hasattr(tty, 'IUCLC'):
new[0] = new[0] & ~tty.IUCLC
# lflag
new[3] = new[3] & ~(tty.ISIG | tty.ICANON | tty.ECHO | tty.ECHO |
tty.ECHOE | tty.ECHOK | tty.ECHONL)
if hasattr(tty, 'IEXTEN'):
new[3] = new[3] & ~tty.IEXTEN
#oflag
new[1] = new[1] & ~tty.OPOST
new[6][tty.VMIN] = 1
new[6][tty.VTIME] = 0
_savedMode = old
tty.tcsetattr(fd, tty.TCSANOW, new)
#tty.setraw(fd)
_inRawMode = 1