2019年10月31日

webbit記事

mpf連線(linux)
安裝mpfshell
pip install mpfshell

執行mpfshell
mpfshell

mpfs [/]>

連線 usb0
mpfs [/]> open ttyUSB0

可以執行指令
ls
rm 
 ------------------------------------------
下載原始檔
git clone https://github.com/llk/scratch-gui
 安裝
npm install

執行
npm start
使用瀏覽器開啟http://0.0.0.0:8601/

建立擴充套件
在scratch-gui/node_modules/scratch-vm/src/extensions目錄下建立scratch3_bpibit資料夾
在scratch-gui/src/lib/libraries/extensions/建立bpibit資料夾,裡面放svg圖檔
編輯index.js
加入(參考micro:bit,配合資料夾內的圖檔名稱)
import bpibitIconURL from './bpibit/bpibit.png';
import bpibitInsetIconURL from './bpibit/bpibit-small.svg';
import bpibitConnectionIconURL from './bpibit/bpibit-illustration.svg';
import bpibitConnectionSmallIconURL from './bpibit/bpibit-small.svg';


在下面加入(參考micro:bit)
{
        name: 'bpi:bit',
        extensionId: 'bpibit',
        collaborator: 'bpi:bit',
        iconURL: bpibitIconURL,
        insetIconURL: bpibitInsetIconURL,
        description: (
            <FormattedMessage
                defaultMessage="Connect your projects with the world."
                description="Description for the 'bpi:bit' extension"
                id="gui.extension.bpibit.description"
            />
        ),
        featured: true,
        disabled: false,
        bluetoothRequired: true,
        internetConnectionRequired: true,
        launchPeripheralConnectionFlow: true,
        useAutoScan: false,
        connectionIconURL: bpibitConnectionIconURL,
        connectionSmallIconURL: bpibitConnectionSmallIconURL,
        connectingMessage: (
            <FormattedMessage
                defaultMessage="Connecting"
                description="Message to help people connect to their bpi:bit."
                id="gui.extension.bpibit.connectingMessage"
            />
        ),
        helpLink: 'https://scratch.mit.edu/microbit'
    },













scratch-gui/node_modules/scratch-vm/src/extension-support/extension-manager.js

const builtinExtensions = {
下增加
bpibit: () => require('../extensions/scratch3_bpibit'),



翻譯
scratch-gui/node_modules/scratch-l10n/locales/extensions-msgs.js
interface-msgs.js
editor-msgs.js
加入
    "bpibit.buttonsMenu.any": "任何",
    "bpibit.clearDisplay": "清空畫面",



沒有留言: