electron gui base
This commit is contained in:
parent
5a3af4ff28
commit
27346a688a
|
@ -1,3 +1,5 @@
|
||||||
.idea
|
.idea
|
||||||
scratch-blocks
|
scratch-blocks
|
||||||
scratch-gui
|
scratch-gui
|
||||||
|
pyblocks-gui/node_modules
|
||||||
|
pyblocks-gui/out
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
From ffe17da4d9c7319672e67bee9ee0ec4b3ccf11ee Mon Sep 17 00:00:00 2001
|
||||||
|
From: c0repwn3r <core@coredoes.dev>
|
||||||
|
Date: Wed, 24 May 2023 14:21:32 -0400
|
||||||
|
Subject: [PATCH] a patch to make patcher work
|
||||||
|
|
||||||
|
---
|
||||||
|
src/components/telemetry-modal/telemetry-modal.jsx | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/components/telemetry-modal/telemetry-modal.jsx b/src/components/telemetry-modal/telemetry-modal.jsx
|
||||||
|
index 3f5c76b32..d202e6a17 100644
|
||||||
|
--- a/src/components/telemetry-modal/telemetry-modal.jsx
|
||||||
|
+++ b/src/components/telemetry-modal/telemetry-modal.jsx
|
||||||
|
@@ -1,3 +1,4 @@
|
||||||
|
+// TODO: Remove
|
||||||
|
import bindAll from 'lodash.bindall';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
3bb1944a1a6eda77006c77a2bf539fb87b7be55f
|
77
pbt.sh
77
pbt.sh
|
@ -51,6 +51,30 @@ sub_clone() {
|
||||||
fi
|
fi
|
||||||
cd .. || exit
|
cd .. || exit
|
||||||
job_success "scratch-blocks" "checkout"
|
job_success "scratch-blocks" "checkout"
|
||||||
|
|
||||||
|
job_start "scratch-gui" "clone"
|
||||||
|
if [ -d "$(pwd)/scratch-gui" ]; then
|
||||||
|
echo "Clone dir already exists"
|
||||||
|
job_skip "scratch-gui" "clone"
|
||||||
|
else
|
||||||
|
git clone https://github.com/scratchfoundation/scratch-gui scratch-gui
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
job_fail "scratch-gui" "clone"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
job_success "scratch-gui" "clone"
|
||||||
|
fi
|
||||||
|
job_start "scratch-gui" "checkout"
|
||||||
|
pbase=$(cat patches/gui/PATCHBASE | tr -d '\n')
|
||||||
|
echo "Checking out scratch-gui patchbase $pbase"
|
||||||
|
cd scratch-gui || exit
|
||||||
|
git checkout "$pbase"
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
job_fail "scratch-gui" "checkout"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd .. || exit
|
||||||
|
job_success "scratch-gui" "checkout"
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_patch() {
|
sub_patch() {
|
||||||
|
@ -71,7 +95,28 @@ sub_patch() {
|
||||||
|
|
||||||
echo "[*] Patches applied cleanly to scratch-blocks"
|
echo "[*] Patches applied cleanly to scratch-blocks"
|
||||||
|
|
||||||
|
cd .. || exit
|
||||||
|
|
||||||
job_success "scratch-blocks" "patch"
|
job_success "scratch-blocks" "patch"
|
||||||
|
|
||||||
|
job_start "scratch-gui" "patch"
|
||||||
|
|
||||||
|
cd scratch-gui || exit
|
||||||
|
|
||||||
|
git am --abort >/dev/null 2>&1
|
||||||
|
|
||||||
|
git am --3way "../patches/gui/"*.patch
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "One or more patches did not apply cleanly to scratch-gui. Check above message and try again".
|
||||||
|
job_fail "scratch-gui" "patch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Patches applied cleanly to scratch-gui"
|
||||||
|
|
||||||
|
cd .. || exit
|
||||||
|
|
||||||
|
job_success "scratch-gui" "patch"
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_compile() {
|
sub_compile() {
|
||||||
|
@ -79,6 +124,8 @@ sub_compile() {
|
||||||
|
|
||||||
job_start "scratch-blocks" "compile"
|
job_start "scratch-blocks" "compile"
|
||||||
|
|
||||||
|
cd scratch-blocks || exit
|
||||||
|
|
||||||
NODE_OPTIONS=--openssl-legacy-provider npm i
|
NODE_OPTIONS=--openssl-legacy-provider npm i
|
||||||
|
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
|
@ -86,7 +133,37 @@ sub_compile() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
npm link
|
||||||
|
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "Unable to configure scratch-gui to use scratch-blocks. Check above message and try again".
|
||||||
|
job_fail "scratch-blocks" "compile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd .. || exit
|
||||||
|
|
||||||
job_success "scratch-blocks" "compile"
|
job_success "scratch-blocks" "compile"
|
||||||
|
|
||||||
|
job_start "scratch-gui" "compile"
|
||||||
|
|
||||||
|
cd scratch-gui || exit
|
||||||
|
|
||||||
|
npm link scratch-blocks
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "Unable to configure scratch-gui to use scratch-blocks. Check above message and try again".
|
||||||
|
job_fail "scratch-gui" "compile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
npm i
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
job_fail "scratch-gui" "compile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd .. || exit
|
||||||
|
|
||||||
|
job_success "scratch-gui" "compile"
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_patchc() {
|
sub_patchc() {
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
module.exports = {
|
||||||
|
packagerConfig: {},
|
||||||
|
rebuildConfig: {},
|
||||||
|
makers: [
|
||||||
|
{
|
||||||
|
name: '@electron-forge/maker-squirrel',
|
||||||
|
config: {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '@electron-forge/maker-zip',
|
||||||
|
platforms: ['darwin'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '@electron-forge/maker-deb',
|
||||||
|
config: {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '@electron-forge/maker-rpm',
|
||||||
|
config: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "pyblocks-gui",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Open-source GUI for programming PyBlocks with Scratch.",
|
||||||
|
"main": "src/main.js",
|
||||||
|
"repository": "https://git.e3t.cc/~core/pyblocks",
|
||||||
|
"author": "c0repwn3r",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"private": false,
|
||||||
|
"devDependencies": {
|
||||||
|
"@electron-forge/cli": "^6.1.1",
|
||||||
|
"@electron-forge/maker-deb": "^6.1.1",
|
||||||
|
"@electron-forge/maker-rpm": "^6.1.1",
|
||||||
|
"@electron-forge/maker-squirrel": "^6.1.1",
|
||||||
|
"@electron-forge/maker-zip": "^6.1.1",
|
||||||
|
"electron": "^24.3.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron-forge start",
|
||||||
|
"package": "electron-forge package",
|
||||||
|
"make": "electron-forge make"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"electron-squirrel-startup": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||||
|
<title>Hello World!</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Hello World!</h1>
|
||||||
|
We are using Node.js <span id="node-version"></span>,
|
||||||
|
Chromium <span id="chrome-version"></span>,
|
||||||
|
and Electron <span id="electron-version"></span>.
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,26 @@
|
||||||
|
const { app, BrowserWindow } = require('electron');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const createWindow = () => {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, 'preload.js')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
win.loadFile('src/index.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') app.quit()
|
||||||
|
})
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,10 @@
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const replaceText = (selector, text) => {
|
||||||
|
const element = document.getElementById(selector)
|
||||||
|
if (element) element.innerText = text
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const dependency of ['chrome', 'node', 'electron']) {
|
||||||
|
replaceText(`${dependency}-version`, process.versions[dependency])
|
||||||
|
}
|
||||||
|
})
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue