feat(board): python_pyodide下添加 Teachable Machine (待完善)
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
import { KernelLoader } from '@basthon/kernel-loader';
|
||||
import StatusBarImage from './statusbar-image';
|
||||
import StatusBarFileSystem from './statusbar-filesystem';
|
||||
import StatusBarTool from './statusbar-tool';
|
||||
import LOADER_TEMPLATE from '../templates/html/loader.html';
|
||||
|
||||
|
||||
@@ -55,6 +56,7 @@ export default class PythonShell {
|
||||
this.kernel = kernel;
|
||||
this.statusBarImage = StatusBarImage.init();
|
||||
this.statusBarFileSystem = StatusBarFileSystem.init();
|
||||
this.statusBarTool = StatusBarTool.init();
|
||||
this.pythonShell = new PythonShell();
|
||||
this.pyodide = window.pyodide;
|
||||
this.interruptBuffer = new Uint8Array(new ArrayBuffer(1));
|
||||
|
||||
51
boards/default_src/python_pyodide/others/statusbar-tool.js
Normal file
51
boards/default_src/python_pyodide/others/statusbar-tool.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import $ from 'jquery';
|
||||
import { Msg } from 'blockly/core';
|
||||
import {
|
||||
PageBase,
|
||||
HTMLTemplate,
|
||||
StatusBarsManager,
|
||||
Workspace
|
||||
} from 'mixly';
|
||||
import '../language/loader';
|
||||
import STATUS_BAR_TOOL_TEMPLATE from '../templates/html/statusbar-tool.html';
|
||||
|
||||
|
||||
export default class StatusBarTool extends PageBase {
|
||||
static {
|
||||
HTMLTemplate.add(
|
||||
'html/statusbar/statusbar-tool.html',
|
||||
new HTMLTemplate(STATUS_BAR_TOOL_TEMPLATE)
|
||||
);
|
||||
|
||||
this.init = function () {
|
||||
StatusBarsManager.typesRegistry.register(['tool'], StatusBarTool);
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
const statusBarsManager = mainWorkspace.getStatusBarsManager();
|
||||
statusBarsManager.add({
|
||||
type: 'tool',
|
||||
id: 'tool',
|
||||
name: Msg.PYTHON_PYODIDE_TOOL,
|
||||
title: Msg.PYTHON_PYODIDE_TOOL
|
||||
});
|
||||
statusBarsManager.changeTo('output');
|
||||
return statusBarsManager.get('tool');
|
||||
}
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const $content = $(HTMLTemplate.get('html/statusbar/statusbar-tool.html').render());
|
||||
this.setContent($content);
|
||||
}
|
||||
|
||||
init() {
|
||||
super.init();
|
||||
this.hideCloseBtn();
|
||||
}
|
||||
|
||||
onMounted() { }
|
||||
|
||||
onUnmounted() { }
|
||||
|
||||
resize() { }
|
||||
}
|
||||
Reference in New Issue
Block a user