Update: 移除python_pyodide中的 人工智能 和 图像处理
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -134,35 +134,35 @@ div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(15) > div.blo
|
|||||||
background:url('../../../../common/media/mark/turtle2.png') no-repeat;
|
background:url('../../../../common/media/mark/turtle2.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
/* div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/ai.png') no-repeat;
|
background:url('../../../../common/media/mark/ai.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/ai2.png') no-repeat;
|
background:url('../../../../common/media/mark/ai2.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
} */
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(17) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/data.png') no-repeat;
|
background:url('../../../../common/media/mark/data.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(17) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(16) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/data2.png') no-repeat;
|
background:url('../../../../common/media/mark/data2.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(18) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
/* div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(18) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/cv.png') no-repeat;
|
background:url('../../../../common/media/mark/cv.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(18) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(18) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/cv2.png') no-repeat;
|
background:url('../../../../common/media/mark/cv2.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
} */
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(19) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(17) > div.blocklyTreeRow > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/algorithm.png') no-repeat;
|
background:url('../../../../common/media/mark/algorithm.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(19) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
div.blocklyToolboxDiv > div.blocklyToolboxContents > div:nth-child(17) > div.blocklyTreeRow.blocklyTreeSelected > div.blocklyTreeRowContentContainer > span.blocklyTreeIcon{
|
||||||
background:url('../../../../common/media/mark/algorithm2.png') no-repeat;
|
background:url('../../../../common/media/mark/algorithm2.png') no-repeat;
|
||||||
background-size: 100% auto;
|
background-size: 100% auto;
|
||||||
}
|
}
|
||||||
@@ -54,114 +54,114 @@ class StatusBarImage extends PageBase {
|
|||||||
let canvas = null;
|
let canvas = null;
|
||||||
let iframe = null;
|
let iframe = null;
|
||||||
switch (data.display_type) {
|
switch (data.display_type) {
|
||||||
case 'p5':
|
case 'p5':
|
||||||
root.style.width = '100%';
|
root.style.width = '100%';
|
||||||
root.style.height = '100%';
|
root.style.height = '100%';
|
||||||
root.style.display = 'flex';
|
root.style.display = 'flex';
|
||||||
root.style.justifyContent = 'center';
|
root.style.justifyContent = 'center';
|
||||||
root.style.alignItems = 'center';
|
root.style.alignItems = 'center';
|
||||||
|
|
||||||
// some canvas nodes can be added later so we observe...
|
// some canvas nodes can be added later so we observe...
|
||||||
new MutationObserver(function (mutationsList) {
|
new MutationObserver(function (mutationsList) {
|
||||||
mutationsList.forEach((mutation) =>
|
mutationsList.forEach((mutation) =>
|
||||||
mutation.addedNodes.forEach((node) => {
|
mutation.addedNodes.forEach((node) => {
|
||||||
const elem = node;
|
const elem = node;
|
||||||
if (
|
if (
|
||||||
elem.tagName != null &&
|
elem.tagName != null &&
|
||||||
['canvas', 'video'].includes(elem.tagName.toLowerCase())
|
['canvas', 'video'].includes(elem.tagName.toLowerCase())
|
||||||
)
|
)
|
||||||
autoFit(elem);
|
autoFit(elem);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}).observe(root, { childList: true });
|
}).observe(root, { childList: true });
|
||||||
|
|
||||||
root.querySelectorAll('canvas,video').forEach(autoFit);
|
root.querySelectorAll('canvas,video').forEach(autoFit);
|
||||||
$content.append(root);
|
$content.append(root);
|
||||||
break;
|
break;
|
||||||
case 'matplotlib':
|
case 'matplotlib':
|
||||||
canvas = root.querySelector('canvas');
|
canvas = root.querySelector('canvas');
|
||||||
if (canvas) root = canvas;
|
if (canvas) root = canvas;
|
||||||
root.style.width = '';
|
root.style.width = '';
|
||||||
root.style.height = '';
|
root.style.height = '';
|
||||||
root.style.maxWidth = '100%';
|
root.style.maxWidth = '100%';
|
||||||
root.style.maxHeight = '100%';
|
root.style.maxHeight = '100%';
|
||||||
$content.append(root);
|
$content.append(root);
|
||||||
break;
|
break;
|
||||||
case 'ocaml-canvas':
|
case 'ocaml-canvas':
|
||||||
root.style.width = '';
|
root.style.width = '';
|
||||||
root.style.height = '';
|
root.style.height = '';
|
||||||
root.style.maxWidth = '100%';
|
root.style.maxWidth = '100%';
|
||||||
root.style.maxHeight = '100%';
|
root.style.maxHeight = '100%';
|
||||||
$content.append(root);
|
$content.append(root);
|
||||||
break;
|
break;
|
||||||
case 'turtle':
|
case 'turtle':
|
||||||
// Turtle result
|
// Turtle result
|
||||||
root.setAttribute('width', '100%');
|
root.setAttribute('width', '100%');
|
||||||
root.setAttribute('height', '100%');
|
root.setAttribute('height', '100%');
|
||||||
$content.append(root.outerHTML);
|
$content.append(root.outerHTML);
|
||||||
break;
|
break;
|
||||||
case 'sympy':
|
case 'sympy':
|
||||||
$content.append(data.content);
|
$content.append(data.content);
|
||||||
if (typeof window.MathJax === 'undefined') {
|
if (typeof window.MathJax === 'undefined') {
|
||||||
// dynamically loading MathJax
|
// dynamically loading MathJax
|
||||||
console.log('Loading MathJax (Sympy expression needs it).');
|
console.log('Loading MathJax (Sympy expression needs it).');
|
||||||
(function () {
|
(function () {
|
||||||
let script = document.createElement('script');
|
let script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.src =
|
script.src =
|
||||||
'https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-mml-chtml.js';
|
'https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-mml-chtml.js';
|
||||||
document.getElementsByTagName('head')[0].appendChild(script);
|
document.getElementsByTagName('head')[0].appendChild(script);
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
// otherwise, render it
|
// otherwise, render it
|
||||||
window.MathJax.typeset();
|
window.MathJax.typeset();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'multiple':
|
case 'multiple':
|
||||||
/* typically dispached by display() */
|
/* typically dispached by display() */
|
||||||
for (let mime of [
|
for (let mime of [
|
||||||
'image/svg+xml',
|
'image/svg+xml',
|
||||||
'image/png',
|
'image/png',
|
||||||
'text/html',
|
'text/html',
|
||||||
'text/plain',
|
'text/plain',
|
||||||
]) {
|
]) {
|
||||||
if (mime in data.content) {
|
if (mime in data.content) {
|
||||||
let content = data.content[mime];
|
let content = data.content[mime];
|
||||||
if (mime === 'image/png') {
|
if (mime === 'image/png') {
|
||||||
content =
|
content =
|
||||||
'<img src="data:image/png;base64,' +
|
'<img src="data:image/png;base64,' +
|
||||||
content +
|
content +
|
||||||
'" style="max-width: 100%; max-height: 100%;">';
|
'" style="max-width: 100%; max-height: 100%;">';
|
||||||
|
}
|
||||||
|
$content.append(content);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$content.append(content);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case 'tutor':
|
||||||
case 'tutor':
|
// hacky but iframe.document.body.style require to wait for
|
||||||
// hacky but iframe.document.body.style require to wait for
|
// iframe loading
|
||||||
// iframe loading
|
$content.append($(data.content.replace('overflow-y%3A%20hidden%3B', '')));
|
||||||
$content.append($(data.content.replace('overflow-y%3A%20hidden%3B', '')));
|
iframe = this.getContent()[0].getElementsByTagName('iframe')[0];
|
||||||
iframe = this.getContent()[0].getElementsByTagName('iframe')[0];
|
if (iframe == null) return;
|
||||||
if (iframe == null) return;
|
// trick to avoid taking height update into account
|
||||||
// trick to avoid taking height update into account
|
iframe.style.maxHeight = iframe.style.minHeight = '100%';
|
||||||
iframe.style.maxHeight = iframe.style.minHeight = '100%';
|
|
||||||
|
|
||||||
// force rendering when visible,
|
// force rendering when visible,
|
||||||
// otherwise, strange things happends
|
// otherwise, strange things happends
|
||||||
// since PythonTutor check for visibility at some point
|
// since PythonTutor check for visibility at some point
|
||||||
new IntersectionObserver((entries, observer) => {
|
new IntersectionObserver((entries, observer) => {
|
||||||
const entry = entries[0];
|
const entry = entries[0];
|
||||||
if (entry && !entry.isIntersecting) return;
|
if (entry && !entry.isIntersecting) return;
|
||||||
iframe.contentWindow?.postMessage({ type: 'redraw' }, '*');
|
iframe.contentWindow?.postMessage({ type: 'redraw' }, '*');
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}).observe(iframe);
|
}).observe(iframe);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(
|
console.error(
|
||||||
`Not supported node type '${data.display_type}' in eval.display result processing.`
|
`Not supported node type '${data.display_type}' in eval.display result processing.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2210,7 +2210,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
</category>
|
</category>
|
||||||
<category id="catAI" colour="205">
|
<!-- <category id="catAI" colour="205">
|
||||||
<block type="AI_ChooseAndGet">
|
<block type="AI_ChooseAndGet">
|
||||||
</block>
|
</block>
|
||||||
<block type="AI_audio">
|
<block type="AI_audio">
|
||||||
@@ -2429,7 +2429,7 @@
|
|||||||
</block>
|
</block>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
</category>
|
</category> -->
|
||||||
<category id="catData" colour="170">
|
<category id="catData" colour="170">
|
||||||
<block type="variables_set">
|
<block type="variables_set">
|
||||||
<field name="VAR">df1</field>
|
<field name="VAR">df1</field>
|
||||||
@@ -3097,7 +3097,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
</category>
|
</category>
|
||||||
<category id="catCv" colour="f0a559">
|
<!-- <category id="catCv" colour="f0a559">
|
||||||
<block type="variables_set">
|
<block type="variables_set">
|
||||||
<field name="VAR">img</field>
|
<field name="VAR">img</field>
|
||||||
<value name="VALUE">
|
<value name="VALUE">
|
||||||
@@ -3292,7 +3292,7 @@
|
|||||||
</shadow>
|
</shadow>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
</category>
|
</category> -->
|
||||||
<category id="catsklearn" colour="80">
|
<category id="catsklearn" colour="80">
|
||||||
<block type="sklearn_make_classification">
|
<block type="sklearn_make_classification">
|
||||||
<value name="n_samples">
|
<value name="n_samples">
|
||||||
|
|||||||
Reference in New Issue
Block a user