view_plugin.py

来自「这是一个支持向量机的代码」· Python 代码 · 共 29 行

PY
29
字号
from common_interface import File, ImageFileimport ViewTextFrame, ViewImageFrameplugin_name  = "Viewer"def create(callback):    return Viewer(callback)def show(input):    if isinstance(input, ImageFile):        f = ViewImageFrame.create(None)        f.set_image(input.pathname)        f.Show()    else:        f = ViewTextFrame.create(None)        f.set_text(open(input.pathname).read())        f.Show()class Viewer:    input_description = [('input', File)]    output_description = [('output', None)]    def __init__(self,callback):        self.callback = callback    def run(self,input):        self.callback.run(lambda: show(input))        return {'output': input}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?