(code, title)
| 104 | |
| 105 | |
| 106 | def handle_code(code, title): |
| 107 | run_js(CLIPBOARD_SETUP) |
| 108 | session_local.globals = dict(globals()) |
| 109 | if title: |
| 110 | put_markdown('## %s' % title) |
| 111 | |
| 112 | for p in gen_snippets(code): |
| 113 | with use_scope() as scope: |
| 114 | put_code(p, 'python') |
| 115 | |
| 116 | put_buttons( |
| 117 | [t('Run', '运行'), |
| 118 | t("Edit", '编辑'), |
| 119 | t("Copy to clipboard", '复制代码')], |
| 120 | onclick=[ |
| 121 | partial(run_code, code=p, scope=scope), |
| 122 | partial(playground, code=p), |
| 123 | partial(copytoclipboard, code=p) |
| 124 | ] |
| 125 | ) |
| 126 | |
| 127 | put_markdown('----') |
| 128 | |
| 129 | |
| 130 | def get_app(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…