show_documentation.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:blackmamba 作者: zrzka 项目源码 文件源码
def _show_documentation(definition):
    reuse = get_config_value('documentation.reuse', True)
    frame = get_config_value('documentation.frame', (630, 110, 730, 350))
    tag = '__blackmamba.show_documentation'
    if not reuse:
        tag += ':{}'.format(definition.full_name)

    manager = overlay.get_manager()

    o = manager.get_overlay(tag)
    if o:
        o.title = definition.name
        o.content_view.text = definition.docstring()
        o.expand()
        o.become_active()
        return

    tv = ui.TextView(
        text=definition.docstring(),
        background_color=get_theme_value('background_color'),
        text_color=get_theme_value('text_color'),
        font=get_editor_font()
    )
    tv.editable = False

    window_size = ui.get_window_size()
    x = frame[0]
    y = frame[1]
    width = min(window_size[0] - x - 12, frame[2])
    height = min(window_size[1] - y - 12, frame[3])
    manager.present(definition.name, tv, frame=(x, y, width, height), tag=tag)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号