Skip to content

Commit bd2efe4

Browse files
committed
update
1 parent 504579d commit bd2efe4

File tree

2 files changed

+99
-9
lines changed

2 files changed

+99
-9
lines changed

blog/4.8-release.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: "发布 CodeLab Adapter 4.8"
3+
date: 2021-05-07
4+
tags: ["CodeLab"]
5+
Slug: adapter-5-7
6+
---
7+
8+
![](/img/63904194b51c887981829d54dc4d1935.png)
9+
10+
以下是自 4.7 版本以来的主要改进。 具体细节参考[changelog](https://adapter.codelab.club/changelog/)
11+
12+
<!--truncate-->
13+
14+
# 内核(core)更新
15+
16+
[软件更新源(`LATEST_VERSION`)](https://adapter.codelab.club/dev_guide/%E5%AE%9A%E5%88%B6%E4%B8%8E%E5%88%86%E5%8F%91/#_2)可配置,方便定制后二次分发。
17+
18+
## webUI 更新
19+
20+
* 添加可扩展的 webUI extension: [extension_webUI_manager.py](https://github.com/CodeLabClub/codelab_adapter_extensions/blob/master/extensions_v3/extension_webUI_manager.py), 使开发者可以自行扩展 UI 功能。该插件开机自启。
21+
* 使用 [CodeLab 社区创作平台](https://create.codelab.club/projects/editor/) 替代 [scratch beta](https://scratch-beta.codelab.club/)
22+
* 添加打开 host 目录功能
23+
* 系统小图标添加打开主目录( **Open Adapter Home** )菜单按钮
24+
25+
# Python 环境更新
26+
添加 Toio 和 microbit 的 Python 驱动;
27+
28+
你可以直接在 Adapter Jupyterlab 中与 Toio 和 microbit **交互**
29+
30+
<video width='80%' src="https://adapter.codelab.club/video/1620365683263637.mp4" controls="controls"></video>
31+
32+
入门案例可以看 Adapter 内置的 notebooks:
33+
34+
* hello_Toio.ipynb
35+
* hello_microbit.ipynb: 在本地 Python 中与 microbit 实时交互,无需烧入,意味着可以在本地Python程序中,把microbit视为 **活的** 外设
36+
37+
38+
39+
# 插件更新
40+
41+
## Python 插件
42+
[Python 插件](https://adapter.codelab.club/extension_guide/extension_python_kernel/)引入 [requests](https://docs.python-requests.org/zh_CN/latest/)
43+
44+
考虑到网络极为强大,Python 插件允许用户在 Scratch 中直接与 requests 交互(只支持表达式,形如`requests.get(...), requests.post(...)`)。
45+
46+
由于 requests 的 API 极为漂亮(支持链式风格),你几乎可以单个表达式中干绝大多数的事情!
47+
48+
一些典型的用例包括:
49+
50+
* [两个 Adapter 之间的消息通信](https://adapter.codelab.club/user_guide/%E4%B8%8E%E5%A4%96%E9%83%A8%E7%B3%BB%E7%BB%9F%E9%80%9A%E4%BF%A1/#requests)
51+
* 触发 webhook
52+
* 请求[公开的网络 API](https://github.com/public-apis/public-apis)
53+
* 与自己搭建的 web server 交互
54+
55+
### demo
56+
```py
57+
requests.get("http://httpbin.org/get")
58+
# 链式写法
59+
requests.get("http://httpbin.org/get").text
60+
requests.get("http://httpbin.org/get").json()
61+
62+
# 携带参数
63+
requests.get("http://httpbin.org/get", params={"name": "codelab"})
64+
65+
# post
66+
requests.post('http://httpbin.org/post', data = {'key':'value'})
67+
```
68+
69+
### 一些奇怪的想法
70+
* 通过与带有存储能力的 API 结合,可以构建出类似云变量这种东西
71+
* 或者使用 [json-server](https://github.com/typicode/json-server) 临时搭建一个
72+
73+
74+
75+
## OSC 插件
76+
加速 [OSC](https://adapter.codelab.club/extension_guide/osc/) send 的速度, 从 Scratch 发出的消息,延迟在2-3毫秒。
77+
78+
音乐项目对实时性要求很高,为了更好地支持[NeverlandBeats](https://www.codelab.club/blog/2021/04/08/neverlandsle),我们改进了 OSC 机制,缩短消息流转的时间。
79+
80+
## microbit radio 插件
81+
[microbit radio](https://github.com/CodeLabClub/codelab_adapter_extensions/blob/master/extensions_v3/extension_microbit_radio.py#L116) 插件加锁
82+

static/video_config.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@
2424
}
2525
],
2626
"横版视频": [
27+
2728
{
28-
"src": "/img/ToioShowTime.MP4",
29-
"title": "Toio,it's show time!",
29+
"src": "https://adapter.codelab.club/video/1620365dfdf3erf34rf.mp4",
30+
"title": "物理引擎2.0-台球",
3031
"id": "3",
31-
"tags": ["Neverland2"],
32+
"tags": ["物理引擎"],
3233
"weight": ""
3334
},
3435
{
35-
"src": "/img/ShinningforToio.MP4",
36-
"title": "灯光为 Toio",
36+
"src": "https://adapter.codelab.club/video/1620610444486932.mp4",
37+
"title": "gamepad-漂移",
3738
"id": "3",
38-
"tags": ["Neverland2"],
39+
"tags": ["高级编辑器"],
40+
"weight": ""
41+
},
42+
{
43+
"src": "https://adapter.codelab.club/video/1620610446385098.mp4",
44+
"title": "高级编辑器-兼容gamepad",
45+
"id": "3",
46+
"tags": ["高级编辑器"],
3947
"weight": ""
4048
},
4149
{
@@ -68,7 +76,7 @@
6876
},
6977
{
7078
"src": "https://adapter.codelab.club/video/a6b6c0576c150144e1ae0226b7bee8.MP4",
71-
"title": "召唤!",
79+
"title": "召唤变形金刚",
7280
"id": "3",
7381
"tags": [""],
7482
"weight": ""
@@ -82,7 +90,7 @@
8290
},
8391
{
8492
"src": "https://adapter.codelab.club/video/overdrive-ai-demo.MP4",
85-
"title": "四驱兄弟 之 Neverland剧场版 (AI实时训练)",
93+
"title": "四驱兄弟之Neverland剧场版 (AI实时训练)",
8694
"id": "3",
8795
"tags": ["Neverland2"],
8896
"weight": ""
@@ -96,7 +104,7 @@
96104
},
97105
{
98106
"src": "https://adapter.codelab.club/video/08022ae2b5ffe87c68f21ad9dee5ec.MP4",
99-
"title": "3D世界 作为Scratch的舞台",
107+
"title": "3D世界作为Scratch的舞台",
100108
"id": "3",
101109
"tags": [],
102110
"weight": ""

0 commit comments

Comments
 (0)