8000 Merge pull request #59 from pyscript/fpliger/fix_lint · sudhircw/pyscript@3b22aa8 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 3b22aa8

Browse files
authored
Merge pull request pyscript#59 from pyscript/fpliger/fix_lint
remove old code and bypass some warning
2 parents e8d1067 + 4e66764 commit 3b22aa8

16 files changed

+40
-145
lines changed

pyscriptjs/examples/bokeh.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html><head>
22
<title>Bokeh Example</title>
33
<meta charset="iso-8859-1">
4+
<link rel="icon" type="image/x-icon" href="./favicon.png">
45
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js"></script>
56
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js"></script>
67
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js"></script>
@@ -40,11 +41,7 @@ <h1>Bokeh Example</h1>
4041
p.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=15, line_color="navy", fill_color="orange", fill_alpha=0.5)
4142
p_json = json.dumps(json_item(p, "myplot"))
4243

43-
print("about to embed")
44-
4544
Bokeh.embed.embed_item(JSON.parse(p_json))
46-
47-
print ("Done embedding...")
4845
</py-script>
4946

5047
</body>

pyscriptjs/examples/bokeh_interactive.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html><head>
22
<title>Bokeh Example</title>
33
<meta charset="iso-8859-1">
4+
<link rel="icon" type="image/x-icon" href="./favicon.png">
45
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.js"></script>
56
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js"></script>
67
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js"></script>

pyscriptjs/examples/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ <h2 class="text-2xl font-bold text-blue-600"><a href="./panel.html" target=”_b
9090
WARNING: This examples takes a little longer to load. So be patient :)
9191
</p>
9292

93+
<h2 class="text-2xl font-bold text-blue-600"><a href="./panel_deckgl.html" target=”_blank”>NYC Taxi Data Panel DeckGL Demo</a></h2>
94+
<p>Interactive application exploring the NYC Taxi dataset using Panel and DeckGL
95+
96+
WARNING: This examples takes a little longer to load. So be patient :)
97+
</p>
98+
9399
<h2 class="text-2xl font-bold text-blue-600"><a href="./toga/freedom.html" target=”_blank”>Freedom Units!</a></h2>
94100
<p>A Toga application (a Fahrenheit to Celsius converter), rendered as a Single Page App</p>
95101

pyscriptjs/examples/panel.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<head>
33
<title>Panel Example</title>
44
<meta charset="iso-8859-1">
5+
<link rel="icon" type="image/x-icon" href="./favicon.png">
56
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.js"></script>
67
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js"></script>
78
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js"></script>

pyscriptjs/examples/panel_deckgl.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5+
<link rel="icon" type="image/x-icon" href="./favicon.png">
56
<meta name="apple-mobile-web-app-capable" content="yes">
67
<meta name="apple-mobile-web-app-status-bar-style" content="default">
78
<meta name="theme-color" content="#0072b5">

pyscriptjs/examples/panel_kmeans.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5+
<link rel="icon" type="image/x-icon" href="./favicon.png">
56
<meta name="apple-mobile-web-app-capable" content="yes">
67
<meta name="apple-mobile-web-app-status-bar-style" content="default">
78
<meta name="theme-color" content="#000000">

pyscriptjs/examples/panel_stream.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<meta charset="utf-8">
5+
<link rel="icon" type="image/x-icon" href="./favicon.png">
66
<meta name="apple-mobile-web-app-capable" content="yes">
77
<meta name="apple-mobile-web-app-status-bar-style" content="default">
88
<meta name="theme-color" content="#000000">

pyscriptjs/src/App.svelte

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,31 @@
22
import Tailwind from './Tailwind.svelte';
33
import { loadInterpreter } from './interpreter';
44
import {
5-
componentsNavOpen,
65
initializers,
76
loadedEnvironments,
87
mode,
9-
navBarOpen,
108
postInitializers,
119
pyodideLoaded,
1210
scriptsQueue,
1311
} from './stores';
1412
15-
let iconSize = 2;
1613
let pyodideReadyPromise;
1714
18-
function bumpSize(evt) {
19-
iconSize = 4;
20-
}
21-
22-
function downSize(evt) {
23-
iconSize = 2;
24-
}
25-
2615
const initializePyodide = async () => {
2716
pyodideReadyPromise = loadInterpreter();
17+
const pyodide = await pyodideReadyPromise;
2818
let newEnv = {
2919
id: 'a',
3020
promise: pyodideReadyPromise,
21+
runtime: pyodide,
3122
state: 'loading',
3223
};
33-
pyodideLoaded.set(pyodideReadyPromise);
24+
pyodideLoaded.set(pyodide);
25+
3426
loadedEnvironments.update((value: any): any => {
3527
value[newEnv['id']] = newEnv;
3628
});
3729
38-
let showNavBar = false;
39-
let main = document.querySelector('#main');
40-
navBarOpen.subscribe(value => {
41-
showNavBar = value;
42-
});
43-
4430
// now we call all initializers before we actually executed all page scripts
4531
for (let initializer of $initializers) {
4632
await initializer();
@@ -61,10 +47,6 @@
6147
}
6248
}, 3000);
6349
};
64-
65-
function toggleComponentsNavBar(evt) {
66-
componentsNavOpen.set(!$componentsNavOpen);
67-
}
6850
</script>
6951

7052
<svelte:head>

pyscriptjs/src/components/base.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { componentDetailsNavOpen, loadedEnvironments, mode, pyodideLoaded } from '../stores';
1+
import { loadedEnvironments, mode, pyodideLoaded } from '../stores';
22
import { guidGenerator, addClasses } from '../utils';
33
// Premise used to connect to the first available pyodide interpreter
44
let pyodideReadyPromise;
@@ -13,10 +13,6 @@ loadedEnvironments.subscribe(value => {
1313
environments = value;
1414
});
1515

16-
let propertiesNavOpen;
17-
componentDetailsNavOpen.subscribe(value => {
18-
propertiesNavOpen = value;
19-
});
2016

2117
mode.subscribe(value => {
2218
currentMode = value;
@@ -52,7 +48,11 @@ export class BaseEvalElement extends HTMLElement {
5248
this.outputElement.hidden = false;
5349
}
5450

55-
postEvaluate() {}
51+
// subclasses should overwrite this method to define custom logic
52+
// after code has been evaluated
53+
postEvaluate() {
54+
return null;
55+
}
5656

5757
checkId() {
5858
if (!this.id) this.id = this.constructor.name + '-' + guidGenerator();

pyscriptjs/src/components/pybox.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,12 @@ export class PyBox extends HTMLElement {
4949
this.widths.push(`w-${w}`);
5050
}
5151
} else {
52-
for (const el of mainDiv.childNodes) {
53-
this.widths.push(`w-1/${mainDiv.childNodes.length}`);
54-
}
52+
this.widths = [...this.widths, ...[`w-1/${mainDiv.childNodes.length}`]];
5553
}
5654

5755
this.widths.forEach((width, index)=>{
5856
const node: ChildNode = mainDiv.childNodes[index];
59-
addClasses(node, [width, 'mx-4'])
57+
addClasses(node, [width, 'mx-1'])
6058

6159
})
6260

0 commit comments

Comments
 (0)
0