本文整理汇总了Python中pyte.Screen类的典型用法代码示例。如果您正苦于以下问题:Python Screen类的具体用法?Python Screen怎么用?Python Screen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Screen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_report_device_attributes
def test_report_device_attributes():
screen = Screen(10, 10)
acc = []
screen.write_process_input = acc.append
screen.report_device_attributes()
assert acc.pop() == ctrl.CSI + "?6c"
开发者ID:aurelien-rainone,项目名称:pyte,代码行数:7,代码来源:test_screen.py
示例2: test_remove_non_existant_attribute
def test_remove_non_existant_attribute():
screen = Screen(2, 2)
assert screen == [[screen.default_char, screen.default_char]] * 2
screen.select_graphic_rendition(24) # underline-off.
assert screen == [[screen.default_char, screen.default_char]] * 2
assert not screen.cursor.attrs.underscore
开发者ID:heinrich5991,项目名称:pyte,代码行数:7,代码来源:test_screen.py
示例3: test_draw_wcwidth
def test_draw_wcwidth():
# Example from https://github.com/selectel/pyte/issues/9
screen = Screen(10, 1)
for char in "コンニチハ":
screen.draw(char)
assert screen.cursor.x == screen.columns
开发者ID:mrdon,项目名称:pyte,代码行数:7,代码来源:test_screen.py
示例4: test_backspace
def test_backspace():
screen = Screen(2, 2)
assert screen.cursor.x == 0
screen.backspace()
assert screen.cursor.x == 0
screen.cursor.x = 1
screen.backspace()
assert screen.cursor.x == 0
开发者ID:heinrich5991,项目名称:pyte,代码行数:8,代码来源:test_screen.py
示例5: test_restore_cursor_with_none_saved
def test_restore_cursor_with_none_saved():
screen = Screen(10, 10)
screen.set_mode(mo.DECOM)
screen.cursor.x, screen.cursor.y = 5, 5
screen.restore_cursor()
assert (screen.cursor.y, screen.cursor.x) == (0, 0)
assert mo.DECOM not in screen.mode
开发者ID:heinrich5991,项目名称:pyte,代码行数:8,代码来源:test_screen.py
示例6: test_multi_attribs
def test_multi_attribs():
screen = Screen(2, 2)
assert screen == [[screen.default_char, screen.default_char]] * 2
screen.select_graphic_rendition(1)
screen.select_graphic_rendition(3)
assert screen.cursor.attrs.bold
assert screen.cursor.attrs.italics
开发者ID:heinrich5991,项目名称:pyte,代码行数:8,代码来源:test_screen.py
示例7: test_private_report_device_attributes
def test_private_report_device_attributes():
# Some console apps (e.g. ADOM) might add ``?`` to the DA request,
# even though the VT102/VT220 spec does not allow this.
screen = Screen(10, 10)
stream = Stream(screen)
acc = []
screen.write_process_input = acc.append
stream.feed(ctrl.CSI + b"?0c")
assert acc.pop() == ctrl.CSI + b"?6c"
开发者ID:donfanning,项目名称:pyte,代码行数:10,代码来源:test_screen.py
示例8: test_colors
def test_colors():
screen = Screen(2, 2)
screen.select_graphic_rendition(30)
screen.select_graphic_rendition(40)
assert screen.cursor.attrs.fg == "black"
assert screen.cursor.attrs.bg == "black"
screen.select_graphic_rendition(31)
assert screen.cursor.attrs.fg == "red"
assert screen.cursor.attrs.bg == "black"
开发者ID:donfanning,项目名称:pyte,代码行数:11,代码来源:test_screen.py
示例9: test_reset_resets_colors
def test_reset_resets_colors():
screen = Screen(2, 2)
assert screen == [[screen.default_char, screen.default_char]] * 2
screen.select_graphic_rendition(30)
screen.select_graphic_rendition(40)
assert screen.cursor.attrs.fg == "black"
assert screen.cursor.attrs.bg == "black"
screen.select_graphic_rendition(0)
assert screen.cursor.attrs == screen.default_char
开发者ID:heinrich5991,项目名称:pyte,代码行数:11,代码来源:test_screen.py
示例10: test_colors
def test_colors():
screen = Screen(2, 2)
assert screen == [[screen.default_char, screen.default_char]] * 2
screen.select_graphic_rendition(30) # black foreground
screen.select_graphic_rendition(40) # black background
assert screen.cursor.attrs.fg == "black"
assert screen.cursor.attrs.bg == "black"
screen.select_graphic_rendition(31) # red foreground
assert screen.cursor.attrs.fg == "red"
assert screen.cursor.attrs.bg == "black"
开发者ID:heinrich5991,项目名称:pyte,代码行数:12,代码来源:test_screen.py
示例11: test_attributes
def test_attributes():
screen = Screen(2, 2)
assert screen == [[screen.default_char, screen.default_char]] * 2
screen.select_graphic_rendition(1) # Bold
# Still default, since we haven't written anything.
assert screen == [[screen.default_char, screen.default_char]] * 2
assert screen.cursor.attrs.bold
screen.draw("f")
assert screen == [
[Char("f", "default", "default", bold=True), screen.default_char],
[screen.default_char, screen.default_char]
]
开发者ID:heinrich5991,项目名称:pyte,代码行数:14,代码来源:test_screen.py
示例12: test_hide_cursor
def test_hide_cursor():
screen = Screen(10, 10)
# DECTCEM is set by default.
assert mo.DECTCEM in screen.mode
assert not screen.cursor.hidden
# a) resetting DECTCEM hides the cursor.
screen.reset_mode(mo.DECTCEM)
assert screen.cursor.hidden
# b) ... and it's back!
screen.set_mode(mo.DECTCEM)
assert not screen.cursor.hidden
开发者ID:heinrich5991,项目名称:pyte,代码行数:14,代码来源:test_screen.py
示例13: test_draw_cp437
def test_draw_cp437():
screen = Screen(5, 1)
assert screen.charset == 0
screen.define_charset(b"U", b"(")
screen.select_other_charset(b"@")
screen.draw("α ± ε".encode("cp437"))
assert screen.display == ["α ± ε"]
开发者ID:donfanning,项目名称:pyte,代码行数:9,代码来源:test_screen.py
示例14: test_screen_set_icon_name_title
def test_screen_set_icon_name_title():
screen = Screen(10, 1)
screen.select_other_charset(b"@")
text = "±"
screen.set_icon_name(text.encode("latin-1"))
assert screen.icon_name == text
screen.set_title(text.encode("latin-1"))
assert screen.title == text
开发者ID:donfanning,项目名称:pyte,代码行数:10,代码来源:test_screen.py
示例15: test_colors24bit
def test_colors24bit():
screen = Screen(2, 2)
# a) OK-case
screen.select_graphic_rendition(38, 2, 0, 0, 0)
screen.select_graphic_rendition(48, 2, 255, 255, 255)
assert screen.cursor.attrs.fg == "000000"
assert screen.cursor.attrs.bg == "ffffff"
# b) invalid color.
screen.select_graphic_rendition(48, 2, 255)
开发者ID:donfanning,项目名称:pyte,代码行数:11,代码来源:test_screen.py
示例16: test_colors256
def test_colors256():
screen = Screen(2, 2)
# a) OK-case.
screen.select_graphic_rendition(38, 5, 0)
screen.select_graphic_rendition(48, 5, 15)
assert screen.cursor.attrs.fg == "000000"
assert screen.cursor.attrs.bg == "ffffff"
# b) invalid color.
screen.select_graphic_rendition(48, 5, 100500)
开发者ID:donfanning,项目名称:pyte,代码行数:11,代码来源:test_screen.py
示例17: test_colors_ignore_invalid
def test_colors_ignore_invalid():
screen = Screen(2, 2)
default_attrs = screen.cursor.attrs
screen.select_graphic_rendition(100500)
assert screen.cursor.attrs == default_attrs
screen.select_graphic_rendition(38, 100500)
assert screen.cursor.attrs == default_attrs
screen.select_graphic_rendition(48, 100500)
assert screen.cursor.attrs == default_attrs
开发者ID:donfanning,项目名称:pyte,代码行数:12,代码来源:test_screen.py
示例18: test_alignment_display
def test_alignment_display():
screen = Screen(5, 5)
screen.draw("a")
screen.linefeed()
screen.linefeed()
screen.draw("b")
assert screen.display == ["a ",
" ",
"b ",
" ",
" "]
screen.alignment_display()
assert screen.display == ["EEEEE",
"EEEEE",
"EEEEE",
"EEEEE",
"EEEEE"]
开发者ID:YuriyNasretdinov,项目名称:pyte,代码行数:20,代码来源:test_screen.py
示例19: test_select_other_charset
def test_select_other_charset():
screen = Screen(3, 3)
assert screen.use_utf8 # on by default.
# a) disable utf-8
screen.select_other_charset(b"@")
assert not screen.use_utf8
# b) unknown code -- noop
screen.select_other_charset(b"X")
assert not screen.use_utf8
# c) enable utf-8
screen.select_other_charset(b"G")
assert screen.use_utf8
开发者ID:donfanning,项目名称:pyte,代码行数:15,代码来源:test_screen.py
示例20: test_report_device_attributes
def test_report_device_attributes():
screen = Screen(10, 10)
acc = []
screen.write_process_input = acc.append
# a) noop
screen.report_device_attributes(42)
assert not acc
# b) OK case
screen.report_device_attributes()
assert acc.pop() == ctrl.CSI + "?6c"
开发者ID:mrdon,项目名称:pyte,代码行数:13,代码来源:test_screen.py
注:本文中的pyte.Screen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论