• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyte.Screen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pytesseract.image_to_string函数代码示例发布时间:2022-05-27
下一篇:
Python hq.TdxHq_API类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap