Updated README file with explanations to run the program
This commit is contained in:
1 parent
069686c84d
commit
ae5df4f12f
41 files changed
+7061
No files matched your search
@@ -3,3 +3,29 @@
|
||||
This is my attempt at building Conway's game of life in multiple languages.
|
||||
|
||||
My first attempt is to do it in Python using Pygame and other libraries. I do plan on showcasing these on my website.
|
||||
|
||||
## Running with Python
|
||||
|
||||
To run the Python version I recommend that you set up a python virtual environment, you can do this with the following command
|
||||
|
||||
`python<version> -m venv /path/to/virtual/environment`
|
||||
|
||||
After that you can use it to run the program and pip installs to get the libraries.
|
||||
|
||||
### Installing dependencies
|
||||
|
||||
The following commands should install any dependencies and ensure you are ready to run the program.
|
||||
|
||||
`pip install --upgrade pip` - This will update pip to the version compatible with the virtual environment.
|
||||
|
||||
`pip install pygame pygame-menu pygbag numpy importlib` - This will install the dependencies needed for the project.
|
||||
|
||||
### Running the program
|
||||
|
||||
Running the program is fairly simple.
|
||||
|
||||
Starting the program can be done with the following command:
|
||||
|
||||
`python<version> -m src.main`
|
||||
|
||||
Once running the menu is fairly simple and some parts do not work at the moment. However once in game the right mouse will remove a cell and a left click will create a cell. To start the simulation you press the return button, this will prevent you from making new cells. the same button will stop the simulation in place. To clear the screen and stop the simulation if running simply press C. Escape will pause the game but the simulation will not stop. To exit press escape and follow prompts to quit the game.
|
||||
@@ -0,0 +1 @@
|
||||
0.9.2
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,489 @@
|
||||
<html lang="en-us"><script src="{{cookiecutter.cdn}}pythons.js" type=module id=site data-LINES={{cookiecutter.LINES}} data-CONSOLE={{cookiecutter.CONSOLE}} data-python=python{{cookiecutter.PYBUILD}} data-os=vtx,fs,snd,gui async defer>#<!--
|
||||
|
||||
print("""
|
||||
Loading {{cookiecutter.title}} from {{cookiecutter.archive}}.apk
|
||||
Pygbag Version : {{cookiecutter.version}}
|
||||
Template Version : 0.9.0
|
||||
Python : {{cookiecutter.PYBUILD}}
|
||||
CDN URL : {{cookiecutter.cdn}}
|
||||
Screen : {{cookiecutter.width}}x{{cookiecutter.height}}
|
||||
Title : {{cookiecutter.title}}
|
||||
Folder : {{cookiecutter.directory}}
|
||||
Authors : {{cookiecutter.authors}}
|
||||
SPDX-License-Identifier: {{cookiecutter.spdx}}
|
||||
|
||||
""")
|
||||
|
||||
|
||||
# screen pixels (real, hardware)
|
||||
WIDTH=1024 # {{cookiecutter.width}}
|
||||
HEIGHT=600 # {{cookiecutter.height}}
|
||||
|
||||
# reference/idealized screen pixels
|
||||
REFX = 1980
|
||||
REFY = 1080
|
||||
|
||||
def u(real, ref, v):
|
||||
if abs(v)<0.9999999:
|
||||
result = int( (float(real)/100.0) * (v*1000))
|
||||
if v<0:
|
||||
return real-result
|
||||
return result
|
||||
return int( (real/ref) * v )
|
||||
|
||||
def ux(*argv):
|
||||
global WIDTH, REFX
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(WIDTH, REFX, v)
|
||||
return acc
|
||||
|
||||
def uy(*argv):
|
||||
global HEIGHT, REFY
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(HEIGHT, REFY, v)
|
||||
return acc
|
||||
|
||||
|
||||
|
||||
|
||||
# do not rename
|
||||
async def custom_site():
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import platform
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
import embed
|
||||
|
||||
|
||||
platform.document.body.style.background = "#7f7f7f"
|
||||
|
||||
import pygame
|
||||
|
||||
def compose():
|
||||
pygame.display.update()
|
||||
window.chromakey(None, *screen.get_colorkey(), 40)
|
||||
|
||||
pygame.init()
|
||||
pygame.font.init()
|
||||
|
||||
screen = pygame.display.set_mode([ux(.100),uy(.100)], pygame.SRCALPHA, 32)
|
||||
screen.set_colorkey( (0,0,0,0), pygame.RLEACCEL )
|
||||
screen.fill( (0,0,0,0) )
|
||||
|
||||
compose()
|
||||
|
||||
platform.window.transfer.hidden = true
|
||||
platform.window.canvas.style.visibility = "visible"
|
||||
|
||||
|
||||
|
||||
apk = "{{cookiecutter.archive}}.apk"
|
||||
|
||||
bundle = "{{cookiecutter.archive}}"
|
||||
|
||||
# the C or js loader could do that but be explicit.
|
||||
appdir = Path(f"/data/data/{bundle}") # /data/data/{{cookiecutter.archive}}
|
||||
appdir.mkdir()
|
||||
|
||||
|
||||
# mount apk
|
||||
|
||||
cfg = {
|
||||
"io": "url",
|
||||
"type":"mount",
|
||||
"mount" : {
|
||||
"point" : appdir.as_posix(),
|
||||
"path" : "/",
|
||||
},
|
||||
"path" : f"/ => {appdir.as_posix()}",
|
||||
}
|
||||
|
||||
|
||||
track = platform.window.MM.prepare(apk, json.dumps(cfg))
|
||||
|
||||
marginx = ux(.020) # 20%
|
||||
marginy = uy(.045) # 45%
|
||||
|
||||
|
||||
def pg_bar(pos):
|
||||
nonlocal marginx, marginy
|
||||
# resolution of progress bar, recalculate since it may not be know yet.
|
||||
total = track.len or 10 # avoid div0
|
||||
slot = ux(.060)/ total # 60%
|
||||
|
||||
pygame.draw.rect(screen,(10,10,10),( marginx-ux(10), marginy-uy(10), (total*slot)+ux(20), uy(110) ) )
|
||||
pygame.draw.rect(screen,(0,255,0), ( marginx, marginy, track.pos*slot, uy(90)) )
|
||||
|
||||
# wait until zip mount + overlayfs is complete
|
||||
while not track.ready:
|
||||
pg_bar(track.pos)
|
||||
compose()
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# fill it up in case it was cached and instant download
|
||||
pg_bar(track.len)
|
||||
compose()
|
||||
|
||||
|
||||
# preloader will change dir and prepend it to sys.path
|
||||
platform.run_main(PyConfig, loaderhome= appdir / "assets", loadermain=None)
|
||||
|
||||
|
||||
# wait preloading complete
|
||||
# that includes images and wasm compilation of bundled modules
|
||||
while embed.counter()<0:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
main = appdir / "assets" / "main.py"
|
||||
|
||||
# start async top level machinery and add a console.
|
||||
await TopLevel_async_handler.start_toplevel(platform.shell, console=window.python.config.debug)
|
||||
|
||||
# now that apk is mounted we have access to font cache
|
||||
# but we need to fill __file__ that is not yet set
|
||||
__import__(__name__).__file__ = str(main)
|
||||
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
|
||||
def ui_callback(pkg, error=None):
|
||||
nonlocal fnt
|
||||
if error:
|
||||
prompt = fnt.render(f"{error}", True, "black")
|
||||
else:
|
||||
prompt = fnt.render(f"Setting [{pkg}] up", True, "black")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
|
||||
# test/wait if user media interaction required
|
||||
if not platform.window.MM.UME:
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
prompt = fnt.render("Ready to start !", True, "blue")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
print("""
|
||||
* Waiting for media user engagement : please click/touch page *
|
||||
""")
|
||||
while not platform.window.MM.UME:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# cleanup
|
||||
screen.fill( (0,0,0,0) )
|
||||
pygame.display.flip()
|
||||
|
||||
await shell.runpy(main, callback=ui_callback)
|
||||
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
asyncio.run( custom_site() )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# BEGIN BLOCK
|
||||
#
|
||||
# now this is the html part you can (and should) customize
|
||||
# It is not mandatory : pygame-script when it reads the first line (also called
|
||||
# shebang ) of above code create absolute minimal widget set
|
||||
# required for running with default rules
|
||||
#
|
||||
# do not alter that comment block it is separating python code from html code
|
||||
# =============================================================================
|
||||
# --></script><head><!--
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
{%- if cookiecutter.comment != "" -%}
|
||||
{{cookiecutter.comment}}
|
||||
{% endif %}
|
||||
|
||||
--><script type="application/javascript">
|
||||
// END BLOCK
|
||||
|
||||
|
||||
|
||||
// this dict is available under PyConfig.config from __main__
|
||||
|
||||
config = {
|
||||
xtermjs : "{{cookiecutter.xtermjs}}" ,
|
||||
_sdl2 : "canvas",
|
||||
user_canvas : 0,
|
||||
user_canvas_managed : 0,
|
||||
ume_block : {{cookiecutter.ume_block}},
|
||||
can_close : {{cookiecutter.can_close}},
|
||||
archive : "{{cookiecutter.archive}}",
|
||||
gui_debug : 3,
|
||||
cdn : "{{cookiecutter.cdn}}",
|
||||
autorun : {{cookiecutter.autorun}},
|
||||
PYBUILD : "{{cookiecutter.PYBUILD}}"
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<title>{{cookiecutter.title}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="height=device-height, initial-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}pythonrc.py">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm.js">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">
|
||||
|
||||
|
||||
<link rel="icon" type="image/png" href="favicon.png" sizes="16x16">
|
||||
|
||||
<style>
|
||||
#status {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 20px;
|
||||
margin-left: 30px;
|
||||
font-weight: bold;
|
||||
color: rgb(120, 120, 120);
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
div.thick_border { border: 4px solid black; }
|
||||
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
/* average size of droid screen 470dp x 320dp */
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 5;
|
||||
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
padding: none;
|
||||
background-color:powderblue;
|
||||
}
|
||||
|
||||
.topright{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.bottomright {
|
||||
position:absolute;
|
||||
top: 40%;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.trinfo{
|
||||
position:relative;
|
||||
right:0px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.framed{
|
||||
position:relative;
|
||||
top:150px;
|
||||
right:10px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="{{cookiecutter.cdn}}/browserfs.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="transfer" align=center>
|
||||
<!-- <div class="spinner" id='spinner'></div> -->
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress"></progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<canvas class="emscripten" id="canvas"
|
||||
width="1px"
|
||||
height="1px"
|
||||
oncontextmenu="event.preventDefault()" tabindex=1>
|
||||
</canvas>
|
||||
|
||||
<div id=html></div>
|
||||
|
||||
<div id=crt class=bottomright >
|
||||
|
||||
<div id="system" hidden>
|
||||
<div class="button-container">
|
||||
<button id="aiostop" disabled>AIO ⏏︎</button>
|
||||
<button id="aiopaused_true" disabled>AIO ■</button>
|
||||
<button id="aiopaused_false" disabled>AIO ▶</button>
|
||||
<button id="pygame_mixer_music_pause" disabled>Music ■</button>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<div id=load_min>min</div>
|
||||
<div id=load_avg>avg</div>
|
||||
<div id=load_max>max</div>
|
||||
<button id="load_rst" disabled>RESET</button>
|
||||
</div>
|
||||
|
||||
<div id="level">(battery level unknown)</div>
|
||||
<div id="stateBattery">(charging state unknown)</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id=box class="emscripten_border" hidden=true>
|
||||
|
||||
<div id="info" class="trinfo"></div>
|
||||
|
||||
<iframe id="iframe" class="framed" name="iframe"
|
||||
width="470px" height="90%"
|
||||
allowtransparency="true"
|
||||
style="z-index: 10;"
|
||||
style="background: #FFFFFF;"
|
||||
frameborder="1"
|
||||
allowfullscreen="true"
|
||||
webkitallowfullscreen="true"
|
||||
msallowfullscreen="true"
|
||||
mozallowfullscreen="true"
|
||||
sandbox="allow-same-origin allow-top-navigation allow-scripts allow-pointer-lock"
|
||||
allow="autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr; cross-origin-isolated"
|
||||
src="{{cookiecutter.cdn}}empty.html"
|
||||
scrolling="yes">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="dlg" hidden>
|
||||
<input type="file" id="dlg_multifile" multiple accept="image/*">
|
||||
<label for="dlg_multifile">Select files</label>
|
||||
</div>
|
||||
|
||||
<div id="pyconsole">
|
||||
<div id="terminal" tabIndex=1 align="left"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
async function custom_onload(debug_hidden) {
|
||||
// this is called before anything python is loaded
|
||||
// make your js customization here
|
||||
console.log(__FILE__, "custom_onload")
|
||||
|
||||
pyconsole.hidden = debug_hidden
|
||||
system.hidden = debug_hidden
|
||||
transfer.hidden = debug_hidden
|
||||
info.hidden = debug_hidden
|
||||
box.hidden = debug_hidden
|
||||
|
||||
}
|
||||
|
||||
function custom_prerun(){
|
||||
// no python main and no (MEMFS + VFS) yet.
|
||||
console.log(__FILE__, "custom_prerun")
|
||||
|
||||
}
|
||||
|
||||
function custom_postrun(){
|
||||
// python main and no VFS filesystem yet.
|
||||
console.log(__FILE__, "custom_postrun")
|
||||
|
||||
// prevent ff horizontal scroll
|
||||
window.addEventListener("keydown", function(e) {
|
||||
if(["Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(e.code) > -1) {
|
||||
if (!python.config.debug)
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
function debug() {
|
||||
// allow to gain access to dev tools from js console
|
||||
// but only on desktop. difficult to reach when in iframe
|
||||
python.config.debug = true
|
||||
custom_onload(false)
|
||||
Module.PyRun_SimpleString("shell.uptime()")
|
||||
window_resize()
|
||||
}
|
||||
|
||||
function info_inline(data){
|
||||
document.getElementById("info").innerHTML = data
|
||||
}
|
||||
|
||||
function info_online(url) {
|
||||
// display info about current APK
|
||||
fetch( url /*, options */)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
info_inline(html);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
});
|
||||
}
|
||||
|
||||
function frame_online(url) {
|
||||
window.frames["iframe"].location = url;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,489 @@
|
||||
<html lang="en-us"><script src="https://pygame-web.github.io/archives/0.9/pythons.js" type=module id=site data-LINES=57 data-CONSOLE=25 data-python=python3.12 data-os=vtx,fs,snd,gui async defer>#<!--
|
||||
|
||||
print("""
|
||||
Loading conway-s-game-of-life-rebuilt from conway-s-game-of-life-rebuilt.apk
|
||||
Pygbag Version : 0.9.2
|
||||
Template Version : 0.9.0
|
||||
Python : 3.12
|
||||
CDN URL : https://pygame-web.github.io/archives/0.9/
|
||||
Screen : 1280x720
|
||||
Title : conway-s-game-of-life-rebuilt
|
||||
Folder : conway-s-game-of-life-rebuilt
|
||||
Authors : pgw
|
||||
SPDX-License-Identifier: cookiecutter.spdx
|
||||
|
||||
""")
|
||||
|
||||
|
||||
# screen pixels (real, hardware)
|
||||
WIDTH=1024 # 1280
|
||||
HEIGHT=600 # 720
|
||||
|
||||
# reference/idealized screen pixels
|
||||
REFX = 1980
|
||||
REFY = 1080
|
||||
|
||||
def u(real, ref, v):
|
||||
if abs(v)<0.9999999:
|
||||
result = int( (float(real)/100.0) * (v*1000))
|
||||
if v<0:
|
||||
return real-result
|
||||
return result
|
||||
return int( (real/ref) * v )
|
||||
|
||||
def ux(*argv):
|
||||
global WIDTH, REFX
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(WIDTH, REFX, v)
|
||||
return acc
|
||||
|
||||
def uy(*argv):
|
||||
global HEIGHT, REFY
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(HEIGHT, REFY, v)
|
||||
return acc
|
||||
|
||||
|
||||
|
||||
|
||||
# do not rename
|
||||
async def custom_site():
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import platform
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
import embed
|
||||
|
||||
|
||||
platform.document.body.style.background = "#7f7f7f"
|
||||
|
||||
import pygame
|
||||
|
||||
def compose():
|
||||
pygame.display.update()
|
||||
window.chromakey(None, *screen.get_colorkey(), 40)
|
||||
|
||||
pygame.init()
|
||||
pygame.font.init()
|
||||
|
||||
screen = pygame.display.set_mode([ux(.100),uy(.100)], pygame.SRCALPHA, 32)
|
||||
screen.set_colorkey( (0,0,0,0), pygame.RLEACCEL )
|
||||
screen.fill( (0,0,0,0) )
|
||||
|
||||
compose()
|
||||
|
||||
platform.window.transfer.hidden = true
|
||||
platform.window.canvas.style.visibility = "visible"
|
||||
|
||||
|
||||
|
||||
apk = "conway-s-game-of-life-rebuilt.apk"
|
||||
|
||||
bundle = "conway-s-game-of-life-rebuilt"
|
||||
|
||||
# the C or js loader could do that but be explicit.
|
||||
appdir = Path(f"/data/data/{bundle}") # /data/data/conway-s-game-of-life-rebuilt
|
||||
appdir.mkdir()
|
||||
|
||||
|
||||
# mount apk
|
||||
|
||||
cfg = {
|
||||
"io": "url",
|
||||
"type":"mount",
|
||||
"mount" : {
|
||||
"point" : appdir.as_posix(),
|
||||
"path" : "/",
|
||||
},
|
||||
"path" : f"/ => {appdir.as_posix()}",
|
||||
}
|
||||
|
||||
|
||||
track = platform.window.MM.prepare(apk, json.dumps(cfg))
|
||||
|
||||
marginx = ux(.020) # 20%
|
||||
marginy = uy(.045) # 45%
|
||||
|
||||
|
||||
def pg_bar(pos):
|
||||
nonlocal marginx, marginy
|
||||
# resolution of progress bar, recalculate since it may not be know yet.
|
||||
total = track.len or 10 # avoid div0
|
||||
slot = ux(.060)/ total # 60%
|
||||
|
||||
pygame.draw.rect(screen,(10,10,10),( marginx-ux(10), marginy-uy(10), (total*slot)+ux(20), uy(110) ) )
|
||||
pygame.draw.rect(screen,(0,255,0), ( marginx, marginy, track.pos*slot, uy(90)) )
|
||||
|
||||
# wait until zip mount + overlayfs is complete
|
||||
while not track.ready:
|
||||
pg_bar(track.pos)
|
||||
compose()
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# fill it up in case it was cached and instant download
|
||||
pg_bar(track.len)
|
||||
compose()
|
||||
|
||||
|
||||
# preloader will change dir and prepend it to sys.path
|
||||
platform.run_main(PyConfig, loaderhome= appdir / "assets", loadermain=None)
|
||||
|
||||
|
||||
# wait preloading complete
|
||||
# that includes images and wasm compilation of bundled modules
|
||||
while embed.counter()<0:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
main = appdir / "assets" / "main.py"
|
||||
|
||||
# start async top level machinery and add a console.
|
||||
await TopLevel_async_handler.start_toplevel(platform.shell, console=window.python.config.debug)
|
||||
|
||||
# now that apk is mounted we have access to font cache
|
||||
# but we need to fill __file__ that is not yet set
|
||||
__import__(__name__).__file__ = str(main)
|
||||
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
|
||||
def ui_callback(pkg, error=None):
|
||||
nonlocal fnt
|
||||
if error:
|
||||
prompt = fnt.render(f"{error}", True, "black")
|
||||
else:
|
||||
prompt = fnt.render(f"Setting [{pkg}] up", True, "black")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
|
||||
# test/wait if user media interaction required
|
||||
if not platform.window.MM.UME:
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
prompt = fnt.render("Ready to start !", True, "blue")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
print("""
|
||||
* Waiting for media user engagement : please click/touch page *
|
||||
""")
|
||||
while not platform.window.MM.UME:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# cleanup
|
||||
screen.fill( (0,0,0,0) )
|
||||
pygame.display.flip()
|
||||
|
||||
await shell.runpy(main, callback=ui_callback)
|
||||
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
asyncio.run( custom_site() )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# BEGIN BLOCK
|
||||
#
|
||||
# now this is the html part you can (and should) customize
|
||||
# It is not mandatory : pygame-script when it reads the first line (also called
|
||||
# shebang ) of above code create absolute minimal widget set
|
||||
# required for running with default rules
|
||||
#
|
||||
# do not alter that comment block it is separating python code from html code
|
||||
# =============================================================================
|
||||
# --></script><head><!--
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
{%- if cookiecutter.comment != "" -%}
|
||||
{{cookiecutter.comment}}
|
||||
{% endif %}
|
||||
|
||||
--><script type="application/javascript">
|
||||
// END BLOCK
|
||||
|
||||
|
||||
|
||||
// this dict is available under PyConfig.config from __main__
|
||||
|
||||
config = {
|
||||
xtermjs : "1" ,
|
||||
_sdl2 : "canvas",
|
||||
user_canvas : 0,
|
||||
user_canvas_managed : 0,
|
||||
ume_block : 1,
|
||||
can_close : 0,
|
||||
archive : "conway-s-game-of-life-rebuilt",
|
||||
gui_debug : 3,
|
||||
cdn : "https://pygame-web.github.io/archives/0.9/",
|
||||
autorun : 0,
|
||||
PYBUILD : "3.12"
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<title>conway-s-game-of-life-rebuilt</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="height=device-height, initial-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/pythonrc.py">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm.js">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js">
|
||||
|
||||
|
||||
<link rel="icon" type="image/png" href="favicon.png" sizes="16x16">
|
||||
|
||||
<style>
|
||||
#status {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 20px;
|
||||
margin-left: 30px;
|
||||
font-weight: bold;
|
||||
color: rgb(120, 120, 120);
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
div.thick_border { border: 4px solid black; }
|
||||
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
/* average size of droid screen 470dp x 320dp */
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 5;
|
||||
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
padding: none;
|
||||
background-color:powderblue;
|
||||
}
|
||||
|
||||
.topright{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.bottomright {
|
||||
position:absolute;
|
||||
top: 40%;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.trinfo{
|
||||
position:relative;
|
||||
right:0px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.framed{
|
||||
position:relative;
|
||||
top:150px;
|
||||
right:10px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="https://pygame-web.github.io/archives/0.9//browserfs.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="transfer" align=center>
|
||||
<!-- <div class="spinner" id='spinner'></div> -->
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress"></progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<canvas class="emscripten" id="canvas"
|
||||
width="1px"
|
||||
height="1px"
|
||||
oncontextmenu="event.preventDefault()" tabindex=1>
|
||||
</canvas>
|
||||
|
||||
<div id=html></div>
|
||||
|
||||
<div id=crt class=bottomright >
|
||||
|
||||
<div id="system" hidden>
|
||||
<div class="button-container">
|
||||
<button id="aiostop" disabled>AIO ⏏︎</button>
|
||||
<button id="aiopaused_true" disabled>AIO ■</button>
|
||||
<button id="aiopaused_false" disabled>AIO ▶</button>
|
||||
<button id="pygame_mixer_music_pause" disabled>Music ■</button>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<div id=load_min>min</div>
|
||||
<div id=load_avg>avg</div>
|
||||
<div id=load_max>max</div>
|
||||
<button id="load_rst" disabled>RESET</button>
|
||||
</div>
|
||||
|
||||
<div id="level">(battery level unknown)</div>
|
||||
<div id="stateBattery">(charging state unknown)</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id=box class="emscripten_border" hidden=true>
|
||||
|
||||
<div id="info" class="trinfo"></div>
|
||||
|
||||
<iframe id="iframe" class="framed" name="iframe"
|
||||
width="470px" height="90%"
|
||||
allowtransparency="true"
|
||||
style="z-index: 10;"
|
||||
style="background: #FFFFFF;"
|
||||
frameborder="1"
|
||||
allowfullscreen="true"
|
||||
webkitallowfullscreen="true"
|
||||
msallowfullscreen="true"
|
||||
mozallowfullscreen="true"
|
||||
sandbox="allow-same-origin allow-top-navigation allow-scripts allow-pointer-lock"
|
||||
allow="autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr; cross-origin-isolated"
|
||||
src="https://pygame-web.github.io/archives/0.9/empty.html"
|
||||
scrolling="yes">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="dlg" hidden>
|
||||
<input type="file" id="dlg_multifile" multiple accept="image/*">
|
||||
<label for="dlg_multifile">Select files</label>
|
||||
</div>
|
||||
|
||||
<div id="pyconsole">
|
||||
<div id="terminal" tabIndex=1 align="left"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
async function custom_onload(debug_hidden) {
|
||||
// this is called before anything python is loaded
|
||||
// make your js customization here
|
||||
console.log(__FILE__, "custom_onload")
|
||||
|
||||
pyconsole.hidden = debug_hidden
|
||||
system.hidden = debug_hidden
|
||||
transfer.hidden = debug_hidden
|
||||
info.hidden = debug_hidden
|
||||
box.hidden = debug_hidden
|
||||
|
||||
}
|
||||
|
||||
function custom_prerun(){
|
||||
// no python main and no (MEMFS + VFS) yet.
|
||||
console.log(__FILE__, "custom_prerun")
|
||||
|
||||
}
|
||||
|
||||
function custom_postrun(){
|
||||
// python main and no VFS filesystem yet.
|
||||
console.log(__FILE__, "custom_postrun")
|
||||
|
||||
// prevent ff horizontal scroll
|
||||
window.addEventListener("keydown", function(e) {
|
||||
if(["Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(e.code) > -1) {
|
||||
if (!python.config.debug)
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
function debug() {
|
||||
// allow to gain access to dev tools from js console
|
||||
// but only on desktop. difficult to reach when in iframe
|
||||
python.config.debug = true
|
||||
custom_onload(false)
|
||||
Module.PyRun_SimpleString("shell.uptime()")
|
||||
window_resize()
|
||||
}
|
||||
|
||||
function info_inline(data){
|
||||
document.getElementById("info").innerHTML = data
|
||||
}
|
||||
|
||||
function info_online(url) {
|
||||
// display info about current APK
|
||||
fetch( url /*, options */)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
info_inline(html);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
});
|
||||
}
|
||||
|
||||
function frame_online(url) {
|
||||
window.frames["iframe"].location = url;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
0.9.2
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 7577474
|
||||
Server: GitHub.com
|
||||
Content-Type: application/octet-stream
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-739f82"
|
||||
expires: Thu, 18 Dec 2025 22:43:25 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 571C:145425:D69EB:F5A09:69448135
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:25 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kjyo7100096-IAD
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097205.212023,VS0,VE64
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 2ae9f0f29a312ef1830cf5c53f32997e30607908
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
/**
|
||||
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
||||
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
||||
* https://github.com/chjj/term.js
|
||||
* @license MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* Originally forked from (with the author's permission):
|
||||
* Fabrice Bellard's javascript vt100 for jslinux:
|
||||
* http://bellard.org/jslinux/
|
||||
* Copyright (c) 2011 Fabrice Bellard
|
||||
* The original design remains. The terminal itself
|
||||
* has been extended to include xterm CSI codes, among
|
||||
* other features.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default styles for xterm.js
|
||||
*/
|
||||
|
||||
.xterm {
|
||||
cursor: text;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.xterm.focus,
|
||||
.xterm:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.xterm .xterm-helpers {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
/**
|
||||
* The z-index of the helpers must be higher than the canvases in order for
|
||||
* IMEs to appear on top.
|
||||
*/
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.xterm .xterm-helper-textarea {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
left: -9999em;
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
z-index: -5;
|
||||
/** Prevent wrapping so the IME appears against the textarea at the correct position */
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.xterm .composition-view {
|
||||
/* TODO: Composition position got messed up somewhere */
|
||||
background: #000;
|
||||
color: #FFF;
|
||||
display: none;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.xterm .composition-view.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.xterm .xterm-viewport {
|
||||
/* On OS X this is required in order for the scroll bar to appear fully opaque */
|
||||
background-color: #000;
|
||||
overflow-y: scroll;
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.xterm .xterm-screen {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.xterm .xterm-screen canvas {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.xterm .xterm-scroll-area {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.xterm-char-measure-element {
|
||||
display: inline-block;
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -9999em;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.xterm.enable-mouse-events {
|
||||
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.xterm.xterm-cursor-pointer,
|
||||
.xterm .xterm-cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.xterm.column-select.focus {
|
||||
/* Column selection mode */
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.xterm .xterm-accessibility,
|
||||
.xterm .xterm-message {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.xterm .live-region {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.xterm-dim {
|
||||
/* Dim should not apply to background, so the opacity of the foreground color is applied
|
||||
* explicitly in the generated class and reset to 1 here */
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.xterm-underline-1 { text-decoration: underline; }
|
||||
.xterm-underline-2 { text-decoration: double underline; }
|
||||
.xterm-underline-3 { text-decoration: wavy underline; }
|
||||
.xterm-underline-4 { text-decoration: dotted underline; }
|
||||
.xterm-underline-5 { text-decoration: dashed underline; }
|
||||
|
||||
.xterm-overline {
|
||||
text-decoration: overline;
|
||||
}
|
||||
|
||||
.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
|
||||
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
|
||||
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
|
||||
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
|
||||
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
|
||||
|
||||
.xterm-strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.xterm-screen .xterm-decoration-container .xterm-decoration {
|
||||
z-index: 6;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
|
||||
z-index: 7;
|
||||
}
|
||||
|
||||
.xterm-decoration-overview-ruler {
|
||||
z-index: 8;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.xterm-decoration-top {
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 5383
|
||||
Server: GitHub.com
|
||||
Content-Type: text/css; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-1507"
|
||||
expires: Thu, 18 Dec 2025 19:44:02 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: F078:1CE6E4:386FA2:3B98CA:6944572A
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:24 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780106-PDK
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097205.692271,VS0,VE24
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 5f3a34cae2c377d9e82594803535b42ec9f6948e
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 2478965
|
||||
Server: GitHub.com
|
||||
Content-Type: application/octet-stream
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-25d375"
|
||||
expires: Thu, 18 Dec 2025 22:43:27 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 7A81:9C719:106E48:11D87B:69448137
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:27 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780101-PDK
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097208.576908,VS0,VE212
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 6f4cd36a90da77b5e422788f34bae84758af5c53
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 12716708
|
||||
Server: GitHub.com
|
||||
Content-Type: application/wasm
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-c20aa4"
|
||||
expires: Thu, 18 Dec 2025 22:43:25 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 7A25:240900:11B6EE:13A886:69448135
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:25 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kcgs7200171-IAD
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097206.531020,VS0,VE86
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 4ee848965e319aaf22b58920d2fecfa0087b4c70
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
<html lang="en-us"><script src="{{cookiecutter.cdn}}pythons.js" type=module id=site data-LINES={{cookiecutter.LINES}} data-CONSOLE={{cookiecutter.CONSOLE}} data-python=python{{cookiecutter.PYBUILD}} data-os=vtx,fs,snd,gui async defer>#<!--
|
||||
|
||||
print("""
|
||||
Loading {{cookiecutter.title}} from {{cookiecutter.archive}}.apk
|
||||
Pygbag Version : {{cookiecutter.version}}
|
||||
Template Version : 0.9.0
|
||||
Python : {{cookiecutter.PYBUILD}}
|
||||
CDN URL : {{cookiecutter.cdn}}
|
||||
Screen : {{cookiecutter.width}}x{{cookiecutter.height}}
|
||||
Title : {{cookiecutter.title}}
|
||||
Folder : {{cookiecutter.directory}}
|
||||
Authors : {{cookiecutter.authors}}
|
||||
SPDX-License-Identifier: {{cookiecutter.spdx}}
|
||||
|
||||
""")
|
||||
|
||||
|
||||
# screen pixels (real, hardware)
|
||||
WIDTH=1024 # {{cookiecutter.width}}
|
||||
HEIGHT=600 # {{cookiecutter.height}}
|
||||
|
||||
# reference/idealized screen pixels
|
||||
REFX = 1980
|
||||
REFY = 1080
|
||||
|
||||
def u(real, ref, v):
|
||||
if abs(v)<0.9999999:
|
||||
result = int( (float(real)/100.0) * (v*1000))
|
||||
if v<0:
|
||||
return real-result
|
||||
return result
|
||||
return int( (real/ref) * v )
|
||||
|
||||
def ux(*argv):
|
||||
global WIDTH, REFX
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(WIDTH, REFX, v)
|
||||
return acc
|
||||
|
||||
def uy(*argv):
|
||||
global HEIGHT, REFY
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(HEIGHT, REFY, v)
|
||||
return acc
|
||||
|
||||
|
||||
|
||||
|
||||
# do not rename
|
||||
async def custom_site():
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import platform
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
import embed
|
||||
|
||||
|
||||
platform.document.body.style.background = "#7f7f7f"
|
||||
|
||||
import pygame
|
||||
|
||||
def compose():
|
||||
pygame.display.update()
|
||||
window.chromakey(None, *screen.get_colorkey(), 40)
|
||||
|
||||
pygame.init()
|
||||
pygame.font.init()
|
||||
|
||||
screen = pygame.display.set_mode([ux(.100),uy(.100)], pygame.SRCALPHA, 32)
|
||||
screen.set_colorkey( (0,0,0,0), pygame.RLEACCEL )
|
||||
screen.fill( (0,0,0,0) )
|
||||
|
||||
compose()
|
||||
|
||||
platform.window.transfer.hidden = true
|
||||
platform.window.canvas.style.visibility = "visible"
|
||||
|
||||
|
||||
|
||||
apk = "{{cookiecutter.archive}}.apk"
|
||||
|
||||
bundle = "{{cookiecutter.archive}}"
|
||||
|
||||
# the C or js loader could do that but be explicit.
|
||||
appdir = Path(f"/data/data/{bundle}") # /data/data/{{cookiecutter.archive}}
|
||||
appdir.mkdir()
|
||||
|
||||
|
||||
# mount apk
|
||||
|
||||
cfg = {
|
||||
"io": "url",
|
||||
"type":"mount",
|
||||
"mount" : {
|
||||
"point" : appdir.as_posix(),
|
||||
"path" : "/",
|
||||
},
|
||||
"path" : f"/ => {appdir.as_posix()}",
|
||||
}
|
||||
|
||||
|
||||
track = platform.window.MM.prepare(apk, json.dumps(cfg))
|
||||
|
||||
marginx = ux(.020) # 20%
|
||||
marginy = uy(.045) # 45%
|
||||
|
||||
|
||||
def pg_bar(pos):
|
||||
nonlocal marginx, marginy
|
||||
# resolution of progress bar, recalculate since it may not be know yet.
|
||||
total = track.len or 10 # avoid div0
|
||||
slot = ux(.060)/ total # 60%
|
||||
|
||||
pygame.draw.rect(screen,(10,10,10),( marginx-ux(10), marginy-uy(10), (total*slot)+ux(20), uy(110) ) )
|
||||
pygame.draw.rect(screen,(0,255,0), ( marginx, marginy, track.pos*slot, uy(90)) )
|
||||
|
||||
# wait until zip mount + overlayfs is complete
|
||||
while not track.ready:
|
||||
pg_bar(track.pos)
|
||||
compose()
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# fill it up in case it was cached and instant download
|
||||
pg_bar(track.len)
|
||||
compose()
|
||||
|
||||
|
||||
# preloader will change dir and prepend it to sys.path
|
||||
platform.run_main(PyConfig, loaderhome= appdir / "assets", loadermain=None)
|
||||
|
||||
|
||||
# wait preloading complete
|
||||
# that includes images and wasm compilation of bundled modules
|
||||
while embed.counter()<0:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
main = appdir / "assets" / "main.py"
|
||||
|
||||
# start async top level machinery and add a console.
|
||||
await TopLevel_async_handler.start_toplevel(platform.shell, console=window.python.config.debug)
|
||||
|
||||
# now that apk is mounted we have access to font cache
|
||||
# but we need to fill __file__ that is not yet set
|
||||
__import__(__name__).__file__ = str(main)
|
||||
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
|
||||
def ui_callback(pkg, error=None):
|
||||
nonlocal fnt
|
||||
if error:
|
||||
prompt = fnt.render(f"{error}", True, "black")
|
||||
else:
|
||||
prompt = fnt.render(f"Setting [{pkg}] up", True, "black")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
|
||||
# test/wait if user media interaction required
|
||||
if not platform.window.MM.UME:
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
prompt = fnt.render("Ready to start !", True, "blue")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
print("""
|
||||
* Waiting for media user engagement : please click/touch page *
|
||||
""")
|
||||
while not platform.window.MM.UME:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# cleanup
|
||||
screen.fill( (0,0,0,0) )
|
||||
pygame.display.flip()
|
||||
|
||||
await shell.runpy(main, callback=ui_callback)
|
||||
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
asyncio.run( custom_site() )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# BEGIN BLOCK
|
||||
#
|
||||
# now this is the html part you can (and should) customize
|
||||
# It is not mandatory : pygame-script when it reads the first line (also called
|
||||
# shebang ) of above code create absolute minimal widget set
|
||||
# required for running with default rules
|
||||
#
|
||||
# do not alter that comment block it is separating python code from html code
|
||||
# =============================================================================
|
||||
# --></script><head><!--
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
{%- if cookiecutter.comment != "" -%}
|
||||
{{cookiecutter.comment}}
|
||||
{% endif %}
|
||||
|
||||
--><script type="application/javascript">
|
||||
// END BLOCK
|
||||
|
||||
|
||||
|
||||
// this dict is available under PyConfig.config from __main__
|
||||
|
||||
config = {
|
||||
xtermjs : "{{cookiecutter.xtermjs}}" ,
|
||||
_sdl2 : "canvas",
|
||||
user_canvas : 0,
|
||||
user_canvas_managed : 0,
|
||||
ume_block : {{cookiecutter.ume_block}},
|
||||
can_close : {{cookiecutter.can_close}},
|
||||
archive : "{{cookiecutter.archive}}",
|
||||
gui_debug : 3,
|
||||
cdn : "{{cookiecutter.cdn}}",
|
||||
autorun : {{cookiecutter.autorun}},
|
||||
PYBUILD : "{{cookiecutter.PYBUILD}}"
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<title>{{cookiecutter.title}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="height=device-height, initial-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}pythonrc.py">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm.js">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">
|
||||
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">
|
||||
|
||||
|
||||
<link rel="icon" type="image/png" href="favicon.png" sizes="16x16">
|
||||
|
||||
<style>
|
||||
#status {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 20px;
|
||||
margin-left: 30px;
|
||||
font-weight: bold;
|
||||
color: rgb(120, 120, 120);
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
div.thick_border { border: 4px solid black; }
|
||||
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
/* average size of droid screen 470dp x 320dp */
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 5;
|
||||
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
padding: none;
|
||||
background-color:powderblue;
|
||||
}
|
||||
|
||||
.topright{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.bottomright {
|
||||
position:absolute;
|
||||
top: 40%;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.trinfo{
|
||||
position:relative;
|
||||
right:0px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.framed{
|
||||
position:relative;
|
||||
top:150px;
|
||||
right:10px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="{{cookiecutter.cdn}}/browserfs.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="transfer" align=center>
|
||||
<!-- <div class="spinner" id='spinner'></div> -->
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress"></progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<canvas class="emscripten" id="canvas"
|
||||
width="1px"
|
||||
height="1px"
|
||||
oncontextmenu="event.preventDefault()" tabindex=1>
|
||||
</canvas>
|
||||
|
||||
<div id=html></div>
|
||||
|
||||
<div id=crt class=bottomright >
|
||||
|
||||
<div id="system" hidden>
|
||||
<div class="button-container">
|
||||
<button id="aiostop" disabled>AIO ⏏︎</button>
|
||||
<button id="aiopaused_true" disabled>AIO ■</button>
|
||||
<button id="aiopaused_false" disabled>AIO ▶</button>
|
||||
<button id="pygame_mixer_music_pause" disabled>Music ■</button>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<div id=load_min>min</div>
|
||||
<div id=load_avg>avg</div>
|
||||
<div id=load_max>max</div>
|
||||
<button id="load_rst" disabled>RESET</button>
|
||||
</div>
|
||||
|
||||
<div id="level">(battery level unknown)</div>
|
||||
<div id="stateBattery">(charging state unknown)</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id=box class="emscripten_border" hidden=true>
|
||||
|
||||
<div id="info" class="trinfo"></div>
|
||||
|
||||
<iframe id="iframe" class="framed" name="iframe"
|
||||
width="470px" height="90%"
|
||||
allowtransparency="true"
|
||||
style="z-index: 10;"
|
||||
style="background: #FFFFFF;"
|
||||
frameborder="1"
|
||||
allowfullscreen="true"
|
||||
webkitallowfullscreen="true"
|
||||
msallowfullscreen="true"
|
||||
mozallowfullscreen="true"
|
||||
sandbox="allow-same-origin allow-top-navigation allow-scripts allow-pointer-lock"
|
||||
allow="autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr; cross-origin-isolated"
|
||||
src="{{cookiecutter.cdn}}empty.html"
|
||||
scrolling="yes">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="dlg" hidden>
|
||||
<input type="file" id="dlg_multifile" multiple accept="image/*">
|
||||
<label for="dlg_multifile">Select files</label>
|
||||
</div>
|
||||
|
||||
<div id="pyconsole">
|
||||
<div id="terminal" tabIndex=1 align="left"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
async function custom_onload(debug_hidden) {
|
||||
// this is called before anything python is loaded
|
||||
// make your js customization here
|
||||
console.log(__FILE__, "custom_onload")
|
||||
|
||||
pyconsole.hidden = debug_hidden
|
||||
system.hidden = debug_hidden
|
||||
transfer.hidden = debug_hidden
|
||||
info.hidden = debug_hidden
|
||||
box.hidden = debug_hidden
|
||||
|
||||
}
|
||||
|
||||
function custom_prerun(){
|
||||
// no python main and no (MEMFS + VFS) yet.
|
||||
console.log(__FILE__, "custom_prerun")
|
||||
|
||||
}
|
||||
|
||||
function custom_postrun(){
|
||||
// python main and no VFS filesystem yet.
|
||||
console.log(__FILE__, "custom_postrun")
|
||||
|
||||
// prevent ff horizontal scroll
|
||||
window.addEventListener("keydown", function(e) {
|
||||
if(["Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(e.code) > -1) {
|
||||
if (!python.config.debug)
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
function debug() {
|
||||
// allow to gain access to dev tools from js console
|
||||
// but only on desktop. difficult to reach when in iframe
|
||||
python.config.debug = true
|
||||
custom_onload(false)
|
||||
Module.PyRun_SimpleString("shell.uptime()")
|
||||
window_resize()
|
||||
}
|
||||
|
||||
function info_inline(data){
|
||||
document.getElementById("info").innerHTML = data
|
||||
}
|
||||
|
||||
function info_online(url) {
|
||||
// display info about current APK
|
||||
fetch( url /*, options */)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
info_inline(html);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
});
|
||||
}
|
||||
|
||||
function frame_online(url) {
|
||||
window.frames["iframe"].location = url;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 11966614
|
||||
Server: GitHub.com
|
||||
Content-Type: application/octet-stream
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-b69896"
|
||||
expires: Thu, 18 Dec 2025 22:43:30 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 1D1C:2681E0:140597:15723D:6944813A
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:30 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780134-PDK
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097211.520416,VS0,VE140
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: a0b76bfc769147d7c35c429dc9d9eba0da8cbe79
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(()=>(()=>{"use strict";var e={4567:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=i(9042),o=i(6114),a=i(9924),h=i(844),c=i(5596),l=i(4725),d=i(3656);let _=t.AccessibilityManager=class extends h.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new a.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar("\n")))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new c.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,d.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,h.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=n.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,o.isMac&&this._liveRegion.remove()}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.translateBufferLineToString(i.ydisp+r,!0),t=(i.ydisp+r+1).toString(),n=this._rowElements[r];n&&(0===e.length?n.innerText=" ":n.textContent=e,n.setAttribute("aria-posinset",t),n.setAttribute("aria-setsize",s))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rLine truncated
|
||||
//# sourceMappingURL=xterm.js.map
|
||||
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 283404
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-4530c"
|
||||
expires: Thu, 18 Dec 2025 22:43:23 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: C89C:2DEB26:11B9C4:13ACDC:69448133
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:23 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kcgs7200059-IAD
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097204.928202,VS0,VE14
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: bcaab6b766782b99f4849e1de117df29407f153a
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 49169
|
||||
Server: GitHub.com
|
||||
Content-Type: application/octet-stream
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-c011"
|
||||
expires: Thu, 18 Dec 2025 22:26:10 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: E38A:2FD9A8:BE335:D52A0:69447D29
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:26 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kjyo7100081-IAD
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097206.473582,VS0,VE7
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 232fce85b8eb4abe4aa6bce491ab30f04cc25913
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 73841
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-12071"
|
||||
expires: Thu, 18 Dec 2025 19:44:01 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: B9F4:F13DD:3677E9:39A011:69445729
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:23 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780118-PDK
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097203.391155,VS0,VE31
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 5a26d533584ec3fafb7c28c16de979a419850bea
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
var Module=typeof Module!="undefined"?Module:{};if(typeof globalThis.BigInt64Array==="undefined"){function partsToBigIntSigned(lower,upper){return BigInt(lower)|BigInt(upper+2*(upper&2147483648))<<32n}function partsToBigIntUnsigned(lower,upper){return BigInt(lower)|BigInt(upper)<<32n}function bigIntToParts(value){var lower=Number(BigInt(value)&BigInt(4294967295))|0;var upper=Number(BigInt(value)>>32n)|0;return[lower,upper]}function createBigIntArrayShim(partsToBigInt){function createBigInt64Array(array){if(typeof array==="number"){array=new Uint32Array(2*array)}var orig_array;if(!ArrayBuffer.isView(array)){if(array.constructor&&array.constructor.name==="ArrayBuffer"){array=new Uint32Array(array)}else{orig_array=array;array=new Uint32Array(array.length*2)}}var proxy=new Proxy({slice(min,max){max??=array.length;var new_buf=array.slice(min*2,max*2);return createBigInt64Array(new_buf)},subarray(min,max){var new_buf=array.subarray(min*2,max*2);return createBigInt64Array(new_buf)},[Symbol.iterator]:function*(){for(var i=0;i<array.length/2;i++){yield partsToBigInt(array[2*i],array[2*i+1])}},BYTES_PER_ELEMENT:2*array.BYTES_PER_ELEMENT,buffer:array.buffer,byteLength:array.byteLength,byteOffset:array.byteOffset,length:array.length/2,copyWithin:function(target,start,end){array.copyWithin(target*2,start*2,end*2);return proxy},set(source,targetOffset){targetOffset??=0;if(2*(source.length+targetOffset)>array.length){throw new RangeError("offset is out of bounds")}for(var i=0;i<source.length;i++){var value=source[i];var pair=bigIntToParts(value);array.set(pair,2*(targetOffset+i))}}},{get(target,idx,receiver){if(typeof idx!=="string"||!/^\d+$/.test(idx)){return Reflect.get(target,idx,receiver)}var lower=array[idx*2];var upper=array[idx*2+1];return partsToBigInt(lower,upper)},set(target,idx,value,receiver){if(typeof idx!=="string"||!/^\d+$/.test(idx)){return Reflect.set(target,idx,value,receiver)}if(typeof value!=="bigint"){throw new TypeError(`Cannot convert ${value} to a BigInt`)}var pair=bigIntToParts(value);array.set(pair,2*idx);return true}});if(orig_array){proxy.set(orig_array)}return proxy}return createBigInt64Array}globalThis.BigUint64Array=createBigIntArrayShim(partsToBigIntUnsigned);globalThis.BigInt64Array=createBigIntArrayShim(partsToBigIntSigned)}if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Module["ENVIRONMENT_IS_PTHREAD"]||Module["$ww"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="/data/git/pygbag/build/web/archives/0.0/cpython312/main.data";var REMOTE_PACKAGE_BASE="main.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){require("fs").readFile(packageName,function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}});return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"](`Downloading data... (${loaded}/${total})`)}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module[Line truncated
|
||||
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 4951434
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-4b8d8a"
|
||||
expires: Thu, 18 Dec 2025 22:43:24 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: ADE8:3C2F3D:1E7701:206536:69448134
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:24 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780103-PDK
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097205.724511,VS0,VE158
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: a47ead5cf7d8ddbd4d5586bdf26e262d4a717c36
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BrowserFS=e():t.BrowserFS=e()}(this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=19)}([function(t,e,n){"use strict";var r=n(6),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=h;var o=n(3);o.inherits=n(1);var s=n(14),a=n(12);o.inherits(h,s);for(var c=i(a.prototype),u=0;u<c.length;u++){var f=c[u];h.prototype[f]||(h.prototype[f]=a.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||r.nextTick(p,this)}function p(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),h.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";var r=new(n(22)),i={};function o(t){i[t]||("function"==typeof r[t]?i[t]=function(){return r[t].apply(r,arguments)}:i[t]=r[t])}for(var s in r)o(s);i.initializeTTYs=function(){null===r.stdin&&(r.initializeTTYs(),i.stdin=r.stdin,i.stdout=r.stdout,i.stderr=r.stderr)},r.nextTick(function(){i.initializeTTYs()}),t.exports=i},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(9))},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,s,a,c,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var f=new Error('Uncaught, unspecified "error" event. ('+e+")");throw f.context=e,f}if(o(n=this._events[t]))return!1;if(r(n))switch(arguments.lengthLine truncated
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/var r=n(20),i=n(21);e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function s(t){if(t>o)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(t)}return c(t,e,n)}function c(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return B(t)||t&&B(t.buffer)?function(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n);return r.__proto__=a.prototype,r}(t,e,n):"string"==typeof t?function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|p(t,e),r=s(n),i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e):function(t){if(a.isBuffer(t)){var e=0|l(t.length),n=s(e);return 0===n.length?n:(t.copy(n,0,0,e),n)}if(t){if(ArrayBuffer.isView(t)||"length"in t)return"number"!=typeof t.length||z(t.length)?s(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}(t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t){return u(t),s(t<0?0:0|l(t))}function h(t){for(var e=t.length<0?0:0|l(t.length),n=s(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(r)return M(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===c)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var h=!0,l=0;l<c;l++)if(u(t,o+l)!==u(e,l)){h=!1;break}if(h)return o}return-1}function _(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(z(a))return s;t[n+s]=a}return s}function m(t,e,n,r){return j(M(e,t.length-n),t,n,r)}function w(t,e,n,r){return j(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function v(t,e,n,r){return w(t,e,n,r)}function b(t,e,n,r){return j(U(e),t,n,r)}function S(t,e,n,r){return j(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],f=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=h}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(StriLine truncated
|
||||
//# sourceMappingURL=browserfs.min.js.map
|
||||
@@ -0,0 +1,23 @@
|
||||
Connection: close
|
||||
Content-Length: 251354
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-3d5da"
|
||||
expires: Thu, 18 Dec 2025 22:43:23 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 4DFC:29EB59:113667:1327D8:69448133
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:23 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kcgs7200073-IAD
|
||||
X-Cache: MISS
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097203.492891,VS0,VE25
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 54b55983cbf723f30df6d7c91c0b42c484718bf6
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 4035
|
||||
Server: GitHub.com
|
||||
Content-Type: audio/ogg
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-fc3"
|
||||
expires: Thu, 18 Dec 2025 19:21:02 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: B1A0:108AFE:28EE97:2D28A4:694451C6
|
||||
Accept-Ranges: bytes
|
||||
Date: Thu, 18 Dec 2025 22:33:24 GMT
|
||||
Via: 1.1 varnish
|
||||
Age: 3
|
||||
X-Served-By: cache-pdk-kpdk1780063-PDK
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 1
|
||||
X-Timer: S1766097205.723973,VS0,VE2
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: bf9e5411de168421cbb91fd96e0cfce1777d0cea
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/*! For license information please see xterm-addon-image.js.LICENSE.txt */
|
||||
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ImageAddon=e():A.ImageAddon=e()}(self,(()=>(()=>{"use strict";var A={615:(A,e)=>{function t(A){if("undefined"!=typeof Buffer)return Buffer.from(A,"base64");const e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<t.length;++A)t[A]=e.charCodeAt(A);return t}Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=void 0,e.InWasm=function(A){if(A.d){const{t:e,s:i,d:s}=A;let r,g;const a=WebAssembly;return 2===e?i?()=>r||(r=t(s)):()=>Promise.resolve(r||(r=t(s))):1===e?i?()=>g||(g=new a.Module(r||(r=t(s)))):()=>g?Promise.resolve(g):a.compile(r||(r=t(s))).then((A=>g=A)):i?A=>new a.Instance(g||(g=new a.Module(r||(r=t(s)))),A):A=>g?a.instantiate(g,A):a.instantiate(r||(r=t(s)),A).then((A=>(g=A.module)&&A.instance))}if("undefined"==typeof _wasmCtx)throw new Error('must run "inwasm"');_wasmCtx.add(A)}},477:(A,e)=>{function t(A){return 255&A}function i(A){return A>>>8&255}function s(A){return A>>>16&255}function r(A,e,t,i=255){return((255&i)<<24|(255&t)<<16|(255&e)<<8|255&A)>>>0}function g(A,e,t){return Math.max(A,Math.min(t,e))}function a(A,e,t){return t<0&&(t+=1),t>1&&(t-=1),6*t<1?e+6*(A-e)*t:2*t<1?A:3*t<2?e+(A-e)*(4-6*t):e}function o(A,e,t){return(4278190080|Math.round(t/100*255)<<16|Math.round(e/100*255)<<8|Math.round(A/100*255))>>>0}Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=255===new Uint8Array(new Uint32Array([4278190080]).buffer)[0],e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly."),e.red=t,e.green=i,e.blue=s,e.alpha=function(A){return A>>>24&255},e.toRGBA8888=r,e.fromRGBA8888=function(A){return[255&A,A>>8&255,A>>16&255,A>>>24]},e.nearestColorIndex=function(A,e){const r=t(A),g=i(A),a=s(A);let o=Number.MAX_SAFE_INTEGER,h=-1;for(let A=0;A<e.length;++A){const t=r-e[A][0],i=g-e[A][1],s=a-e[A][2],n=t*t+i*i+s*s;if(!n)return A;n<o&&(o=n,h=A)}return h},e.normalizeRGB=o,e.normalizeHLS=function(A,e,t){return function(A,e,t){if(!t){const A=Math.round(255*e);return r(A,A,A)}const i=e<.5?e*(1+t):e+t-e*t,s=2*e-i;return r(g(0,255,Math.round(255*a(i,s,A+1/3))),g(0,255,Math.round(255*a(i,s,A))),g(0,255,Math.round(255*a(i,s,A-1/3))))}((A+240)/360,e/100,t/100)},e.PALETTE_VT340_COLOR=new Uint32Array([o(0,0,0),o(20,20,80),o(80,13,13),o(20,80,20),o(80,20,80),o(20,80,80),o(80,80,20),o(53,53,53),o(26,26,26),o(33,33,60),o(60,26,26),o(33,60,33),o(60,33,60),o(33,60,60),o(60,60,33),o(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([o(0,0,0),o(13,13,13),o(26,26,26),o(40,40,40),o(6,6,6),o(20,20,20),o(33,33,33),o(46,46,46),o(0,0,0),o(13,13,13),o(26,26,26),o(40,40,40),o(6,6,6),o(20,20,20),o(33,33,33),o(46,46,46)]),e.PALETTE_ANSI_256=(()=>{const A=[r(0,0,0),r(205,0,0),r(0,205,0),r(205,205,0),r(0,0,238),r(205,0,205),r(0,250,205),r(229,229,229),r(127,127,127),r(255,0,0),r(0,255,0),r(255,255,0),r(92,92,255),r(255,0,255),r(0,255,255),r(255,255,255)],e=[0,95,135,175,215,255];for(let t=0;t<6;++t)for(let i=0;i<6;++i)for(let s=0;s<6;++s)A.push(r(e[t],e[i],e[s]));for(let e=8;e<=238;e+=10)A.push(r(e,e,e));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=r(0,0,0,255),e.DEFAULT_FOREGROUND=r(255,255,255,255)},710:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;const i=t(477),s=t(343),r=function(A){if("undefined"!=typeof Buffer)return Buffer.from(A,"base64");const e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<t.length;++A)t[A]=e.charCodeAt(A);return t}(s.LIMITS.BYTES);let g;const a=new Uint32Array;class o{constructor(){this.bandHandler=A=>1,this.modeHandler=A=>1}handle_band(A){return this.bandHandler(A)}mode_parsed(A){return this.modeHandler(A)}}const h={memoryLimit:134217728,sixelColor:i.DEFAULT_FOREGROUND,fillColor:i.DEFAULT_BACKGROUND,palette:i.PALETTE_VT340_COLOR,paletteLimit:s.LIMITS.PALETTE_SIZE,truncate:!0};function n(A){const e=new o,t={env:{handle_band:e.handle_band.bind(e),mode_parsed:e.mode_parsed.bind(e)}};return WebAssembly.instantiate(g||r,t).then((t=>(g=g||t.module,new I(A,t.instance||t,e))))}e.DecoderAsync=n;class I{constructor(A,e,t){if(this._PIXEL_OFFSET=s.LIMITS.MAX_WIDTH+4,this._canvas=a,this._bandWidths=[],this._maxWidth=0,this._minWidth=s.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},h,A),this._opts.paletteLimit>s.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${s.LIMITS.PALETTE_SIZE}`);if(e)t.bandHandler=this._handle_band.bind(this),t.modeHandler=this._initCanvas.bind(this);else{const A=g||(g=new WebAssembly.Module(r));e=new WebAssembly.Instance(A,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.biLine truncated
|
||||
//# sourceMappingURL=xterm-addon-image.js.map
|
||||
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 54544
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-d510"
|
||||
expires: Thu, 18 Dec 2025 19:44:02 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: E4A6:A025B:31E012:350A08:6944572A
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:23 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-pdk-kpdk1780087-PDK
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097204.936260,VS0,VE19
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: 0fd9079c065f4b5676733c4fd8f4dc4d3c22be8e
|
||||
|
||||
@@ -0,0 +1,317 @@
|
||||
"use strict";
|
||||
|
||||
var readline = { last_cx : -1 , index : 0, history : ["help()"] }
|
||||
|
||||
// two modes based on RAW_MODE: default readline emulation or python.rawstdin
|
||||
|
||||
readline.complete = function (line) {
|
||||
if ( readline.history[ readline.history.length -1 ] != line )
|
||||
readline.history.push(line);
|
||||
readline.index = 0;
|
||||
python.readline(line + "\n")
|
||||
|
||||
}
|
||||
|
||||
if (!window.Terminal) {
|
||||
var xterm_cdn
|
||||
if (window.Module.config && window.Module.config.cdn) {
|
||||
xterm_cdn = window.Module.config.cdn+"vt/"
|
||||
console.log("Terminal+ImageAddon importing from CDN :", xterm_cdn)
|
||||
} else {
|
||||
xterm_cdn = xterm_cdn || "https://pygame-web.github.io/archives/vt/"
|
||||
console.warn("Terminal+ImageAddon importing from fallback ", xterm_cdn)
|
||||
}
|
||||
|
||||
for (const css of ["xterm.css"]) { //,"style.css"]) {
|
||||
const cssref = document.createElement('link')
|
||||
cssref.setAttribute("rel", "stylesheet")
|
||||
cssref.setAttribute("type", "text/css")
|
||||
cssref.setAttribute("href", xterm_cdn + css)
|
||||
document.getElementsByTagName("head")[0].appendChild(cssref)
|
||||
}
|
||||
|
||||
await import(xterm_cdn + "xterm.js")
|
||||
await import(xterm_cdn + "xterm-addon-image.js")
|
||||
|
||||
|
||||
} else {
|
||||
console.warn("Terminal+ImageAddon were inlined")
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class WasmTerminal {
|
||||
constructor(hostid, cols, rows, fontsize, is_fbdev, addons_list) {
|
||||
this.input = ''
|
||||
this.resolveInput = null
|
||||
this.activeInput = true
|
||||
this.inputStartCursor = null
|
||||
|
||||
this.nodup = 1
|
||||
var theme = {
|
||||
background: '#1a1c1f'
|
||||
}
|
||||
|
||||
|
||||
var transparency = false
|
||||
var sback = 1000
|
||||
|
||||
if (is_fbdev) {
|
||||
theme = {
|
||||
foreground: '#ffffff',
|
||||
background: 'rgba(0, 0, 0, 0)'
|
||||
}
|
||||
sback = 0
|
||||
transparency = true
|
||||
}
|
||||
|
||||
this.xterm = new Terminal(
|
||||
{
|
||||
// rendererType : "dom",
|
||||
rendererType : "webgl",
|
||||
experimentalCharAtlas : "webgl",
|
||||
theme: theme,
|
||||
allowTransparency: transparency,
|
||||
allowProposedApi : true , // xterm 0.5 + sixel
|
||||
scrollback: sback,
|
||||
fontFamily: 'Courier-new, courier, monospace',
|
||||
fontSize: (fontsize || 12),
|
||||
cols: (cols || 132),
|
||||
rows: (rows || 32)
|
||||
}
|
||||
);
|
||||
|
||||
if (typeof(Worker) !== "undefined") {
|
||||
|
||||
for (const addon of (addons_list||[]) ) {
|
||||
console.warn(hostid, cols, rows, addon)
|
||||
const imageAddon = new ImageAddon.ImageAddon(addon.url , addon);
|
||||
this.xterm.loadAddon(imageAddon);
|
||||
this.sixel = function write(data) {
|
||||
this.xterm.write(data)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
console.warn("No worker support, not loading xterm addons")
|
||||
this.sixel = function ni() {
|
||||
console.warn("SIXEL N/I")
|
||||
}
|
||||
}
|
||||
|
||||
this.xterm.open(document.getElementById(hostid))
|
||||
|
||||
this.xterm.onKey((keyEvent) => {
|
||||
// Fix for iOS Keyboard Jumping on space
|
||||
if (keyEvent.key === " ") {
|
||||
keyEvent.domEvent.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.xterm.onData(this.handleTermData)
|
||||
}
|
||||
|
||||
open(container) {
|
||||
this.xterm.open(container);
|
||||
}
|
||||
|
||||
ESC() {
|
||||
for (var i=0; i < arguments.length; i++)
|
||||
this.xterm.write("\x1b"+arguments[i])
|
||||
}
|
||||
|
||||
handleTermData = (data) => {
|
||||
|
||||
|
||||
|
||||
// TODO: check mouse Y pos for raw mode in debug mode
|
||||
if (window.RAW_MODE) {
|
||||
python.rawstdin(data)
|
||||
return
|
||||
}
|
||||
|
||||
const ord = data.charCodeAt(0);
|
||||
let ofs;
|
||||
|
||||
const cx = this.xterm.buffer.active.cursorX
|
||||
|
||||
// TODO: Handle ANSI escape sequences
|
||||
if (ord === 0x1b) {
|
||||
|
||||
// Handle special characters
|
||||
switch ( data.charCodeAt(1) ) {
|
||||
case 0x5b:
|
||||
|
||||
const cursor = readline.history.length + readline.index
|
||||
var histo = ">h> "
|
||||
|
||||
switch ( data.charCodeAt(2) ) {
|
||||
// "?"
|
||||
case 63:
|
||||
const c4 = data.charCodeAt(4)
|
||||
const c5 = data.charCodeAt(5)
|
||||
if ((c4==54) && (c5==99)) {
|
||||
// Primary Device Attribute of Sixel support : 4
|
||||
// "?6c" https://github.com/odknt/st/issues/1
|
||||
console.log("query")
|
||||
|
||||
}
|
||||
|
||||
|
||||
case 65:
|
||||
//console.log("VT UP")
|
||||
// memo cursor pos before entering histo
|
||||
if (!readline.index) {
|
||||
if (readline.last_cx < 0 ) {
|
||||
readline.last_cx = cx
|
||||
readline.buffer = this.input
|
||||
}
|
||||
// TODO: get current line content from XTERM
|
||||
}
|
||||
|
||||
if ( cursor >0 ) {
|
||||
readline.index--
|
||||
histo = ">h> " +readline.history[cursor-1]
|
||||
//console.log(__FILE__," histo-up :", readline.index, cursor, histo)
|
||||
|
||||
this.ESC("[132D","[2K")
|
||||
this.xterm.write(histo)
|
||||
this.input = histo.substr(4)
|
||||
}
|
||||
break;
|
||||
|
||||
case 66:
|
||||
//console.log("VT DOWN")
|
||||
if ( readline.index < 0 ) {
|
||||
readline.index++
|
||||
histo = histo + readline.history[cursor]
|
||||
this.ESC("[132D","[2K")
|
||||
this.xterm.write(histo)
|
||||
this.input = histo.substr(4)
|
||||
} else {
|
||||
// we are back
|
||||
if (readline.last_cx >= 0) {
|
||||
histo = histo + readline.buffer
|
||||
readline.buffer = ""
|
||||
this.ESC("[2K")
|
||||
this.ESC("[132D")
|
||||
this.xterm.write(histo)
|
||||
this.input = histo.substr(4)
|
||||
this.ESC("[132D")
|
||||
this.ESC("["+readline.last_cx+"C")
|
||||
//console.log(__FILE__," histo-back", readline.index, cursor, histo)
|
||||
readline.last_cx = -1
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 67:
|
||||
//console.log("VT RIGHT")
|
||||
break;
|
||||
|
||||
case 68:
|
||||
//console.log("VT LEFT")
|
||||
break;
|
||||
|
||||
case 60:
|
||||
// python.rawstdin(data)
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log(__FILE__,"VT unhandled ? "+data.charCodeAt(2))
|
||||
}
|
||||
break
|
||||
default:
|
||||
|
||||
console.log(__FILE__,"VT ESC "+data.charCodeAt(1))
|
||||
}
|
||||
|
||||
} else if (ord < 32 || ord === 0x7f) {
|
||||
switch (data) {
|
||||
case "\r": // ENTER
|
||||
case "\x0a": // CTRL+J
|
||||
case "\x0d": // CTRL+M
|
||||
this.xterm.write('\r\n');
|
||||
readline.complete(this.input)
|
||||
this.input = '';
|
||||
break;
|
||||
case "\x7F": // BACKSPACE
|
||||
case "\x08": // CTRL+H
|
||||
case "\x04": // CTRL+D
|
||||
this.handleCursorErase(true);
|
||||
break;
|
||||
|
||||
case "\0x03": // CTRL+C
|
||||
|
||||
break
|
||||
|
||||
// ^L for clearing VT but keep X pos.
|
||||
case "\x0c":
|
||||
const cy = this.xterm.buffer.active.cursorY
|
||||
|
||||
if (cy < this.xterm.rows )
|
||||
this.ESC("[B","[J","[A")
|
||||
|
||||
this.ESC("[A","[K","[1J")
|
||||
|
||||
for (var i=1;i<cy;i++) {
|
||||
this.ESC("[A","[M")
|
||||
}
|
||||
|
||||
this.ESC("[M")
|
||||
|
||||
if ( cx>0 )
|
||||
this.ESC("["+cx+"C")
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (ord) {
|
||||
case 3:
|
||||
readline.complete("raise KeyboardInterrupt")
|
||||
break
|
||||
default :
|
||||
console.log("vt:" + ord )
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.input += data;
|
||||
this.xterm.write(data)
|
||||
}
|
||||
}
|
||||
|
||||
handleCursorErase() {
|
||||
// Don't delete past the start of input
|
||||
if (this.xterm.buffer.active.cursorX <= this.inputStartCursor) {
|
||||
return
|
||||
}
|
||||
this.input = this.input.slice(0, -1)
|
||||
this.xterm.write('\x1B[D')
|
||||
this.xterm.write('\x1B[P')
|
||||
}
|
||||
|
||||
|
||||
clear() {
|
||||
this.xterm.clear()
|
||||
}
|
||||
|
||||
// direct write
|
||||
sixel(data) {
|
||||
this.xterm.write(data)
|
||||
}
|
||||
|
||||
print(message) {
|
||||
const normInput = message.replace(/[\r\n]+/g, "\n").replace(/\n/g, "\r\n")
|
||||
this.xterm.write(normInput)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
window.WasmTerminal = WasmTerminal
|
||||
window.readline = readline
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Connection: close
|
||||
Content-Length: 9889
|
||||
Server: GitHub.com
|
||||
Content-Type: application/javascript; charset=utf-8
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-26a1"
|
||||
expires: Thu, 18 Dec 2025 22:26:06 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: MISS
|
||||
X-GitHub-Request-Id: 1879:7E214:BCC64:D3B36:69447D26
|
||||
Accept-Ranges: bytes
|
||||
Age: 0
|
||||
Date: Thu, 18 Dec 2025 22:33:24 GMT
|
||||
Via: 1.1 varnish
|
||||
X-Served-By: cache-iad-kjyo7100029-IAD
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 0
|
||||
X-Timer: S1766097204.318168,VS0,VE13
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: c03acb115e230145311fcc0706ae80f5d7bab379
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html></html>
|
||||
@@ -0,0 +1,24 @@
|
||||
Connection: close
|
||||
Content-Length: 14
|
||||
Server: GitHub.com
|
||||
Content-Type: text/html; charset=utf-8
|
||||
x-origin-cache: HIT
|
||||
Last-Modified: Wed, 30 Jul 2025 00:35:46 GMT
|
||||
Access-Control-Allow-Origin: *
|
||||
Strict-Transport-Security: max-age=31556952
|
||||
ETag: "688968e2-e"
|
||||
expires: Thu, 18 Dec 2025 19:44:00 GMT
|
||||
Cache-Control: max-age=600
|
||||
x-proxy-cache: HIT
|
||||
X-GitHub-Request-Id: 7A46:7DED2:3864CF:3B8D62:69445726
|
||||
Accept-Ranges: bytes
|
||||
Date: Thu, 18 Dec 2025 22:33:23 GMT
|
||||
Via: 1.1 varnish
|
||||
Age: 0
|
||||
X-Served-By: cache-pdk-kpdk1780064-PDK
|
||||
X-Cache: HIT
|
||||
X-Cache-Hits: 1
|
||||
X-Timer: S1766097204.890409,VS0,VE25
|
||||
Vary: Accept-Encoding
|
||||
X-Fastly-Request-ID: a9efdd31bdb5facb9f49ed611389b2a4c0a49bd1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,489 @@
|
||||
<html lang="en-us"><script src="https://pygame-web.github.io/archives/0.9/pythons.js" type=module id=site data-LINES=57 data-CONSOLE=25 data-python=python3.12 data-os=vtx,fs,snd,gui async defer>#<!--
|
||||
|
||||
print("""
|
||||
Loading src from src.apk
|
||||
Pygbag Version : 0.9.2
|
||||
Template Version : 0.9.0
|
||||
Python : 3.12
|
||||
CDN URL : https://pygame-web.github.io/archives/0.9/
|
||||
Screen : 1280x720
|
||||
Title : src
|
||||
Folder : src
|
||||
Authors : pgw
|
||||
SPDX-License-Identifier: cookiecutter.spdx
|
||||
|
||||
""")
|
||||
|
||||
|
||||
# screen pixels (real, hardware)
|
||||
WIDTH=1024 # 1280
|
||||
HEIGHT=600 # 720
|
||||
|
||||
# reference/idealized screen pixels
|
||||
REFX = 1980
|
||||
REFY = 1080
|
||||
|
||||
def u(real, ref, v):
|
||||
if abs(v)<0.9999999:
|
||||
result = int( (float(real)/100.0) * (v*1000))
|
||||
if v<0:
|
||||
return real-result
|
||||
return result
|
||||
return int( (real/ref) * v )
|
||||
|
||||
def ux(*argv):
|
||||
global WIDTH, REFX
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(WIDTH, REFX, v)
|
||||
return acc
|
||||
|
||||
def uy(*argv):
|
||||
global HEIGHT, REFY
|
||||
acc = 0
|
||||
for v in argv:
|
||||
acc += u(HEIGHT, REFY, v)
|
||||
return acc
|
||||
|
||||
|
||||
|
||||
|
||||
# do not rename
|
||||
async def custom_site():
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import platform
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
import embed
|
||||
|
||||
|
||||
platform.document.body.style.background = "#7f7f7f"
|
||||
|
||||
import pygame
|
||||
|
||||
def compose():
|
||||
pygame.display.update()
|
||||
window.chromakey(None, *screen.get_colorkey(), 40)
|
||||
|
||||
pygame.init()
|
||||
pygame.font.init()
|
||||
|
||||
screen = pygame.display.set_mode([ux(.100),uy(.100)], pygame.SRCALPHA, 32)
|
||||
screen.set_colorkey( (0,0,0,0), pygame.RLEACCEL )
|
||||
screen.fill( (0,0,0,0) )
|
||||
|
||||
compose()
|
||||
|
||||
platform.window.transfer.hidden = true
|
||||
platform.window.canvas.style.visibility = "visible"
|
||||
|
||||
|
||||
|
||||
apk = "src.apk"
|
||||
|
||||
bundle = "src"
|
||||
|
||||
# the C or js loader could do that but be explicit.
|
||||
appdir = Path(f"/data/data/{bundle}") # /data/data/src
|
||||
appdir.mkdir()
|
||||
|
||||
|
||||
# mount apk
|
||||
|
||||
cfg = {
|
||||
"io": "url",
|
||||
"type":"mount",
|
||||
"mount" : {
|
||||
"point" : appdir.as_posix(),
|
||||
"path" : "/",
|
||||
},
|
||||
"path" : f"/ => {appdir.as_posix()}",
|
||||
}
|
||||
|
||||
|
||||
track = platform.window.MM.prepare(apk, json.dumps(cfg))
|
||||
|
||||
marginx = ux(.020) # 20%
|
||||
marginy = uy(.045) # 45%
|
||||
|
||||
|
||||
def pg_bar(pos):
|
||||
nonlocal marginx, marginy
|
||||
# resolution of progress bar, recalculate since it may not be know yet.
|
||||
total = track.len or 10 # avoid div0
|
||||
slot = ux(.060)/ total # 60%
|
||||
|
||||
pygame.draw.rect(screen,(10,10,10),( marginx-ux(10), marginy-uy(10), (total*slot)+ux(20), uy(110) ) )
|
||||
pygame.draw.rect(screen,(0,255,0), ( marginx, marginy, track.pos*slot, uy(90)) )
|
||||
|
||||
# wait until zip mount + overlayfs is complete
|
||||
while not track.ready:
|
||||
pg_bar(track.pos)
|
||||
compose()
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# fill it up in case it was cached and instant download
|
||||
pg_bar(track.len)
|
||||
compose()
|
||||
|
||||
|
||||
# preloader will change dir and prepend it to sys.path
|
||||
platform.run_main(PyConfig, loaderhome= appdir / "assets", loadermain=None)
|
||||
|
||||
|
||||
# wait preloading complete
|
||||
# that includes images and wasm compilation of bundled modules
|
||||
while embed.counter()<0:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
main = appdir / "assets" / "main.py"
|
||||
|
||||
# start async top level machinery and add a console.
|
||||
await TopLevel_async_handler.start_toplevel(platform.shell, console=window.python.config.debug)
|
||||
|
||||
# now that apk is mounted we have access to font cache
|
||||
# but we need to fill __file__ that is not yet set
|
||||
__import__(__name__).__file__ = str(main)
|
||||
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
|
||||
def ui_callback(pkg, error=None):
|
||||
nonlocal fnt
|
||||
if error:
|
||||
prompt = fnt.render(f"{error}", True, "black")
|
||||
else:
|
||||
prompt = fnt.render(f"Setting [{pkg}] up", True, "black")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
|
||||
# test/wait if user media interaction required
|
||||
if not platform.window.MM.UME:
|
||||
|
||||
# now make a prompt
|
||||
fnt = pygame.sysfont.SysFont("freesans", uy(80) )
|
||||
prompt = fnt.render("Ready to start !", True, "blue")
|
||||
pg_bar(track.len)
|
||||
screen.blit(prompt, ( marginx+ ux(80), marginy - uy(10) ) )
|
||||
compose()
|
||||
print("""
|
||||
* Waiting for media user engagement : please click/touch page *
|
||||
""")
|
||||
while not platform.window.MM.UME:
|
||||
await asyncio.sleep(.1)
|
||||
|
||||
# cleanup
|
||||
screen.fill( (0,0,0,0) )
|
||||
pygame.display.flip()
|
||||
|
||||
await shell.runpy(main, callback=ui_callback)
|
||||
|
||||
|
||||
|
||||
import asyncio
|
||||
|
||||
asyncio.run( custom_site() )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# BEGIN BLOCK
|
||||
#
|
||||
# now this is the html part you can (and should) customize
|
||||
# It is not mandatory : pygame-script when it reads the first line (also called
|
||||
# shebang ) of above code create absolute minimal widget set
|
||||
# required for running with default rules
|
||||
#
|
||||
# do not alter that comment block it is separating python code from html code
|
||||
# =============================================================================
|
||||
# --></script><head><!--
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
{%- if cookiecutter.comment != "" -%}
|
||||
{{cookiecutter.comment}}
|
||||
{% endif %}
|
||||
|
||||
--><script type="application/javascript">
|
||||
// END BLOCK
|
||||
|
||||
|
||||
|
||||
// this dict is available under PyConfig.config from __main__
|
||||
|
||||
config = {
|
||||
xtermjs : "1" ,
|
||||
_sdl2 : "canvas",
|
||||
user_canvas : 0,
|
||||
user_canvas_managed : 0,
|
||||
ume_block : 1,
|
||||
can_close : 0,
|
||||
archive : "src",
|
||||
gui_debug : 3,
|
||||
cdn : "https://pygame-web.github.io/archives/0.9/",
|
||||
autorun : 0,
|
||||
PYBUILD : "3.12"
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<title>src</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="height=device-height, initial-scale=1.0">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/pythonrc.py">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm.js">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js">
|
||||
<link rel="prefetch" href="https://pygame-web.github.io/archives/0.9/vt/xterm-addon-image.js">
|
||||
|
||||
|
||||
<link rel="icon" type="image/png" href="favicon.png" sizes="16x16">
|
||||
|
||||
<style>
|
||||
#status {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 20px;
|
||||
margin-left: 30px;
|
||||
font-weight: bold;
|
||||
color: rgb(120, 120, 120);
|
||||
}
|
||||
|
||||
#progress {
|
||||
height: 20px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
div.thick_border { border: 4px solid black; }
|
||||
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
/* average size of droid screen 470dp x 320dp */
|
||||
canvas.emscripten {
|
||||
border: 0px none;
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 5;
|
||||
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: arial;
|
||||
margin: 0;
|
||||
padding: none;
|
||||
background-color:powderblue;
|
||||
}
|
||||
|
||||
.topright{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.bottomright {
|
||||
position:absolute;
|
||||
top: 40%;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.trinfo{
|
||||
position:relative;
|
||||
right:0px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.framed{
|
||||
position:relative;
|
||||
top:150px;
|
||||
right:10px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="https://pygame-web.github.io/archives/0.9//browserfs.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="transfer" align=center>
|
||||
<!-- <div class="spinner" id='spinner'></div> -->
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress"></progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<canvas class="emscripten" id="canvas"
|
||||
width="1px"
|
||||
height="1px"
|
||||
oncontextmenu="event.preventDefault()" tabindex=1>
|
||||
</canvas>
|
||||
|
||||
<div id=html></div>
|
||||
|
||||
<div id=crt class=bottomright >
|
||||
|
||||
<div id="system" hidden>
|
||||
<div class="button-container">
|
||||
<button id="aiostop" disabled>AIO ⏏︎</button>
|
||||
<button id="aiopaused_true" disabled>AIO ■</button>
|
||||
<button id="aiopaused_false" disabled>AIO ▶</button>
|
||||
<button id="pygame_mixer_music_pause" disabled>Music ■</button>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<div id=load_min>min</div>
|
||||
<div id=load_avg>avg</div>
|
||||
<div id=load_max>max</div>
|
||||
<button id="load_rst" disabled>RESET</button>
|
||||
</div>
|
||||
|
||||
<div id="level">(battery level unknown)</div>
|
||||
<div id="stateBattery">(charging state unknown)</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id=box class="emscripten_border" hidden=true>
|
||||
|
||||
<div id="info" class="trinfo"></div>
|
||||
|
||||
<iframe id="iframe" class="framed" name="iframe"
|
||||
width="470px" height="90%"
|
||||
allowtransparency="true"
|
||||
style="z-index: 10;"
|
||||
style="background: #FFFFFF;"
|
||||
frameborder="1"
|
||||
allowfullscreen="true"
|
||||
webkitallowfullscreen="true"
|
||||
msallowfullscreen="true"
|
||||
mozallowfullscreen="true"
|
||||
sandbox="allow-same-origin allow-top-navigation allow-scripts allow-pointer-lock"
|
||||
allow="autoplay; fullscreen *; geolocation; microphone; camera; midi; monetization; xr-spatial-tracking; gamepad; gyroscope; accelerometer; xr; cross-origin-isolated"
|
||||
src="https://pygame-web.github.io/archives/0.9/empty.html"
|
||||
scrolling="yes">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="dlg" hidden>
|
||||
<input type="file" id="dlg_multifile" multiple accept="image/*">
|
||||
<label for="dlg_multifile">Select files</label>
|
||||
</div>
|
||||
|
||||
<div id="pyconsole">
|
||||
<div id="terminal" tabIndex=1 align="left"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
async function custom_onload(debug_hidden) {
|
||||
// this is called before anything python is loaded
|
||||
// make your js customization here
|
||||
console.log(__FILE__, "custom_onload")
|
||||
|
||||
pyconsole.hidden = debug_hidden
|
||||
system.hidden = debug_hidden
|
||||
transfer.hidden = debug_hidden
|
||||
info.hidden = debug_hidden
|
||||
box.hidden = debug_hidden
|
||||
|
||||
}
|
||||
|
||||
function custom_prerun(){
|
||||
// no python main and no (MEMFS + VFS) yet.
|
||||
console.log(__FILE__, "custom_prerun")
|
||||
|
||||
}
|
||||
|
||||
function custom_postrun(){
|
||||
// python main and no VFS filesystem yet.
|
||||
console.log(__FILE__, "custom_postrun")
|
||||
|
||||
// prevent ff horizontal scroll
|
||||
window.addEventListener("keydown", function(e) {
|
||||
if(["Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(e.code) > -1) {
|
||||
if (!python.config.debug)
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
function debug() {
|
||||
// allow to gain access to dev tools from js console
|
||||
// but only on desktop. difficult to reach when in iframe
|
||||
python.config.debug = true
|
||||
custom_onload(false)
|
||||
Module.PyRun_SimpleString("shell.uptime()")
|
||||
window_resize()
|
||||
}
|
||||
|
||||
function info_inline(data){
|
||||
document.getElementById("info").innerHTML = data
|
||||
}
|
||||
|
||||
function info_online(url) {
|
||||
// display info about current APK
|
||||
fetch( url /*, options */)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
info_inline(html);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
});
|
||||
}
|
||||
|
||||
function frame_online(url) {
|
||||
window.frames["iframe"].location = url;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Reference in new issue
Block a user