first commit
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.shared/
|
||||||
|
bin/
|
||||||
|
!bin/sources/
|
||||||
|
node_modules/
|
||||||
|
*yarn*
|
0
LICENSE.md
Normal file
BIN
fonts/Pakchee-R.otf
Normal file
BIN
fonts/SourceHanCodeJP-Light.otf
Normal file
BIN
fonts/SourceHanCodeJP-Normal.otf
Normal file
BIN
fonts/SourceHanCodeJP-Regular.otf
Normal file
BIN
fonts/SourceHanCodeJP.otf
Normal file
BIN
fonts/averia-sans-libre-v7-latin-regular.woff2
Normal file
BIN
fonts/fa-brands-400.woff2
Normal file
BIN
fonts/fa-solid-900.woff2
Normal file
BIN
img/saori.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
img/saori_hakodot.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/saori_hakodot_2x.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
img/scratch_cat.png
Normal file
After Width: | Height: | Size: 28 KiB |
1768
index.html
Normal file
108
index.js
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
const { app, BrowserWindow, Menu, session } = require('electron');
|
||||||
|
|
||||||
|
/** Force disable security warning */
|
||||||
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
||||||
|
|
||||||
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
let win
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
// Create the browser window.
|
||||||
|
win = new BrowserWindow({
|
||||||
|
/** Icon */
|
||||||
|
icon: "./icon.png",
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/** Maximize Window when launch */
|
||||||
|
win.maximize();
|
||||||
|
|
||||||
|
// and load the index.html of the app.
|
||||||
|
win.loadFile('index.html')
|
||||||
|
|
||||||
|
// Open the DevTools.
|
||||||
|
// win.webContents.openDevTools()
|
||||||
|
|
||||||
|
// Emitted when the window is closed.
|
||||||
|
win.on('closed', () => {
|
||||||
|
// Dereference the window object, usually you would store windows
|
||||||
|
// in an array if your app supports multi windows, this is the time
|
||||||
|
// when you should delete the corresponding element.
|
||||||
|
win = null
|
||||||
|
})
|
||||||
|
|
||||||
|
/** For SkyWay */
|
||||||
|
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
|
||||||
|
details.requestHeaders['Origin'] = 'electron://localhost';
|
||||||
|
callback({
|
||||||
|
cancel: false,
|
||||||
|
requestHeaders: details.requestHeaders
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method will be called when Electron has finished
|
||||||
|
// initialization and is ready to create browser windows.
|
||||||
|
// Some APIs can only be used after this event occurs.
|
||||||
|
// app.on('ready', createWindow)
|
||||||
|
app.on('ready', () => {
|
||||||
|
createWindow();
|
||||||
|
/** Custom Menu */
|
||||||
|
let template = [
|
||||||
|
{
|
||||||
|
label: 'Menu',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Quit',
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
},
|
||||||
|
accelerator: "CommandOrControl+Q"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Developer Tools',
|
||||||
|
click: () => {
|
||||||
|
win.webContents.toggleDevTools()
|
||||||
|
},
|
||||||
|
accelerator: "F12"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Reload',
|
||||||
|
click: () => {
|
||||||
|
win.reload();
|
||||||
|
},
|
||||||
|
accelerator: "F5"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const menu = Menu.buildFromTemplate(template);
|
||||||
|
Menu.setApplicationMenu(menu);
|
||||||
|
win.setMenuBarVisibility(false);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// Quit when all windows are closed.
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
// On macOS it is common for applications and their menu bar
|
||||||
|
// to stay active until the user quits explicitly with Cmd + Q
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
// On macOS it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (win === null) {
|
||||||
|
createWindow()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// In this file you can include the rest of your app's specific main process
|
||||||
|
// code. You can also put them in separate files and require them here.
|
||||||
|
|
10
local_modules/ocoge_pigpiod/binding.gyp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{ "targets":
|
||||||
|
[ { "target_name" : "ocoge_pigpiod"
|
||||||
|
, "sources" : [ "ocoge_pigpiod.cpp" ]
|
||||||
|
, "defines" : [ "NAPI_DISABLE_CPP_EXCEPTIONS" ]
|
||||||
|
, "include_dirs" : [ "<!@(node -p \"require( 'node-addon-api' ).include\")" ]
|
||||||
|
, "dependencies" : ["<!(node -p \"require('node-addon-api').gyp\")"]
|
||||||
|
, "libraries" : [ "-lpigpiod_if2", "-lrt" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
7
local_modules/ocoge_pigpiod/index.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = require('bindings')('ocoge_pigpiod');
|
||||||
|
|
||||||
|
module.exports.INPUT = 0;
|
||||||
|
module.exports.OUTPUT = 1;
|
||||||
|
module.exports.PUD_OFF = 0;
|
||||||
|
module.exports.PUD_DOWN = 1;
|
||||||
|
module.exports.PUD_UP = 2;
|
544
local_modules/ocoge_pigpiod/ocoge_pigpiod.cpp
Normal file
@ -0,0 +1,544 @@
|
|||||||
|
/** PIGPIO デーモンを Node.js から利用するモジュール ** */
|
||||||
|
/** 関数名・書式は Python Interface に準拠 ******************* */
|
||||||
|
|
||||||
|
#include <napi.h>
|
||||||
|
#include <pigpiod_if2.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace Napi;
|
||||||
|
|
||||||
|
int pi = 0;
|
||||||
|
|
||||||
|
Value Usleep(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 1)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(info[0].As<Number>().DoubleValue());
|
||||||
|
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// pigpio 初期化
|
||||||
|
Value Start(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
pi = pigpio_start(0, 0);
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
// リモート
|
||||||
|
Value StartRemote(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsString() || !info[1].IsString())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string addrStr = info[0].As<String>().Utf8Value();
|
||||||
|
std::string portStr = info[1].As<String>().Utf8Value();
|
||||||
|
|
||||||
|
pi = pigpio_start(&addrStr[0], &portStr[0]);
|
||||||
|
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
// pigpio 後始末
|
||||||
|
Value Stop(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
pigpio_stop(pi);
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIO 端子のモードを設定
|
||||||
|
Value SetMode(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int mode = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_mode(pi, gpio, mode)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIO 端子のモードを取得
|
||||||
|
Value GetMode(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 1)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
get_mode(pi, gpio)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIOの内部プルアップ/ダウン抵抗の設定/クリア
|
||||||
|
Value SetPullUpDown(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int pud = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_pull_up_down(pi, gpio, pud)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIOの電圧を読む
|
||||||
|
Value Read(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 1)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
gpio_read(pi, gpio)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GPIO の電圧をセットする
|
||||||
|
Value Write(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int value = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
gpio_write(pi, gpio, value)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// サーボパルス幅をセットする
|
||||||
|
Value SetServoPulsewidth(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int user_gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int pulsewidth = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_servo_pulsewidth(pi, user_gpio, pulsewidth)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PWM周波数を設定する
|
||||||
|
Value SetPwmFrequency(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int user_gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int frequency = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_PWM_frequency(pi, user_gpio, frequency)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PWMのレンジを設定する
|
||||||
|
Value SetPwmRange(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int user_gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int range = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_PWM_range(pi, user_gpio, range)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PWMのデューティ比を指定して出力を開始する
|
||||||
|
Value SetPwmDutycycle(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int user_gpio = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int dutycycle = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
set_PWM_dutycycle(pi, user_gpio, dutycycle)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// シリアルポートを開く
|
||||||
|
Value SerialOpen(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 3)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsString() || !info[1].IsNumber() || !info[2].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ser_tty = info[0].As<String>().Utf8Value();
|
||||||
|
// char *c = new char[ser_tty.size()+1];
|
||||||
|
// std::strcpy(c, ser_tty.c_str());
|
||||||
|
// &ser_tty[0] で参照できるらしいけど危険?
|
||||||
|
|
||||||
|
unsigned int baud = info[1].As<Number>().DoubleValue();
|
||||||
|
unsigned int ser_flags = info[2].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
serial_open(pi, &ser_tty[0], baud, ser_flags)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// シリアルポートを閉じる
|
||||||
|
Value SerialClose(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 1)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
serial_close(pi, handle)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// シリアルデバイスからデータを読む
|
||||||
|
Value SerialRead(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int count = info[1].As<Number>().DoubleValue();
|
||||||
|
char buf[count+1];
|
||||||
|
for (unsigned int i = 0; i <= count; i++)
|
||||||
|
{
|
||||||
|
buf[i] = 0;
|
||||||
|
}
|
||||||
|
serial_read(pi, handle, buf, count);
|
||||||
|
return String::New(env,
|
||||||
|
buf
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// シリアルデバイスにバイト列を書き込む(data: string)
|
||||||
|
Value SerialWrite(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsString())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
std::string buf = info[1].As<String>().Utf8Value();
|
||||||
|
|
||||||
|
unsigned int count = buf.length();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
serial_write(pi, handle, &buf[0], count)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2Cバスアドレスのデバイスのハンドルを返す
|
||||||
|
Value I2cOpen(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 3)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int i2c_bus = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int i2c_addr = info[1].As<Number>().DoubleValue();
|
||||||
|
unsigned int i2c_flags = info[2].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
i2c_open(pi, i2c_bus, i2c_addr, i2c_flags)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// オープン済みI2Cハンドルを閉じる
|
||||||
|
Value I2cClose(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 1)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
i2c_close(pi, handle)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに1バイトを書き込む
|
||||||
|
Value I2cWriteByteData(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 3)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int i2c_reg = info[1].As<Number>().DoubleValue();
|
||||||
|
unsigned int bVal = info[2].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
i2c_write_byte_data(pi, handle, i2c_reg, bVal)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから1バイトを読み込む
|
||||||
|
Value I2cReadByteData(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int i2c_reg = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
i2c_read_byte_data(pi, handle, i2c_reg)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから単一の16ビットワードを読み取る
|
||||||
|
Value I2cReadWordData(const CallbackInfo& info)
|
||||||
|
{
|
||||||
|
Env env = info.Env();
|
||||||
|
if (info.Length() < 2)
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong number of arguments")
|
||||||
|
.ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
if (!info[0].IsNumber() || !info[1].IsNumber())
|
||||||
|
{
|
||||||
|
TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int handle = info[0].As<Number>().DoubleValue();
|
||||||
|
unsigned int i2c_reg = info[1].As<Number>().DoubleValue();
|
||||||
|
|
||||||
|
return Number::New(env,
|
||||||
|
i2c_read_word_data(pi, handle, i2c_reg)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object
|
||||||
|
Init(Env env, Object exports)
|
||||||
|
{
|
||||||
|
exports.Set(String::New(env, "usleep"), Function::New(env, Usleep));
|
||||||
|
exports.Set(String::New(env, "start"), Function::New(env, Start));
|
||||||
|
exports.Set(String::New(env, "start_remote"), Function::New(env, StartRemote));
|
||||||
|
exports.Set(String::New(env, "stop"), Function::New(env, Stop));
|
||||||
|
exports.Set(String::New(env, "set_mode"), Function::New(env, SetMode));
|
||||||
|
exports.Set(String::New(env, "get_mode"), Function::New(env, GetMode));
|
||||||
|
exports.Set(String::New(env, "set_pull_up_down"), Function::New(env, SetPullUpDown));
|
||||||
|
exports.Set(String::New(env, "read"), Function::New(env, Read));
|
||||||
|
exports.Set(String::New(env, "write"), Function::New(env, Write));
|
||||||
|
exports.Set(String::New(env, "set_servo_pulsewidth"), Function::New(env, SetServoPulsewidth));
|
||||||
|
exports.Set(String::New(env, "set_PWM_frequency"), Function::New(env, SetPwmFrequency));
|
||||||
|
exports.Set(String::New(env, "set_PWM_range"), Function::New(env, SetPwmRange));
|
||||||
|
exports.Set(String::New(env, "set_PWM_dutycycle"), Function::New(env, SetPwmDutycycle));
|
||||||
|
exports.Set(String::New(env, "serial_open"), Function::New(env, SerialOpen));
|
||||||
|
exports.Set(String::New(env, "serial_close"), Function::New(env, SerialClose));
|
||||||
|
exports.Set(String::New(env, "serial_read"), Function::New(env, SerialRead));
|
||||||
|
exports.Set(String::New(env, "serial_write"), Function::New(env, SerialWrite));
|
||||||
|
exports.Set(String::New(env, "i2c_open"), Function::New(env, I2cOpen));
|
||||||
|
exports.Set(String::New(env, "i2c_close"), Function::New(env, I2cClose));
|
||||||
|
exports.Set(String::New(env, "i2c_write_byte_data"), Function::New(env, I2cWriteByteData));
|
||||||
|
exports.Set(String::New(env, "i2c_read_byte_data"), Function::New(env, I2cReadByteData));
|
||||||
|
exports.Set(String::New(env, "i2c_read_word_data"), Function::New(env, I2cReadWordData));
|
||||||
|
return exports;
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_API_MODULE( ocoge_pigpiod, Init )
|
11
local_modules/ocoge_pigpiod/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "ocoge_pigpiod",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"main": "index.js",
|
||||||
|
"private": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"node-addon-api": "^1.7.1"
|
||||||
|
}
|
||||||
|
}
|
20
package.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "ocoge",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron .",
|
||||||
|
"postinstall": "electron-rebuild"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"electron": "^7.1.8",
|
||||||
|
"electron-rebuild": "^1.8.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.19.1",
|
||||||
|
"node-dht-sensor": "^0.4.0",
|
||||||
|
"nodemailer": "^6.4.2",
|
||||||
|
"ocoge_pigpiod": "file:./local_modules/ocoge_pigpiod"
|
||||||
|
}
|
||||||
|
}
|
25
pxt-blockly/LICENSE
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
PXT Blockly fork
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
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.
|
70
pxt-blockly/README.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Blockly (Microsoft MakeCode fork)
|
||||||
|
|
||||||
|
This is a fork of [Blockly](https://github.com/google/blockly/), an open source visual programming environment.
|
||||||
|
The fork is maintained by the Microsoft MakeCode team, and is used to power the blocks environment in [PXT](https://github.com/Microsoft/pxt).
|
||||||
|
|
||||||
|
|
||||||
|
Major additions and changes in this fork:
|
||||||
|
* [scratch-blocks](https://github.com/llk/scratch-blocks) rendering of the blocks [block_render_svg.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/block_render_svg.js)
|
||||||
|
* Using insertion markers instead of dragged connections [insertion_marker_manager.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/insertion_marker_manager.js)
|
||||||
|
* Inverted and coloured toolbox modes [toolbox.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/toolbox.js#L428)
|
||||||
|
* Supports disabled categories [toolbox.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/toolbox.js#L360)
|
||||||
|
* Supports icons in the toolbox
|
||||||
|
* Adds a number slider field [field_slider.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/field_slider.js)
|
||||||
|
* Zoom in / out with touch gestures [touch_gesture.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/touch_gesture.js)
|
||||||
|
* Workspace comments that appear like sticky notes [workspace_comment.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/workspace_comment.js)
|
||||||
|
* A number of Edge & IE fixes
|
||||||
|
* Support underlining and icons in flyout labels [flyout_button.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/flyout_button.js#L203)
|
||||||
|
* Support for multiple flyouts per toolbox for performance reasons [pxt_blockly_functions.js](https://github.com/Microsoft/pxt-blockly/blob/develop/core/pxt_blockly_functions.js#L650)
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* node, npm
|
||||||
|
* python
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/google/closure-library
|
||||||
|
cd closure-library
|
||||||
|
git checkout v20180805
|
||||||
|
cd ../
|
||||||
|
git clone https://github.com/Microsoft/pxt-blockly
|
||||||
|
cd pxt-blockly
|
||||||
|
npm install .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
* `gulp build` to build blockly (install ``gulp`` if needed ``npm install -g gulp``)
|
||||||
|
|
||||||
|
## Update Blockly.d.ts
|
||||||
|
|
||||||
|
* `gulp typings` to regenerate blockly.d.ts
|
||||||
|
|
||||||
|
## Testing local changes in PXT
|
||||||
|
|
||||||
|
* `gulp publish` from the ``develop`` branch to generate the blockly-compressed and blocks-compressed files, and copy them into the pxt-blockly node module folder
|
||||||
|
* run `pxt clean && pxt serve` in the **target** directory (eg pxt-arcade, or pxt-minecraft)
|
||||||
|
|
||||||
|
**Make sure you've checked out the correct closure-library (see above)**
|
||||||
|
|
||||||
|
See [more tips about **pxt+pxt-blockly** testing](https://github.com/Microsoft/pxt/tree/master/scripts).
|
||||||
|
|
||||||
|
## Updating pxt-blockly in PXT
|
||||||
|
|
||||||
|
* `gulp bump` to bump blockly version, commit, and tag.
|
||||||
|
|
||||||
|
* After the Travis has deployed the package to npm, update the pxt-blockly version in `package.json` in the pxt repo.
|
||||||
|
|
||||||
|
## Playground
|
||||||
|
|
||||||
|
There is a playground manual testing page at [tests/playground.html](./tests/playground.html), which requires no build step or server running.
|
||||||
|
|
||||||
|
`open tests/playground.html`
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The original Google/Blockly is licensed under Apache License (Version 2.0).
|
||||||
|
|
||||||
|
New code is licensed under MIT.
|
430
pxt-blockly/THIRD-PARTY-NOTICES.txt
Normal file
@ -0,0 +1,430 @@
|
|||||||
|
/*!----------------- PXT Blockly ThirdPartyNotices -------------------------------------------------------
|
||||||
|
|
||||||
|
The Microsoft Blockly fork uses third party material from the projects listed below.
|
||||||
|
The original copyright notice and the license under which Microsoft
|
||||||
|
received such third party material are set forth below. Microsoft
|
||||||
|
reserves all other rights not expressly granted, whether by
|
||||||
|
implication, estoppel or otherwise.
|
||||||
|
|
||||||
|
In the event that we accidentally failed to list a required notice, please
|
||||||
|
bring it to our attention. Post an issue or email us:
|
||||||
|
|
||||||
|
yelmteam@microsoft.com
|
||||||
|
|
||||||
|
---------------------------------------------
|
||||||
|
Third Party Code Components
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
----------------- google/blockly -------------------
|
||||||
|
|
||||||
|
Copyright 2013 Google Inc
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2011
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
%% gulp-git 2.9.0 NOTICES AND INFORMATION BEGIN HERE (https://registry.npmjs.org/gulp-git/-/gulp-git-2.9.0.tgz)
|
||||||
|
=========================================
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2015 Steve Lacy <me@slacy.me> slacy.me
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
=========================================
|
||||||
|
END OF gulp-git NOTICES AND INFORMATION
|
||||||
|
|
||||||
|
%% semver 6.6.0 NOTICES AND INFORMATION BEGIN HERE (https://registry.npmjs.org/semver/-/semver-6.0.0.tgz)
|
||||||
|
=========================================
|
||||||
|
The ISC License
|
||||||
|
|
||||||
|
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
=========================================
|
||||||
|
END OF semver NOTICES AND INFORMATION
|
||||||
|
|
||||||
|
|
||||||
|
%% Closure Library v20190729 NOTICES AND INFORMATION BEGIN HERE (https://github.com/google/closure-library/archive/v20190729.tar.gz)
|
||||||
|
=========================================
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
=========================================
|
||||||
|
END OF Closure Library NOTICES AND INFORMATION
|
2402
pxt-blockly/blockly_compressed.js
Normal file
297
pxt-blockly/blocks_compressed.js
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
// Do not edit this file; automatically generated by build.py.
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
Blockly.Colours={text:"#575E75",workspace:"#F9F9F9",toolboxHover:"#4C97FF",toolboxSelected:"#e9eef2",toolboxText:"#575E75",toolbox:"#FFFFFF",flyout:"#444",scrollbar:"#CECDCE",scrollbarHover:"#CECDCE",textField:"#FFFFFF",insertionMarker:"#000000",insertionMarkerOpacity:.2,dragShadowOpacity:.4,stackGlow:"#FFF200",stackGlowSize:4,stackGlowOpacity:1,replacementGlow:"#FFF200",replacementGlowSize:2,replacementGlowOpacity:1,highlightGlow:"#FFF200",highlightGlowSize:1.1,highlightGlowOpacity:1,selectedGlow:"#FFF200",
|
||||||
|
selectedGlowSize:.4,warningGlow:"#E53D00",warningGlowSize:1.1,warningGlowOpacity:1,colourPickerStroke:"#FFFFFF",fieldShadow:"rgba(255, 255, 255, 0.2)",dropDownShadow:"rgba(0, 0, 0, .3)",numPadBackground:"#547AB2",numPadBorder:"#435F91",numPadActiveBackground:"#435F91",numPadText:"#FFFFFF",valueReportBackground:"#FFFFFF",valueReportBorder:"#AAAAAA",canvasTransitionLength:500};
|
||||||
|
Blockly.constants={};Blockly.LINE_MODE_MULTIPLIER=40;Blockly.PAGE_MODE_MULTIPLIER=125;Blockly.DRAG_RADIUS=3;Blockly.FLYOUT_DRAG_RADIUS=10;Blockly.SNAP_RADIUS=48;Blockly.CONNECTING_SNAP_RADIUS=96;Blockly.CURRENT_CONNECTION_PREFERENCE=20;Blockly.BUMP_DELAY=0;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};
|
||||||
|
Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;
|
||||||
|
Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.OUTPUT_SHAPE_HEXAGONAL=1;Blockly.OUTPUT_SHAPE_ROUND=2;Blockly.OUTPUT_SHAPE_SQUARE=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";
|
||||||
|
Blockly.CREATE_VARIABLE_ID="CREATE_VARIABLE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.FUNCTION_DEFINITION_BLOCK_TYPE="function_definition";Blockly.FUNCTION_DECLARATION_BLOCK_TYPE="function_declaration";Blockly.FUNCTION_CALL_BLOCK_TYPE="function_call";
|
||||||
|
Blockly.Blocks.colour={};Blockly.Constants={};Blockly.Constants.Colour={};Blockly.Constants.Colour.HUE=20;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",outputShape:Blockly.OUTPUT_SHAPE_ROUND,helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"field_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",outputShape:Blockly.OUTPUT_SHAPE_ROUND,helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",
|
||||||
|
tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"LEFT"},{type:"input_value",name:"GREEN",check:"Number",align:"LEFT"},{type:"input_value",name:"BLUE",check:"Number",align:"LEFT"}],output:"Colour",outputShape:Blockly.OUTPUT_SHAPE_ROUND,helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},
|
||||||
|
{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"LEFT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"LEFT"},{type:"input_value",name:"RATIO",check:"Number",align:"LEFT"}],output:"Colour",outputShape:Blockly.OUTPUT_SHAPE_ROUND,helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]);/*
|
||||||
|
|
||||||
|
PXT Blockly
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
https://github.com/Microsoft/pxt-blockly
|
||||||
|
|
||||||
|
See LICENSE file for details.
|
||||||
|
*/
|
||||||
|
Blockly.PXTBlockly={};Blockly.PXTBlockly.Extensions={};
|
||||||
|
Blockly.PXTBlockly.Extensions.INLINE_SVGS=function(){this.ADD_IMAGE_DATAURI="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4KCjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0icmVwZWF0IgogICB4PSIwcHgiCiAgIHk9IjBweCIKICAgdmlld0JveD0iMCAwIDI0IDI0IgogICBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiCiAgIHhtbDpzcGFjZT0icHJlc2VydmUiCiAgIGlua3NjYXBlOnZlcnNpb249IjAuOTEgcjEzNzI1IgogICBzb2RpcG9kaTpkb2NuYW1lPSJhZGQuc3ZnIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGExNSI+PHJkZjpSREY+PGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz48ZGM6dGl0bGU+cmVwZWF0PC9kYzp0aXRsZT48L2NjOldvcms+PC9yZGY6UkRGPjwvbWV0YWRhdGE+PGRlZnMKICAgICBpZD0iZGVmczEzIiAvPjxzb2RpcG9kaTpuYW1lZHZpZXcKICAgICBwYWdlY29sb3I9IiNmZjQ4MjEiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgYm9yZGVyb3BhY2l0eT0iMSIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGdyaWR0b2xlcmFuY2U9IjEwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBpbmtzY2FwZTpwYWdlb3BhY2l0eT0iMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTY4MCIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSI5NjkiCiAgICAgaWQ9Im5hbWVkdmlldzExIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIxOS42NjY2NjciCiAgICAgaW5rc2NhcGU6Y3g9IjEyLjkxNTI1NCIKICAgICBpbmtzY2FwZTpjeT0iMTYuMDY3Nzk2IgogICAgIGlua3NjYXBlOndpbmRvdy14PSIwIgogICAgIGlua3NjYXBlOndpbmRvdy15PSIwIgogICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjAiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0icmVwZWF0IiAvPjxzdHlsZQogICAgIHR5cGU9InRleHQvY3NzIgogICAgIGlkPSJzdHlsZTMiPgoJLnN0MHtmaWxsOiNDRjhCMTc7fQoJLnN0MXtmaWxsOiNGRkZGRkY7fQo8L3N0eWxlPjx0aXRsZQogICAgIGlkPSJ0aXRsZTUiPnJlcGVhdDwvdGl0bGU+PHJlY3QKICAgICBzdHlsZT0ib3BhY2l0eToxO2ZpbGw6I2ZmZmZmZjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MTtzdHJva2UtbGluZWNhcDpzcXVhcmU7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLW9wYWNpdHk6MC4wNzg0MzEzNyIKICAgICBpZD0icmVjdDQxNDMiCiAgICAgd2lkdGg9IjQuMDUwMDAwMiIKICAgICBoZWlnaHQ9IjEyLjM5NzA1IgogICAgIHg9IjkuOTc1MDAwNCIKICAgICB5PSItMTguMTk4NTI2IgogICAgIHJ4PSIwLjgxIgogICAgIHJ5PSIwLjgxIgogICAgIHRyYW5zZm9ybT0ic2NhbGUoMSwtMSkiIC8+PHJlY3QKICAgICBzdHlsZT0ib3BhY2l0eToxO2ZpbGw6I2ZmZmZmZjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MTtzdHJva2UtbGluZWNhcDpzcXVhcmU7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLW9wYWNpdHk6MC4wNzg0MzEzNyIKICAgICBpZD0icmVjdDQxNDMtMSIKICAgICB3aWR0aD0iNC4wNTAwMDAyIgogICAgIGhlaWdodD0iMTIuMzk3MTE5IgogICAgIHg9IjkuOTc1MDAwNCIKICAgICB5PSI1LjgwMTQ0MDciCiAgICAgcng9IjAuODEiCiAgICAgcnk9IjAuODEiCiAgICAgdHJhbnNmb3JtPSJtYXRyaXgoMCwxLDEsMCwwLDApIiAvPjxjaXJjbGUKICAgICBzdHlsZT0ib3BhY2l0eToxO2ZpbGw6bm9uZTtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6I2ZmZmZmZjtzdHJva2Utd2lkdGg6MjtzdHJva2UtbGluZWNhcDpzcXVhcmU7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjQ7c3Ryb2tlLWRhc2hhcnJheTpub25lO3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLW9wYWNpdHk6MSIKICAgICBpZD0icGF0aDQxMzYiCiAgICAgY3g9IjEyIgogICAgIGN5PSIxMiIKICAgICByPSIxMC41MDMxOTEiIC8+PC9zdmc+";this.REMOVE_IMAGE_DATAURI=
|
||||||
|
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4KCjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0icmVwZWF0IgogICB4PSIwcHgiCiAgIHk9IjBweCIKICAgdmlld0JveD0iMCAwIDI0IDI0IgogICBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiCiAgIHhtbDpzcGFjZT0icHJlc2VydmUiCiAgIGlua3NjYXBlOnZlcnNpb249IjAuOTEgcjEzNzI1IgogICBzb2RpcG9kaTpkb2NuYW1lPSJyZW1vdmUuc3ZnIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGExNSI+PHJkZjpSREY+PGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz48ZGM6dGl0bGU+cmVwZWF0PC9kYzp0aXRsZT48L2NjOldvcms+PC9yZGY6UkRGPjwvbWV0YWRhdGE+PGRlZnMKICAgICBpZD0iZGVmczEzIiAvPjxzb2RpcG9kaTpuYW1lZHZpZXcKICAgICBwYWdlY29sb3I9IiNmZjFhZmYiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgYm9yZGVyb3BhY2l0eT0iMSIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGdyaWR0b2xlcmFuY2U9IjEwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBpbmtzY2FwZTpwYWdlb3BhY2l0eT0iMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTY4MCIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSI5NTAiCiAgICAgaWQ9Im5hbWVkdmlldzExIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIxOS42NjY2NjciCiAgICAgaW5rc2NhcGU6Y3g9IjAuMDUwODQ3NTIxIgogICAgIGlua3NjYXBlOmN5PSI5Ljk2NjEwMTciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjAiCiAgICAgaW5rc2NhcGU6d2luZG93LW1heGltaXplZD0iMCIKICAgICBpbmtzY2FwZTpjdXJyZW50LWxheWVyPSJyZXBlYXQiIC8+PHN0eWxlCiAgICAgdHlwZT0idGV4dC9jc3MiCiAgICAgaWQ9InN0eWxlMyI+Cgkuc3Qwe2ZpbGw6I0NGOEIxNzt9Cgkuc3Qxe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU+PHRpdGxlCiAgICAgaWQ9InRpdGxlNSI+cmVwZWF0PC90aXRsZT48cmVjdAogICAgIHN0eWxlPSJvcGFjaXR5OjE7ZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDoxO3N0cm9rZS1saW5lY2FwOnNxdWFyZTtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLWRhc2hvZmZzZXQ6MDtzdHJva2Utb3BhY2l0eTowLjA3ODQzMTM3IgogICAgIGlkPSJyZWN0NDE0My0xIgogICAgIHdpZHRoPSI0LjA1MDAwMDIiCiAgICAgaGVpZ2h0PSIxMi4zOTcxMTkiCiAgICAgeD0iOS45NzUwMDA0IgogICAgIHk9IjUuODAxNDQwNyIKICAgICByeD0iMC44MSIKICAgICByeT0iMC44MSIKICAgICB0cmFuc2Zvcm09Im1hdHJpeCgwLDEsMSwwLDAsMCkiIC8+PGNpcmNsZQogICAgIHN0eWxlPSJvcGFjaXR5OjE7ZmlsbDpub25lO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTojZmZmZmZmO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnNxdWFyZTtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLWRhc2hvZmZzZXQ6MDtzdHJva2Utb3BhY2l0eToxIgogICAgIGlkPSJwYXRoNDEzNiIKICAgICBjeD0iMTIiCiAgICAgY3k9IjEyIgogICAgIHI9IjEwLjUwMzE5MSIgLz48L3N2Zz4="};
|
||||||
|
Blockly.PXTBlockly.Extensions.FUNCTION_CONTEXTMENU_EDIT={customContextMenu:function(a){a.push(Blockly.Functions.makeEditOption(this))}};Blockly.PXTBlockly.Extensions.OUTPUT_NUMBER=function(){this.setInputsInline(!0);this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setOutput(!0,"Number")};Blockly.PXTBlockly.Extensions.OUTPUT_STRING=function(){this.setInputsInline(!0);this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setOutput(!0,"String")};
|
||||||
|
Blockly.PXTBlockly.Extensions.OUTPUT_BOOLEAN=function(){this.setInputsInline(!0);this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);this.setOutput(!0,"Boolean")};
|
||||||
|
Blockly.PXTBlockly.Extensions.registerAll=function(){Blockly.Extensions.register("inline-svgs",this.INLINE_SVGS);Blockly.Extensions.registerMixin("function_contextmenu_edit",Blockly.PXTBlockly.Extensions.FUNCTION_CONTEXTMENU_EDIT);Blockly.Extensions.register("output_number",Blockly.PXTBlockly.Extensions.OUTPUT_NUMBER);Blockly.Extensions.register("output_string",Blockly.PXTBlockly.Extensions.OUTPUT_STRING);Blockly.Extensions.register("output_boolean",Blockly.PXTBlockly.Extensions.OUTPUT_BOOLEAN)};
|
||||||
|
Blockly.PXTBlockly.Extensions.registerAll();Blockly.Blocks.lists={};Blockly.Constants.Lists={};Blockly.Constants.Lists.HUE=260;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",
|
||||||
|
helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",outputShape:Blockly.OUTPUT_SHAPE_ROUND,inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,
|
||||||
|
style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
|
||||||
|
Blockly.Blocks.lists_create_with={init:function(){Blockly.Extensions.apply("inline-svgs",this,!1);this.setHelpUrl(Blockly.Msg.LISTS_CREATE_WITH_HELPURL);this.setStyle("list_blocks");this.itemCount_=3;this.updateShape_();this.setOutput(!0,"Array");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setInputsInline(!0);this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},
|
||||||
|
domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},storeConnections_:function(){this.valueConnections_=[];for(var a=0;a<this.itemCount_;a++)this.valueConnections_.push(this.getInput("ADD"+a).connection.targetConnection)},restoreConnections_:function(){for(var a=0;a<this.itemCount_;a++)Blockly.Mutator.reconnect(this.valueConnections_[a],this,"ADD"+a)},addItem_:function(){this.storeConnections_();this.update_(function(){this.itemCount_++});this.restoreConnections_();
|
||||||
|
if(1<this.itemCount_){var a=this.getInput("ADD0");if(a&&a.connection.targetConnection){var b=this.getInput("ADD"+(this.itemCount_-1)),c=a.connection.getShadowDom();c&&(a=Blockly.utils.xml.createElement("shadow"),c=c.getAttribute("type"),a.setAttribute("type",c),c=Blockly.utils.xml.createElement("field"),c.setAttribute("name","NUM"),a.appendChild(c),a&&(a.setAttribute("id",Blockly.utils.genUid()),b.connection.setShadowDom(a),b.connection.respawnShadow_()))}}},removeItem_:function(){this.storeConnections_();
|
||||||
|
this.update_(function(){this.itemCount_--});this.restoreConnections_()},update_:function(a){Blockly.Events.setGroup(!0);var b=this,c=b.mutationToDom();c=c&&Blockly.Xml.domToText(c);var d=b.rendered;b.rendered=!1;a&&a.call(this);this.updateShape_();b.rendered=d;b.initSvg();var e=Blockly.Events.getGroup();a=(a=b.mutationToDom())&&Blockly.Xml.domToText(a);c!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(b,"mutation",null,c,a)),setTimeout(function(){Blockly.Events.setGroup(e);b.bumpNeighbours_();
|
||||||
|
Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY));b.rendered&&b.render();Blockly.Events.setGroup(!1)},updateShape_:function(){var a=this,b=function(){a.removeItem_()};this.itemCount_?(this.getInput("EMPTY")&&this.removeInput("EMPTY"),this.getInput("TITLE")||this.appendDummyInput("TITLE").appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH)):(this.getInput("TITLE")&&this.removeInput("TITLE"),this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE));
|
||||||
|
var c=0;for(c=0;c<this.itemCount_;c++)this.getInput("ADD"+c)||this.appendValueInput("ADD"+c);for(;this.getInput("ADD"+c);)this.removeInput("ADD"+c),c++;this.getInput("BUTTONS")&&this.removeInput("BUTTONS");c=this.appendDummyInput("BUTTONS");0<this.itemCount_&&c.appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",b,!1));c.appendField(new Blockly.FieldImage(this.ADD_IMAGE_DATAURI,24,24,"*",function(){a.addItem_()},!1));b=5>=this.itemCount_;this.setInputsInline(b);this.setOutputShape(b?
|
||||||
|
Blockly.OUTPUT_SHAPE_ROUND:Blockly.OUTPUT_SHAPE_SQUARE)}};Blockly.Blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.appendStatementInput("STACK");this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
|
||||||
|
Blockly.Blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks");this.appendDummyInput().appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
|
||||||
|
Blockly.Blocks.lists_indexOf={init:function(){var a=[[Blockly.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[Blockly.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_INDEX_OF_HELPURL);this.setStyle("list_blocks");this.setOutput(!0,"Number");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);this.appendValueInput("FIND").appendField(new Blockly.FieldDropdown(a),"END");this.setInputsInline(!0);
|
||||||
|
var b=this;this.setTooltip(function(){return Blockly.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"0":"-1")})}};
|
||||||
|
Blockly.Blocks.lists_getIndex={init:function(){var a=[[Blockly.Msg.LISTS_GET_INDEX_GET,"GET"],[Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[Blockly.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL);
|
||||||
|
this.setStyle("list_blocks");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);a=new Blockly.FieldDropdown(a,function(a){a="REMOVE"==a;this.getSourceBlock().updateStatement_(a)});this.appendValueInput("VALUE").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);this.appendDummyInput().appendField(a,"MODE").appendField("","SPACE");this.appendDummyInput("AT");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL);this.setInputsInline(!0);
|
||||||
|
this.setOutput(!0);this.updateAt_(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(a+" "+d){case "GET FROM_START":case "GET FROM_END":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":e=
|
||||||
|
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case "REMOVE FIRST":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":e=
|
||||||
|
Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":e=Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if("FROM_START"==d||"FROM_END"==d)e+=" "+("FROM_START"==d?Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP:Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("statement",!this.outputConnection);var b=this.getInput("AT").type==Blockly.INPUT_VALUE;
|
||||||
|
a.setAttribute("at",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("statement");this.updateStatement_(b);a="false"!=a.getAttribute("at");this.updateAt_(a)},updateStatement_:function(a){a!=!this.outputConnection&&(this.unplug(!0,!0),a?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(a){this.removeInput("AT");this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),
|
||||||
|
Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.getSourceBlock();e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.getInput("AT").appendField(b,"WHERE");Blockly.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};
|
||||||
|
Blockly.Blocks.lists_setIndex={init:function(){var a=[[Blockly.Msg.LISTS_SET_INDEX_SET,"SET"],[Blockly.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[Blockly.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[Blockly.Msg.LISTS_GET_INDEX_LAST,"LAST"],[Blockly.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.setHelpUrl(Blockly.Msg.LISTS_SET_INDEX_HELPURL);this.setStyle("list_blocks");this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
|
||||||
|
this.appendDummyInput().appendField(new Blockly.FieldDropdown(a),"MODE").appendField("","SPACE");this.appendDummyInput("AT");this.appendValueInput("TO").appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP);this.updateAt_(!0);var b=this;this.setTooltip(function(){var a=b.getFieldValue("MODE"),d=b.getFieldValue("WHERE"),e="";switch(a+" "+d){case "SET FROM_START":case "SET FROM_END":e=
|
||||||
|
Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;
|
||||||
|
break;case "INSERT RANDOM":e=Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"==d||"FROM_END"==d)e+=" "+Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",b.workspace.options.oneBasedIndex?"#1":"#0");return e})},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation"),b=this.getInput("AT").type==Blockly.INPUT_VALUE;a.setAttribute("at",b);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT");
|
||||||
|
this.removeInput("ORDINAL",!0);a?(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var b=new Blockly.FieldDropdown(this.WHERE_OPTIONS,function(b){var c="FROM_START"==b||"FROM_END"==b;if(c!=a){var e=this.getSourceBlock();e.updateAt_(c);e.setFieldValue(b,"WHERE");return null}});this.moveInputBefore("AT","TO");this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL",
|
||||||
|
"TO");this.getInput("AT").appendField(b,"WHERE")}};
|
||||||
|
Blockly.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[Blockly.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL);this.setStyle("list_blocks");
|
||||||
|
this.appendValueInput("LIST").setCheck("Array").appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);this.setInputsInline(!0);this.setOutput(!0,"Array");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var a=
|
||||||
|
Blockly.utils.xml.createElement("mutation"),b=this.getInput("AT1").type==Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&
|
||||||
|
this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.getSourceBlock();f.updateAt_(a,d);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,"WHERE"+a);1==a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"));Blockly.Msg.LISTS_GET_SUBLIST_TAIL&&
|
||||||
|
this.moveInputBefore("TAIL",null)}};
|
||||||
|
Blockly.Blocks.lists_sort={init:function(){this.jsonInit({message0:Blockly.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[Blockly.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[Blockly.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[Blockly.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[Blockly.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",outputShape:Blockly.OUTPUT_SHAPE_ROUND,
|
||||||
|
style:"list_blocks",tooltip:Blockly.Msg.LISTS_SORT_TOOLTIP,helpUrl:Blockly.Msg.LISTS_SORT_HELPURL})}};
|
||||||
|
Blockly.Blocks.lists_split={init:function(){var a=this,b=new Blockly.FieldDropdown([[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(b){a.updateType_(b)});this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);this.setStyle("list_blocks");this.appendValueInput("INPUT").setCheck("String").appendField(b,"MODE");this.appendValueInput("DELIM").setCheck("String").appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);this.setInputsInline(!0);this.setOutput(!0,
|
||||||
|
"Array");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setTooltip(function(){var b=a.getFieldValue("MODE");if("SPLIT"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==b)return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+b);})},updateType_:function(a){if(this.getFieldValue("MODE")!=a){var b=this.getInput("INPUT").connection;b.setShadowDom(null);var c=b.targetBlock();c&&(b.disconnect(),c.isShadow()?c.dispose():this.bumpNeighbours_())}"SPLIT"==a?(this.outputConnection.setCheck("Array"),
|
||||||
|
this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("mode",this.getFieldValue("MODE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("mode"))}};Blockly.Blocks.logic={};Blockly.Constants.Logic={};Blockly.Constants.Logic.HUE=210;
|
||||||
|
Blockly.Blocks.controls_if={init:function(){Blockly.Extensions.apply("inline-svgs",this,!1);this.elseCount_=this.elseifCount_=0;this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL);this.appendValueInput("IF0").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendDummyInput("THEN0").appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.appendStatementInput("DO0");this.updateShape_();this.setInputsInline(!0);this.setColour(Blockly.Msg.LOGIC_HUE);this.setPreviousStatement(!0);this.setNextStatement(!0);
|
||||||
|
Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION.call(this)},mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Blockly.utils.xml.createElement("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){a&&(this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(a.getAttribute("else"),10)||0,this.rebuildShape_())},storeConnections_:function(a){a||
|
||||||
|
(a=0);this.valueConnections_=[null];this.statementConnections_=[null];this.elseStatementConnection_=null;for(var b=1;b<=this.elseifCount_;b++)a!=b&&(this.valueConnections_.push(this.getInput("IF"+b).connection.targetConnection),this.statementConnections_.push(this.getInput("DO"+b).connection.targetConnection));this.getInput("ELSE")&&(this.elseStatementConnection_=this.getInput("ELSE").connection.targetConnection)},restoreConnections_:function(){for(var a=1;a<=this.elseifCount_;a++)Blockly.Mutator.reconnect(this.valueConnections_[a],
|
||||||
|
this,"IF"+a),Blockly.Mutator.reconnect(this.statementConnections_[a],this,"DO"+a);this.getInput("ELSE")&&Blockly.Mutator.reconnect(this.elseStatementConnection_,this,"ELSE")},addElse_:function(){this.storeConnections_();this.update_(function(){this.elseCount_++});this.restoreConnections_()},removeElse_:function(){this.storeConnections_();this.update_(function(){this.elseCount_--});this.restoreConnections_()},addElseIf_:function(){this.storeConnections_();this.update_(function(){this.elseifCount_++});
|
||||||
|
this.restoreConnections_()},removeElseIf_:function(a){this.storeConnections_(a);this.update_(function(){this.elseifCount_--});this.restoreConnections_()},update_:function(a){Blockly.Events.setGroup(!0);var b=this,c=b.mutationToDom();c=c&&Blockly.Xml.domToText(c);var d=b.rendered;b.rendered=!1;a&&a.call(this);this.updateShape_();b.rendered=d;b.initSvg();var e=Blockly.Events.getGroup();a=(a=b.mutationToDom())&&Blockly.Xml.domToText(a);c!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(b,"mutation",
|
||||||
|
null,c,a)),setTimeout(function(){Blockly.Events.setGroup(e);b.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY));b.rendered&&b.render();Blockly.Events.setGroup(!1)},updateShape_:function(){var a=this;this.getInput("ELSE")&&(this.removeInput("ELSE"),this.removeInput("ELSETITLE"),this.removeInput("ELSEBUTTONS"));for(var b=1;this.getInput("IF"+b);)this.removeInput("IF"+b),this.removeInput("IFTITLE"+b),this.removeInput("IFBUTTONS"+b),this.removeInput("DO"+b),b++;for(b=1;b<=this.elseifCount_;b++){var c=
|
||||||
|
function(b){return function(){a.removeElseIf_(b)}}(b);this.appendValueInput("IF"+b).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);this.appendDummyInput("IFTITLE"+b).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);this.appendDummyInput("IFBUTTONS"+b).appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",c,!1)).setAlign(Blockly.ALIGN_RIGHT);this.appendStatementInput("DO"+b)}this.elseCount_&&(this.appendDummyInput("ELSETITLE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE),
|
||||||
|
this.appendDummyInput("ELSEBUTTONS").setAlign(Blockly.ALIGN_RIGHT).appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",a.removeElse_.bind(a),!1)),this.appendStatementInput("ELSE"));this.getInput("ADDBUTTON")&&this.removeInput("ADDBUTTON");a=this;b=function(){return function(){0==a.elseCount_?a.addElse_():(a.elseifCount_||(a.elseifCount_=0),a.addElseIf_())}}();this.appendDummyInput("ADDBUTTON").appendField(new Blockly.FieldImage(this.ADD_IMAGE_DATAURI,24,24,"*",b,!1))},rebuildShape_:function(){var a=
|
||||||
|
[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);){var e=this.getInput("IF"+d),f=this.getInput("DO"+d);a.push(e.connection.targetConnection);b.push(f.connection.targetConnection);d++}this.updateShape_();this.reconnectChildBlocks_(a,b,c)},reconnectChildBlocks_:function(a,b,c){for(var d=1;d<=this.elseifCount_;d++)Blockly.Mutator.reconnect(a[d],this,"IF"+d),Blockly.Mutator.reconnect(b[d],this,"DO"+d);Blockly.Mutator.reconnect(c,
|
||||||
|
this,"ELSE")}};
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1 %{BKY_CONTROLS_IF_MSG_THEN}",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],
|
||||||
|
message1:"%1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE}",message3:"%1",args3:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264",
|
||||||
|
"LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",
|
||||||
|
check:"Boolean"}],inputsInline:!0,output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",
|
||||||
|
output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",
|
||||||
|
extensions:["logic_ternary"]}]);
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,
|
||||||
|
enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);Blockly.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};
|
||||||
|
Blockly.Extensions.register("logic_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Logic.TOOLTIPS_BY_OP));
|
||||||
|
Blockly.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,suppressPrefixSuffix:!0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var a=Blockly.utils.xml.createElement("mutation");this.elseifCount_&&a.setAttribute("elseif",this.elseifCount_);this.elseCount_&&a.setAttribute("else",1);return a},domToMutation:function(a){this.elseifCount_=parseInt(a.getAttribute("elseif"),10)||0;this.elseCount_=parseInt(a.getAttribute("else"),10)||0;this.rebuildShape_()},
|
||||||
|
decompose:function(a){var b=a.newBlock("controls_if_if");b.initSvg();for(var c=b.nextConnection,d=1;d<=this.elseifCount_;d++){var e=a.newBlock("controls_if_elseif");e.initSvg();c.connect(e.previousConnection);c=e.nextConnection}this.elseCount_&&(a=a.newBlock("controls_if_else"),a.initSvg(),c.connect(a.previousConnection));return b},compose:function(a){a=a.nextConnection.targetBlock();this.elseCount_=this.elseifCount_=0;for(var b=[null],c=[null],d=null;a;){switch(a.type){case "controls_if_elseif":this.elseifCount_++;
|
||||||
|
b.push(a.valueConnection_);c.push(a.statementConnection_);break;case "controls_if_else":this.elseCount_++;d=a.statementConnection_;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}this.updateShape_();this.reconnectChildBlocks_(b,c,d)},saveConnections:function(a){a=a.nextConnection.targetBlock();for(var b=1;a;){switch(a.type){case "controls_if_elseif":var c=this.getInput("IF"+b),d=this.getInput("DO"+b);a.valueConnection_=c&&c.connection.targetConnection;
|
||||||
|
a.statementConnection_=d&&d.connection.targetConnection;b++;break;case "controls_if_else":d=this.getInput("ELSE");a.statementConnection_=d&&d.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.nextConnection&&a.nextConnection.targetBlock()}},rebuildShape_:function(){var a=[null],b=[null],c=null;this.getInput("ELSE")&&(c=this.getInput("ELSE").connection.targetConnection);for(var d=1;this.getInput("IF"+d);){var e=this.getInput("IF"+d),f=this.getInput("DO"+
|
||||||
|
d);a.push(e.connection.targetConnection);b.push(f.connection.targetConnection);d++}this.updateShape_();this.reconnectChildBlocks_(a,b,c)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var a=1;this.getInput("IF"+a);)this.removeInput("IF"+a),this.removeInput("DO"+a),a++;for(a=1;a<=this.elseifCount_;a++)this.appendValueInput("IF"+a).setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+a).appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
|
||||||
|
this.elseCount_&&this.appendStatementInput("ELSE").appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(a,b,c){for(var d=1;d<=this.elseifCount_;d++)Blockly.Mutator.reconnect(a[d],this,"IF"+d),Blockly.Mutator.reconnect(b[d],this,"DO"+d);Blockly.Mutator.reconnect(c,this,"ELSE")}};
|
||||||
|
Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return Blockly.Msg.CONTROLS_IF_TOOLTIP_4}else return Blockly.Msg.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};Blockly.Extensions.register("controls_if_tooltip",Blockly.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION);
|
||||||
|
Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(a){this.prevBlocks_||(this.prevBlocks_=[null,null]);var b=this.getInputTargetBlock("A"),c=this.getInputTargetBlock("B");b&&c&&!b.outputConnection.checkType_(c.outputConnection)&&(Blockly.Events.setGroup(a.group),a=this.prevBlocks_[0],a!==b&&(b.unplug(),a&&!a.isShadow()&&this.getInput("A").connection.connect(a.outputConnection)),b=this.prevBlocks_[1],b!==c&&(c.unplug(),b&&!b.isShadow()&&this.getInput("B").connection.connect(b.outputConnection)),
|
||||||
|
this.bumpNeighbours_(),Blockly.Events.setGroup(!1));this.prevBlocks_[0]=this.getInputTargetBlock("A");this.prevBlocks_[1]=this.getInputTargetBlock("B")}};Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)};Blockly.Extensions.register("logic_compare",Blockly.Constants.Logic.LOGIC_COMPARE_EXTENSION);
|
||||||
|
Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1==e?b:c;f&&!f.outputConnection.checkType_(d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours_()):(f.unplug(),f.bumpNeighbours_()),Blockly.Events.setGroup(!1))}this.prevParentConnection_=
|
||||||
|
d}};Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN);Blockly.Blocks.loops={};Blockly.Constants.Loops={};Blockly.Constants.Loops.HUE=120;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,
|
||||||
|
min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],
|
||||||
|
message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"input_value",name:"VAR",check:"Variable"},{type:"input_value",name:"FROM",check:"Number",align:"LEFT"},{type:"input_value",name:"TO",check:"Number",align:"LEFT"},{type:"input_value",name:"BY",
|
||||||
|
check:"Number",align:"LEFT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"input_value",name:"VAR",check:"Variable"},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",
|
||||||
|
name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip",
|
||||||
|
"controls_flow_in_loop_check"]}]);Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};Blockly.Extensions.register("controls_whileUntil_tooltip",Blockly.Extensions.buildTooltipForDropdown("MODE",Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS));Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};
|
||||||
|
Blockly.Extensions.register("controls_flow_tooltip",Blockly.Extensions.buildTooltipForDropdown("FLOW",Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS));
|
||||||
|
Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR").getVariable(),c=b.name;if(!this.isCollapsed()&&null!=c){var d={enabled:!0};d.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);b=Blockly.Variables.generateVariableFieldDom(b);c=Blockly.utils.xml.createElement("block");c.setAttribute("type","variables_get");c.appendChild(b);d.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(d)}}}};
|
||||||
|
Blockly.Extensions.registerMixin("contextMenu_newGetVariableBlock",Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);Blockly.Extensions.register("controls_for_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));Blockly.Extensions.register("controls_forEach_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));
|
||||||
|
Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(a){do{if(-1!=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){this.workspace.isDragging&&!this.workspace.isDragging()&&(Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this)?
|
||||||
|
(this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1)))}};Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);Blockly.Blocks.math={};Blockly.Constants.Math={};Blockly.Constants.Math.HUE=230;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"field_blocks",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_integer",message0:"%1",args0:[{type:"field_number",name:"NUM",precision:1}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"field_blocks",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",
|
||||||
|
tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_whole_number",message0:"%1",args0:[{type:"field_number",name:"NUM",min:0,precision:1}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"field_blocks",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_positive_number",message0:"%1",args0:[{type:"field_number",name:"NUM",min:0}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,
|
||||||
|
style:"field_blocks",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_number_minmax",message0:"%1",args0:[{type:"field_slider",name:"SLIDER",value:0,step:1,labelText:"Number"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"field_blocks",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",mutator:"math_number_minmax_mutator",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",
|
||||||
|
message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",
|
||||||
|
extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",
|
||||||
|
name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0",
|
||||||
|
"PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}",
|
||||||
|
"PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",
|
||||||
|
check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",
|
||||||
|
helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}",
|
||||||
|
"RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",
|
||||||
|
helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",
|
||||||
|
name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",
|
||||||
|
message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
|
||||||
|
Blockly.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
|
||||||
|
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};
|
||||||
|
Blockly.Extensions.register("math_op_tooltip",Blockly.Extensions.buildTooltipForDropdown("OP",Blockly.Constants.Math.TOOLTIPS_BY_OP));
|
||||||
|
Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation"),b="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");a.setAttribute("divisor_input",b);return a},domToMutation:function(a){a="true"==a.getAttribute("divisor_input");this.updateShape_(a)},updateShape_:function(a){var b=this.getInput("DIVISOR");a?b||this.appendValueInput("DIVISOR").setCheck("Number"):b&&this.removeInput("DIVISOR")}};
|
||||||
|
Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(a){a="DIVISIBLE_BY"==a;this.getSourceBlock().updateShape_(a)})};Blockly.Extensions.registerMutator("math_is_divisibleby_mutator",Blockly.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,Blockly.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION);Blockly.Extensions.register("math_change_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));
|
||||||
|
Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"==a?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("op",this.getFieldValue("OP"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("op"))}};Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(a){this.updateType_(a)}.bind(this))};
|
||||||
|
Blockly.Extensions.registerMutator("math_modes_of_list_mutator",Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN,Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION);
|
||||||
|
Blockly.Constants.Math.MATH_NUMBER_MINMAX_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");void 0!=this.inputList[0].fieldRow[0].min_&&a.setAttribute("min",this.inputList[0].fieldRow[0].min_);void 0!=this.inputList[0].fieldRow[0].max_&&a.setAttribute("max",this.inputList[0].fieldRow[0].max_);void 0!=this.inputList[0].fieldRow[0].labelText_&&a.setAttribute("label",this.inputList[0].fieldRow[0].labelText_);void 0!=this.inputList[0].fieldRow[0].step_&&a.setAttribute("step",
|
||||||
|
this.inputList[0].fieldRow[0].step_);void 0!=this.inputList[0].fieldRow[0].sliderColor_&&a.setAttribute("color",this.inputList[0].fieldRow[0].sliderColor_);void 0!=this.inputList[0].fieldRow[0].precision_&&a.setAttribute("precision",this.inputList[0].fieldRow[0].precision_);return a},domToMutation:function(a){var b=a.getAttribute("min"),c=a.getAttribute("max"),d=a.getAttribute("step"),e=a.getAttribute("label"),f=a.getAttribute("color");a=a.getAttribute("precision");this.inputList[0].fieldRow[0].setLabel(e);
|
||||||
|
this.inputList[0].fieldRow[0].setOptions(b,c,d,a);this.inputList[0].fieldRow[0].setColor(f)}};Blockly.Extensions.registerMutator("math_number_minmax_mutator",Blockly.Constants.Math.MATH_NUMBER_MINMAX_MIXIN);Blockly.Blocks.procedures={};
|
||||||
|
Blockly.Blocks.procedures_defnoreturn={init:function(){var a=new Blockly.FieldTextInput("",Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT);
|
||||||
|
this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=
|
||||||
|
a)},updateParams_:function(){var a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));Blockly.Events.disable();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},mutationToDom:function(a){var b=Blockly.utils.xml.createElement("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c<this.argumentVarModels_.length;c++){var d=Blockly.utils.xml.createElement("arg"),e=this.argumentVarModels_[c];d.setAttribute("name",
|
||||||
|
e.name);d.setAttribute("varid",e.getId());a&&this.paramIds_&&d.setAttribute("paramId",this.paramIds_[c]);b.appendChild(d)}this.hasStatements_||b.setAttribute("statements","false");return b},domToMutation:function(a){this.arguments_=[];this.argumentVarModels_=[];for(var b=0,c;c=a.childNodes[b];b++)if("arg"==c.nodeName.toLowerCase()){var d=c.getAttribute("name");c=c.getAttribute("varid")||c.getAttribute("varId");this.arguments_.push(d);c=Blockly.Variables.getOrCreateVariablePackage(this.workspace,c,
|
||||||
|
d,"");null!=c?this.argumentVarModels_.push(c):console.log("Failed to create a variable with name "+d+", ignoring.")}this.updateParams_();Blockly.Procedures.mutateCallers(this);this.setStatements_("false"!==a.getAttribute("statements"))},decompose:function(a){var b=Blockly.utils.xml.createElement("block");b.setAttribute("type","procedures_mutatorcontainer");var c=Blockly.utils.xml.createElement("statement");c.setAttribute("name","STACK");b.appendChild(c);for(var d=0;d<this.arguments_.length;d++){var e=
|
||||||
|
Blockly.utils.xml.createElement("block");e.setAttribute("type","procedures_mutatorarg");var f=Blockly.utils.xml.createElement("field");f.setAttribute("name","NAME");var g=Blockly.utils.xml.createTextNode(this.arguments_[d]);f.appendChild(g);e.appendChild(f);f=Blockly.utils.xml.createElement("next");e.appendChild(f);c.appendChild(e);c=f}a=Blockly.Xml.domToBlock(b,a);"procedures_defreturn"==this.type?a.setFieldValue(this.hasStatements_,"STATEMENTS"):a.removeInput("STATEMENT_INPUT");Blockly.Procedures.mutateCallers(this);
|
||||||
|
return a},compose:function(a){this.arguments_=[];this.paramIds_=[];this.argumentVarModels_=[];for(var b=a.getInputTargetBlock("STACK");b;){var c=b.getFieldValue("NAME");this.arguments_.push(c);c=this.workspace.getVariable(c,"");this.argumentVarModels_.push(c);this.paramIds_.push(b.id);b=b.nextConnection&&b.nextConnection.targetBlock()}this.updateParams_();Blockly.Procedures.mutateCallers(this);a=a.getFieldValue("STATEMENTS");if(null!==a&&(a="TRUE"==a,this.hasStatements_!=a))if(a)this.setStatements_(!0),
|
||||||
|
Blockly.Mutator.reconnect(this.statementConnection_,this,"STACK"),this.statementConnection_=null;else{a=this.getInput("STACK").connection;if(this.statementConnection_=a.targetConnection)a=a.targetBlock(),a.unplug(),a.bumpNeighbours_();this.setStatements_(!1)}},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(a,b){var c=this.workspace.getVariableById(a);
|
||||||
|
if(""==c.type){c=c.name;for(var d=this.workspace.getVariableById(b),e=!1,f=0;f<this.argumentVarModels_.length;f++)this.argumentVarModels_[f].getId()==a&&(this.arguments_[f]=d.name,this.argumentVarModels_[f]=d,e=!0);e&&(this.displayRenamedVar_(c,d.name),Blockly.Procedures.mutateCallers(this))}},updateVarName:function(a){for(var b=a.name,c=!1,d=0;d<this.argumentVarModels_.length;d++)if(this.argumentVarModels_[d].getId()==a.getId()){var e=this.arguments_[d];this.arguments_[d]=b;c=!0}c&&(this.displayRenamedVar_(e,
|
||||||
|
b),Blockly.Procedures.mutateCallers(this))},displayRenamedVar_:function(a,b){this.updateParams_();if(this.mutator.isVisible())for(var c=this.mutator.workspace_.getAllBlocks(!1),d=0,e;e=c[d];d++)"procedures_mutatorarg"==e.type&&Blockly.Names.equals(a,e.getFieldValue("NAME"))&&e.setFieldValue(b,"NAME")},customContextMenu:function(a){if(!this.isInFlyout){var b={enabled:!0},c=this.getFieldValue("NAME");b.text=Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1",c);var d=Blockly.utils.xml.createElement("mutation");
|
||||||
|
d.setAttribute("name",c);for(c=0;c<this.arguments_.length;c++){var e=Blockly.utils.xml.createElement("arg");e.setAttribute("name",this.arguments_[c]);d.appendChild(e)}c=Blockly.utils.xml.createElement("block");c.setAttribute("type",this.callType_);c.appendChild(d);b.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(b);if(!this.isCollapsed())for(c=0;c<this.argumentVarModels_.length;c++)b={enabled:!0},d=this.argumentVarModels_[c],b.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",d.name),
|
||||||
|
d=Blockly.Variables.generateVariableFieldDom(d),e=Blockly.utils.xml.createElement("block"),e.setAttribute("type","variables_get"),e.appendChild(d),b.callback=Blockly.ContextMenu.callbackFactory(this,e),a.push(b)}},callType_:"procedures_callnoreturn"};
|
||||||
|
Blockly.Blocks.procedures_defreturn={init:function(){var a=new Blockly.FieldTextInput("",Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.appendValueInput("RETURN").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&
|
||||||
|
this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFRETURN_COMMENT);this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:Blockly.Blocks.procedures_defnoreturn.setStatements_,updateParams_:Blockly.Blocks.procedures_defnoreturn.updateParams_,
|
||||||
|
mutationToDom:Blockly.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_defnoreturn.domToMutation,decompose:Blockly.Blocks.procedures_defnoreturn.decompose,compose:Blockly.Blocks.procedures_defnoreturn.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:Blockly.Blocks.procedures_defnoreturn.getVars,getVarModels:Blockly.Blocks.procedures_defnoreturn.getVarModels,renameVarById:Blockly.Blocks.procedures_defnoreturn.renameVarById,
|
||||||
|
updateVarName:Blockly.Blocks.procedures_defnoreturn.updateVarName,displayRenamedVar_:Blockly.Blocks.procedures_defnoreturn.displayRenamedVar_,customContextMenu:Blockly.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn"};
|
||||||
|
Blockly.Blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);this.appendStatementInput("STACK");this.appendDummyInput("STATEMENT_INPUT").appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new Blockly.FieldCheckbox("TRUE"),"STATEMENTS");this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1},onchange:function(a){if(this.workspace&&!this.workspace.isFlyout&&
|
||||||
|
(a.type==Blockly.Events.BLOCK_DELETE||a.type==Blockly.Events.BLOCK_CREATE)){var b=this.workspace.getAllBlocks(),c=this.workspace.getAllVariables();if(a.type==Blockly.Events.BLOCK_DELETE){a=[];for(var d=0;d<b.length;d+=1)b[d].getFieldValue("NAME")&&a.push(b[d].getFieldValue("NAME"));for(b=0;b<c.length;b+=1)-1==a.indexOf(c[b].name)&&this.workspace.deleteVariableById(c[b].getId())}else if(a.type==Blockly.Events.BLOCK_CREATE&&(c=this.workspace.getBlockById(a.blockId),c.getField("NAME")&&(d=c.getFieldValue("NAME"),
|
||||||
|
(a=this.workspace.getVariable(d))||(a=this.workspace.createVariable(d)),!c.previousConnection.isConnected()&&!c.nextConnection.isConnected())))for(d=0;d<b.length;d+=1)if(c.id!=b[d].id&&b[d].getFieldValue("NAME")==a.name){d=Blockly.Variables.generateUniqueName(this.workspace);a=this.workspace.createVariable(d);c.setFieldValue(a.name,"NAME");break}}}};
|
||||||
|
Blockly.Blocks.procedures_mutatorarg={init:function(){var a=new Blockly.FieldTextInput("x",this.validator_);a.oldShowEditorFn_=a.showEditor_;a.showEditor_=function(){this.createdVariables_=[];this.oldShowEditorFn_()};this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(a,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.onFinishEditing_=
|
||||||
|
this.deleteIntermediateVars_;a.createdVariables_=[];a.onFinishEditing_("x")},validator_:function(a){var b=Blockly.Mutator.findParentWs(this.getSourceBlock().workspace);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;for(var c=this.getSourceBlock().workspace.getAllBlocks(),d=0;d<c.length;d+=1)if(c[d].id!=this.getSourceBlock().id&&c[d].getFieldValue("NAME")==a)return null;(c=b.getVariable(a,""))&&c.name!=a&&b.renameVarById(c.getId(),a);c||(c=b.createVariable(a,""))&&this.createdVariables_&&
|
||||||
|
this.createdVariables_.push(c);return a},deleteIntermediateVars_:function(a){var b=Blockly.Mutator.findParentWs(this.getSourceBlock().workspace);if(b)for(var c=0;c<this.createdVariables_.length;c++){var d=this.createdVariables_[c];d.name!=a&&b.deleteVariableById(d.getId())}}};
|
||||||
|
Blockly.Blocks.procedures_callnoreturn={init:function(){this.appendDummyInput("TOPROW").appendField(this.id,"NAME");this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=!0},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(a,b){Blockly.Names.equals(a,
|
||||||
|
this.getProcedureCall())&&(this.setFieldValue(b,"NAME"),this.setTooltip((this.outputConnection?Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP:Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",b)))},setProcedureParameters_:function(a,b){var c=Blockly.Procedures.getDefinition(this.getProcedureCall(),this.workspace),d=c&&c.mutator&&c.mutator.isVisible();d||(this.quarkConnections_={},this.quarkIds_=null);if(b)if(a.join("\n")==this.arguments_.join("\n"))this.quarkIds_=b;else{if(b.length!=a.length)throw RangeError("paramNames and paramIds must be the same length.");
|
||||||
|
this.setCollapsed(!1);this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);c=this.rendered;this.rendered=!1;for(var e=0;e<this.arguments_.length;e++){var f=this.getInput("ARG"+e);f&&(f=f.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=f,d&&f&&-1==b.indexOf(this.quarkIds_[e])&&(f.disconnect(),f.getSourceBlock().bumpNeighbours_()))}this.arguments_=[].concat(a);this.argumentVarModels_=[];for(e=0;e<this.arguments_.length;e++)d=Blockly.Variables.getOrCreateVariablePackage(this.workspace,
|
||||||
|
null,this.arguments_[e],""),this.argumentVarModels_.push(d);this.updateShape_();if(this.quarkIds_=b)for(e=0;e<this.arguments_.length;e++)d=this.quarkIds_[e],d in this.quarkConnections_&&(f=this.quarkConnections_[d],Blockly.Mutator.reconnect(f,this,"ARG"+e)||delete this.quarkConnections_[d]);(this.rendered=c)&&this.render()}},updateShape_:function(){for(var a=0;a<this.arguments_.length;a++){var b=this.getField("ARGNAME"+a);if(b){Blockly.Events.disable();try{b.setValue(this.arguments_[a])}finally{Blockly.Events.enable()}}else b=
|
||||||
|
new Blockly.FieldLabel(this.arguments_[a]),this.appendValueInput("ARG"+a).setAlign(Blockly.ALIGN_RIGHT).appendField(b,"ARGNAME"+a).init()}for(;this.getInput("ARG"+a);)this.removeInput("ARG"+a),a++;if(a=this.getInput("TOPROW"))this.arguments_.length?this.getField("WITH")||(a.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),a.init()):this.getField("WITH")&&a.removeField("WITH")},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("name",this.getProcedureCall());
|
||||||
|
for(var b=0;b<this.arguments_.length;b++){var c=Blockly.utils.xml.createElement("arg");c.setAttribute("name",this.arguments_[b]);a.appendChild(c)}return a},domToMutation:function(a){var b=a.getAttribute("name");this.renameProcedure(this.getProcedureCall(),b);b=[];for(var c=[],d=0,e;e=a.childNodes[d];d++)"arg"==e.nodeName.toLowerCase()&&(b.push(e.getAttribute("name")),c.push(e.getAttribute("paramId")));this.setProcedureParameters_(b,c)},getVarModels:function(){return this.argumentVarModels_},onchange:function(a){if(this.workspace&&
|
||||||
|
!this.workspace.isFlyout&&a.recordUndo)if(a.type==Blockly.Events.BLOCK_CREATE&&-1!=a.ids.indexOf(this.id)){var b=this.getProcedureCall();b=Blockly.Procedures.getDefinition(b,this.workspace);!b||b.type==this.defType_&&JSON.stringify(b.arguments_)==JSON.stringify(this.arguments_)||(b=null);if(!b){Blockly.Events.setGroup(a.group);a=Blockly.utils.xml.createElement("xml");b=Blockly.utils.xml.createElement("block");b.setAttribute("type",this.defType_);var c=this.getRelativeToSurfaceXY(),d=c.y+2*Blockly.SNAP_RADIUS;
|
||||||
|
b.setAttribute("x",c.x+Blockly.SNAP_RADIUS*(this.RTL?-1:1));b.setAttribute("y",d);c=this.mutationToDom();b.appendChild(c);c=Blockly.utils.xml.createElement("field");c.setAttribute("name","NAME");c.appendChild(Blockly.utils.xml.createTextNode(this.getProcedureCall()));b.appendChild(c);a.appendChild(b);Blockly.Xml.domToWorkspace(a,this.workspace);Blockly.Events.setGroup(!1)}}else a.type==Blockly.Events.BLOCK_DELETE?(b=this.getProcedureCall(),b=Blockly.Procedures.getDefinition(b,this.workspace),b||(Blockly.Events.setGroup(a.group),
|
||||||
|
this.dispose(!0,!1),Blockly.Events.setGroup(!1))):a.type==Blockly.Events.CHANGE&&"disabled"==a.element&&(b=this.getProcedureCall(),(b=Blockly.Procedures.getDefinition(b,this.workspace))&&b.id==a.blockId&&((b=Blockly.Events.getGroup())&&console.log("Saw an existing group while responding to a definition change"),Blockly.Events.setGroup(a.group),a.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),Blockly.Events.setGroup(b)))},customContextMenu:function(a){if(this.workspace.isMovable()){var b=
|
||||||
|
{enabled:!0};b.text=Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;var c=this.getProcedureCall(),d=this.workspace;b.callback=function(){var a=Blockly.Procedures.getDefinition(c,d);a&&(d.centerOnBlock(a.id),a.select())};a.push(b)}},defType_:"procedures_defnoreturn"};
|
||||||
|
Blockly.Blocks.procedures_callreturn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME");this.setOutput(!0);this.setStyle("procedure_blocks");this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);this.arguments_=[];this.quarkConnections_={};this.quarkIds_=null;this.previousEnabledState_=!0},getProcedureCall:Blockly.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:Blockly.Blocks.procedures_callnoreturn.renameProcedure,setProcedureParameters_:Blockly.Blocks.procedures_callnoreturn.setProcedureParameters_,
|
||||||
|
updateShape_:Blockly.Blocks.procedures_callnoreturn.updateShape_,mutationToDom:Blockly.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:Blockly.Blocks.procedures_callnoreturn.domToMutation,getVarModels:Blockly.Blocks.procedures_callnoreturn.getVarModels,onchange:Blockly.Blocks.procedures_callnoreturn.onchange,customContextMenu:Blockly.Blocks.procedures_callnoreturn.customContextMenu,defType_:"procedures_defreturn"};
|
||||||
|
Blockly.Blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);this.setInputsInline(!0);this.setPreviousStatement(!0);this.setNextStatement(!0);this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_IFRETURN_HELPURL);this.hasReturnValue_=!0},mutationToDom:function(){var a=
|
||||||
|
Blockly.utils.xml.createElement("mutation");a.setAttribute("value",Number(this.hasReturnValue_));return a},domToMutation:function(a){this.hasReturnValue_=1==a.getAttribute("value");this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(a){if(this.workspace.isDragging&&!this.workspace.isDragging()){a=!1;var b=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(b.type)){a=!0;break}b=b.getSurroundParent()}while(b);
|
||||||
|
a?("procedures_defnoreturn"==b.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=b.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING),
|
||||||
|
this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};/*
|
||||||
|
|
||||||
|
PXT Blockly fork
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
Blockly.PXTBlockly.FunctionUtils={};Blockly.PXTBlockly.FunctionUtils.argumentIcons={};Blockly.PXTBlockly.FunctionUtils.argumentDefaultNames={};Blockly.PXTBlockly.FunctionUtils.getArgumentIcon=function(a){return Blockly.PXTBlockly.FunctionUtils.argumentIcons&&Blockly.PXTBlockly.FunctionUtils.argumentIcons[a]||void 0};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.getArgumentDefaultName=function(a){return Blockly.PXTBlockly.FunctionUtils.argumentDefaultNames&&Blockly.PXTBlockly.FunctionUtils.argumentDefaultNames[a]||Blockly.Msg.FUNCTIONS_DEFAULT_CUSTOM_ARG_NAME};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.mutationToDom=function(){this.ensureIds_();var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("name",this.name_);a.setAttribute("functionid",this.functionId_);this.arguments_.forEach(function(b){var c=Blockly.utils.xml.createElement("arg");c.setAttribute("name",b.name);c.setAttribute("id",b.id);c.setAttribute("type",b.type);a.appendChild(c)});return a};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.domToMutation=function(a){for(var b=[],c=0;c<a.childNodes.length;++c){var d=a.childNodes[c];"arg"==d.nodeName.toLowerCase()&&b.push({id:d.getAttribute("id"),name:d.getAttribute("name"),type:d.getAttribute("type")})}this.arguments_=b;this.name_=a.getAttribute("name");this.functionId_=a.getAttribute("functionid");this.ensureIds_();this.updateDisplay_()};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.ensureIds_=function(){switch(this.type){case Blockly.FUNCTION_DEFINITION_BLOCK_TYPE:this.functionId_&&"null"!=this.functionId_||(this.functionId_=Blockly.utils.genUid());for(var a=0;a<this.arguments_.length;++a)this.arguments_[a].id||(this.arguments_[a].id=Blockly.utils.genUid());break;case Blockly.FUNCTION_CALL_BLOCK_TYPE:if(a=Blockly.Functions.getDefinition(this.name_,this.workspace)){this.functionId_=a.getFunctionId();var b=a.getArguments();for(a=0;a<this.arguments_.length;++a)for(var c=
|
||||||
|
0;c<b.length;++c)if(b[c].name==this.arguments_[a].name){this.arguments_[a].id=b[c].id;break}}}};Blockly.PXTBlockly.FunctionUtils.getName=function(){return this.name_};Blockly.PXTBlockly.FunctionUtils.getFunctionId=function(){return this.functionId_};Blockly.PXTBlockly.FunctionUtils.getArguments=function(){return this.arguments_};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.setStatements_=function(a){this.hasStatements_!==a&&(a?this.appendStatementInput("STACK"):this.removeInput("STACK",!0),this.hasStatements_=a)};Blockly.PXTBlockly.FunctionUtils.updateDisplay_=function(){var a=this.rendered;this.rendered=!1;var b=this.disconnectOldBlocks_();this.removeValueInputs_();this.createAllInputs_(b);this.deleteShadows_(b);(this.rendered=a)&&!this.isInsertionMarker()&&this.initSvg&&(this.initSvg(),this.render())};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.disconnectOldBlocks_=function(){for(var a={},b=0,c;c=this.inputList[b];b++)if("STACK"!==c.name&&c.connection){var d=c.connection.targetBlock(),e={shadow:c.connection.getShadowDom(),block:d};a[c.name]=e;c.connection.setShadowDom(null);d&&c.connection.disconnect()}return a};Blockly.PXTBlockly.FunctionUtils.removeValueInputs_=function(){for(var a=[],b=0,c;c=this.inputList[b];b++)c.type==Blockly.INPUT_VALUE?c.dispose():a.push(c);this.inputList=a};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.createAllInputs_=function(a){var b=!1,c=!1;this.inputList.forEach(function(a){"function_title"==a.name?b=!0:"function_name"==a.name&&(c=!0)});if(!b){var d="";switch(this.type){case Blockly.FUNCTION_CALL_BLOCK_TYPE:d=Blockly.Msg.FUNCTIONS_CALL_TITLE;break;case Blockly.FUNCTION_DEFINITION_BLOCK_TYPE:case Blockly.FUNCTION_DECLARATION_BLOCK_TYPE:d=Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE}this.appendDummyInput("function_title").appendField(d,"function_title")}c?this.updateFunctionLabel_(this.getName()):
|
||||||
|
this.addFunctionLabel_(this.getName());var e=this;this.arguments_.forEach(function(b){var c=e.appendValueInput(b.id);Blockly.Functions.isCustomType(b.type)?c.setCheck(b.type):c.setCheck(b.type.charAt(0).toUpperCase()+b.type.slice(1));e.isInsertionMarker()||e.populateArgument_(b,a,c)});this.hasStatements_&&this.moveInputBefore("STACK",null)};Blockly.PXTBlockly.FunctionUtils.deleteShadows_=function(a){if(a)for(var b in a){var c=a[b];c&&(c=c.block)&&c.isShadow()&&(c.dispose(),delete a[b])}};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.updateLabelEditor_=function(a){Blockly.Events.disable();this.getField("function_name").setText(a);Blockly.Events.enable()};Blockly.PXTBlockly.FunctionUtils.updateLabelField_=function(a){this.getField("function_name").setValue(a)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.addLabelEditor_=function(a){a=this.type===Blockly.FUNCTION_DEFINITION_BLOCK_TYPE?new Blockly.FieldTextInput(a||"",Blockly.Functions.rename):new Blockly.FieldTextInput(a||"");a.setSpellcheck(!1);a.setAutoCapitalize(!1);this.appendDummyInput("function_name").appendField(a,"function_name")};Blockly.PXTBlockly.FunctionUtils.addLabelField_=function(a){this.appendDummyInput("function_name").appendField(new Blockly.FieldLabel(a,"functionNameText"),"function_name")};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_=function(a,b){switch(a){case "boolean":var c="logic_boolean";var d="BOOL";var e="TRUE";break;case "number":c="math_number";d="NUM";e="1";break;case "string":c="text";d="TEXT";e="abc";break;default:c="variables_get",d="VAR",e=Blockly.Variables.getOrCreateVariablePackage(b,null,Blockly.PXTBlockly.FunctionUtils.getArgumentDefaultName(a),"").getId()}return[c,d,e]};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.buildShadowDom_=function(a){var b=Blockly.utils.xml.createElement("shadow"),c=Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_(a,this.workspace);a=c[1];var d=c[2];b.setAttribute("type",c[0]);c=goog.dom.createDom("field",null,d);c.setAttribute("name",a);b.appendChild(c);return b};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.attachShadow_=function(a,b){var c=Blockly.PXTBlockly.FunctionUtils.getShadowBlockInfoFromType_(b,this.workspace),d=c[0],e=c[1];c=c[2];Blockly.Events.disable();var f=null;try{f=this.workspace.newBlock(d),f.setFieldValue(c,e),f.setShadow(!0),!this.isInsertionMarker()&&f.initSvg&&(f.initSvg(),f.render(!1))}finally{Blockly.Events.enable()}f&&f.outputConnection.connect(a.connection)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.createArgumentReporter_=function(a){switch(a.type){case "boolean":var b="argument_reporter_boolean";break;case "number":b="argument_reporter_number";break;case "string":b="argument_reporter_string";break;default:b="argument_reporter_custom"}Blockly.Events.disable();try{var c="argument_reporter_custom"==b?Blockly.PXTBlockly.FunctionUtils.createCustomArgumentReporter(a.type,this.workspace):this.workspace.newBlock(b);c.setShadow(!0);c.setFieldValue(a.name,"VALUE");!this.isInsertionMarker()&&
|
||||||
|
c.initSvg&&(c.initSvg(),c.render(!1))}finally{Blockly.Events.enable()}return c};Blockly.PXTBlockly.FunctionUtils.populateArgumentOnCaller_=function(a,b,c){var d=null,e=null;b&&a.id in b&&(e=b[a.id],d=e.block,e=e.shadow);b&&d?(b[c.name]=null,d.outputConnection.connect(c.connection),a=e||this.buildShadowDom_(a.type),c.connection.setShadowDom(a)):this.attachShadow_(c,a.type)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDefinition_=function(a,b,c){var d=null;b&&a.id in b&&(d=b[a.id].block);b&&d?(d.setFieldValue(a.name,"VALUE"),b[c.name]=null):d=this.createArgumentReporter_(a);c.connection.connect(d.outputConnection)};Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDeclaration_=function(a,b,c){a=this.createArgumentEditor_(a.type,a.name);c.connection.connect(a.outputConnection)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.createArgumentEditor_=function(a,b){Blockly.Events.disable();try{var c="";switch(a){case "boolean":c="argument_editor_boolean";break;case "number":c="argument_editor_number";break;case "string":c="argument_editor_string";break;default:c="argument_editor_custom"}var d="argument_editor_custom"==c?Blockly.PXTBlockly.FunctionUtils.createCustomArgumentEditor(a,this.workspace):this.workspace.newBlock(c);d.setFieldValue(b,"TEXT");d.setShadow(!0);!this.isInsertionMarker()&&
|
||||||
|
d.initSvg&&(d.initSvg(),d.render(!1))}finally{Blockly.Events.enable()}return d};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.updateDeclarationMutation_=function(){this.arguments_=[];for(var a=1;a<this.inputList.length;a++){var b=this.inputList[a];switch(b.type){case Blockly.NEXT_STATEMENT:break;case Blockly.DUMMY_INPUT:this.name_=b.fieldRow[0].getText();break;case Blockly.INPUT_VALUE:var c=b.connection.targetBlock();this.arguments_.push({id:b.name,name:c.getFieldValue("TEXT"),type:c.getTypeName()});break;default:console.warn("Unexpected input type on a function mutator root: "+b.type)}}};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.focusLastEditor_=function(){if(0<this.inputList.length){var a=this.inputList[this.inputList.length-2];a.type==Blockly.DUMMY_INPUT?(this.workspace.centerOnBlock(this.id),a.fieldRow[0].showEditor_()):a.type==Blockly.INPUT_VALUE&&(a=a.connection.targetBlock(),a.workspace.centerOnBlock(a.id),a.getField("TEXT").showEditor_())}};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.addParam_=function(a,b){Blockly.WidgetDiv.hide(!0);var c=Blockly.Functions.findUniqueParamName(b,this.arguments_.map(function(a){return a.name}));this.arguments_.push({id:Blockly.utils.genUid(),name:c,type:a});this.updateDisplay_();this.focusLastEditor_()};Blockly.PXTBlockly.FunctionUtils.addBooleanExternal=function(){this.addParam_("boolean",Blockly.Msg.FUNCTIONS_DEFAULT_BOOLEAN_ARG_NAME)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.addStringExternal=function(){this.addParam_("string",Blockly.Msg.FUNCTIONS_DEFAULT_STRING_ARG_NAME)};Blockly.PXTBlockly.FunctionUtils.addNumberExternal=function(){this.addParam_("number",Blockly.Msg.FUNCTIONS_DEFAULT_NUMBER_ARG_NAME)};Blockly.PXTBlockly.FunctionUtils.addCustomExternal=function(a){this.addParam_(a,Blockly.PXTBlockly.FunctionUtils.getArgumentDefaultName(a))};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.removeFieldCallback=function(a){for(var b=null,c=0;c<this.inputList.length&&!b;c++){var d=this.inputList[c];if(d.connection){var e=d.connection.targetBlock();e&&e.getField(a.name)===a&&(b=d.name)}else for(e=0;e<d.fieldRow.length;e++)d.fieldRow[e]==a&&(b=d.name)}b&&(Blockly.WidgetDiv.hide(!0),this.removeInput(b),this.updateFunctionSignature(),this.updateDisplay_())};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.removeArgumentCallback_=function(a){this.parentBlock_&&this.parentBlock_.removeFieldCallback&&this.parentBlock_.removeFieldCallback(a)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.onCallerChange=function(a){if(this.workspace&&!this.workspace.isFlyout)if(a.type==Blockly.Events.BLOCK_CREATE&&-1!=a.ids.indexOf(this.id)){var b=this.getName();if(b=Blockly.Functions.getDefinition(b,this.workspace)){a=b.getArguments().slice();var c=this.arguments_.slice();JSON.stringify(c)!==JSON.stringify(a)&&Blockly.Functions.mutateCallersAndDefinition(b.getName(),this.workspace,b.mutationToDom());this.functionId_=b.functionId_}else{Blockly.Events.setGroup(a.group);
|
||||||
|
b=Blockly.utils.xml.createElement("xml");a=Blockly.utils.xml.createElement("block");a.setAttribute("type",Blockly.FUNCTION_DEFINITION_BLOCK_TYPE);c=this.getRelativeToSurfaceXY();var d=c.y+2*Blockly.SNAP_RADIUS;a.setAttribute("x",c.x+Blockly.SNAP_RADIUS*(this.RTL?-1:1));a.setAttribute("y",d);c=this.mutationToDom();a.appendChild(c);b.appendChild(a);Blockly.Xml.domToWorkspace(b,this.workspace);Blockly.Events.setGroup(!1)}}else a.type==Blockly.Events.BLOCK_DELETE&&(b=this.getName(),b=Blockly.Functions.getDefinition(b,
|
||||||
|
this.workspace),b||(Blockly.Events.setGroup(a.group),this.dispose(!0,!1),Blockly.Events.setGroup(!1)))};
|
||||||
|
Blockly.Blocks.function_declaration={init:function(){this.name_="";this.arguments_=[];this.functionId_="";this.createAllInputs_();this.setColour(Blockly.Msg.PROCEDURES_HUE);this.setStatements_(!0);this.setDeletable(!1);this.setMovable(!1);this.contextMenu=!1;this.setStartHat(!0);this.statementConnection_=null},mutationToDom:Blockly.PXTBlockly.FunctionUtils.mutationToDom,domToMutation:Blockly.PXTBlockly.FunctionUtils.domToMutation,getName:Blockly.PXTBlockly.FunctionUtils.getName,getFunctionId:Blockly.PXTBlockly.FunctionUtils.getFunctionId,
|
||||||
|
getArguments:Blockly.PXTBlockly.FunctionUtils.getArguments,removeValueInputs_:Blockly.PXTBlockly.FunctionUtils.removeValueInputs_,disconnectOldBlocks_:Blockly.PXTBlockly.FunctionUtils.disconnectOldBlocks_,deleteShadows_:Blockly.PXTBlockly.FunctionUtils.deleteShadows_,createAllInputs_:Blockly.PXTBlockly.FunctionUtils.createAllInputs_,updateDisplay_:Blockly.PXTBlockly.FunctionUtils.updateDisplay_,setStatements_:Blockly.PXTBlockly.FunctionUtils.setStatements_,ensureIds_:Blockly.PXTBlockly.FunctionUtils.ensureIds_,
|
||||||
|
populateArgument_:Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDeclaration_,addFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.addLabelEditor_,updateFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.updateLabelEditor_,createArgumentEditor_:Blockly.PXTBlockly.FunctionUtils.createArgumentEditor_,focusLastEditor_:Blockly.PXTBlockly.FunctionUtils.focusLastEditor_,removeFieldCallback:Blockly.PXTBlockly.FunctionUtils.removeFieldCallback,addParam_:Blockly.PXTBlockly.FunctionUtils.addParam_,addBooleanExternal:Blockly.PXTBlockly.FunctionUtils.addBooleanExternal,
|
||||||
|
addStringExternal:Blockly.PXTBlockly.FunctionUtils.addStringExternal,addNumberExternal:Blockly.PXTBlockly.FunctionUtils.addNumberExternal,addCustomExternal:Blockly.PXTBlockly.FunctionUtils.addCustomExternal,updateFunctionSignature:Blockly.PXTBlockly.FunctionUtils.updateDeclarationMutation_};
|
||||||
|
Blockly.Blocks.function_definition={init:function(){this.jsonInit({extensions:["function_contextmenu_edit"]});this.name_="";this.arguments_=[];this.functionId_="";this.createAllInputs_();this.setColour(Blockly.Msg.PROCEDURES_HUE);this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.setStatements_(!0);this.setStartHat(!0);this.statementConnection_=null},mutationToDom:Blockly.PXTBlockly.FunctionUtils.mutationToDom,domToMutation:Blockly.PXTBlockly.FunctionUtils.domToMutation,
|
||||||
|
getName:Blockly.PXTBlockly.FunctionUtils.getName,getFunctionId:Blockly.PXTBlockly.FunctionUtils.getFunctionId,getArguments:Blockly.PXTBlockly.FunctionUtils.getArguments,removeValueInputs_:Blockly.PXTBlockly.FunctionUtils.removeValueInputs_,disconnectOldBlocks_:Blockly.PXTBlockly.FunctionUtils.disconnectOldBlocks_,deleteShadows_:Blockly.PXTBlockly.FunctionUtils.deleteShadows_,createAllInputs_:Blockly.PXTBlockly.FunctionUtils.createAllInputs_,updateDisplay_:Blockly.PXTBlockly.FunctionUtils.updateDisplay_,
|
||||||
|
setStatements_:Blockly.PXTBlockly.FunctionUtils.setStatements_,ensureIds_:Blockly.PXTBlockly.FunctionUtils.ensureIds_,populateArgument_:Blockly.PXTBlockly.FunctionUtils.populateArgumentOnDefinition_,addFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.addLabelEditor_,updateFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.updateLabelEditor_,createArgumentReporter_:Blockly.PXTBlockly.FunctionUtils.createArgumentReporter_};
|
||||||
|
Blockly.Blocks.function_call={init:function(){this.jsonInit({extensions:["function_contextmenu_edit"]});this.name_="";this.arguments_=[];this.functionId_="";this.setPreviousStatement(!0);this.setNextStatement(!0);this.setColour(Blockly.Msg.PROCEDURES_HUE);this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);this.setTooltip(Blockly.Msg.FUNCTION_CALL_TOOLTIP)},mutationToDom:Blockly.PXTBlockly.FunctionUtils.mutationToDom,domToMutation:Blockly.PXTBlockly.FunctionUtils.domToMutation,getName:Blockly.PXTBlockly.FunctionUtils.getName,
|
||||||
|
getFunctionId:Blockly.PXTBlockly.FunctionUtils.getFunctionId,getArguments:Blockly.PXTBlockly.FunctionUtils.getArguments,removeValueInputs_:Blockly.PXTBlockly.FunctionUtils.removeValueInputs_,disconnectOldBlocks_:Blockly.PXTBlockly.FunctionUtils.disconnectOldBlocks_,deleteShadows_:Blockly.PXTBlockly.FunctionUtils.deleteShadows_,createAllInputs_:Blockly.PXTBlockly.FunctionUtils.createAllInputs_,updateDisplay_:Blockly.PXTBlockly.FunctionUtils.updateDisplay_,setStatements_:Blockly.PXTBlockly.FunctionUtils.setStatements_,
|
||||||
|
ensureIds_:Blockly.PXTBlockly.FunctionUtils.ensureIds_,populateArgument_:Blockly.PXTBlockly.FunctionUtils.populateArgumentOnCaller_,addFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.addLabelField_,updateFunctionLabel_:Blockly.PXTBlockly.FunctionUtils.updateLabelField_,attachShadow_:Blockly.PXTBlockly.FunctionUtils.attachShadow_,buildShadowDom_:Blockly.PXTBlockly.FunctionUtils.buildShadowDom_,onchange:Blockly.PXTBlockly.FunctionUtils.onCallerChange};Blockly.PXTBlockly.FunctionUtils.getTypeName=function(){return this.typeName_};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.argumentMutationToDom=function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("typename",this.typeName_);return a};Blockly.PXTBlockly.FunctionUtils.argumentDomToMutation=function(a){this.typeName_=a.getAttribute("typename");this.setOutput(!0,this.typeName_)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.createCustomArgumentBlock=function(a,b,c){a=Blockly.Xml.textToDom('<xml><block type="'+a+'"><mutation typename="'+b+'"></mutation></block></xml>');return Blockly.Xml.domToBlock(a.firstChild,c)};Blockly.PXTBlockly.FunctionUtils.createCustomArgumentEditor=function(a,b){return Blockly.PXTBlockly.FunctionUtils.createCustomArgumentBlock("argument_editor_custom",a,b)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.createCustomArgumentReporter=function(a,b){return Blockly.PXTBlockly.FunctionUtils.createCustomArgumentBlock("argument_reporter_custom",a,b)};
|
||||||
|
Blockly.PXTBlockly.FunctionUtils.onReporterChange=function(a){if(this.workspace&&!this.workspace.isFlyout){var b=a.type===Blockly.Events.BLOCK_CREATE&&-1!=a.ids.indexOf(this.id),c=a.type===Blockly.Events.END_DRAG&&-1!=a.allNestedIds.indexOf(this.id);if(b||c)b=this.getRootBlock(),Blockly.Functions.isFunctionArgumentReporter(b)||null!=b.previousConnection||Blockly.pxtBlocklyUtils.hasMatchingArgumentReporter(b,this)||(Blockly.Events.setGroup(a.group),this.dispose(),Blockly.Events.setGroup(!1))}};
|
||||||
|
Blockly.Blocks.argument_editor_boolean={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_argument_editor",name:"TEXT",text:"bool"}],colour:Blockly.Colours.textField,colourSecondary:Blockly.Colours.textField,colourTertiary:Blockly.Colours.textField,extensions:["output_boolean"]});this.typeName_="boolean"},getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName,removeFieldCallback:Blockly.PXTBlockly.FunctionUtils.removeArgumentCallback_};
|
||||||
|
Blockly.Blocks.argument_editor_string={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_argument_editor",name:"TEXT",text:"text"}],colour:Blockly.Colours.textField,colourSecondary:Blockly.Colours.textField,colourTertiary:Blockly.Colours.textField,extensions:["output_string"]});this.typeName_="string"},getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName,removeFieldCallback:Blockly.PXTBlockly.FunctionUtils.removeArgumentCallback_};
|
||||||
|
Blockly.Blocks.argument_editor_number={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_argument_editor",name:"TEXT",text:"num"}],colour:Blockly.Colours.textField,colourSecondary:Blockly.Colours.textField,colourTertiary:Blockly.Colours.textField,extensions:["output_number"]});this.typeName_="number"},getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName,removeFieldCallback:Blockly.PXTBlockly.FunctionUtils.removeArgumentCallback_};
|
||||||
|
Blockly.Blocks.argument_editor_custom={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_argument_editor",name:"TEXT",text:"arg"}],colour:Blockly.Colours.textField,colourSecondary:Blockly.Colours.textField,colourTertiary:Blockly.Colours.textField,outputShape:Blockly.OUTPUT_SHAPE_ROUND});this.typeName_="any"},getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName,removeFieldCallback:Blockly.PXTBlockly.FunctionUtils.removeArgumentCallback_,mutationToDom:Blockly.PXTBlockly.FunctionUtils.argumentMutationToDom,
|
||||||
|
domToMutation:Blockly.PXTBlockly.FunctionUtils.argumentDomToMutation};Blockly.Blocks.argument_reporter_boolean={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_label_hover",name:"VALUE",text:""}],colour:Blockly.Msg.REPORTERS_HUE,extensions:["output_boolean"]});this.typeName_="boolean"},onchange:Blockly.PXTBlockly.FunctionUtils.onReporterChange,getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName};
|
||||||
|
Blockly.Blocks.argument_reporter_number={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_label_hover",name:"VALUE",text:""}],colour:Blockly.Msg.REPORTERS_HUE,extensions:["output_number"]});this.typeName_="number"},onchange:Blockly.PXTBlockly.FunctionUtils.onReporterChange,getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName};
|
||||||
|
Blockly.Blocks.argument_reporter_string={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_label_hover",name:"VALUE",text:""}],colour:Blockly.Msg.REPORTERS_HUE,extensions:["output_string"]});this.typeName_="string"},onchange:Blockly.PXTBlockly.FunctionUtils.onReporterChange,getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName};
|
||||||
|
Blockly.Blocks.argument_reporter_custom={init:function(){this.jsonInit({message0:" %1",args0:[{type:"field_label_hover",name:"VALUE",text:""}],colour:Blockly.Msg.REPORTERS_HUE,inputsInline:!0,outputShape:Blockly.OUTPUT_SHAPE_ROUND,output:null});this.typeName_=""},onchange:Blockly.PXTBlockly.FunctionUtils.onReporterChange,getTypeName:Blockly.PXTBlockly.FunctionUtils.getTypeName,mutationToDom:Blockly.PXTBlockly.FunctionUtils.argumentMutationToDom,domToMutation:Blockly.PXTBlockly.FunctionUtils.argumentDomToMutation};Blockly.Blocks.texts={};Blockly.Constants.Text={};Blockly.Constants.Text.HUE=160;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"text",message0:"%1",args0:[{type:"field_string",name:"TEXT",text:""}],output:"String",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"field_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},
|
||||||
|
{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",
|
||||||
|
args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",
|
||||||
|
message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",outputShape:Blockly.OUTPUT_SHAPE_HEXAGONAL,style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}",
|
||||||
|
"LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],
|
||||||
|
["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]);
|
||||||
|
Blockly.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]];this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL);this.setStyle("text_blocks");
|
||||||
|
this.appendValueInput("STRING").setCheck("String").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);this.appendDummyInput("AT1");this.appendDummyInput("AT2");Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);this.setInputsInline(!0);this.setOutput(!0,"String");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.updateAt_(1,!0);this.updateAt_(2,!0);this.setTooltip(Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var a=
|
||||||
|
Blockly.utils.xml.createElement("mutation"),b=this.getInput("AT1").type==Blockly.INPUT_VALUE;a.setAttribute("at1",b);b=this.getInput("AT2").type==Blockly.INPUT_VALUE;a.setAttribute("at2",b);return a},domToMutation:function(a){var b="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.updateAt_(1,b);this.updateAt_(2,a)},updateAt_:function(a,b){this.removeInput("AT"+a);this.removeInput("ORDINAL"+a,!0);b?(this.appendValueInput("AT"+a).setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&
|
||||||
|
this.appendDummyInput("ORDINAL"+a).appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+a);2==a&&Blockly.Msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL));var c=new Blockly.FieldDropdown(this["WHERE_OPTIONS_"+a],function(c){var d="FROM_START"==c||"FROM_END"==c;if(d!=b){var f=this.getSourceBlock();f.updateAt_(a,d);f.setFieldValue(c,"WHERE"+a);return null}});this.getInput("AT"+a).appendField(c,
|
||||||
|
"WHERE"+a);1==a&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}};
|
||||||
|
Blockly.Blocks.text_changeCase={init:function(){var a=[[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(a),"CASE");this.setOutput(!0,"String");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP)}};
|
||||||
|
Blockly.Blocks.text_trim={init:function(){var a=[[Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL);this.setStyle("text_blocks");this.appendValueInput("TEXT").setCheck("String").appendField(new Blockly.FieldDropdown(a),"MODE");this.setOutput(!0,"String");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP)}};
|
||||||
|
Blockly.Blocks.text_print={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:Blockly.Msg.TEXT_PRINT_TOOLTIP,helpUrl:Blockly.Msg.TEXT_PRINT_HELPURL})}};
|
||||||
|
Blockly.Blocks.text_prompt_ext={init:function(){var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");var b=this;a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendValueInput("TEXT").appendField(a,"TYPE");this.setOutput(!0,"String");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setTooltip(function(){return"TEXT"==b.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:
|
||||||
|
Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:function(a){this.outputConnection.setCheck("NUMBER"==a?"Number":"String")},mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("type",this.getFieldValue("TYPE"));return a},domToMutation:function(a){this.updateType_(a.getAttribute("type"))}};
|
||||||
|
Blockly.Blocks.text_prompt={init:function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);var a=[[Blockly.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],b=this;this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);this.setStyle("text_blocks");a=new Blockly.FieldDropdown(a,function(a){b.updateType_(a)});this.appendDummyInput().appendField(a,"TYPE").appendField(this.newQuote_(!0)).appendField(new Blockly.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1));
|
||||||
|
this.setOutput(!0,"String");this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);this.setTooltip(function(){return"TEXT"==b.getFieldValue("TYPE")?Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT:Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:Blockly.Blocks.text_prompt_ext.updateType_,mutationToDom:Blockly.Blocks.text_prompt_ext.mutationToDom,domToMutation:Blockly.Blocks.text_prompt_ext.domToMutation};
|
||||||
|
Blockly.Blocks.text_count={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",outputShape:Blockly.OUTPUT_SHAPE_ROUND,inputsInline:!0,style:"text_blocks",tooltip:Blockly.Msg.TEXT_COUNT_TOOLTIP,helpUrl:Blockly.Msg.TEXT_COUNT_HELPURL})}};
|
||||||
|
Blockly.Blocks.text_replace={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",outputShape:Blockly.OUTPUT_SHAPE_ROUND,inputsInline:!0,style:"text_blocks",tooltip:Blockly.Msg.TEXT_REPLACE_TOOLTIP,helpUrl:Blockly.Msg.TEXT_REPLACE_HELPURL})}};
|
||||||
|
Blockly.Blocks.text_reverse={init:function(){this.jsonInit({message0:Blockly.Msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",outputShape:Blockly.OUTPUT_SHAPE_ROUND,inputsInline:!0,style:"text_blocks",tooltip:Blockly.Msg.TEXT_REVERSE_TOOLTIP,helpUrl:Blockly.Msg.TEXT_REVERSE_HELPURL})}};
|
||||||
|
Blockly.Constants.Text.QUOTE_IMAGE_MIXIN={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",
|
||||||
|
QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(a){for(var b=0,c;c=this.inputList[b];b++)for(var d=0,e;e=c.fieldRow[d];d++)if(a==e.name){c.insertFieldAt(d,this.newQuote_(!0));c.insertFieldAt(d+2,this.newQuote_(!1));return}console.warn('field named "'+a+'" not found in '+this.toDevString())},newQuote_:function(a){a=this.RTL?!a:a;return new Blockly.FieldImage(a?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,this.QUOTE_IMAGE_WIDTH,this.QUOTE_IMAGE_HEIGHT,a?"\u201c":"\u201d")}};
|
||||||
|
Blockly.Constants.Text.TEXT_QUOTES_EXTENSION=function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);this.quoteField_("TEXT")};
|
||||||
|
Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("items",this.itemCount_);return a},domToMutation:function(a){this.itemCount_=parseInt(a.getAttribute("items"),10);this.updateShape_()},saveConnections:function(a){a=a.getInputTargetBlock("STACK");for(var b=0;a;){var c=this.getInput("ADD"+b);a.valueConnection_=c&&c.connection.targetConnection;b++;a=a.nextConnection&&a.nextConnection.targetBlock()}},storeValueConnections_:function(){this.valueConnections_=
|
||||||
|
[];for(var a=0;a<this.itemCount_;a++)this.valueConnections_.push(this.getInput("ADD"+a).connection.targetConnection)},restoreValueConnections_:function(){for(var a=0;a<this.itemCount_;a++)Blockly.Mutator.reconnect(this.valueConnections_[a],this,"ADD"+a)},addItem_:function(){this.storeValueConnections_();this.update_(function(){this.itemCount_++});this.restoreValueConnections_();if(1<this.itemCount_){var a=this.getInput("ADD0");if(a&&a.connection.targetConnection){var b=this.getInput("ADD"+(this.itemCount_-
|
||||||
|
1)),c=a.connection.getShadowDom();c&&(a=Blockly.utils.xml.createElement("shadow"),c=c.getAttribute("type"),a.setAttribute("type",c),a&&(a.setAttribute("id",Blockly.utils.genUid()),b.connection.setShadowDom(a),b.connection.respawnShadow_()))}}},removeItem_:function(){this.storeValueConnections_();this.update_(function(){this.itemCount_--});this.restoreValueConnections_()},update_:function(a){Blockly.Events.setGroup(!0);var b=this,c=b.mutationToDom();c=c&&Blockly.Xml.domToText(c);var d=b.rendered;b.rendered=
|
||||||
|
!1;a&&a.call(this);this.updateShape_();b.rendered=d;b.initSvg();var e=Blockly.Events.getGroup();a=(a=b.mutationToDom())&&Blockly.Xml.domToText(a);c!=a&&(Blockly.Events.fire(new Blockly.Events.BlockChange(b,"mutation",null,c,a)),setTimeout(function(){Blockly.Events.setGroup(e);b.bumpNeighbours_();Blockly.Events.setGroup(!1)},Blockly.BUMP_DELAY));b.rendered&&b.render();Blockly.Events.setGroup(!1)},updateShape_:function(){var a=this,b=function(){a.removeItem_()};this.getInput("EMPTY")&&this.removeInput("EMPTY");
|
||||||
|
this.getInput("TITLE")||this.appendDummyInput("TITLE").appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);for(var c=0;c<this.itemCount_;c++)this.getInput("ADD"+c)||this.appendValueInput("ADD"+c).setAlign(Blockly.ALIGN_LEFT);for(;this.getInput("ADD"+c);)this.removeInput("ADD"+c),c++;this.getInput("BUTTONS")&&this.removeInput("BUTTONS");c=this.appendDummyInput("BUTTONS");1<this.itemCount_&&c.appendField(new Blockly.FieldImage(this.REMOVE_IMAGE_DATAURI,24,24,"*",b,!1));c.appendField(new Blockly.FieldImage(this.ADD_IMAGE_DATAURI,
|
||||||
|
24,24,"*",function(){a.addItem_()},!1));b=4>=this.itemCount_;this.setInputsInline(b);this.setOutputShape(b?Blockly.OUTPUT_SHAPE_ROUND:Blockly.OUTPUT_SHAPE_SQUARE)}};Blockly.Constants.Text.TEXT_JOIN_EXTENSION=function(){this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN);Blockly.Extensions.apply("inline-svgs",this,!1);this.itemCount_=2;this.updateShape_()};Blockly.Extensions.register("text_append_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_TEXT_APPEND_TOOLTIP}","VAR"));
|
||||||
|
Blockly.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){var a=this;this.setTooltip(function(){return Blockly.Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",a.workspace.options.oneBasedIndex?"0":"-1")})};
|
||||||
|
Blockly.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){var a=Blockly.utils.xml.createElement("mutation");a.setAttribute("at",!!this.isAt_);return a},domToMutation:function(a){a="false"!=a.getAttribute("at");this.updateAt_(a)},updateAt_:function(a){this.removeInput("AT",!0);this.removeInput("ORDINAL",!0);a&&(this.appendValueInput("AT").setCheck("Number"),Blockly.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX));Blockly.Msg.TEXT_CHARAT_TAIL&&
|
||||||
|
(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(Blockly.Msg.TEXT_CHARAT_TAIL));this.isAt_=a}};
|
||||||
|
Blockly.Constants.Text.TEXT_CHARAT_EXTENSION=function(){this.getField("WHERE").setValidator(function(a){a="FROM_START"==a||"FROM_END"==a;a!=this.isAt_&&this.getSourceBlock().updateAt_(a)});this.updateAt_(!0);var a=this;this.setTooltip(function(){var b=a.getFieldValue("WHERE"),c=Blockly.Msg.TEXT_CHARAT_TOOLTIP;("FROM_START"==b||"FROM_END"==b)&&(b="FROM_START"==b?Blockly.Msg.LISTS_INDEX_FROM_START_TOOLTIP:Blockly.Msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(c+=" "+b.replace("%1",a.workspace.options.oneBasedIndex?
|
||||||
|
"#1":"#0"));return c})};Blockly.Extensions.register("text_indexOf_tooltip",Blockly.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION);Blockly.Extensions.register("text_quotes",Blockly.Constants.Text.TEXT_QUOTES_EXTENSION);Blockly.Extensions.registerMutator("text_join_mutator",Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN,Blockly.Constants.Text.TEXT_JOIN_EXTENSION);Blockly.Extensions.registerMutator("text_charAt_mutator",Blockly.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN,Blockly.Constants.Text.TEXT_CHARAT_EXTENSION);Blockly.Blocks.variables={};Blockly.Constants.Variables={};Blockly.Constants.Variables.HUE=330;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,outputShape:Blockly.OUTPUT_SHAPE_ROUND,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_get_reporter",message0:"%1",args0:[{type:"field_variable_getter",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,
|
||||||
|
colour:"%{BKY_VARIABLES_HUE}",outputShape:Blockly.OUTPUT_SHAPE_ROUND,helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableReporter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",
|
||||||
|
extensions:["contextMenu_variableSetterGetter"]}]);
|
||||||
|
Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isCollapsed())if(!this.isInFlyout){if("variables_get"==this.type||"variables_get_reporter"==this.type)var b="variables_set",c=Blockly.Msg.VARIABLES_GET_CREATE_SET;else b="variables_get",c=Blockly.Msg.VARIABLES_SET_CREATE_GET;var d={enabled:0<this.workspace.remainingCapacity()},e=this.getField("VAR").getText();d.text=c.replace("%1",e);c=Blockly.utils.xml.createElement("field");c.setAttribute("name",
|
||||||
|
"VAR");c.appendChild(Blockly.utils.xml.createTextNode(e));e=Blockly.utils.xml.createElement("block");e.setAttribute("type",b);e.appendChild(c);d.callback=Blockly.ContextMenu.callbackFactory(this,e);a.push(d)}else if("variables_get"==this.type||"variables_get_reporter"==this.type)b={text:Blockly.Msg.RENAME_VARIABLE,enabled:!0,callback:Blockly.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY(this)},e=this.getField("VAR").getText(),d={text:Blockly.Msg.DELETE_VARIABLE.replace("%1",e),enabled:!0,callback:Blockly.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY(this)},
|
||||||
|
a.unshift(b),a.unshift(d)}};
|
||||||
|
Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_REPORTER_MIXIN={customContextMenu:function(a){if(!this.isCollapsed()){var b={text:Blockly.Msg.RENAME_VARIABLE,enabled:!0,callback:Blockly.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY(this)};a.unshift(b);if(!this.isInFlyout){b=this.workspace.getVariablesOfType("");0<b.length&&a.unshift({separator:!0});for(var c=b.length-1;0<=c;c--){var d={enabled:!0};d.text=b[c].name;d.callback=Blockly.Constants.Variables.VARIABLE_OPTION_CALLBACK_FACTORY(this,d.text,
|
||||||
|
b[c].getId());a.unshift(d)}}}}};Blockly.Constants.Variables.VARIABLE_OPTION_CALLBACK_FACTORY=function(a,b,c){return function(){var b=a.getField("VAR");b||console.log("Tried to get a variable field on the wrong type of block.");b.setValue(c)}};Blockly.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();Blockly.Variables.renameVariable(b,c)}};
|
||||||
|
Blockly.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};Blockly.Extensions.registerMixin("contextMenu_variableSetterGetter",Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);Blockly.Extensions.registerMixin("contextMenu_variableReporter",Blockly.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_REPORTER_MIXIN);
|
||||||
|
Blockly.Constants.VariablesDynamic={};Blockly.Constants.VariablesDynamic.HUE=310;
|
||||||
|
Blockly.defineBlocksWithJsonArray([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",
|
||||||
|
name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]);
|
||||||
|
Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getFieldValue("VAR");var c=this.workspace.getVariableById(b).type;if("variables_get_dynamic"==this.type){b="variables_set_dynamic";var d=Blockly.Msg.VARIABLES_GET_CREATE_SET}else b="variables_get_dynamic",d=Blockly.Msg.VARIABLES_SET_CREATE_GET;var e={enabled:0<this.workspace.remainingCapacity()},f=this.getField("VAR").getText();e.text=d.replace("%1",f);
|
||||||
|
d=Blockly.utils.xml.createElement("field");d.setAttribute("name","VAR");d.setAttribute("variabletype",c);d.appendChild(Blockly.utils.xml.createTextNode(f));f=Blockly.utils.xml.createElement("block");f.setAttribute("type",b);f.appendChild(d);e.callback=Blockly.ContextMenu.callbackFactory(this,f);a.push(e)}else if("variables_get_dynamic"==this.type||"variables_get_reporter_dynamic"==this.type)b={text:Blockly.Msg.RENAME_VARIABLE,enabled:!0,callback:Blockly.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY(this)},
|
||||||
|
f=this.getField("VAR").getText(),e={text:Blockly.Msg.DELETE_VARIABLE.replace("%1",f),enabled:!0,callback:Blockly.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY(this)},a.unshift(b),a.unshift(e)},onchange:function(a){a=this.getFieldValue("VAR");a=Blockly.Variables.getVariable(this.workspace,a);"variables_get_dynamic"==this.type?this.outputConnection.setCheck(a.type):this.getInput("VALUE").connection.setCheck(a.type)}};
|
||||||
|
Blockly.Constants.VariablesDynamic.RENAME_OPTION_CALLBACK_FACTORY=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();Blockly.Variables.renameVariable(b,c)}};Blockly.Constants.VariablesDynamic.DELETE_OPTION_CALLBACK_FACTORY=function(a){return function(){var b=a.workspace,c=a.getField("VAR").getVariable();b.deleteVariableById(c.getId());b.refreshToolboxSelection()}};Blockly.Extensions.registerMixin("contextMenu_variableDynamicSetterGetter",Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN);
|
101
pxt-blockly/javascript_compressed.js
Normal file
BIN
pxt-blockly/media/1x1.gif
Normal file
After Width: | Height: | Size: 43 B |
72
pxt-blockly/media/add.svg
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="repeat"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
style="enable-background:new 0 0 24 24;"
|
||||||
|
xml:space="preserve"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="add.svg"><metadata
|
||||||
|
id="metadata15"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>repeat</dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs13" /><sodipodi:namedview
|
||||||
|
pagecolor="#ff4821"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1680"
|
||||||
|
inkscape:window-height="969"
|
||||||
|
id="namedview11"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="19.666667"
|
||||||
|
inkscape:cx="12.915254"
|
||||||
|
inkscape:cy="16.067796"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="repeat" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style3">
|
||||||
|
.st0{fill:#CF8B17;}
|
||||||
|
.st1{fill:#FFFFFF;}
|
||||||
|
</style><title
|
||||||
|
id="title5">repeat</title><rect
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.07843137"
|
||||||
|
id="rect4143"
|
||||||
|
width="4.0500002"
|
||||||
|
height="12.39705"
|
||||||
|
x="9.9750004"
|
||||||
|
y="-18.198526"
|
||||||
|
rx="0.81"
|
||||||
|
ry="0.81"
|
||||||
|
transform="scale(1,-1)" /><rect
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.07843137"
|
||||||
|
id="rect4143-1"
|
||||||
|
width="4.0500002"
|
||||||
|
height="12.397119"
|
||||||
|
x="9.9750004"
|
||||||
|
y="5.8014407"
|
||||||
|
rx="0.81"
|
||||||
|
ry="0.81"
|
||||||
|
transform="matrix(0,1,1,0,0,0)" /><circle
|
||||||
|
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:2;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
id="path4136"
|
||||||
|
cx="12"
|
||||||
|
cy="12"
|
||||||
|
r="10.503191" /></svg>
|
After Width: | Height: | Size: 2.7 KiB |
75
pxt-blockly/media/arrow.svg
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="8px"
|
||||||
|
height="10px"
|
||||||
|
viewBox="0 0 8 10"
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="arrow.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata16">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1179"
|
||||||
|
inkscape:window-height="710"
|
||||||
|
id="namedview14"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="23.6"
|
||||||
|
inkscape:cx="4"
|
||||||
|
inkscape:cy="5"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title
|
||||||
|
id="title4">arrow</title>
|
||||||
|
<desc
|
||||||
|
id="desc6">Created with Sketch.</desc>
|
||||||
|
<defs
|
||||||
|
id="defs8" />
|
||||||
|
<g
|
||||||
|
id="Page-1"
|
||||||
|
stroke="none"
|
||||||
|
stroke-width="1"
|
||||||
|
fill="none"
|
||||||
|
fill-rule="evenodd"
|
||||||
|
transform="rotate(90, 4, 5)"
|
||||||
|
style="fill:#000000">
|
||||||
|
<g
|
||||||
|
id="arrow"
|
||||||
|
transform="translate(-4.000000, -3.000000)"
|
||||||
|
fill="#4C97FF"
|
||||||
|
style="fill:#000000">
|
||||||
|
<path
|
||||||
|
d="M8.01891083,6.68223055 L3.50991601,7.43372969 C3.24679131,7.4775838 3.01891083,7.73942151 3.01891083,8.01556388 C3.01891083,8.28363029 3.23874134,8.5522023 3.50991601,8.59739808 L8.01891083,9.34889722 L8.01891083,11.0185337 C8.01891083,11.5625276 8.38326686,11.7520032 8.83272279,11.4268847 L12.6410176,8.67211587 C13.0981638,8.34143455 13.0957223,7.81470518 12.6527411,7.48320806 L8.82099936,4.61579253 C8.37557664,4.28246838 8.01891083,4.46194948 8.01891083,5.01259402 L8.01891083,6.68223055 Z"
|
||||||
|
transform="translate(8.001673, 8.017237) rotate(-90.000000) translate(-8.001673, -8.017237) "
|
||||||
|
id="path12"
|
||||||
|
style="fill:#000000" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
BIN
pxt-blockly/media/click.mp3
Normal file
BIN
pxt-blockly/media/click.ogg
Normal file
BIN
pxt-blockly/media/click.wav
Normal file
10
pxt-blockly/media/comment-arrow-down.svg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>dropdown-caret-up</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<defs></defs>
|
||||||
|
<g id="dropdown-caret-up" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<path d="M6,9 C5.72520708,9 5.45163006,8.89695045 5.24127973,8.68965311 L2.31461357,5.80666227 C1.89512881,5.39326583 1.89512881,4.72464202 2.31461357,4.31004733 C2.73288244,3.89665089 9.26711756,3.89665089 9.68538643,4.31004733 C10.1048712,4.72344377 10.1048712,5.39326583 9.68538643,5.80666227 L6.75993617,8.68965311 C6.54958583,8.89695045 6.27600882,9 6,9" id="dropdown-caret" fill="#fff"></path>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 877 B |
10
pxt-blockly/media/comment-arrow-up.svg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>dropdown-caret-down</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<defs></defs>
|
||||||
|
<g id="dropdown-caret-down" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<path d="M6,9 C5.72520708,9 5.45163006,8.89695045 5.24127973,8.68965311 L2.31461357,5.80666227 C1.89512881,5.39326583 1.89512881,4.72464202 2.31461357,4.31004733 C2.73288244,3.89665089 9.26711756,3.89665089 9.68538643,4.31004733 C10.1048712,4.72344377 10.1048712,5.39326583 9.68538643,5.80666227 L6.75993617,8.68965311 C6.54958583,8.89695045 6.27600882,9 6,9" id="dropdown-caret" fill="#fff" transform="translate(6.000000, 6.500000) scale(1, -1) translate(-6.000000, -6.500000) "></path>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 969 B |
10
pxt-blockly/media/delete-x.svg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>delete-x</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<defs></defs>
|
||||||
|
<g id="delete-x" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<path d="M10.8761123,10.87825 C10.2421123,11.52125 9.20511231,11.52125 8.56211231,10.87825 L5.92911231,8.24525 L3.29511231,10.87825 C2.65611231,11.51725 1.62011231,11.51725 0.981112306,10.87825 C0.662112306,10.55925 0.500112306,10.13725 0.500112306,9.72125 C0.500112306,9.30425 0.662112306,8.88325 0.981112306,8.56425 L3.61411231,5.93125 L0.977112306,3.29325 C0.657112306,2.97325 0.495112306,2.55225 0.500112306,2.13125 C0.500112306,1.71425 0.657112306,1.29825 0.977112306,0.97925 C1.61511231,0.34025 2.65111231,0.34025 3.29111231,0.97925 L5.92911231,3.61625 L8.56611231,0.97925 C9.20511231,0.34025 10.2421123,0.34025 10.8811123,0.97925 C11.5201123,1.61725 11.5201123,2.65425 10.8811123,3.29325 L8.24211231,5.93125 L10.8811123,8.56825 C11.5201123,9.20725 11.5201123,10.23425 10.8761123,10.87825" id="Fill-1" fill="#fff"></path>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
BIN
pxt-blockly/media/delete.mp3
Normal file
BIN
pxt-blockly/media/delete.ogg
Normal file
BIN
pxt-blockly/media/delete.wav
Normal file
BIN
pxt-blockly/media/disconnect.mp3
Normal file
BIN
pxt-blockly/media/disconnect.ogg
Normal file
BIN
pxt-blockly/media/disconnect.wav
Normal file
1
pxt-blockly/media/dropdown-arrow-dark.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="12.71" height="8.79" viewBox="0 0 12.71 8.79"><title>dropdown-arrow</title><g opacity="0.1"><path d="M12.71,2.44A2.41,2.41,0,0,1,12,4.16L8.08,8.08a2.45,2.45,0,0,1-3.45,0L0.72,4.16A2.42,2.42,0,0,1,0,2.44,2.48,2.48,0,0,1,.71.71C1,0.47,1.43,0,6.36,0S11.75,0.46,12,.71A2.44,2.44,0,0,1,12.71,2.44Z" fill="#231f20"/></g><path d="M6.36,7.79a1.43,1.43,0,0,1-1-.42L1.42,3.45a1.44,1.44,0,0,1,0-2c0.56-.56,9.31-0.56,9.87,0a1.44,1.44,0,0,1,0,2L7.37,7.37A1.43,1.43,0,0,1,6.36,7.79Z" fill="#575E75"/></svg>
|
After Width: | Height: | Size: 573 B |
1
pxt-blockly/media/dropdown-arrow.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="12.71" height="8.79" viewBox="0 0 12.71 8.79"><title>dropdown-arrow</title><g opacity="0.1"><path d="M12.71,2.44A2.41,2.41,0,0,1,12,4.16L8.08,8.08a2.45,2.45,0,0,1-3.45,0L0.72,4.16A2.42,2.42,0,0,1,0,2.44,2.48,2.48,0,0,1,.71.71C1,0.47,1.43,0,6.36,0S11.75,0.46,12,.71A2.44,2.44,0,0,1,12.71,2.44Z" fill="#231f20"/></g><path d="M6.36,7.79a1.43,1.43,0,0,1-1-.42L1.42,3.45a1.44,1.44,0,0,1,0-2c0.56-.56,9.31-0.56,9.87,0a1.44,1.44,0,0,1,0,2L7.37,7.37A1.43,1.43,0,0,1,6.36,7.79Z" fill="#fff"/></svg>
|
After Width: | Height: | Size: 569 B |
BIN
pxt-blockly/media/handclosed.cur
Normal file
After Width: | Height: | Size: 326 B |
BIN
pxt-blockly/media/handdelete.cur
Normal file
After Width: | Height: | Size: 766 B |
BIN
pxt-blockly/media/handopen.cur
Normal file
After Width: | Height: | Size: 198 B |
85
pxt-blockly/media/position_eyedropper.svg
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24px"
|
||||||
|
height="24px"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="position_eyedropper.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata23">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1425"
|
||||||
|
inkscape:window-height="1088"
|
||||||
|
id="namedview21"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="6.9532167"
|
||||||
|
inkscape:cx="8.0592537"
|
||||||
|
inkscape:cy="12.66076"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title
|
||||||
|
id="title4">Artboard</title>
|
||||||
|
<desc
|
||||||
|
id="desc6">Created with Sketch.</desc>
|
||||||
|
<defs
|
||||||
|
id="defs8">
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 12 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="24 : 12 : 1"
|
||||||
|
inkscape:persp3d-origin="12 : 8 : 1"
|
||||||
|
id="perspective4151" />
|
||||||
|
</defs>
|
||||||
|
<rect
|
||||||
|
style="fill:#575e75;fill-opacity:1;stroke:#575e75;stroke-width:1.63426888;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect4173"
|
||||||
|
width="0.91683972"
|
||||||
|
height="20.330549"
|
||||||
|
x="11.54158"
|
||||||
|
y="1.8347254" />
|
||||||
|
<rect
|
||||||
|
y="-22.165276"
|
||||||
|
x="11.54158"
|
||||||
|
height="20.330549"
|
||||||
|
width="0.91683972"
|
||||||
|
id="rect4175"
|
||||||
|
style="fill:#575e75;fill-opacity:1;stroke:#575e75;stroke-width:1.63426888;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
transform="matrix(0,1,-1,0,0,0)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect4185"
|
||||||
|
width="5.5821486"
|
||||||
|
height="5.4646297"
|
||||||
|
x="9.2089252"
|
||||||
|
y="9.2676849" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
4
pxt-blockly/media/question.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="13" cy="13" r="13" fill="white"/>
|
||||||
|
<path d="M17.952 9.18402C17.952 10.256 17.816 11.072 17.544 11.632C17.288 12.192 16.752 12.792 15.936 13.432C15.12 14.072 14.576 14.584 14.304 14.968C14.048 15.336 13.92 15.736 13.92 16.168V16.96H11.808C11.424 16.464 11.232 15.84 11.232 15.088C11.232 14.688 11.384 14.288 11.688 13.888C11.992 13.488 12.536 12.968 13.32 12.328C14.104 11.672 14.624 11.168 14.88 10.816C15.136 10.448 15.264 9.96802 15.264 9.37602C15.264 8.20802 14.416 7.62402 12.72 7.62402C11.76 7.62402 10.752 7.73602 9.696 7.96002L9.144 8.08002L9 6.08802C10.488 5.56002 11.84 5.29602 13.056 5.29602C14.736 5.29602 15.968 5.60802 16.752 6.23202C17.552 6.84002 17.952 7.82402 17.952 9.18402ZM11.4 22V18.64H14.184V22H11.4Z" fill="#595E74"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 855 B |
BIN
pxt-blockly/media/quote0.png
Normal file
After Width: | Height: | Size: 639 B |
64
pxt-blockly/media/quote0.svg
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="repeat"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
style="enable-background:new 0 0 24 24;"
|
||||||
|
xml:space="preserve"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="quote0.svg"
|
||||||
|
inkscape:export-filename="/Users/sammysam/Work/pxt-blockly/media/quote0.png"
|
||||||
|
inkscape:export-xdpi="198.75"
|
||||||
|
inkscape:export-ydpi="198.75"><metadata
|
||||||
|
id="metadata15"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>repeat</dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs13" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1363"
|
||||||
|
inkscape:window-height="834"
|
||||||
|
id="namedview11"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="9.8333335"
|
||||||
|
inkscape:cx="19.093587"
|
||||||
|
inkscape:cy="13.288136"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="repeat" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style3">
|
||||||
|
.st0{fill:#CF8B17;}
|
||||||
|
.st1{fill:#FFFFFF;}
|
||||||
|
</style><title
|
||||||
|
id="title5">repeat</title><text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:30.97599983px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#a31515;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="7.7923865"
|
||||||
|
y="25.679182"
|
||||||
|
id="text4137"
|
||||||
|
sodipodi:linespacing="125%"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4139"
|
||||||
|
x="7.7923865"
|
||||||
|
y="25.679182"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Monaco;-inkscape-font-specification:Monaco;fill:#a31515;fill-opacity:1">"</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
BIN
pxt-blockly/media/quote1.png
Normal file
After Width: | Height: | Size: 646 B |
64
pxt-blockly/media/quote1.svg
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="repeat"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
style="enable-background:new 0 0 24 24;"
|
||||||
|
xml:space="preserve"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="quote1.svg"
|
||||||
|
inkscape:export-filename="/Users/sammysam/Work/pxt-blockly/media/quote1.png"
|
||||||
|
inkscape:export-xdpi="198.75"
|
||||||
|
inkscape:export-ydpi="198.75"><metadata
|
||||||
|
id="metadata15"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>repeat</dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs13" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1363"
|
||||||
|
inkscape:window-height="834"
|
||||||
|
id="namedview11"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="9.8333335"
|
||||||
|
inkscape:cx="19.093587"
|
||||||
|
inkscape:cy="13.288136"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="repeat" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style3">
|
||||||
|
.st0{fill:#CF8B17;}
|
||||||
|
.st1{fill:#FFFFFF;}
|
||||||
|
</style><title
|
||||||
|
id="title5">repeat</title><text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:30.97599983px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#a31515;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="-2.2076135"
|
||||||
|
y="25.679182"
|
||||||
|
id="text4137"
|
||||||
|
sodipodi:linespacing="125%"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4139"
|
||||||
|
x="-2.2076135"
|
||||||
|
y="25.679182"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Monaco;-inkscape-font-specification:Monaco;fill:#a31515;fill-opacity:1">"</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
63
pxt-blockly/media/remove.svg
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="repeat"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
style="enable-background:new 0 0 24 24;"
|
||||||
|
xml:space="preserve"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="remove.svg"><metadata
|
||||||
|
id="metadata15"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>repeat</dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs13" /><sodipodi:namedview
|
||||||
|
pagecolor="#ff1aff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1680"
|
||||||
|
inkscape:window-height="950"
|
||||||
|
id="namedview11"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="19.666667"
|
||||||
|
inkscape:cx="0.050847521"
|
||||||
|
inkscape:cy="9.9661017"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="repeat" /><style
|
||||||
|
type="text/css"
|
||||||
|
id="style3">
|
||||||
|
.st0{fill:#CF8B17;}
|
||||||
|
.st1{fill:#FFFFFF;}
|
||||||
|
</style><title
|
||||||
|
id="title5">repeat</title><rect
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.07843137"
|
||||||
|
id="rect4143-1"
|
||||||
|
width="4.0500002"
|
||||||
|
height="12.397119"
|
||||||
|
x="9.9750004"
|
||||||
|
y="5.8014407"
|
||||||
|
rx="0.81"
|
||||||
|
ry="0.81"
|
||||||
|
transform="matrix(0,1,1,0,0,0)" /><circle
|
||||||
|
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:2;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||||
|
id="path4136"
|
||||||
|
cx="12"
|
||||||
|
cy="12"
|
||||||
|
r="10.503191" /></svg>
|
After Width: | Height: | Size: 2.3 KiB |
19
pxt-blockly/media/removeArg.svg
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<!-- Generator: Sketch 48.1 (47250) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title>delete-argument v2</title>
|
||||||
|
<desc>Created with Sketch.</desc>
|
||||||
|
<defs></defs>
|
||||||
|
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="delete-argument-v2" stroke="#FF661A">
|
||||||
|
<g id="Group" transform="translate(3.000000, 2.500000)">
|
||||||
|
<path d="M1,3 L13,3 L11.8900496,14.0995037 C11.8389294,14.6107055 11.4087639,15 10.8950124,15 L3.10498756,15 C2.59123611,15 2.16107055,14.6107055 2.10995037,14.0995037 L1,3 Z" id="Rectangle" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||||
|
<path d="M7,11 L7,6" id="Line" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||||
|
<path d="M9.5,11 L9.5,6" id="Line-Copy" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||||
|
<path d="M4.5,11 L4.5,6" id="Line-Copy-2" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||||
|
<rect id="Rectangle-2" fill="#FF661A" x="0" y="2.5" width="14" height="1" rx="0.5"></rect>
|
||||||
|
<path d="M6,0 L8,0 C8.55228475,-1.01453063e-16 9,0.44771525 9,1 L9,3 L5,3 L5,1 C5,0.44771525 5.44771525,1.01453063e-16 6,0 Z" id="Rectangle-3" stroke-width="1.5"></path>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
BIN
pxt-blockly/media/sprites.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
204
pxt-blockly/media/sprites.svg
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
width="96px"
|
||||||
|
height="124px"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="sprites.svg"
|
||||||
|
inkscape:export-filename="/Users/sammysam/Work/pxt-blockly/media/sprites.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<metadata
|
||||||
|
id="metadata65">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs63" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ff41ff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1366"
|
||||||
|
inkscape:window-height="959"
|
||||||
|
id="namedview61"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="15.225806"
|
||||||
|
inkscape:cx="43.927966"
|
||||||
|
inkscape:cy="90.504237"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="1"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<style
|
||||||
|
type="text/css"
|
||||||
|
id="style4">
|
||||||
|
#background {
|
||||||
|
fill: none;
|
||||||
|
}
|
||||||
|
.arrows {
|
||||||
|
fill: #000;
|
||||||
|
stroke: none;
|
||||||
|
}
|
||||||
|
.selected>.arrows {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
.checkmark {
|
||||||
|
fill: #000;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 10pt;
|
||||||
|
text-anchor: middle;
|
||||||
|
}
|
||||||
|
.trash {
|
||||||
|
fill: #888;
|
||||||
|
}
|
||||||
|
.zoom {
|
||||||
|
fill: none;
|
||||||
|
stroke: #888;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
}
|
||||||
|
.zoom>.center {
|
||||||
|
fill: #888;
|
||||||
|
stroke-width: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<rect
|
||||||
|
id="background"
|
||||||
|
width="96"
|
||||||
|
height="124"
|
||||||
|
x="0"
|
||||||
|
y="0" />
|
||||||
|
<g
|
||||||
|
id="g7">
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 13,1.5 13,14.5 1.74,8 z"
|
||||||
|
id="path9" />
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 17.5,3 30.5,3 24,14.26 z"
|
||||||
|
id="path11" />
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 35,1.5 35,14.5 46.26,8 z"
|
||||||
|
id="path13" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
class="selected"
|
||||||
|
transform="translate(0, 16)"
|
||||||
|
id="g15">
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 13,1.5 13,14.5 1.74,8 z"
|
||||||
|
id="path17" />
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 17.5,3 30.5,3 24,14.26 z"
|
||||||
|
id="path19" />
|
||||||
|
<path
|
||||||
|
class="arrows"
|
||||||
|
d="M 35,1.5 35,14.5 46.26,8 z"
|
||||||
|
id="path21" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
class="trash"
|
||||||
|
id="g25">
|
||||||
|
<path
|
||||||
|
d="M 2,41 v 6 h 42 v -6 h -10.5 l -3,-3 h -15 l -3,3 z"
|
||||||
|
id="path27" />
|
||||||
|
<rect
|
||||||
|
width="36"
|
||||||
|
height="20"
|
||||||
|
x="5"
|
||||||
|
y="50"
|
||||||
|
id="rect29" />
|
||||||
|
<rect
|
||||||
|
width="36"
|
||||||
|
height="42"
|
||||||
|
x="5"
|
||||||
|
y="50"
|
||||||
|
rx="4"
|
||||||
|
ry="4"
|
||||||
|
id="rect31" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
class="zoom"
|
||||||
|
id="g33">
|
||||||
|
<circle
|
||||||
|
r="11.5"
|
||||||
|
cx="16"
|
||||||
|
cy="108"
|
||||||
|
id="circle35" />
|
||||||
|
<circle
|
||||||
|
r="4.3"
|
||||||
|
cx="16"
|
||||||
|
cy="108"
|
||||||
|
class="center"
|
||||||
|
id="circle37" />
|
||||||
|
<path
|
||||||
|
d="m 28,108 h3"
|
||||||
|
id="path39" />
|
||||||
|
<path
|
||||||
|
d="m 1,108 h3"
|
||||||
|
id="path41" />
|
||||||
|
<path
|
||||||
|
d="m 16,120 v3"
|
||||||
|
id="path43" />
|
||||||
|
<path
|
||||||
|
d="m 16,93 v3"
|
||||||
|
id="path45" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
class="zoom"
|
||||||
|
id="g47">
|
||||||
|
<circle
|
||||||
|
r="15"
|
||||||
|
cx="48"
|
||||||
|
cy="108"
|
||||||
|
id="circle49" />
|
||||||
|
<path
|
||||||
|
d="m 48,101.6 v12.8"
|
||||||
|
id="path51" />
|
||||||
|
<path
|
||||||
|
d="m 41.6,108 h12.8"
|
||||||
|
id="path53" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
class="zoom"
|
||||||
|
id="g55">
|
||||||
|
<circle
|
||||||
|
r="15"
|
||||||
|
cx="80"
|
||||||
|
cy="108"
|
||||||
|
id="circle57" />
|
||||||
|
<path
|
||||||
|
d="m 73.6,108 h12.8"
|
||||||
|
id="path59" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#ffffff"
|
||||||
|
d="m 53.606125,28.447668 c -0.337724,0 -0.675448,-0.133184 -0.932699,-0.398195 l -2.532931,-2.609332 c -0.515821,-0.531379 -0.515821,-1.390283 0,-1.921664 0.515821,-0.53138 1.349577,-0.53138 1.865398,0 l 1.600232,1.6485 4.990666,-5.139839 c 0.514502,-0.53138 1.349577,-0.53138 1.865399,0 0.514502,0.530019 0.514502,1.390284 0,1.921664 l -5.923365,6.100671 c -0.257252,0.265011 -0.594976,0.398195 -0.9327,0.398195"
|
||||||
|
id="Fill-1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.4 KiB |
272
scripts/BME280.py
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
AUX_SPI=256
|
||||||
|
|
||||||
|
# Sampling
|
||||||
|
|
||||||
|
OVER_SAMPLE_1 = 1
|
||||||
|
OVER_SAMPLE_2 = 2
|
||||||
|
OVER_SAMPLE_4 = 3
|
||||||
|
OVER_SAMPLE_8 = 4
|
||||||
|
OVER_SAMPLE_16 = 5
|
||||||
|
|
||||||
|
class sensor:
|
||||||
|
"""
|
||||||
|
A class to read the BME280 pressure, humidity, and temperature sensor._
|
||||||
|
"""
|
||||||
|
|
||||||
|
# BME280 Registers
|
||||||
|
|
||||||
|
_calib00 = 0x88
|
||||||
|
|
||||||
|
_T1 = 0x88 - _calib00
|
||||||
|
_T2 = 0x8A - _calib00
|
||||||
|
_T3 = 0x8C - _calib00
|
||||||
|
|
||||||
|
_P1 = 0x8E - _calib00
|
||||||
|
_P2 = 0x90 - _calib00
|
||||||
|
_P3 = 0x92 - _calib00
|
||||||
|
_P4 = 0x94 - _calib00
|
||||||
|
_P5 = 0x96 - _calib00
|
||||||
|
_P6 = 0x98 - _calib00
|
||||||
|
_P7 = 0x9A - _calib00
|
||||||
|
_P8 = 0x9C - _calib00
|
||||||
|
_P9 = 0x9E - _calib00
|
||||||
|
|
||||||
|
_H1 = 0xA1 - _calib00
|
||||||
|
|
||||||
|
_chip_id = 0xD0
|
||||||
|
_reset = 0xE0
|
||||||
|
|
||||||
|
_calib26 = 0xE1
|
||||||
|
|
||||||
|
_H2 = 0xE1 - _calib26
|
||||||
|
_H3 = 0xE3 - _calib26
|
||||||
|
_xE4 = 0xE4 - _calib26
|
||||||
|
_xE5 = 0xE5 - _calib26
|
||||||
|
_xE6 = 0xE6 - _calib26
|
||||||
|
_H6 = 0xE7 - _calib26
|
||||||
|
|
||||||
|
_ctrl_hum = 0xF2
|
||||||
|
_status = 0xF3
|
||||||
|
_ctrl_meas = 0xF4
|
||||||
|
_config = 0xF5
|
||||||
|
|
||||||
|
_rawdata = 0xF7
|
||||||
|
|
||||||
|
_p_msb = 0xF7 - _rawdata
|
||||||
|
_p_lsb = 0xF8 - _rawdata
|
||||||
|
_p_xlsb = 0xF9 - _rawdata
|
||||||
|
_t_msb = 0xFA - _rawdata
|
||||||
|
_t_lsb = 0xFB - _rawdata
|
||||||
|
_t_xlsb = 0xFC - _rawdata
|
||||||
|
_h_msb = 0xFD - _rawdata
|
||||||
|
_h_lsb = 0xFE - _rawdata
|
||||||
|
|
||||||
|
_os_ms = [0, 1, 2, 4, 8, 16]
|
||||||
|
|
||||||
|
def __init__(self, pi, sampling=OVER_SAMPLE_1,
|
||||||
|
bus=1, address=0x76,
|
||||||
|
channel=0, baud=10000000, flags=0):
|
||||||
|
self.pi = pi
|
||||||
|
|
||||||
|
self.sampling = sampling
|
||||||
|
self.h = pi.i2c_open(bus, address)
|
||||||
|
|
||||||
|
self._load_calibration()
|
||||||
|
|
||||||
|
self.measure_delay = self._measurement_time(sampling, sampling, sampling)
|
||||||
|
|
||||||
|
self.t_fine = 0.0
|
||||||
|
|
||||||
|
def _measurement_time(self, os_temp, os_press, os_hum):
|
||||||
|
ms = ( (1.25 + 2.3 * sensor._os_ms[os_temp]) +
|
||||||
|
(0.575 + 2.3 * sensor._os_ms[os_press]) +
|
||||||
|
(0.575 + 2.3 * sensor._os_ms[os_hum]) )
|
||||||
|
return (ms/1000.0)
|
||||||
|
|
||||||
|
def _u16(self, _calib, off):
|
||||||
|
return (_calib[off] | (_calib[off+1]<<8))
|
||||||
|
|
||||||
|
def _s16(self, _calib, off):
|
||||||
|
v = self._u16(_calib, off)
|
||||||
|
if v > 32767:
|
||||||
|
v -= 65536
|
||||||
|
return v
|
||||||
|
|
||||||
|
def _u8(self, _calib, off):
|
||||||
|
return _calib[off]
|
||||||
|
|
||||||
|
def _s8(self, _calib, off):
|
||||||
|
v = self._u8(_calib,off)
|
||||||
|
if v > 127:
|
||||||
|
v -= 256
|
||||||
|
return v
|
||||||
|
|
||||||
|
def _write_registers(self, data):
|
||||||
|
self.pi.i2c_write_device(self.h, data)
|
||||||
|
|
||||||
|
def _read_registers(self, reg, count):
|
||||||
|
return self.pi.i2c_read_i2c_block_data(self.h, reg, count)
|
||||||
|
|
||||||
|
def _load_calibration(self):
|
||||||
|
|
||||||
|
c, d1 = self._read_registers(sensor._calib00, 26)
|
||||||
|
|
||||||
|
self.T1 = self._u16(d1, sensor._T1)
|
||||||
|
self.T2 = self._s16(d1, sensor._T2)
|
||||||
|
self.T3 = self._s16(d1, sensor._T3)
|
||||||
|
|
||||||
|
self.P1 = self._u16(d1, sensor._P1)
|
||||||
|
self.P2 = self._s16(d1, sensor._P2)
|
||||||
|
self.P3 = self._s16(d1, sensor._P3)
|
||||||
|
self.P4 = self._s16(d1, sensor._P4)
|
||||||
|
self.P5 = self._s16(d1, sensor._P5)
|
||||||
|
self.P6 = self._s16(d1, sensor._P6)
|
||||||
|
self.P7 = self._s16(d1, sensor._P7)
|
||||||
|
self.P8 = self._s16(d1, sensor._P8)
|
||||||
|
self.P9 = self._s16(d1, sensor._P9)
|
||||||
|
|
||||||
|
self.H1 = self._u8(d1, sensor._H1)
|
||||||
|
|
||||||
|
c, d2 = self._read_registers(sensor._calib26, 7)
|
||||||
|
|
||||||
|
self.H2 = self._s16(d2, sensor._H2)
|
||||||
|
|
||||||
|
self.H3 = self._u8(d2, sensor._H3)
|
||||||
|
|
||||||
|
t = self._u8(d2, sensor._xE5)
|
||||||
|
|
||||||
|
t_l = t & 15
|
||||||
|
t_h = (t >> 4) & 15
|
||||||
|
|
||||||
|
self.H4 = (self._u8(d2, sensor._xE4) << 4) | t_l
|
||||||
|
|
||||||
|
if self.H4 > 2047:
|
||||||
|
self.H4 -= 4096
|
||||||
|
|
||||||
|
self.H5 = (self._u8(d2, sensor._xE6) << 4) | t_h
|
||||||
|
|
||||||
|
if self.H5 > 2047:
|
||||||
|
self.H5 -= 4096
|
||||||
|
|
||||||
|
self.H6 = self._s8(d2, sensor._H6)
|
||||||
|
|
||||||
|
def _read_raw_data(self):
|
||||||
|
|
||||||
|
# Set oversampling rate and force reading.
|
||||||
|
|
||||||
|
self._write_registers(
|
||||||
|
[sensor._ctrl_hum, self.sampling,
|
||||||
|
sensor._ctrl_meas, self.sampling << 5 | self.sampling << 2 | 1])
|
||||||
|
|
||||||
|
# Measurement delay.
|
||||||
|
|
||||||
|
time.sleep(self.measure_delay)
|
||||||
|
|
||||||
|
# Grab reading.
|
||||||
|
|
||||||
|
c, d = self._read_registers(sensor._rawdata, 8)
|
||||||
|
|
||||||
|
msb = self._u8(d, sensor._t_msb)
|
||||||
|
lsb = self._u8(d, sensor._t_lsb)
|
||||||
|
xlsb = self._u8(d, sensor._t_xlsb)
|
||||||
|
raw_t = ((msb << 16) | (lsb << 8) | xlsb) >> 4
|
||||||
|
|
||||||
|
msb = self._u8(d, sensor._p_msb)
|
||||||
|
lsb = self._u8(d, sensor._p_lsb)
|
||||||
|
xlsb = self._u8(d, sensor._p_xlsb)
|
||||||
|
raw_p = ((msb << 16) | (lsb << 8) | xlsb) >> 4
|
||||||
|
|
||||||
|
msb = self._u8(d, sensor._h_msb)
|
||||||
|
lsb = self._u8(d, sensor._h_lsb)
|
||||||
|
raw_h = (msb << 8) | lsb
|
||||||
|
|
||||||
|
return raw_t, raw_p, raw_h
|
||||||
|
|
||||||
|
def read_data(self):
|
||||||
|
"""
|
||||||
|
Returns the temperature, pressure, and humidity as a tuple.
|
||||||
|
|
||||||
|
Each value is a float.
|
||||||
|
|
||||||
|
The temperature is returned in degrees centigrade. The
|
||||||
|
pressure is returned in Pascals. The humidity is returned
|
||||||
|
as the relative humidity between 0 and 100%.
|
||||||
|
"""
|
||||||
|
|
||||||
|
raw_t, raw_p, raw_h = self._read_raw_data()
|
||||||
|
|
||||||
|
var1 = (raw_t/16384.0 - (self.T1)/1024.0) * float(self.T2)
|
||||||
|
var2 = (((raw_t)/131072.0 - (self.T1)/8192.0) *
|
||||||
|
((raw_t)/131072.0 - (self.T1)/8192.0)) * (self.T3)
|
||||||
|
|
||||||
|
self.t_fine = var1 + var2
|
||||||
|
|
||||||
|
t = (var1 + var2) / 5120.0
|
||||||
|
|
||||||
|
var1 = (self.t_fine/2.0) - 64000.0
|
||||||
|
var2 = var1 * var1 * self.P6 / 32768.0
|
||||||
|
var2 = var2 + (var1 * self.P5 * 2.0)
|
||||||
|
var2 = (var2/4.0)+(self.P4 * 65536.0)
|
||||||
|
var1 = ((self.P3 * var1 * var1 / 524288.0) + (self.P2 * var1)) / 524288.0
|
||||||
|
var1 = (1.0 + var1 / 32768.0)*self.P1
|
||||||
|
if var1 != 0.0:
|
||||||
|
p = 1048576.0 - raw_p
|
||||||
|
p = (p - (var2 / 4096.0)) * 6250.0 / var1
|
||||||
|
var1 = self.P9 * p * p / 2147483648.0
|
||||||
|
var2 = p * self.P8 / 32768.0
|
||||||
|
p = p + (var1 + var2 + self.P7) / 16.0
|
||||||
|
else:
|
||||||
|
p = 0
|
||||||
|
|
||||||
|
h = self.t_fine - 76800.0
|
||||||
|
|
||||||
|
h = ( (raw_h - ((self.H4) * 64.0 + (self.H5) / 16384.0 * h)) *
|
||||||
|
((self.H2) / 65536.0 * (1.0 + (self.H6) / 67108864.0 * h *
|
||||||
|
(1.0 + (self.H3) / 67108864.0 * h))))
|
||||||
|
|
||||||
|
h = h * (1.0 - self.H1 * h / 524288.0)
|
||||||
|
|
||||||
|
if h > 100.0:
|
||||||
|
h = 100.0
|
||||||
|
elif h < 0.0:
|
||||||
|
h = 0.0
|
||||||
|
|
||||||
|
return t, p, h
|
||||||
|
|
||||||
|
def cancel(self):
|
||||||
|
"""
|
||||||
|
Cancels the sensor and releases resources.
|
||||||
|
"""
|
||||||
|
if self.h is not None:
|
||||||
|
self.pi.i2c_close(self.h)
|
||||||
|
self.h = None
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
# import time
|
||||||
|
import BME280
|
||||||
|
import pigpio
|
||||||
|
|
||||||
|
pi = pigpio.pi()
|
||||||
|
|
||||||
|
if not pi.connected:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
s = BME280.sensor(pi)
|
||||||
|
t, p, h = s.read_data()
|
||||||
|
print("h={:.2f} p={:.1f} t={:.2f}".format(h, p/100.0, t), flush=True)
|
||||||
|
|
||||||
|
# stop = time.time() + 60
|
||||||
|
|
||||||
|
# while stop > time.time():
|
||||||
|
# t, p, h = s.read_data()
|
||||||
|
# print("h={:.2f} p={:.1f} t={:.2f}".format(h, p/100.0, t))
|
||||||
|
# time.sleep(0.9)
|
||||||
|
|
||||||
|
s.cancel()
|
||||||
|
|
||||||
|
pi.stop()
|
1
scripts/beautify.min.js
vendored
Normal file
174
scripts/custom-dialog.js
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
/**
|
||||||
|
* Blockly Demos: Custom Dialogs
|
||||||
|
*
|
||||||
|
* Copyright 2016 Google Inc.
|
||||||
|
* https://developers.google.com/blockly/
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An example implementation of how one might replace Blockly's browser
|
||||||
|
* dialogs. This is just an example, and applications are not encouraged to use
|
||||||
|
* it verbatim.
|
||||||
|
*
|
||||||
|
* @namespace
|
||||||
|
*/
|
||||||
|
CustomDialog = {};
|
||||||
|
|
||||||
|
/** Override Blockly.alert() with custom implementation. */
|
||||||
|
Blockly.alert = function(message, callback) {
|
||||||
|
console.log('Alert: ' + message);
|
||||||
|
CustomDialog.show('Alert', message, {
|
||||||
|
onCancel: callback
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Override Blockly.confirm() with custom implementation. */
|
||||||
|
Blockly.confirm = function(message, callback) {
|
||||||
|
console.log('Confirm: ' + message);
|
||||||
|
CustomDialog.show('Confirm', message, {
|
||||||
|
showOkay: true,
|
||||||
|
onOkay: function() {
|
||||||
|
callback(true);
|
||||||
|
},
|
||||||
|
showCancel: true,
|
||||||
|
onCancel: function() {
|
||||||
|
callback(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Override Blockly.prompt() with custom implementation. */
|
||||||
|
Blockly.prompt = function(message, defaultValue, callback) {
|
||||||
|
console.log('Prompt: ' + message);
|
||||||
|
CustomDialog.show('Prompt', message, {
|
||||||
|
showInput: true,
|
||||||
|
showOkay: true,
|
||||||
|
onOkay: function() {
|
||||||
|
callback(CustomDialog.inputField.value);
|
||||||
|
},
|
||||||
|
showCancel: true,
|
||||||
|
onCancel: function() {
|
||||||
|
callback(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CustomDialog.inputField.value = defaultValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Hides any currently visible dialog. */
|
||||||
|
CustomDialog.hide = function() {
|
||||||
|
if (CustomDialog.backdropDiv_) {
|
||||||
|
CustomDialog.backdropDiv_.style.display = 'none';
|
||||||
|
CustomDialog.dialogDiv_.style.display = 'none';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the dialog.
|
||||||
|
* Allowed options:
|
||||||
|
* - showOkay: Whether to show the OK button.
|
||||||
|
* - showCancel: Whether to show the Cancel button.
|
||||||
|
* - showInput: Whether to show the text input field.
|
||||||
|
* - onOkay: Callback to handle the okay button.
|
||||||
|
* - onCancel: Callback to handle the cancel button and backdrop clicks.
|
||||||
|
*/
|
||||||
|
CustomDialog.show = function(title, message, options) {
|
||||||
|
var backdropDiv = CustomDialog.backdropDiv_;
|
||||||
|
var dialogDiv = CustomDialog.dialogDiv_;
|
||||||
|
if (!dialogDiv) {
|
||||||
|
// Generate HTML
|
||||||
|
backdropDiv = document.createElement('div');
|
||||||
|
backdropDiv.id = 'customDialogBackdrop';
|
||||||
|
backdropDiv.style.cssText =
|
||||||
|
'position: absolute;' +
|
||||||
|
'top: 0; left: 0; right: 0; bottom: 0;' +
|
||||||
|
'background-color: rgba(0, 0, 0, .7);' +
|
||||||
|
'z-index: 100;';
|
||||||
|
document.body.appendChild(backdropDiv);
|
||||||
|
|
||||||
|
dialogDiv = document.createElement('div');
|
||||||
|
dialogDiv.id = 'customDialog';
|
||||||
|
dialogDiv.style.cssText =
|
||||||
|
'background-color: #fff;' +
|
||||||
|
'width: 400px;' +
|
||||||
|
'margin: 20px auto 0;' +
|
||||||
|
'padding: 10px;';
|
||||||
|
backdropDiv.appendChild(dialogDiv);
|
||||||
|
|
||||||
|
dialogDiv.onclick = function(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
CustomDialog.backdropDiv_ = backdropDiv;
|
||||||
|
CustomDialog.dialogDiv_ = dialogDiv;
|
||||||
|
}
|
||||||
|
backdropDiv.style.display = 'block';
|
||||||
|
dialogDiv.style.display = 'block';
|
||||||
|
|
||||||
|
dialogDiv.innerHTML =
|
||||||
|
'<header class="customDialogTitle"></header>' +
|
||||||
|
'<p class="customDialogMessage"></p>' +
|
||||||
|
(options.showInput ? '<div><input id="customDialogInput"></div>' : '') +
|
||||||
|
'<div class="customDialogButtons">' +
|
||||||
|
(options.showCancel ? '<button id="customDialogCancel">Cancel</button>': '') +
|
||||||
|
(options.showOkay ? '<button id="customDialogOkay">OK</button>': '') +
|
||||||
|
'</div>';
|
||||||
|
dialogDiv.getElementsByClassName('customDialogTitle')[0]
|
||||||
|
.appendChild(document.createTextNode(title));
|
||||||
|
dialogDiv.getElementsByClassName('customDialogMessage')[0]
|
||||||
|
.appendChild(document.createTextNode(message));
|
||||||
|
|
||||||
|
var onOkay = function(event) {
|
||||||
|
CustomDialog.hide();
|
||||||
|
options.onOkay && options.onOkay();
|
||||||
|
event && event.stopPropagation();
|
||||||
|
};
|
||||||
|
var onCancel = function(event) {
|
||||||
|
CustomDialog.hide();
|
||||||
|
options.onCancel && options.onCancel();
|
||||||
|
event && event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialogInput = document.getElementById('customDialogInput');
|
||||||
|
CustomDialog.inputField = dialogInput;
|
||||||
|
if (dialogInput) {
|
||||||
|
dialogInput.focus();
|
||||||
|
|
||||||
|
dialogInput.onkeyup = function(event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
// Process as OK when user hits enter.
|
||||||
|
onOkay();
|
||||||
|
return false;
|
||||||
|
} else if (event.keyCode == 27) {
|
||||||
|
// Process as cancel when user hits esc.
|
||||||
|
onCancel();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var okay = document.getElementById('customDialogOkay');
|
||||||
|
okay && okay.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.showOkay) {
|
||||||
|
document.getElementById('customDialogOkay')
|
||||||
|
.addEventListener('click', onOkay);
|
||||||
|
}
|
||||||
|
if (options.showCancel) {
|
||||||
|
document.getElementById('customDialogCancel')
|
||||||
|
.addEventListener('click', onCancel);
|
||||||
|
}
|
||||||
|
|
||||||
|
backdropDiv.onclick = onCancel;
|
||||||
|
};
|
228
scripts/eleclib.js
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/** Node.js または Electron 固有の機能を利用した関数のモジュール ************* */
|
||||||
|
|
||||||
|
// ローカルプロパティ
|
||||||
|
// Hard Coding!!!
|
||||||
|
const appName = 'ocoge';
|
||||||
|
const defpath = '/home/pi/Documents/ocoge/';
|
||||||
|
// Require
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require("path");
|
||||||
|
const mainWin = require('electron').remote.getCurrentWindow();
|
||||||
|
const dialog = require('electron').remote.dialog;
|
||||||
|
const shell = require('electron').shell;
|
||||||
|
const clipboard = require('electron').clipboard;
|
||||||
|
|
||||||
|
|
||||||
|
var saveFilepath = null;
|
||||||
|
var wsChanged = false;
|
||||||
|
|
||||||
|
// 0で数値の桁合わせ
|
||||||
|
// NUM=値 LEN=桁数
|
||||||
|
const zeroPadding = (NUM, LEN) => (Array(LEN).join('0') + NUM).slice(-LEN);
|
||||||
|
|
||||||
|
// 現在の日付時刻から workspace フォルダ内のユニークなファイルパスを作成
|
||||||
|
const getUniqueFilepath = () => {
|
||||||
|
let today = new Date();
|
||||||
|
let filename = today.getFullYear() + '-' + zeroPadding((today.getMonth() + 1), 2) + '-' + zeroPadding(today.getDate(), 2) + '-' + zeroPadding(today.getHours(), 2) + '-' + zeroPadding(today.getMinutes(), 2) + '-' + zeroPadding(today.getSeconds(), 2);
|
||||||
|
let filepath = path.join(defpath, filename);
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// クリップボードにコピー
|
||||||
|
exports.copyText = text => clipboard.writeText(text);
|
||||||
|
|
||||||
|
// リンクを外部ブラウザで開く
|
||||||
|
exports.openURL = (url) => {
|
||||||
|
shell.openExternal(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
// タイトルバーにファイル名を表示
|
||||||
|
// const setTitle = () => {
|
||||||
|
// if (saveFilepath) let title = appName;
|
||||||
|
// else let title = saveFilepath + ' - ' + appName;
|
||||||
|
// mainWin.setTitle(title);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// saveFilepath を更新
|
||||||
|
// ウィンドウタイトルバーテキストを変更
|
||||||
|
const setSaveFilepath = filepath => {
|
||||||
|
let title;
|
||||||
|
saveFilepath = filepath;
|
||||||
|
// if (filepath) title = filepath + ' - ' + appName;
|
||||||
|
// else title = appName;
|
||||||
|
// mainWin.setTitle(title);
|
||||||
|
this.setWsChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ワークスペースが変更された・保存された
|
||||||
|
// ウィンドウタイトルバーテキストを変更
|
||||||
|
exports.setWsChanged = changed => {
|
||||||
|
let title;
|
||||||
|
wsChanged = changed;
|
||||||
|
if (saveFilepath) title = saveFilepath + ' - ' + appName;
|
||||||
|
else title = appName;
|
||||||
|
if (changed) title = '*' + title;
|
||||||
|
mainWin.setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存ファイルプロパティを更新
|
||||||
|
exports.newFile = () => setSaveFilepath(null);
|
||||||
|
|
||||||
|
// ワークスペースファイル読み込みの一連の動作のラッパ
|
||||||
|
exports.loadWsFile = () => {
|
||||||
|
let filepath = openFile('xml');
|
||||||
|
if (filepath.length > 0) {
|
||||||
|
if (saveFilepath === null) {
|
||||||
|
setSaveFilepath(filepath);
|
||||||
|
} //読み込みに失敗してもsaveFilepathが更新されてしまうのはちょっと具合が悪いかも
|
||||||
|
return readFromFile(filepath);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// その他ファイル読み込みの一連の動作のラッパ
|
||||||
|
exports.loadFile = ext => {
|
||||||
|
let filepath = openFile(ext);
|
||||||
|
if (filepath.length > 0) {
|
||||||
|
return readFromFile(filepath);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// オープンファイルダイアログ
|
||||||
|
const openFile = ext => {
|
||||||
|
let filter;
|
||||||
|
if (ext == 'xml') {
|
||||||
|
filter = { name: 'xml file', extensions: ['xml'] };
|
||||||
|
} else if (ext == 'js') {
|
||||||
|
filter = { name: 'javascript file', extensions: ['js'] };
|
||||||
|
} else {
|
||||||
|
filter = { name: 'text file', extensions: ['txt'] };
|
||||||
|
}
|
||||||
|
let filepaths = dialog.showOpenDialogSync(mainWin, {
|
||||||
|
properties: ['openFile'],
|
||||||
|
title: 'Select a file',
|
||||||
|
defaultPath: defpath,
|
||||||
|
filters: [
|
||||||
|
filter
|
||||||
|
]
|
||||||
|
});
|
||||||
|
if (filepaths == undefined) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return filepaths[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ファイルからデータを読み込み
|
||||||
|
const readFromFile = filepath => {
|
||||||
|
let data = '';
|
||||||
|
try {
|
||||||
|
data = fs.readFileSync(filepath, 'utf-8');
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
// テキストファイル読み込み: 外部スクリプト動的読み込みに使用
|
||||||
|
exports.readTextFile = filepath => {
|
||||||
|
return readFromFile(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ワークスペースファイル保存の一連の動作のラッパ
|
||||||
|
exports.saveWsFile = data => {
|
||||||
|
if (saveFilepath === null) {
|
||||||
|
let filepath = selectSaveFile('xml');
|
||||||
|
if (filepath === undefined) { //キャンセル
|
||||||
|
return undefined;
|
||||||
|
} else {
|
||||||
|
setSaveFilepath(filepath);
|
||||||
|
} //これも保存が成功したら変更するようにすべきかしら
|
||||||
|
} else this.setWsChanged(false);
|
||||||
|
return writeToFile(saveFilepath, data);
|
||||||
|
}
|
||||||
|
// その他ファイル保存の一連の動作のラッパ
|
||||||
|
exports.saveFile = (data, ext) => {
|
||||||
|
let filepath = selectSaveFile(ext);
|
||||||
|
if (filepath === undefined) { //キャンセル
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return writeToFile(filepath, data);
|
||||||
|
}
|
||||||
|
// ファイル保存ダイアログ
|
||||||
|
const selectSaveFile = ext => {
|
||||||
|
let filter;
|
||||||
|
let defName;
|
||||||
|
if (ext == 'xml') {
|
||||||
|
filter = { name: 'xml file', extensions: ['xml'] };
|
||||||
|
defName = getUniqueFilepath() + '.xml';
|
||||||
|
} else if (ext == 'js') {
|
||||||
|
filter = { name: 'javascript file', extensions: ['js'] };
|
||||||
|
// ワークスペース保存名がある場合、それをベースにファイル名の候補を決める
|
||||||
|
if (saveFilepath === null) {
|
||||||
|
defName = getUniqueFilepath() + '.js';
|
||||||
|
} else {
|
||||||
|
let dirname = path.dirname(saveFilepath);
|
||||||
|
let basename = path.basename(saveFilepath, '.xml');
|
||||||
|
defName = path.join(dirname, basename) + '.js';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
filter = { name: 'text file', extensions: ['txt'] };
|
||||||
|
}
|
||||||
|
let filename = dialog.showSaveDialogSync(mainWin, {
|
||||||
|
title: '保存先を決定してください',
|
||||||
|
defaultPath: defName,
|
||||||
|
filters: [filter]
|
||||||
|
});
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
// ファイル書き込み
|
||||||
|
const writeToFile = (filepath, data) => {
|
||||||
|
try {
|
||||||
|
fs.writeFileSync(filepath, data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子プロセス関連
|
||||||
|
let children = [];
|
||||||
|
// 新しい子プロセスを作成し、配列に保存
|
||||||
|
exports.addChild = (child) => {
|
||||||
|
children.push(child);
|
||||||
|
}
|
||||||
|
// 全ての子プロセスを殺し、配列をクリア
|
||||||
|
exports.killAllChildren = () => {
|
||||||
|
children.forEach(function( child ) {
|
||||||
|
child.kill();
|
||||||
|
});
|
||||||
|
children = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 設定(保存ファイルパスと未保存フラグ)をローカルストレージに保存
|
||||||
|
exports.savePrefsToLS = () => {
|
||||||
|
let wc = '0';
|
||||||
|
if (wsChanged) wc = '1';
|
||||||
|
let o = { 'saveFilepath': saveFilepath, 'wsChanged': wc };
|
||||||
|
let s = JSON.stringify(o);
|
||||||
|
localStorage.setItem("abrage.json", s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 設定(保存ファイルパスと未保存フラグ)をローカルストレージからロード
|
||||||
|
exports.loadPrefsFromLS = () => {
|
||||||
|
let s = localStorage.getItem("abrage.json");
|
||||||
|
let o = JSON.parse(s);
|
||||||
|
setSaveFilepath(o.saveFilepath);
|
||||||
|
if (o.wsChanged == '0') this.setWsChanged(false);
|
||||||
|
else this.setWsChanged(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ファイル名にアプリケーションのドキュメントルートまでのパスをつけて返す
|
||||||
|
exports.getDocPath = filename => {
|
||||||
|
return path.join(appDocRoot, filename);
|
||||||
|
}
|
6197
scripts/face-api.js
Normal file
53
scripts/face.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
import cv2
|
||||||
|
import time
|
||||||
|
|
||||||
|
# 引数
|
||||||
|
args = sys.argv
|
||||||
|
isWIN = 0
|
||||||
|
if len(args) >= 2:
|
||||||
|
if args[1] == "-w":
|
||||||
|
isWIN = 1
|
||||||
|
|
||||||
|
# カメラの準備
|
||||||
|
faceCascade = cv2.CascadeClassifier('scripts/haarcascade_frontalface_alt.xml')
|
||||||
|
|
||||||
|
capture = cv2.VideoCapture(0) # カメラセット
|
||||||
|
# 画像サイズの指定
|
||||||
|
ret = capture.set(3, 320)
|
||||||
|
ret = capture.set(4, 180)
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
ret, image = capture.read() # 画像取得
|
||||||
|
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||||
|
face = faceCascade.detectMultiScale(
|
||||||
|
gray_image, scaleFactor=1.3, minNeighbors=2, minSize=(30, 30))
|
||||||
|
|
||||||
|
if len(face) > 0: # 一番大きい顔を選ぶ
|
||||||
|
bigw = 0
|
||||||
|
for (x, y, w, h) in face:
|
||||||
|
if w > bigw:
|
||||||
|
bigx = x
|
||||||
|
bigw = w
|
||||||
|
|
||||||
|
if isWIN:
|
||||||
|
cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
|
||||||
|
|
||||||
|
pos = (bigx+(bigw/2)) - 160 # 顔の位置
|
||||||
|
|
||||||
|
print pos
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
if isWIN: # カメラ画像表示
|
||||||
|
cv2.imshow("Camera Test", image)
|
||||||
|
# キーが押されたら保存・終了
|
||||||
|
if cv2.waitKey(10) == 32: # 32:[Space]
|
||||||
|
pass
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
capture.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
print "正常終了"
|
533
scripts/gesture.py
Normal file
@ -0,0 +1,533 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# GrovePi Library for using the Grove - Gesture Sensor v1.0(http://www.seeedstudio.com/depot/Grove-Gesture-p-2463.html)
|
||||||
|
#
|
||||||
|
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
|
||||||
|
#
|
||||||
|
# Have a question about this library? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi
|
||||||
|
#
|
||||||
|
# History
|
||||||
|
# ------------------------------------------------
|
||||||
|
# Author Date Comments
|
||||||
|
# Karan 31 Dec 15 Initial Authoring
|
||||||
|
#
|
||||||
|
# Code derived from the basic Arduino library for the Gesture Sensor by Seeed: https://github.com/Seeed-Studio/Gesture_PAJ7620
|
||||||
|
|
||||||
|
# Released under the MIT license (http://choosealicense.com/licenses/mit/).
|
||||||
|
# For more information see https://github.com/DexterInd/GrovePi/blob/master/LICENSE
|
||||||
|
|
||||||
|
import time,sys
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import smbus
|
||||||
|
|
||||||
|
# use the bus that matches your raspi version
|
||||||
|
rev = GPIO.RPI_REVISION
|
||||||
|
if rev == 2 or rev == 3:
|
||||||
|
bus = smbus.SMBus(1)
|
||||||
|
else:
|
||||||
|
bus = smbus.SMBus(0)
|
||||||
|
|
||||||
|
class gesture:
|
||||||
|
#Registers and variables for the gesture sensor
|
||||||
|
GES_REACTION_TIME =.500 # You can adjust the reaction time according to the actual circumstance.
|
||||||
|
GES_ENTRY_TIME =.800 # When you want to recognize the Forward/Backward gestures, your gestures' reaction time must less than GES_ENTRY_TIME(0.8s).
|
||||||
|
GES_QUIT_TIME =1.000
|
||||||
|
|
||||||
|
BANK0 = 0
|
||||||
|
BANK1 = 1
|
||||||
|
|
||||||
|
PAJ7620_ADDR_BASE =0x00
|
||||||
|
|
||||||
|
#REGISTER BANK SELECT
|
||||||
|
PAJ7620_REGITER_BANK_SEL =(PAJ7620_ADDR_BASE + 0xEF) #W
|
||||||
|
|
||||||
|
#DEVICE ID
|
||||||
|
PAJ7620_ID =0x73
|
||||||
|
|
||||||
|
#REGISTER BANK 0
|
||||||
|
PAJ7620_ADDR_SUSPEND_CMD =(PAJ7620_ADDR_BASE + 0x3) #W
|
||||||
|
PAJ7620_ADDR_GES_PS_DET_MASK_0 =(PAJ7620_ADDR_BASE + 0x41) #RW
|
||||||
|
PAJ7620_ADDR_GES_PS_DET_MASK_1 =(PAJ7620_ADDR_BASE + 0x42) #RW
|
||||||
|
PAJ7620_ADDR_GES_PS_DET_FLAG_0 =(PAJ7620_ADDR_BASE + 0x43) #R
|
||||||
|
PAJ7620_ADDR_GES_PS_DET_FLAG_1 =(PAJ7620_ADDR_BASE + 0x44) #R
|
||||||
|
PAJ7620_ADDR_STATE_INDICATOR =(PAJ7620_ADDR_BASE + 0x45) #R
|
||||||
|
PAJ7620_ADDR_PS_HIGH_THRESHOLD =(PAJ7620_ADDR_BASE + 0x69) #RW
|
||||||
|
PAJ7620_ADDR_PS_LOW_THRESHOLD =(PAJ7620_ADDR_BASE + 0x6A) #RW
|
||||||
|
PAJ7620_ADDR_PS_APPROACH_STATE =(PAJ7620_ADDR_BASE + 0x6B) #R
|
||||||
|
PAJ7620_ADDR_PS_RAW_DATA =(PAJ7620_ADDR_BASE + 0x6C) #R
|
||||||
|
|
||||||
|
#REGISTER BANK 1
|
||||||
|
PAJ7620_ADDR_PS_GAIN =(PAJ7620_ADDR_BASE + 0x44) #RW
|
||||||
|
PAJ7620_ADDR_IDLE_S1_STEP_0 =(PAJ7620_ADDR_BASE + 0x67) #RW
|
||||||
|
PAJ7620_ADDR_IDLE_S1_STEP_1 =(PAJ7620_ADDR_BASE + 0x68) #RW
|
||||||
|
PAJ7620_ADDR_IDLE_S2_STEP_0 =(PAJ7620_ADDR_BASE + 0x69) #RW
|
||||||
|
PAJ7620_ADDR_IDLE_S2_STEP_1 =(PAJ7620_ADDR_BASE + 0x6A) #RW
|
||||||
|
PAJ7620_ADDR_OP_TO_S1_STEP_0 =(PAJ7620_ADDR_BASE + 0x6B) #RW
|
||||||
|
PAJ7620_ADDR_OP_TO_S1_STEP_1 =(PAJ7620_ADDR_BASE + 0x6C) #RW
|
||||||
|
PAJ7620_ADDR_OP_TO_S2_STEP_0 =(PAJ7620_ADDR_BASE + 0x6D) #RW
|
||||||
|
PAJ7620_ADDR_OP_TO_S2_STEP_1 =(PAJ7620_ADDR_BASE + 0x6E) #RW
|
||||||
|
PAJ7620_ADDR_OPERATION_ENABLE =(PAJ7620_ADDR_BASE + 0x72) #RW
|
||||||
|
|
||||||
|
#PAJ7620_REGITER_BANK_SEL
|
||||||
|
PAJ7620_BANK0=0
|
||||||
|
PAJ7620_BANK1=1
|
||||||
|
|
||||||
|
#PAJ7620_ADDR_SUSPEND_CMD
|
||||||
|
PAJ7620_I2C_WAKEUP =1
|
||||||
|
PAJ7620_I2C_SUSPEND =0
|
||||||
|
|
||||||
|
#PAJ7620_ADDR_OPERATION_ENABLE
|
||||||
|
PAJ7620_ENABLE=1
|
||||||
|
PAJ7620_DISABLE=0
|
||||||
|
|
||||||
|
#ADC, delete
|
||||||
|
REG_ADDR_RESULT = 0x00
|
||||||
|
REG_ADDR_ALERT = 0x01
|
||||||
|
REG_ADDR_CONFIG = 0x02
|
||||||
|
REG_ADDR_LIMITL = 0x03
|
||||||
|
REG_ADDR_LIMITH = 0x04
|
||||||
|
REG_ADDR_HYST = 0x05
|
||||||
|
REG_ADDR_CONVL = 0x06
|
||||||
|
REG_ADDR_CONVH = 0x07
|
||||||
|
|
||||||
|
GES_RIGHT_FLAG =1<<0
|
||||||
|
GES_LEFT_FLAG =1<<1
|
||||||
|
GES_UP_FLAG =1<<2
|
||||||
|
GES_DOWN_FLAG =1<<3
|
||||||
|
GES_FORWARD_FLAG =1<<4
|
||||||
|
GES_BACKWARD_FLAG =1<<5
|
||||||
|
GES_CLOCKWISE_FLAG =1<<6
|
||||||
|
GES_COUNT_CLOCKWISE_FLAG =1<<7
|
||||||
|
GES_WAVE_FLAG =1<<0
|
||||||
|
|
||||||
|
#Gesture output
|
||||||
|
FORWARD = 1
|
||||||
|
BACKWARD = 2
|
||||||
|
RIGHT = 3
|
||||||
|
LEFT = 4
|
||||||
|
UP = 5
|
||||||
|
DOWN = 6
|
||||||
|
CLOCKWISE = 7
|
||||||
|
ANTI_CLOCKWISE = 8
|
||||||
|
WAVE = 9
|
||||||
|
|
||||||
|
#Initial register state
|
||||||
|
initRegisterArray=( [0xEF,0x00],
|
||||||
|
[0x32,0x29],
|
||||||
|
[0x33,0x01],
|
||||||
|
[0x34,0x00],
|
||||||
|
[0x35,0x01],
|
||||||
|
[0x36,0x00],
|
||||||
|
[0x37,0x07],
|
||||||
|
[0x38,0x17],
|
||||||
|
[0x39,0x06],
|
||||||
|
[0x3A,0x12],
|
||||||
|
[0x3F,0x00],
|
||||||
|
[0x40,0x02],
|
||||||
|
[0x41,0xFF],
|
||||||
|
[0x42,0x01],
|
||||||
|
[0x46,0x2D],
|
||||||
|
[0x47,0x0F],
|
||||||
|
[0x48,0x3C],
|
||||||
|
[0x49,0x00],
|
||||||
|
[0x4A,0x1E],
|
||||||
|
[0x4B,0x00],
|
||||||
|
[0x4C,0x20],
|
||||||
|
[0x4D,0x00],
|
||||||
|
[0x4E,0x1A],
|
||||||
|
[0x4F,0x14],
|
||||||
|
[0x50,0x00],
|
||||||
|
[0x51,0x10],
|
||||||
|
[0x52,0x00],
|
||||||
|
[0x5C,0x02],
|
||||||
|
[0x5D,0x00],
|
||||||
|
[0x5E,0x10],
|
||||||
|
[0x5F,0x3F],
|
||||||
|
[0x60,0x27],
|
||||||
|
[0x61,0x28],
|
||||||
|
[0x62,0x00],
|
||||||
|
[0x63,0x03],
|
||||||
|
[0x64,0xF7],
|
||||||
|
[0x65,0x03],
|
||||||
|
[0x66,0xD9],
|
||||||
|
[0x67,0x03],
|
||||||
|
[0x68,0x01],
|
||||||
|
[0x69,0xC8],
|
||||||
|
[0x6A,0x40],
|
||||||
|
[0x6D,0x04],
|
||||||
|
[0x6E,0x00],
|
||||||
|
[0x6F,0x00],
|
||||||
|
[0x70,0x80],
|
||||||
|
[0x71,0x00],
|
||||||
|
[0x72,0x00],
|
||||||
|
[0x73,0x00],
|
||||||
|
[0x74,0xF0],
|
||||||
|
[0x75,0x00],
|
||||||
|
[0x80,0x42],
|
||||||
|
[0x81,0x44],
|
||||||
|
[0x82,0x04],
|
||||||
|
[0x83,0x20],
|
||||||
|
[0x84,0x20],
|
||||||
|
[0x85,0x00],
|
||||||
|
[0x86,0x10],
|
||||||
|
[0x87,0x00],
|
||||||
|
[0x88,0x05],
|
||||||
|
[0x89,0x18],
|
||||||
|
[0x8A,0x10],
|
||||||
|
[0x8B,0x01],
|
||||||
|
[0x8C,0x37],
|
||||||
|
[0x8D,0x00],
|
||||||
|
[0x8E,0xF0],
|
||||||
|
[0x8F,0x81],
|
||||||
|
[0x90,0x06],
|
||||||
|
[0x91,0x06],
|
||||||
|
[0x92,0x1E],
|
||||||
|
[0x93,0x0D],
|
||||||
|
[0x94,0x0A],
|
||||||
|
[0x95,0x0A],
|
||||||
|
[0x96,0x0C],
|
||||||
|
[0x97,0x05],
|
||||||
|
[0x98,0x0A],
|
||||||
|
[0x99,0x41],
|
||||||
|
[0x9A,0x14],
|
||||||
|
[0x9B,0x0A],
|
||||||
|
[0x9C,0x3F],
|
||||||
|
[0x9D,0x33],
|
||||||
|
[0x9E,0xAE],
|
||||||
|
[0x9F,0xF9],
|
||||||
|
[0xA0,0x48],
|
||||||
|
[0xA1,0x13],
|
||||||
|
[0xA2,0x10],
|
||||||
|
[0xA3,0x08],
|
||||||
|
[0xA4,0x30],
|
||||||
|
[0xA5,0x19],
|
||||||
|
[0xA6,0x10],
|
||||||
|
[0xA7,0x08],
|
||||||
|
[0xA8,0x24],
|
||||||
|
[0xA9,0x04],
|
||||||
|
[0xAA,0x1E],
|
||||||
|
[0xAB,0x1E],
|
||||||
|
[0xCC,0x19],
|
||||||
|
[0xCD,0x0B],
|
||||||
|
[0xCE,0x13],
|
||||||
|
[0xCF,0x64],
|
||||||
|
[0xD0,0x21],
|
||||||
|
[0xD1,0x0F],
|
||||||
|
[0xD2,0x88],
|
||||||
|
[0xE0,0x01],
|
||||||
|
[0xE1,0x04],
|
||||||
|
[0xE2,0x41],
|
||||||
|
[0xE3,0xD6],
|
||||||
|
[0xE4,0x00],
|
||||||
|
[0xE5,0x0C],
|
||||||
|
[0xE6,0x0A],
|
||||||
|
[0xE7,0x00],
|
||||||
|
[0xE8,0x00],
|
||||||
|
[0xE9,0x00],
|
||||||
|
[0xEE,0x07],
|
||||||
|
[0xEF,0x01],
|
||||||
|
[0x00,0x1E],
|
||||||
|
[0x01,0x1E],
|
||||||
|
[0x02,0x0F],
|
||||||
|
[0x03,0x10],
|
||||||
|
[0x04,0x02],
|
||||||
|
[0x05,0x00],
|
||||||
|
[0x06,0xB0],
|
||||||
|
[0x07,0x04],
|
||||||
|
[0x08,0x0D],
|
||||||
|
[0x09,0x0E],
|
||||||
|
[0x0A,0x9C],
|
||||||
|
[0x0B,0x04],
|
||||||
|
[0x0C,0x05],
|
||||||
|
[0x0D,0x0F],
|
||||||
|
[0x0E,0x02],
|
||||||
|
[0x0F,0x12],
|
||||||
|
[0x10,0x02],
|
||||||
|
[0x11,0x02],
|
||||||
|
[0x12,0x00],
|
||||||
|
[0x13,0x01],
|
||||||
|
[0x14,0x05],
|
||||||
|
[0x15,0x07],
|
||||||
|
[0x16,0x05],
|
||||||
|
[0x17,0x07],
|
||||||
|
[0x18,0x01],
|
||||||
|
[0x19,0x04],
|
||||||
|
[0x1A,0x05],
|
||||||
|
[0x1B,0x0C],
|
||||||
|
[0x1C,0x2A],
|
||||||
|
[0x1D,0x01],
|
||||||
|
[0x1E,0x00],
|
||||||
|
[0x21,0x00],
|
||||||
|
[0x22,0x00],
|
||||||
|
[0x23,0x00],
|
||||||
|
[0x25,0x01],
|
||||||
|
[0x26,0x00],
|
||||||
|
[0x27,0x39],
|
||||||
|
[0x28,0x7F],
|
||||||
|
[0x29,0x08],
|
||||||
|
[0x30,0x03],
|
||||||
|
[0x31,0x00],
|
||||||
|
[0x32,0x1A],
|
||||||
|
[0x33,0x1A],
|
||||||
|
[0x34,0x07],
|
||||||
|
[0x35,0x07],
|
||||||
|
[0x36,0x01],
|
||||||
|
[0x37,0xFF],
|
||||||
|
[0x38,0x36],
|
||||||
|
[0x39,0x07],
|
||||||
|
[0x3A,0x00],
|
||||||
|
[0x3E,0xFF],
|
||||||
|
[0x3F,0x00],
|
||||||
|
[0x40,0x77],
|
||||||
|
[0x41,0x40],
|
||||||
|
[0x42,0x00],
|
||||||
|
[0x43,0x30],
|
||||||
|
[0x44,0xA0],
|
||||||
|
[0x45,0x5C],
|
||||||
|
[0x46,0x00],
|
||||||
|
[0x47,0x00],
|
||||||
|
[0x48,0x58],
|
||||||
|
[0x4A,0x1E],
|
||||||
|
[0x4B,0x1E],
|
||||||
|
[0x4C,0x00],
|
||||||
|
[0x4D,0x00],
|
||||||
|
[0x4E,0xA0],
|
||||||
|
[0x4F,0x80],
|
||||||
|
[0x50,0x00],
|
||||||
|
[0x51,0x00],
|
||||||
|
[0x52,0x00],
|
||||||
|
[0x53,0x00],
|
||||||
|
[0x54,0x00],
|
||||||
|
[0x57,0x80],
|
||||||
|
[0x59,0x10],
|
||||||
|
[0x5A,0x08],
|
||||||
|
[0x5B,0x94],
|
||||||
|
[0x5C,0xE8],
|
||||||
|
[0x5D,0x08],
|
||||||
|
[0x5E,0x3D],
|
||||||
|
[0x5F,0x99],
|
||||||
|
[0x60,0x45],
|
||||||
|
[0x61,0x40],
|
||||||
|
[0x63,0x2D],
|
||||||
|
[0x64,0x02],
|
||||||
|
[0x65,0x96],
|
||||||
|
[0x66,0x00],
|
||||||
|
[0x67,0x97],
|
||||||
|
[0x68,0x01],
|
||||||
|
[0x69,0xCD],
|
||||||
|
[0x6A,0x01],
|
||||||
|
[0x6B,0xB0],
|
||||||
|
[0x6C,0x04],
|
||||||
|
[0x6D,0x2C],
|
||||||
|
[0x6E,0x01],
|
||||||
|
[0x6F,0x32],
|
||||||
|
[0x71,0x00],
|
||||||
|
[0x72,0x01],
|
||||||
|
[0x73,0x35],
|
||||||
|
[0x74,0x00],
|
||||||
|
[0x75,0x33],
|
||||||
|
[0x76,0x31],
|
||||||
|
[0x77,0x01],
|
||||||
|
[0x7C,0x84],
|
||||||
|
[0x7D,0x03],
|
||||||
|
[0x7E,0x01])
|
||||||
|
|
||||||
|
#Enable debug message
|
||||||
|
debug=0
|
||||||
|
|
||||||
|
#Initialize the sensors
|
||||||
|
def init(self):
|
||||||
|
time.sleep(.001)
|
||||||
|
self.paj7620SelectBank(self.BANK0)
|
||||||
|
self.paj7620SelectBank(self.BANK0)
|
||||||
|
|
||||||
|
data0 = self.paj7620ReadReg(0, 1)[0]
|
||||||
|
data1 = self.paj7620ReadReg(1, 1)[0]
|
||||||
|
if self.debug:
|
||||||
|
print("data0:",data0,"data1:",data1, flush=True, end="")
|
||||||
|
if data0 != 0x20 :#or data1 <> 0x76:
|
||||||
|
print("Error with sensor", flush=True, end="")
|
||||||
|
#return 0xff
|
||||||
|
if data0 == 0x20:
|
||||||
|
print("wake-up finish.", flush=True, end="")
|
||||||
|
|
||||||
|
for i in range(len(self.initRegisterArray)):
|
||||||
|
self.paj7620WriteReg(self.initRegisterArray[i][0],self.initRegisterArray[i][1])
|
||||||
|
|
||||||
|
self.paj7620SelectBank(self.BANK0)
|
||||||
|
|
||||||
|
print("Paj7620 initialize register finished.", flush=True, end="")
|
||||||
|
|
||||||
|
#Write a byte to a register on the Gesture sensor
|
||||||
|
def paj7620WriteReg(self,addr,cmd):
|
||||||
|
bus.write_word_data(self.PAJ7620_ID, addr, cmd)
|
||||||
|
|
||||||
|
#Select a register bank on the Gesture Sensor
|
||||||
|
def paj7620SelectBank(self,bank):
|
||||||
|
if bank==self.BANK0:
|
||||||
|
self.paj7620WriteReg(self.PAJ7620_REGITER_BANK_SEL, self.PAJ7620_BANK0)
|
||||||
|
|
||||||
|
#Read a block of bytes of length "qty" starting at address "addr" from the Gesture sensor
|
||||||
|
def paj7620ReadReg(self,addr,qty):
|
||||||
|
return bus.read_i2c_block_data(self.PAJ7620_ID, addr,qty)
|
||||||
|
|
||||||
|
#Print the values from the gesture sensor
|
||||||
|
def print_gesture(self):
|
||||||
|
data=self.paj7620ReadReg(0x43,1)[0]
|
||||||
|
if data==self.GES_RIGHT_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
print("1", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
print("2", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
print("3", flush=True, end="")
|
||||||
|
|
||||||
|
elif data==self.GES_LEFT_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
print("1", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
print("2", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
print("4", flush=True, end="")
|
||||||
|
|
||||||
|
elif data==self.GES_UP_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
print("1", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
print("2", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
print("5", flush=True, end="")
|
||||||
|
|
||||||
|
elif data==self.GES_DOWN_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
print("1", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
print("2", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
print("6", flush=True, end="")
|
||||||
|
|
||||||
|
elif data==self.GES_FORWARD_FLAG:
|
||||||
|
print("1", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
|
||||||
|
elif data==self.GES_BACKWARD_FLAG:
|
||||||
|
print("2", flush=True, end="")
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
|
||||||
|
elif data==self.GES_CLOCKWISE_FLAG:
|
||||||
|
print("7", flush=True, end="")
|
||||||
|
|
||||||
|
elif data==self.GES_COUNT_CLOCKWISE_FLAG:
|
||||||
|
print("8", flush=True, end="")
|
||||||
|
|
||||||
|
else:
|
||||||
|
data1=self.paj7620ReadReg(0x44, 1)[0]
|
||||||
|
if (data1 == self.GES_WAVE_FLAG):
|
||||||
|
print("9", flush=True, end="")
|
||||||
|
|
||||||
|
#Return a vlaue from the gestire sensor which can be used in a program
|
||||||
|
# 0:nothing
|
||||||
|
# 1:Forward
|
||||||
|
# 2:Backward
|
||||||
|
# 3:Right
|
||||||
|
# 4:Left
|
||||||
|
# 5:Up
|
||||||
|
# 6:Down
|
||||||
|
# 7:Clockwise
|
||||||
|
# 8:anti-clockwise
|
||||||
|
# 9:wave
|
||||||
|
def return_gesture(self):
|
||||||
|
|
||||||
|
data=self.paj7620ReadReg(0x43,1)[0]
|
||||||
|
if data==self.GES_RIGHT_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
return 1
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
return 2
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
return 3
|
||||||
|
|
||||||
|
elif data==self.GES_LEFT_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
return 1
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
return 2
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
return 4
|
||||||
|
|
||||||
|
elif data==self.GES_UP_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
return 1
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
return 2
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
return 5
|
||||||
|
|
||||||
|
elif data==self.GES_DOWN_FLAG:
|
||||||
|
time.sleep(self.GES_ENTRY_TIME)
|
||||||
|
data=self.paj7620ReadReg(0x43, 1)[0]
|
||||||
|
if data == self.GES_FORWARD_FLAG:
|
||||||
|
return 1
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
elif data == self.GES_BACKWARD_FLAG:
|
||||||
|
return 2
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
else:
|
||||||
|
return 6
|
||||||
|
|
||||||
|
elif data==self.GES_FORWARD_FLAG:
|
||||||
|
return 1
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
|
||||||
|
elif data==self.GES_BACKWARD_FLAG:
|
||||||
|
return 2
|
||||||
|
time.sleep(self.GES_QUIT_TIME)
|
||||||
|
|
||||||
|
elif data==self.GES_CLOCKWISE_FLAG:
|
||||||
|
return 7
|
||||||
|
|
||||||
|
elif data==self.GES_COUNT_CLOCKWISE_FLAG:
|
||||||
|
return 8
|
||||||
|
|
||||||
|
else:
|
||||||
|
data1=self.paj7620ReadReg(0x44, 1)[0]
|
||||||
|
if (data1 == self.GES_WAVE_FLAG):
|
||||||
|
return 9
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
g=gesture()
|
||||||
|
g.init()
|
||||||
|
while True:
|
||||||
|
g.print_gesture()
|
||||||
|
time.sleep(.1)
|
||||||
|
# print g.return_gesture()
|
||||||
|
# time.sleep(.1)
|
26161
scripts/haarcascade_frontalface_alt.xml
Normal file
515
scripts/irrp.py
Normal file
@ -0,0 +1,515 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# irrp.py
|
||||||
|
# 2015-12-21
|
||||||
|
# Public Domain
|
||||||
|
|
||||||
|
"""
|
||||||
|
A utility to record and then playback IR remote control codes.
|
||||||
|
|
||||||
|
To record use
|
||||||
|
|
||||||
|
./irrp.py -r -g4 -fcodes 1 2 3 4 5 6
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
-r record
|
||||||
|
-g the GPIO connected to the IR receiver
|
||||||
|
-f the file to store the codes
|
||||||
|
|
||||||
|
and 1 2 3 4 5 6 is a list of codes to record.
|
||||||
|
|
||||||
|
To playback use
|
||||||
|
|
||||||
|
./irrp.py -p -g17 -fcodes 2 3 4
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
-p playback
|
||||||
|
-g the GPIO connected to the IR transmitter
|
||||||
|
-f the file storing the codes to transmit
|
||||||
|
|
||||||
|
and 2 3 4 is a list of codes to transmit.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
|
||||||
|
-r record
|
||||||
|
-p playback
|
||||||
|
-g GPIO (receiver for record, transmitter for playback)
|
||||||
|
-f file
|
||||||
|
|
||||||
|
id1 id2 id3 list of ids to record or transmit
|
||||||
|
|
||||||
|
RECORD
|
||||||
|
|
||||||
|
--glitch ignore edges shorter than glitch microseconds, default 100 us
|
||||||
|
--post expect post milliseconds of silence after code, default 15 ms
|
||||||
|
--pre expect pre milliseconds of silence before code, default 200 ms
|
||||||
|
--short reject codes with less than short pulses, default 10
|
||||||
|
--tolerance consider pulses the same if within tolerance percent, default 15
|
||||||
|
--no-confirm don't require a code to be repeated during record
|
||||||
|
|
||||||
|
TRANSMIT
|
||||||
|
|
||||||
|
--freq IR carrier frequency, default 38 kHz
|
||||||
|
--gap gap in milliseconds between transmitted codes, default 100 ms
|
||||||
|
"""
|
||||||
|
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
import pigpio # http://abyz.co.uk/rpi/pigpio/python.html
|
||||||
|
|
||||||
|
p = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
g = p.add_mutually_exclusive_group(required=True)
|
||||||
|
g.add_argument("-p", "--play", help="play keys", action="store_true")
|
||||||
|
g.add_argument("-r", "--record", help="record keys", action="store_true")
|
||||||
|
|
||||||
|
p.add_argument("-g", "--gpio", help="GPIO for RX/TX", required=True, type=int)
|
||||||
|
# p.add_argument("-f", "--file", help="Filename", required=True)
|
||||||
|
p.add_argument("--irdata", help="IR Data")
|
||||||
|
|
||||||
|
p.add_argument('id', nargs='+', type=str, help='IR codes')
|
||||||
|
|
||||||
|
p.add_argument("--freq", help="frequency kHz", type=float, default=38.0)
|
||||||
|
|
||||||
|
p.add_argument("--gap", help="key gap ms", type=int, default=100)
|
||||||
|
p.add_argument("--glitch", help="glitch us", type=int, default=100)
|
||||||
|
p.add_argument("--post", help="postamble ms", type=int, default=15)
|
||||||
|
p.add_argument("--pre", help="preamble ms", type=int, default=200)
|
||||||
|
p.add_argument("--short", help="short code length", type=int, default=10)
|
||||||
|
p.add_argument("--tolerance", help="tolerance percent", type=int, default=15)
|
||||||
|
|
||||||
|
p.add_argument("-v", "--verbose", help="Be verbose", action="store_true")
|
||||||
|
p.add_argument("--no-confirm", help="No confirm needed", action="store_true")
|
||||||
|
|
||||||
|
args = p.parse_args()
|
||||||
|
|
||||||
|
GPIO = args.gpio
|
||||||
|
# FILE = args.file
|
||||||
|
IRDATA = args.irdata
|
||||||
|
GLITCH = args.glitch
|
||||||
|
PRE_MS = args.pre
|
||||||
|
POST_MS = args.post
|
||||||
|
FREQ = args.freq
|
||||||
|
VERBOSE = args.verbose
|
||||||
|
SHORT = args.short
|
||||||
|
GAP_MS = args.gap
|
||||||
|
NO_CONFIRM = args.no_confirm
|
||||||
|
TOLERANCE = args.tolerance
|
||||||
|
|
||||||
|
POST_US = POST_MS * 1000
|
||||||
|
PRE_US = PRE_MS * 1000
|
||||||
|
GAP_S = GAP_MS / 1000.0
|
||||||
|
CONFIRM = not NO_CONFIRM
|
||||||
|
TOLER_MIN = (100 - TOLERANCE) / 100.0
|
||||||
|
TOLER_MAX = (100 + TOLERANCE) / 100.0
|
||||||
|
|
||||||
|
last_tick = 0
|
||||||
|
in_code = False
|
||||||
|
code = []
|
||||||
|
fetching_code = False
|
||||||
|
|
||||||
|
def backup(f):
|
||||||
|
"""
|
||||||
|
f -> f.bak -> f.bak1 -> f.bak2
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
os.rename(os.path.realpath(f)+".bak1", os.path.realpath(f)+".bak2")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.rename(os.path.realpath(f)+".bak", os.path.realpath(f)+".bak1")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.rename(os.path.realpath(f), os.path.realpath(f)+".bak")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def carrier(gpio, frequency, micros):
|
||||||
|
"""
|
||||||
|
Generate carrier square wave.
|
||||||
|
"""
|
||||||
|
wf = []
|
||||||
|
cycle = 1000.0 / frequency
|
||||||
|
cycles = int(round(micros/cycle))
|
||||||
|
on = int(round(cycle / 2.0))
|
||||||
|
sofar = 0
|
||||||
|
for c in range(cycles):
|
||||||
|
target = int(round((c+1)*cycle))
|
||||||
|
sofar += on
|
||||||
|
off = target - sofar
|
||||||
|
sofar += off
|
||||||
|
wf.append(pigpio.pulse(1<<gpio, 0, on))
|
||||||
|
wf.append(pigpio.pulse(0, 1<<gpio, off))
|
||||||
|
return wf
|
||||||
|
|
||||||
|
def normalise(c):
|
||||||
|
"""
|
||||||
|
Typically a code will be made up of two or three distinct
|
||||||
|
marks (carrier) and spaces (no carrier) of different lengths.
|
||||||
|
|
||||||
|
Because of transmission and reception errors those pulses
|
||||||
|
which should all be x micros long will have a variance around x.
|
||||||
|
|
||||||
|
This function identifies the distinct pulses and takes the
|
||||||
|
average of the lengths making up each distinct pulse. Marks
|
||||||
|
and spaces are processed separately.
|
||||||
|
|
||||||
|
This makes the eventual generation of waves much more efficient.
|
||||||
|
|
||||||
|
Input
|
||||||
|
|
||||||
|
M S M S M S M S M S M
|
||||||
|
9000 4500 600 540 620 560 590 1660 620 1690 615
|
||||||
|
|
||||||
|
Distinct marks
|
||||||
|
|
||||||
|
9000 average 9000
|
||||||
|
600 620 590 620 615 average 609
|
||||||
|
|
||||||
|
Distinct spaces
|
||||||
|
|
||||||
|
4500 average 4500
|
||||||
|
540 560 average 550
|
||||||
|
1660 1690 average 1675
|
||||||
|
|
||||||
|
Output
|
||||||
|
|
||||||
|
M S M S M S M S M S M
|
||||||
|
9000 4500 609 550 609 550 609 1675 609 1675 609
|
||||||
|
"""
|
||||||
|
if VERBOSE:
|
||||||
|
print("before normalise", c, flush=True)
|
||||||
|
entries = len(c)
|
||||||
|
p = [0]*entries # Set all entries not processed.
|
||||||
|
for i in range(entries):
|
||||||
|
if not p[i]: # Not processed?
|
||||||
|
v = c[i]
|
||||||
|
tot = v
|
||||||
|
similar = 1.0
|
||||||
|
|
||||||
|
# Find all pulses with similar lengths to the start pulse.
|
||||||
|
for j in range(i+2, entries, 2):
|
||||||
|
if not p[j]: # Unprocessed.
|
||||||
|
if (c[j]*TOLER_MIN) < v < (c[j]*TOLER_MAX): # Similar.
|
||||||
|
tot = tot + c[j]
|
||||||
|
similar += 1.0
|
||||||
|
|
||||||
|
# Calculate the average pulse length.
|
||||||
|
newv = round(tot / similar, 2)
|
||||||
|
c[i] = newv
|
||||||
|
|
||||||
|
# Set all similar pulses to the average value.
|
||||||
|
for j in range(i+2, entries, 2):
|
||||||
|
if not p[j]: # Unprocessed.
|
||||||
|
if (c[j]*TOLER_MIN) < v < (c[j]*TOLER_MAX): # Similar.
|
||||||
|
c[j] = newv
|
||||||
|
p[j] = 1
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("after normalise", c, flush=True)
|
||||||
|
|
||||||
|
def compare(p1, p2):
|
||||||
|
"""
|
||||||
|
Check that both recodings correspond in pulse length to within
|
||||||
|
TOLERANCE%. If they do average the two recordings pulse lengths.
|
||||||
|
|
||||||
|
Input
|
||||||
|
|
||||||
|
M S M S M S M S M S M
|
||||||
|
1: 9000 4500 600 560 600 560 600 1700 600 1700 600
|
||||||
|
2: 9020 4570 590 550 590 550 590 1640 590 1640 590
|
||||||
|
|
||||||
|
Output
|
||||||
|
|
||||||
|
A: 9010 4535 595 555 595 555 595 1670 595 1670 595
|
||||||
|
"""
|
||||||
|
if len(p1) != len(p2):
|
||||||
|
return False
|
||||||
|
|
||||||
|
for i in range(len(p1)):
|
||||||
|
v = p1[i] / p2[i]
|
||||||
|
if (v < TOLER_MIN) or (v > TOLER_MAX):
|
||||||
|
return False
|
||||||
|
|
||||||
|
for i in range(len(p1)):
|
||||||
|
p1[i] = int(round((p1[i]+p2[i])/2.0))
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("after compare", p1, flush=True)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
def tidy_mark_space(records, base):
|
||||||
|
|
||||||
|
ms = {}
|
||||||
|
|
||||||
|
# Find all the unique marks (base=0) or spaces (base=1)
|
||||||
|
# and count the number of times they appear,
|
||||||
|
|
||||||
|
for rec in records:
|
||||||
|
rl = len(records[rec])
|
||||||
|
for i in range(base, rl, 2):
|
||||||
|
if records[rec][i] in ms:
|
||||||
|
ms[records[rec][i]] += 1
|
||||||
|
else:
|
||||||
|
ms[records[rec][i]] = 1
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("t_m_s A", ms, flush=True)
|
||||||
|
|
||||||
|
v = None
|
||||||
|
|
||||||
|
for plen in sorted(ms):
|
||||||
|
|
||||||
|
# Now go through in order, shortest first, and collapse
|
||||||
|
# pulses which are the same within a tolerance to the
|
||||||
|
# same value. The value is the weighted average of the
|
||||||
|
# occurences.
|
||||||
|
#
|
||||||
|
# E.g. 500x20 550x30 600x30 1000x10 1100x10 1700x5 1750x5
|
||||||
|
#
|
||||||
|
# becomes 556(x80) 1050(x20) 1725(x10)
|
||||||
|
#
|
||||||
|
if v == None:
|
||||||
|
e = [plen]
|
||||||
|
v = plen
|
||||||
|
tot = plen * ms[plen]
|
||||||
|
similar = ms[plen]
|
||||||
|
|
||||||
|
elif plen < (v*TOLER_MAX):
|
||||||
|
e.append(plen)
|
||||||
|
tot += (plen * ms[plen])
|
||||||
|
similar += ms[plen]
|
||||||
|
|
||||||
|
else:
|
||||||
|
v = int(round(tot/float(similar)))
|
||||||
|
# set all previous to v
|
||||||
|
for i in e:
|
||||||
|
ms[i] = v
|
||||||
|
e = [plen]
|
||||||
|
v = plen
|
||||||
|
tot = plen * ms[plen]
|
||||||
|
similar = ms[plen]
|
||||||
|
|
||||||
|
v = int(round(tot/float(similar)))
|
||||||
|
# set all previous to v
|
||||||
|
for i in e:
|
||||||
|
ms[i] = v
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("t_m_s B", ms, flush=True)
|
||||||
|
|
||||||
|
for rec in records:
|
||||||
|
rl = len(records[rec])
|
||||||
|
for i in range(base, rl, 2):
|
||||||
|
records[rec][i] = ms[records[rec][i]]
|
||||||
|
|
||||||
|
def tidy(records):
|
||||||
|
|
||||||
|
tidy_mark_space(records, 0) # Marks.
|
||||||
|
|
||||||
|
tidy_mark_space(records, 1) # Spaces.
|
||||||
|
|
||||||
|
def end_of_code():
|
||||||
|
global code, fetching_code
|
||||||
|
if len(code) > SHORT:
|
||||||
|
normalise(code)
|
||||||
|
fetching_code = False
|
||||||
|
else:
|
||||||
|
code = []
|
||||||
|
print("Short code, probably a repeat, try again", flush=True)
|
||||||
|
|
||||||
|
def cbf(gpio, level, tick):
|
||||||
|
|
||||||
|
global last_tick, in_code, code, fetching_code
|
||||||
|
|
||||||
|
if level != pigpio.TIMEOUT:
|
||||||
|
|
||||||
|
edge = pigpio.tickDiff(last_tick, tick)
|
||||||
|
last_tick = tick
|
||||||
|
|
||||||
|
if fetching_code:
|
||||||
|
|
||||||
|
if (edge > PRE_US) and (not in_code): # Start of a code.
|
||||||
|
in_code = True
|
||||||
|
pi.set_watchdog(GPIO, POST_MS) # Start watchdog.
|
||||||
|
|
||||||
|
elif (edge > POST_US) and in_code: # End of a code.
|
||||||
|
in_code = False
|
||||||
|
pi.set_watchdog(GPIO, 0) # Cancel watchdog.
|
||||||
|
end_of_code()
|
||||||
|
|
||||||
|
elif in_code:
|
||||||
|
code.append(edge)
|
||||||
|
|
||||||
|
else:
|
||||||
|
pi.set_watchdog(GPIO, 0) # Cancel watchdog.
|
||||||
|
if in_code:
|
||||||
|
in_code = False
|
||||||
|
end_of_code()
|
||||||
|
|
||||||
|
pi = pigpio.pi() # Connect to Pi.
|
||||||
|
|
||||||
|
if not pi.connected:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if args.record: # Record.
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# f = open(FILE, "r")
|
||||||
|
# records = json.load(f)
|
||||||
|
# f.close()
|
||||||
|
# except:
|
||||||
|
# records = {}
|
||||||
|
records = {}
|
||||||
|
|
||||||
|
pi.set_mode(GPIO, pigpio.INPUT) # IR RX connected to this GPIO.
|
||||||
|
|
||||||
|
pi.set_glitch_filter(GPIO, GLITCH) # Ignore glitches.
|
||||||
|
|
||||||
|
cb = pi.callback(GPIO, pigpio.EITHER_EDGE, cbf)
|
||||||
|
|
||||||
|
# Process each id
|
||||||
|
|
||||||
|
print("読み取り開始:", flush=True)
|
||||||
|
for arg in args.id:
|
||||||
|
print("リモコンのボタンを押してください。", flush=True)
|
||||||
|
code = []
|
||||||
|
fetching_code = True
|
||||||
|
while fetching_code:
|
||||||
|
time.sleep(0.1)
|
||||||
|
print("OK", flush=True)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
if CONFIRM:
|
||||||
|
press_1 = code[:]
|
||||||
|
done = False
|
||||||
|
|
||||||
|
tries = 0
|
||||||
|
while not done:
|
||||||
|
print("確認のためもう一度同じボタンを押してください。", flush=True)
|
||||||
|
code = []
|
||||||
|
fetching_code = True
|
||||||
|
while fetching_code:
|
||||||
|
time.sleep(0.1)
|
||||||
|
press_2 = code[:]
|
||||||
|
the_same = compare(press_1, press_2)
|
||||||
|
if the_same:
|
||||||
|
done = True
|
||||||
|
records[arg] = press_1[:]
|
||||||
|
print("OK", flush=True)
|
||||||
|
time.sleep(0.5)
|
||||||
|
else:
|
||||||
|
tries += 1
|
||||||
|
if tries <= 3:
|
||||||
|
print("信号が一致しません。", flush=True)
|
||||||
|
else:
|
||||||
|
print("信号が一致しませんでした。終了します。", flush=True)
|
||||||
|
done = True
|
||||||
|
time.sleep(0.5)
|
||||||
|
else: # No confirm.
|
||||||
|
records[arg] = code[:]
|
||||||
|
|
||||||
|
pi.set_glitch_filter(GPIO, 0) # Cancel glitch filter.
|
||||||
|
pi.set_watchdog(GPIO, 0) # Cancel watchdog.
|
||||||
|
|
||||||
|
tidy(records)
|
||||||
|
|
||||||
|
# backup(FILE)
|
||||||
|
|
||||||
|
# f = open(FILE, "w")
|
||||||
|
# f.write(json.dumps(records, sort_keys=True).replace("],", "],\n")+"\n")
|
||||||
|
# f.close()
|
||||||
|
|
||||||
|
# print('\n', flush=True)
|
||||||
|
print(json.dumps(records), flush=True)
|
||||||
|
|
||||||
|
else: # Playback.
|
||||||
|
|
||||||
|
# try:
|
||||||
|
# f = open(FILE, "r")
|
||||||
|
# except:
|
||||||
|
# print("Can't open: {}".format(FILE))
|
||||||
|
# exit(0)
|
||||||
|
|
||||||
|
# print(FILE, flush=True)
|
||||||
|
records = json.loads(IRDATA)
|
||||||
|
# records = json.loads(FILE)
|
||||||
|
# print(records, flush=True)
|
||||||
|
|
||||||
|
# f.close()
|
||||||
|
|
||||||
|
pi.set_mode(GPIO, pigpio.OUTPUT) # IR TX connected to this GPIO.
|
||||||
|
|
||||||
|
pi.wave_add_new()
|
||||||
|
|
||||||
|
emit_time = time.time()
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("送信中", flush=True)
|
||||||
|
|
||||||
|
for arg in args.id:
|
||||||
|
if arg in records:
|
||||||
|
|
||||||
|
code = records[arg]
|
||||||
|
|
||||||
|
# Create wave
|
||||||
|
|
||||||
|
marks_wid = {}
|
||||||
|
spaces_wid = {}
|
||||||
|
|
||||||
|
wave = [0]*len(code)
|
||||||
|
|
||||||
|
for i in range(0, len(code)):
|
||||||
|
ci = code[i]
|
||||||
|
if i & 1: # Space
|
||||||
|
if ci not in spaces_wid:
|
||||||
|
pi.wave_add_generic([pigpio.pulse(0, 0, ci)])
|
||||||
|
spaces_wid[ci] = pi.wave_create()
|
||||||
|
wave[i] = spaces_wid[ci]
|
||||||
|
else: # Mark
|
||||||
|
if ci not in marks_wid:
|
||||||
|
wf = carrier(GPIO, FREQ, ci)
|
||||||
|
pi.wave_add_generic(wf)
|
||||||
|
marks_wid[ci] = pi.wave_create()
|
||||||
|
wave[i] = marks_wid[ci]
|
||||||
|
|
||||||
|
delay = emit_time - time.time()
|
||||||
|
|
||||||
|
if delay > 0.0:
|
||||||
|
time.sleep(delay)
|
||||||
|
|
||||||
|
pi.wave_chain(wave)
|
||||||
|
|
||||||
|
if VERBOSE:
|
||||||
|
print("key " + arg, flush=True)
|
||||||
|
|
||||||
|
while pi.wave_tx_busy():
|
||||||
|
time.sleep(0.002)
|
||||||
|
|
||||||
|
emit_time = time.time() + GAP_S
|
||||||
|
|
||||||
|
for i in marks_wid:
|
||||||
|
pi.wave_delete(marks_wid[i])
|
||||||
|
|
||||||
|
marks_wid = {}
|
||||||
|
|
||||||
|
for i in spaces_wid:
|
||||||
|
pi.wave_delete(spaces_wid[i])
|
||||||
|
|
||||||
|
spaces_wid = {}
|
||||||
|
|
||||||
|
print("Id: {}".format(arg), flush=True)
|
||||||
|
else:
|
||||||
|
print("Id {} not found".format(arg), flush=True)
|
||||||
|
|
||||||
|
pi.stop() # Disconnect from Pi.
|
||||||
|
|
451
scripts/ja.js
Normal file
@ -0,0 +1,451 @@
|
|||||||
|
// This file was automatically generated. Do not modify.
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
goog.provide('Blockly.Msg.ja');
|
||||||
|
|
||||||
|
goog.require('Blockly.Msg');
|
||||||
|
|
||||||
|
Blockly.Msg["ADD_COMMENT"] = "コメントを追加";
|
||||||
|
Blockly.Msg["CANNOT_DELETE_VARIABLE_PROCEDURE"] = "変数 '%1' は関数 '%2' の定義の一部であるため、削除できません";
|
||||||
|
Blockly.Msg["CHANGE_VALUE_TITLE"] = "値を変える:";
|
||||||
|
Blockly.Msg["CLEAN_UP"] = "ブロックを整理する";
|
||||||
|
Blockly.Msg["COLLAPSED_WARNINGS_WARNING"] = "Collapsed blocks contain warnings."; // untranslated
|
||||||
|
Blockly.Msg["COLLAPSE_ALL"] = "ブロックを折りたたむ";
|
||||||
|
Blockly.Msg["COLLAPSE_BLOCK"] = "ブロックを折りたたむ";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_COLOUR1"] = "色 1";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_COLOUR2"] = "色 2";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_HELPURL"] = "http://meyerweb.com/eric/tools/color-blend/";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_RATIO"] = "比率";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_TITLE"] = "ブレンド";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_TOOLTIP"] = "2色を与えられた比率(0.0~1.0)で混ぜます。";
|
||||||
|
Blockly.Msg["COLOUR_PICKER_HELPURL"] = "https://ja.wikipedia.org/wiki/色";
|
||||||
|
Blockly.Msg["COLOUR_PICKER_TOOLTIP"] = "パレットから色を選んでください。";
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_HELPURL"] = "http://randomcolour.com"; // untranslated
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_TITLE"] = "ランダムな色";
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_TOOLTIP"] = "ランダムな色を選ぶ。";
|
||||||
|
Blockly.Msg["COLOUR_RGB_BLUE"] = "青";
|
||||||
|
Blockly.Msg["COLOUR_RGB_GREEN"] = "緑";
|
||||||
|
Blockly.Msg["COLOUR_RGB_HELPURL"] = "http://www.december.com/html/spec/colorper.html";
|
||||||
|
Blockly.Msg["COLOUR_RGB_RED"] = "赤";
|
||||||
|
Blockly.Msg["COLOUR_RGB_TITLE"] = "色:";
|
||||||
|
Blockly.Msg["COLOUR_RGB_TOOLTIP"] = "赤、緑、および青の指定された量で色を作成します。すべての値は 0 ~ 100 の間でなければなりません。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK"] = "ループから抜け出す";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE"] = "ループの次の反復処理を続行します";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK"] = "入っているループから抜け出します。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE"] = "このループの残りの部分をスキップして、ループの繰り返しを続けます。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_WARNING"] = "注意: このブロックは、ループ内でのみ使用できます。";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#for-each"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_TITLE"] = "リスト%2の各項目%1について";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_TOOLTIP"] = "リストの各項目について、その項目を変数'%1'として、いくつかのステートメントを実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_FOR_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#count-with"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FOR_TITLE"] = "%1 を %2 から %3 まで %4 ずつカウントする";
|
||||||
|
Blockly.Msg["CONTROLS_FOR_TOOLTIP"] = "変数 '%1' が開始番号から終了番号まで指定した間隔での値をとって、指定したブロックを実行する。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSEIF_TOOLTIP"] = "「もしも」のブロックに条件を追加します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSE_TOOLTIP"] = "Ifブロックに、すべてをキャッチする条件を追加。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_HELPURL"] = "https://github.com/google/blockly/wiki/IfElse"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_IF_IF_TOOLTIP"] = "追加、削除、またはセクションを順序変更して、ブロックをこれを再構成します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_ELSE"] = "そうでなければ";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_ELSEIF"] = "そうでなくもし";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_IF"] = "もし";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_1"] = "値が true の場合、ステートメントを実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_2"] = "値が true 場合は、ステートメントの最初のブロックを行います。それ以外の場合は、ステートメントの 2 番目のブロックを行います。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_3"] = "最初の値が true 場合は、ステートメントの最初のブロックを行います。それ以外の場合は、2 番目の値が true の場合、ステートメントの 2 番目のブロックをします。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_4"] = "最初の値が true 場合は、ステートメントの最初のブロックを行います。2 番目の値が true の場合は、ステートメントの 2 番目のブロックを行います。それ以外の場合は最後のブロックのステートメントを行います。";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_HELPURL"] = "https://ja.wikipedia.org/wiki/for文";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"] = "実行";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_TITLE"] = "%1 回繰り返す";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_TOOLTIP"] = "いくつかのステートメントを数回実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#repeat"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_OPERATOR_UNTIL"] = "繰り返す:終わる条件";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_OPERATOR_WHILE"] = "繰り返す:続ける条件";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL"] = "値がfalseの間、いくつかのステートメントを実行する。";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_TOOLTIP_WHILE"] = "値がtrueの間、いくつかのステートメントを実行する。";
|
||||||
|
Blockly.Msg["DELETE_ALL_BLOCKS"] = "%1件のすべてのブロックを削除しますか?";
|
||||||
|
Blockly.Msg["DELETE_BLOCK"] = "ブロックを削除";
|
||||||
|
Blockly.Msg["DELETE_VARIABLE"] = "変数 '%1' を削除";
|
||||||
|
Blockly.Msg["DELETE_VARIABLE_CONFIRMATION"] = "%1か所で使われている変数 '%2' を削除しますか?";
|
||||||
|
Blockly.Msg["DELETE_X_BLOCKS"] = "%1 個のブロックを削除";
|
||||||
|
Blockly.Msg["DISABLE_BLOCK"] = "ブロックを無効にする";
|
||||||
|
Blockly.Msg["DUPLICATE_BLOCK"] = "複製";
|
||||||
|
Blockly.Msg["DUPLICATE_COMMENT"] = "コメントを複製";
|
||||||
|
Blockly.Msg["ENABLE_BLOCK"] = "ブロックを有効にする";
|
||||||
|
Blockly.Msg["EXPAND_ALL"] = "ブロックを展開する";
|
||||||
|
Blockly.Msg["EXPAND_BLOCK"] = "ブロックを展開する";
|
||||||
|
Blockly.Msg["EXTERNAL_INPUTS"] = "外部入力";
|
||||||
|
Blockly.Msg["FUNCTIONS_CALL_TITLE"] = "call"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_DEFAULT_BOOLEAN_ARG_NAME"] = "bool"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_DEFAULT_CUSTOM_ARG_NAME"] = "arg"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_DEFAULT_FUNCTION_NAME"] = "do_something"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_DEFAULT_NUMBER_ARG_NAME"] = "num"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_DEFAULT_STRING_ARG_NAME"] = "text"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTIONS_EDIT_OPTION"] = "Edit"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTION_CALL_TOOLTIP"] = "Call a function that was previously defined."; // untranslated
|
||||||
|
Blockly.Msg["FUNCTION_CREATE_NEW"] = "Create a Function"; // untranslated
|
||||||
|
Blockly.Msg["FUNCTION_WARNING_ARG_NAME_IS_FUNCTION_NAME"] = "Argument names must not be the same as the function name."; // untranslated
|
||||||
|
Blockly.Msg["FUNCTION_WARNING_DUPLICATE_ARG"] = "Functions cannot use the same argument name more than once."; // untranslated
|
||||||
|
Blockly.Msg["FUNCTION_WARNING_EMPTY_NAME"] = "Function and argument names cannot be empty."; // untranslated
|
||||||
|
Blockly.Msg["HELP"] = "ヘルプ";
|
||||||
|
Blockly.Msg["INLINE_INPUTS"] = "インライン入力";
|
||||||
|
Blockly.Msg["IOS_CANCEL"] = "キャンセル";
|
||||||
|
Blockly.Msg["IOS_ERROR"] = "エラー";
|
||||||
|
Blockly.Msg["IOS_OK"] = "OK";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_ADD_INPUT"] = "+ 入力を追加";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_ALLOW_STATEMENTS"] = "ステートメントを許可";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR"] = "この関数には重複する入力があります。";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_INPUTS"] = "入力";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_ADD_BUTTON"] = "追加";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_ADD_VARIABLE"] = "+ 変数を追加";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_DELETE_BUTTON"] = "削除";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_EMPTY_NAME_ERROR"] = "空の変数名は使用できません。";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_RENAME_BUTTON"] = "名前を変更";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_VARIABLE_NAME"] = "変数名";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-empty-list";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_TITLE"] = "空のリストを作成";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_TOOLTIP"] = "長さ0でデータ・レコードを含まない空のリストを返す";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_CONTAINER_TITLE_ADD"] = "リスト";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_CONTAINER_TOOLTIP"] = "追加、削除、またはセクションの順序変更をして、このリスト・ブロックを再構成する。";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-list-with"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_INPUT_WITH"] = "以下を使ってリストを作成:";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_ITEM_TOOLTIP"] = "リストに項目を追加。";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_TOOLTIP"] = "項目数が不定のリストを作成。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FIRST"] = "最初";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FROM_END"] = "位置:後ろから";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FROM_START"] = "#";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_GET"] = "取得";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_GET_REMOVE"] = "取得して削除";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_LAST"] = "最後";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_RANDOM"] = "ランダム";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_REMOVE"] = "削除";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TAIL"] = "";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_FIRST"] = "リストの最初の項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_FROM"] = "リスト内の指定位置にある項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_LAST"] = "リストの最後の項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_RANDOM"] = "ランダム アイテム リストを返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST"] = "リスト内の最初の項目を削除し返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM"] = "リスト内の指定位置にある項目を削除し、返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST"] = "リスト内の最後の項目を削除したあと返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM"] = "リストのランダムなアイテムを削除し返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST"] = "リスト内の最初の項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM"] = "リスト内の指定された項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST"] = "リスト内の最後の項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM"] = "リスト内にあるアイテムをランダムに削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_FROM_END"] = "終了位置:後ろから";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_FROM_START"] = "終了位置:";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_LAST"] = "最後まで";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-a-sublist"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FIRST"] = "最初からサブリストを取得する。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FROM_END"] = "端から #のサブリストを取得します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FROM_START"] = "# からサブディレクトリのリストを取得します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_TAIL"] = "";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_TOOLTIP"] = "リストの指定された部分のコピーを作成してくださ。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_FROM_END_TOOLTIP"] = "%1 は、最後の項目です。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_FROM_START_TOOLTIP"] = "%1 は、最初の項目です。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_FIRST"] = "で以下のアイテムの最初の出現箇所を検索:";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_LAST"] = "で以下のテキストの最後の出現箇所を検索:";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_TOOLTIP"] = "リスト項目の最初/最後に出現するインデックス位置を返します。項目が見つからない場合は %1 を返します。";
|
||||||
|
Blockly.Msg["LISTS_INLIST"] = "リスト";
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#is-empty"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_TITLE"] = "%1が空";
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_TOOLTIP"] = "リストが空の場合は、true を返します。";
|
||||||
|
Blockly.Msg["LISTS_LENGTH_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#length-of"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_LENGTH_TITLE"] = "%1の長さ";
|
||||||
|
Blockly.Msg["LISTS_LENGTH_TOOLTIP"] = "リストの長さを返します。";
|
||||||
|
Blockly.Msg["LISTS_REPEAT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-list-with"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_REPEAT_TITLE"] = "項目%1を%2回繰り返したリストを作成";
|
||||||
|
Blockly.Msg["LISTS_REPEAT_TOOLTIP"] = "与えられた値を指定された回数繰り返してリストを作成。";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#reversing-a-list";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_MESSAGE0"] = "%1を逆順に";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_TOOLTIP"] = "リストのコピーを逆順にする。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#in-list--set"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INPUT_TO"] = "値:";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INSERT"] = "挿入位置:";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_SET"] = "セット";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST"] = "リストの先頭に項目を挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_FROM"] = "リスト内の指定位置に項目を挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_LAST"] = "リストの末尾に項目を追加します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM"] = "リストに項目をランダムに挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_FIRST"] = "リスト内に最初の項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_FROM"] = "リスト内の指定された位置に項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_LAST"] = "リスト内の最後の項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_RANDOM"] = "リスト内にランダムなアイテムを設定します。";
|
||||||
|
Blockly.Msg["LISTS_SORT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#sorting-a-list";
|
||||||
|
Blockly.Msg["LISTS_SORT_ORDER_ASCENDING"] = "昇順";
|
||||||
|
Blockly.Msg["LISTS_SORT_ORDER_DESCENDING"] = "降順";
|
||||||
|
Blockly.Msg["LISTS_SORT_TITLE"] = "%1 ( %2 ) に %3 を並び替える";
|
||||||
|
Blockly.Msg["LISTS_SORT_TOOLTIP"] = "リストのコピーを並べ替え";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_IGNORECASE"] = "アルファベット順(大文字・小文字の区別無し)";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_NUMERIC"] = "数値順";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_TEXT"] = "アルファベット順";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_SPLIT_LIST_FROM_TEXT"] = "テキストからリストを作る";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TEXT_FROM_LIST"] = "リストからテキストを作る";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TOOLTIP_JOIN"] = "テキストのリストを区切り記号で区切られた一つのテキストにする";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TOOLTIP_SPLIT"] = "テキストを区切り記号で分割したリストにする";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_WITH_DELIMITER"] = "区切り記号";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_FALSE"] = "false";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_HELPURL"] = "https://github.com/google/blockly/wiki/Logic#values"; // untranslated
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_TOOLTIP"] = "true または false を返します。";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_TRUE"] = "true";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_HELPURL"] = "https://ja.wikipedia.org/wiki/不等式";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_EQ"] = "両方の入力が互いに等しい場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_GT"] = "最初の入力が 2 番目の入力よりも大きい場合は true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_GTE"] = "最初の入力が 2 番目の入力以上の場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_LT"] = "最初の入力が 2 番目の入力よりも小さい場合は true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_LTE"] = "最初の入力が 2 番目の入力以下の場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_NEQ"] = "両方の入力が互いに等しくない場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_HELPURL"] = "https://ja.wikipedia.org/wiki/否定";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_TITLE"] = "%1ではない";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_TOOLTIP"] = "入力が false の場合は、true を返します。入力が true の場合は false を返します。";
|
||||||
|
Blockly.Msg["LOGIC_NULL"] = "null";
|
||||||
|
Blockly.Msg["LOGIC_NULL_HELPURL"] = "https://en.wikipedia.org/wiki/Nullable_type";
|
||||||
|
Blockly.Msg["LOGIC_NULL_TOOLTIP"] = "null を返します。";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_AND"] = "かつ";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_HELPURL"] = "https://github.com/google/blockly/wiki/Logic#logical-operations"; // untranslated
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_OR"] = "または";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_TOOLTIP_AND"] = "両方の入力が true のときに true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_TOOLTIP_OR"] = "少なくとも 1 つの入力が true のときに true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_CONDITION"] = "テスト";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_HELPURL"] = "https://ja.wikipedia.org/wiki/%3F:";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_IF_FALSE"] = "false の場合";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_IF_TRUE"] = "true の場合";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_TOOLTIP"] = "'テスト' の条件をチェックします。条件が true の場合、'true' の値を返します。それ以外の場合 'false' のを返します。";
|
||||||
|
Blockly.Msg["MATH_ADDITION_SYMBOL"] = "+";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_HELPURL"] = "https://ja.wikipedia.org/wiki/算術";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_ADD"] = "2 つの数の合計を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_DIVIDE"] = "2 つの数の商を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MINUS"] = "2 つの数の差を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MULTIPLY"] = "2 つの数の積を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_POWER"] = "最初の数を2 番目の値で累乗した結果を返します。";
|
||||||
|
Blockly.Msg["MATH_ATAN2_HELPURL"] = "https://en.wikipedia.org/wiki/Atan2"; // untranslated
|
||||||
|
Blockly.Msg["MATH_ATAN2_TITLE"] = "atan2 of X:%1 Y:%2"; // untranslated
|
||||||
|
Blockly.Msg["MATH_ATAN2_TOOLTIP"] = "Return the arctangent of point (X, Y) in degrees from -180 to 180."; // untranslated
|
||||||
|
Blockly.Msg["MATH_CHANGE_HELPURL"] = "https://ja.wikipedia.org/wiki/加法";
|
||||||
|
Blockly.Msg["MATH_CHANGE_TITLE"] = "%1 を %2 増やす";
|
||||||
|
Blockly.Msg["MATH_CHANGE_TOOLTIP"] = "変数'%1'に数をたす。";
|
||||||
|
Blockly.Msg["MATH_CONSTANT_HELPURL"] = "https://ja.wikipedia.org/wiki/数学定数";
|
||||||
|
Blockly.Msg["MATH_CONSTANT_TOOLTIP"] = "いずれかの共通の定数のを返す: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (無限).";
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_HELPURL"] = "https://en.wikipedia.org/wiki/Clamping_(graphics)"; // untranslated
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_TITLE"] = "%1 を %2 以上 %3 以下の範囲に制限";
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_TOOLTIP"] = "指定した上限と下限の間に値を制限する(上限と下限の値を含む)。";
|
||||||
|
Blockly.Msg["MATH_DIVISION_SYMBOL"] = "÷";
|
||||||
|
Blockly.Msg["MATH_IS_DIVISIBLE_BY"] = "は以下で割りきれる:";
|
||||||
|
Blockly.Msg["MATH_IS_EVEN"] = "は偶数";
|
||||||
|
Blockly.Msg["MATH_IS_NEGATIVE"] = "は負";
|
||||||
|
Blockly.Msg["MATH_IS_ODD"] = "は奇数";
|
||||||
|
Blockly.Msg["MATH_IS_POSITIVE"] = "は正";
|
||||||
|
Blockly.Msg["MATH_IS_PRIME"] = "は素数";
|
||||||
|
Blockly.Msg["MATH_IS_TOOLTIP"] = "数字が、偶数、奇数、素数、整数、正数、負数、または特定の数で割り切れるかどうかを判定し、true か false を返します。";
|
||||||
|
Blockly.Msg["MATH_IS_WHOLE"] = "は整数";
|
||||||
|
Blockly.Msg["MATH_MODULO_HELPURL"] = "https://en.wikipedia.org/wiki/Modulo_operation";
|
||||||
|
Blockly.Msg["MATH_MODULO_TITLE"] = "%1÷%2の余り";
|
||||||
|
Blockly.Msg["MATH_MODULO_TOOLTIP"] = "2つの数値の割り算の余りを返す。";
|
||||||
|
Blockly.Msg["MATH_MULTIPLICATION_SYMBOL"] = "×";
|
||||||
|
Blockly.Msg["MATH_NUMBER_HELPURL"] = "https://ja.wikipedia.org/wiki/数";
|
||||||
|
Blockly.Msg["MATH_NUMBER_TOOLTIP"] = "数です。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_HELPURL"] = ""; // untranslated
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_AVERAGE"] = "リストの平均";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MAX"] = "リストの最大値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MEDIAN"] = "リストの中央値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MIN"] = "リストの最小値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MODE"] = "リストの最頻値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_RANDOM"] = "リストからランダムに選ばれた項目";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_STD_DEV"] = "リストの標準偏差";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_SUM"] = "リストの合計";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_AVERAGE"] = "リストの数値の平均 (算術平均) を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MAX"] = "リストの最大値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MEDIAN"] = "リストの中央値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MIN"] = "リストの最小値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MODE"] = "リスト中の最頻項目のリストを返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_RANDOM"] = "リストからランダムに選ばれた要素を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_STD_DEV"] = "リストの標準偏差を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_SUM"] = "リストの数値を足して返す。";
|
||||||
|
Blockly.Msg["MATH_POWER_SYMBOL"] = "^";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_TITLE_RANDOM"] = "1未満の正の乱数";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_TOOLTIP"] = "0.0以上で1.0未満の範囲の乱数を返します。";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_TITLE"] = "%1から%2までのランダムな整数";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_TOOLTIP"] = "指定された(上下限を含む)範囲のランダムな整数を返します。";
|
||||||
|
Blockly.Msg["MATH_ROUND_HELPURL"] = "https://ja.wikipedia.org/wiki/端数処理";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUND"] = "四捨五入";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUNDDOWN"] = "切り捨て";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUNDUP"] = "切り上げ";
|
||||||
|
Blockly.Msg["MATH_ROUND_TOOLTIP"] = "数値を切り上げるか切り捨てる";
|
||||||
|
Blockly.Msg["MATH_SINGLE_HELPURL"] = "https://ja.wikipedia.org/wiki/平方根";
|
||||||
|
Blockly.Msg["MATH_SINGLE_OP_ABSOLUTE"] = "絶対値";
|
||||||
|
Blockly.Msg["MATH_SINGLE_OP_ROOT"] = "平方根";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_ABS"] = "絶対値を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_EXP"] = "ネイピア数eの数値乗を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_LN"] = "数値の自然対数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_LOG10"] = "底が10の対数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_NEG"] = "負の数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_POW10"] = "10の数値乗を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_ROOT"] = "平方根を返す。";
|
||||||
|
Blockly.Msg["MATH_SUBTRACTION_SYMBOL"] = "-";
|
||||||
|
Blockly.Msg["MATH_TRIG_ACOS"] = "acos";
|
||||||
|
Blockly.Msg["MATH_TRIG_ASIN"] = "asin";
|
||||||
|
Blockly.Msg["MATH_TRIG_ATAN"] = "atan";
|
||||||
|
Blockly.Msg["MATH_TRIG_COS"] = "cos";
|
||||||
|
Blockly.Msg["MATH_TRIG_HELPURL"] = "https://ja.wikipedia.org/wiki/三角関数";
|
||||||
|
Blockly.Msg["MATH_TRIG_SIN"] = "sin";
|
||||||
|
Blockly.Msg["MATH_TRIG_TAN"] = "tan";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ACOS"] = "アークコサイン(arccosin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ASIN"] = "アークサイン(arcsin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ATAN"] = "アークタンジェント(arctan)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_COS"] = "(ラジアンではなく)度数の余弦(cosin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_SIN"] = "(ラジアンではなく)度数の正弦(sin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_TAN"] = "(ラジアンではなく)度数の正接(tan)を返す。";
|
||||||
|
Blockly.Msg["NEW_COLOUR_VARIABLE"] = "色の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_NUMBER_VARIABLE"] = "数の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_STRING_VARIABLE"] = "文字列の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_VARIABLE"] = "変数の作成…";
|
||||||
|
Blockly.Msg["NEW_VARIABLE_DROPDOWN"] = "New variable..."; // untranslated
|
||||||
|
Blockly.Msg["NEW_VARIABLE_TITLE"] = "新しい変数の名前:";
|
||||||
|
Blockly.Msg["NEW_VARIABLE_TYPE_TITLE"] = "新しい変数の型:";
|
||||||
|
Blockly.Msg["ORDINAL_NUMBER_SUFFIX"] = ""; // untranslated
|
||||||
|
Blockly.Msg["PROCEDURES_ALLOW_STATEMENTS"] = "ステートメントを許可";
|
||||||
|
Blockly.Msg["PROCEDURES_BEFORE_PARAMS"] = "引数:";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLNORETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLNORETURN_TOOLTIP"] = "ユーザー定義関数 '%1' を実行します。";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLRETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLRETURN_TOOLTIP"] = "ユーザー定義関数 '%1' を実行し、その出力を使用します。";
|
||||||
|
Blockly.Msg["PROCEDURES_CALL_BEFORE_PARAMS"] = "引数:";
|
||||||
|
Blockly.Msg["PROCEDURES_CREATE_DO"] = "'%1' を作成";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_COMMENT"] = "この関数の説明…";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_DO"] = "";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_PROCEDURE"] = "何かする";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_TITLE"] = "関数";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_TOOLTIP"] = "出力なしの関数を作成します。";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_RETURN"] = "返す";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_TOOLTIP"] = "一つの出力を持つ関数を作成します。";
|
||||||
|
Blockly.Msg["PROCEDURES_DEF_DUPLICATE_WARNING"] = "警告: この関数には重複するパラメーターがあります。";
|
||||||
|
Blockly.Msg["PROCEDURES_HIGHLIGHT_DEF"] = "関数の内容を強調表示します。";
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_HELPURL"] = "http://c2.com/cgi/wiki?GuardClause"; // untranslated
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_TOOLTIP"] = "1番目の値が true の場合、2番目の値を返します。";
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_WARNING"] = "警告: このブロックは、関数定義内でのみ使用できます。";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORARG_TITLE"] = "入力名:";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORARG_TOOLTIP"] = "関数への入力の追加。";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORCONTAINER_TITLE"] = "入力";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORCONTAINER_TOOLTIP"] = "この関数への入力の追加、削除、順番変更。";
|
||||||
|
Blockly.Msg["REDO"] = "やり直す";
|
||||||
|
Blockly.Msg["REMOVE_COMMENT"] = "コメントを削除";
|
||||||
|
Blockly.Msg["RENAME_VARIABLE"] = "変数の名前を変える…";
|
||||||
|
Blockly.Msg["RENAME_VARIABLE_TITLE"] = "選択した%1の変数すべての名前を変える:";
|
||||||
|
Blockly.Msg["TEXT_APPEND_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-modification"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_APPEND_TITLE"] = "項目 %1 へテキストを追加 %2";
|
||||||
|
Blockly.Msg["TEXT_APPEND_TOOLTIP"] = "変数 '%1' にテキストを追加。";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#adjusting-text-case"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_LOWERCASE"] = "小文字に";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_TITLECASE"] = "タイトル ケースに";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_UPPERCASE"] = "大文字に";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_TOOLTIP"] = "別のケースに、テキストのコピーを返します。";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FIRST"] = "最初の文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FROM_END"] = "の、後ろから以下の数字番目の文字:";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FROM_START"] = "の、以下の数字番目の文字:";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_CHARAT_LAST"] = "最後の文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_RANDOM"] = "ランダムな文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TAIL"] = "";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TITLE"] = "テキスト %1 %2";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TOOLTIP"] = "指定された位置に文字を返します。";
|
||||||
|
Blockly.Msg["TEXT_COUNT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#counting-substrings";
|
||||||
|
Blockly.Msg["TEXT_COUNT_MESSAGE0"] = "%2に含まれる%1の数を数える";
|
||||||
|
Blockly.Msg["TEXT_COUNT_TOOLTIP"] = "とある文が別の文のなかに使われた回数を数える。";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_ITEM_TOOLTIP"] = "テキストへ項目を追加。";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_TITLE_JOIN"] = "結合";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_TOOLTIP"] = "セクションを追加、削除、または順序変更して、ブロックを再構成。";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_END"] = "終了位置:後ろから";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_START"] = "終了位置:";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_LAST"] = "最後のの文字";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_INPUT_IN_TEXT"] = "テキスト";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FIRST"] = "の部分文字列を取得;最初から";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FROM_END"] = "の部分文字列を取得;開始位置:後ろから";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FROM_START"] = "の部分文字列を取得;開始位置:";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_TAIL"] = "";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_TOOLTIP"] = "テキストの指定部分を返します。";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_HELPURL"] = "https://github.com/google/blockly/wiki/Text#finding-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_OPERATOR_FIRST"] = "で以下のテキストの最初の出現箇所を検索:";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_OPERATOR_LAST"] = "で以下のテキストの最後の出現箇所を検索:";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_TITLE"] = "テキスト %1 %2 %3";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_TOOLTIP"] = "二番目のテキストの中で一番目のテキストが最初/最後に出現したインデックスを返す。テキストが見つからない場合は%1を返す。";
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Text#checking-for-empty-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_TITLE"] = "%1が空";
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_TOOLTIP"] = "与えられたテキストが空の場合は true を返す。";
|
||||||
|
Blockly.Msg["TEXT_JOIN_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-creation"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_JOIN_TITLE_CREATEWITH"] = "テキストの作成:";
|
||||||
|
Blockly.Msg["TEXT_JOIN_TOOLTIP"] = "任意の数の項目一部を一緒に接合してテキストを作成。";
|
||||||
|
Blockly.Msg["TEXT_LENGTH_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-modification"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_LENGTH_TITLE"] = "%1の長さ";
|
||||||
|
Blockly.Msg["TEXT_LENGTH_TOOLTIP"] = "与えられたテキストの(スペースを含む)文字数を返す。";
|
||||||
|
Blockly.Msg["TEXT_PRINT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#printing-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_PRINT_TITLE"] = "%1 を表示";
|
||||||
|
Blockly.Msg["TEXT_PRINT_TOOLTIP"] = "指定したテキスト、番号または他の値を印刷します。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TOOLTIP_NUMBER"] = "ユーザーに数値のインプットを求める。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TOOLTIP_TEXT"] = "ユーザーにテキスト入力を求める。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TYPE_NUMBER"] = "メッセージで番号の入力を求める";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TYPE_TEXT"] = "メッセージでテキスト入力を求める";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#replacing-substrings";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_MESSAGE0"] = "%3に含まれる%1を%2に置換";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_TOOLTIP"] = "文に含まれるキーワードを置換する。";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#reversing-text";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_MESSAGE0"] = "%1を逆順に";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_TOOLTIP"] = "文の文字を逆順にする。";
|
||||||
|
Blockly.Msg["TEXT_TEXT_HELPURL"] = "https://ja.wikipedia.org/wiki/文字列";
|
||||||
|
Blockly.Msg["TEXT_TEXT_TOOLTIP"] = "文字、単語、または行のテキスト。";
|
||||||
|
Blockly.Msg["TEXT_TRIM_HELPURL"] = "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_BOTH"] = "両端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_LEFT"] = "左端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_RIGHT"] = "右端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_TOOLTIP"] = "スペースを 1 つまたは両方の端から削除したのち、テキストのコピーを返します。";
|
||||||
|
Blockly.Msg["TODAY"] = "今日";
|
||||||
|
Blockly.Msg["UNDO"] = "取り消す";
|
||||||
|
Blockly.Msg["UNNAMED_KEY"] = "unnamed"; // untranslated
|
||||||
|
Blockly.Msg["VARIABLES_DEFAULT_NAME"] = "項目";
|
||||||
|
Blockly.Msg["VARIABLES_GET_CREATE_SET"] = "'セット%1を作成します。";
|
||||||
|
Blockly.Msg["VARIABLES_GET_HELPURL"] = "https://github.com/google/blockly/wiki/Variables#get"; // untranslated
|
||||||
|
Blockly.Msg["VARIABLES_GET_TOOLTIP"] = "この変数の値を返します。";
|
||||||
|
Blockly.Msg["VARIABLES_SET"] = "%1 に %2 をセット";
|
||||||
|
Blockly.Msg["VARIABLES_SET_CREATE_GET"] = "'%1 を取得' を作成します。";
|
||||||
|
Blockly.Msg["VARIABLES_SET_HELPURL"] = "https://github.com/google/blockly/wiki/Variables#set"; // untranslated
|
||||||
|
Blockly.Msg["VARIABLES_SET_TOOLTIP"] = "この入力を変数と等しくなるように設定します。";
|
||||||
|
Blockly.Msg["VARIABLE_ALREADY_EXISTS"] = "変数名 '%1' は既に存在しています。";
|
||||||
|
Blockly.Msg["VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE"] = "'%2' 型の '%1' という名前の変数が既に存在します。";
|
||||||
|
Blockly.Msg["WORKSPACE_COMMENT_DEFAULT_TEXT"] = "ここへ入力";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_FOR_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSEIF_TITLE_ELSEIF"] = Blockly.Msg["CONTROLS_IF_MSG_ELSEIF"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSE_TITLE_ELSE"] = Blockly.Msg["CONTROLS_IF_MSG_ELSE"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_IF_TITLE_IF"] = Blockly.Msg["CONTROLS_IF_MSG_IF"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_THEN"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_ITEM_TITLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_HELPURL"] = Blockly.Msg["LISTS_INDEX_OF_HELPURL"];
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["MATH_CHANGE_TITLE_ITEM"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_COMMENT"] = Blockly.Msg["PROCEDURES_DEFNORETURN_COMMENT"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_DO"] = Blockly.Msg["PROCEDURES_DEFNORETURN_DO"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_PROCEDURE"] = Blockly.Msg["PROCEDURES_DEFNORETURN_PROCEDURE"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_TITLE"] = Blockly.Msg["PROCEDURES_DEFNORETURN_TITLE"];
|
||||||
|
Blockly.Msg["TEXT_APPEND_VARIABLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_ITEM_TITLE_ITEM"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
|
||||||
|
Blockly.Msg["MATH_HUE"] = "230";
|
||||||
|
Blockly.Msg["LOOPS_HUE"] = "120";
|
||||||
|
Blockly.Msg["LISTS_HUE"] = "260";
|
||||||
|
Blockly.Msg["LOGIC_HUE"] = "210";
|
||||||
|
Blockly.Msg["VARIABLES_HUE"] = "330";
|
||||||
|
Blockly.Msg["TEXTS_HUE"] = "160";
|
||||||
|
Blockly.Msg["REPORTERS_HUE"] = "290";
|
||||||
|
Blockly.Msg["PROCEDURES_HUE"] = "290";
|
||||||
|
Blockly.Msg["COLOUR_HUE"] = "20";
|
||||||
|
Blockly.Msg["VARIABLES_DYNAMIC_HUE"] = "310";
|
436
scripts/ja.js.BAK
Normal file
@ -0,0 +1,436 @@
|
|||||||
|
// This file was automatically generated. Do not modify.
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
goog.provide('Blockly.Msg.ja');
|
||||||
|
|
||||||
|
goog.require('Blockly.Msg');
|
||||||
|
|
||||||
|
Blockly.Msg["ADD_COMMENT"] = "コメントを追加";
|
||||||
|
Blockly.Msg["CANNOT_DELETE_VARIABLE_PROCEDURE"] = "変数 '%1' は関数 '%2' の定義の一部であるため、削除できません";
|
||||||
|
Blockly.Msg["CHANGE_VALUE_TITLE"] = "値を変える:";
|
||||||
|
Blockly.Msg["CLEAN_UP"] = "ブロックを整理する";
|
||||||
|
Blockly.Msg["COLLAPSED_WARNINGS_WARNING"] = "Collapsed blocks contain warnings."; // untranslated
|
||||||
|
Blockly.Msg["COLLAPSE_ALL"] = "ブロックを折りたたむ";
|
||||||
|
Blockly.Msg["COLLAPSE_BLOCK"] = "ブロックを折りたたむ";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_COLOUR1"] = "色 1";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_COLOUR2"] = "色 2";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_HELPURL"] = "http://meyerweb.com/eric/tools/color-blend/";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_RATIO"] = "比率";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_TITLE"] = "ブレンド";
|
||||||
|
Blockly.Msg["COLOUR_BLEND_TOOLTIP"] = "2色を与えられた比率(0.0~1.0)で混ぜます。";
|
||||||
|
Blockly.Msg["COLOUR_PICKER_HELPURL"] = "https://ja.wikipedia.org/wiki/色";
|
||||||
|
Blockly.Msg["COLOUR_PICKER_TOOLTIP"] = "パレットから色を選んでください。";
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_HELPURL"] = "http://randomcolour.com"; // untranslated
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_TITLE"] = "ランダムな色";
|
||||||
|
Blockly.Msg["COLOUR_RANDOM_TOOLTIP"] = "ランダムな色を選ぶ。";
|
||||||
|
Blockly.Msg["COLOUR_RGB_BLUE"] = "青";
|
||||||
|
Blockly.Msg["COLOUR_RGB_GREEN"] = "緑";
|
||||||
|
Blockly.Msg["COLOUR_RGB_HELPURL"] = "http://www.december.com/html/spec/colorper.html";
|
||||||
|
Blockly.Msg["COLOUR_RGB_RED"] = "赤";
|
||||||
|
Blockly.Msg["COLOUR_RGB_TITLE"] = "色:";
|
||||||
|
Blockly.Msg["COLOUR_RGB_TOOLTIP"] = "赤、緑、および青の指定された量で色を作成します。すべての値は 0 ~ 100 の間でなければなりません。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#loop-termination-blocks"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK"] = "ループから抜け出す";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE"] = "ループの次の反復処理を続行します";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK"] = "入っているループから抜け出します。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE"] = "このループの残りの部分をスキップして、ループの繰り返しを続けます。";
|
||||||
|
Blockly.Msg["CONTROLS_FLOW_STATEMENTS_WARNING"] = "注意: このブロックは、ループ内でのみ使用できます。";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#for-each"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_TITLE"] = "リスト%2の各項目%1について";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_TOOLTIP"] = "リストの各項目について、その項目を変数'%1'として、いくつかのステートメントを実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_FOR_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#count-with"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_FOR_TITLE"] = "%1 を %2 から %3 まで %4 ずつカウントする";
|
||||||
|
Blockly.Msg["CONTROLS_FOR_TOOLTIP"] = "変数 '%1' が開始番号から終了番号まで指定した間隔での値をとって、指定したブロックを実行する。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSEIF_TOOLTIP"] = "「もしも」のブロックに条件を追加します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSE_TOOLTIP"] = "Ifブロックに、すべてをキャッチする条件を追加。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_HELPURL"] = "https://github.com/google/blockly/wiki/IfElse"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_IF_IF_TOOLTIP"] = "追加、削除、またはセクションを順序変更して、ブロックをこれを再構成します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_ELSE"] = "そうでなければ";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_ELSEIF"] = "そうでなくもし";
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_IF"] = "もし";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_1"] = "値が true の場合、ステートメントを実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_2"] = "値が true 場合は、ステートメントの最初のブロックを行います。それ以外の場合は、ステートメントの 2 番目のブロックを行います。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_3"] = "最初の値が true 場合は、ステートメントの最初のブロックを行います。それ以外の場合は、2 番目の値が true の場合、ステートメントの 2 番目のブロックをします。";
|
||||||
|
Blockly.Msg["CONTROLS_IF_TOOLTIP_4"] = "最初の値が true 場合は、ステートメントの最初のブロックを行います。2 番目の値が true の場合は、ステートメントの 2 番目のブロックを行います。それ以外の場合は最後のブロックのステートメントを行います。";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_HELPURL"] = "https://ja.wikipedia.org/wiki/for文";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"] = "実行";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_TITLE"] = "%1 回繰り返す";
|
||||||
|
Blockly.Msg["CONTROLS_REPEAT_TOOLTIP"] = "いくつかのステートメントを数回実行します。";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_HELPURL"] = "https://github.com/google/blockly/wiki/Loops#repeat"; // untranslated
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_OPERATOR_UNTIL"] = "繰り返す:終わる条件";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_OPERATOR_WHILE"] = "繰り返す:続ける条件";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL"] = "値がfalseの間、いくつかのステートメントを実行する。";
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_TOOLTIP_WHILE"] = "値がtrueの間、いくつかのステートメントを実行する。";
|
||||||
|
Blockly.Msg["DELETE_ALL_BLOCKS"] = "%1件のすべてのブロックを削除しますか?";
|
||||||
|
Blockly.Msg["DELETE_BLOCK"] = "ブロックを削除";
|
||||||
|
Blockly.Msg["DELETE_VARIABLE"] = "変数 '%1' を削除";
|
||||||
|
Blockly.Msg["DELETE_VARIABLE_CONFIRMATION"] = "%1か所で使われている変数 '%2' を削除しますか?";
|
||||||
|
Blockly.Msg["DELETE_X_BLOCKS"] = "%1 個のブロックを削除";
|
||||||
|
Blockly.Msg["DISABLE_BLOCK"] = "ブロックを無効にする";
|
||||||
|
Blockly.Msg["DUPLICATE_BLOCK"] = "複製";
|
||||||
|
Blockly.Msg["DUPLICATE_COMMENT"] = "コメントを複製";
|
||||||
|
Blockly.Msg["ENABLE_BLOCK"] = "ブロックを有効にする";
|
||||||
|
Blockly.Msg["EXPAND_ALL"] = "ブロックを展開する";
|
||||||
|
Blockly.Msg["EXPAND_BLOCK"] = "ブロックを展開する";
|
||||||
|
Blockly.Msg["EXTERNAL_INPUTS"] = "外部入力";
|
||||||
|
Blockly.Msg["HELP"] = "ヘルプ";
|
||||||
|
Blockly.Msg["INLINE_INPUTS"] = "インライン入力";
|
||||||
|
Blockly.Msg["IOS_CANCEL"] = "キャンセル";
|
||||||
|
Blockly.Msg["IOS_ERROR"] = "エラー";
|
||||||
|
Blockly.Msg["IOS_OK"] = "OK";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_ADD_INPUT"] = "+ 入力を追加";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_ALLOW_STATEMENTS"] = "ステートメントを許可";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR"] = "この関数には重複する入力があります。";
|
||||||
|
Blockly.Msg["IOS_PROCEDURES_INPUTS"] = "入力";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_ADD_BUTTON"] = "追加";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_ADD_VARIABLE"] = "+ 変数を追加";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_DELETE_BUTTON"] = "削除";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_EMPTY_NAME_ERROR"] = "空の変数名は使用できません。";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_RENAME_BUTTON"] = "名前を変更";
|
||||||
|
Blockly.Msg["IOS_VARIABLES_VARIABLE_NAME"] = "変数名";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-empty-list";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_TITLE"] = "空のリストを作成";
|
||||||
|
Blockly.Msg["LISTS_CREATE_EMPTY_TOOLTIP"] = "長さ0でデータ・レコードを含まない空のリストを返す";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_CONTAINER_TITLE_ADD"] = "リスト";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_CONTAINER_TOOLTIP"] = "追加、削除、またはセクションの順序変更をして、このリスト・ブロックを再構成する。";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-list-with"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_INPUT_WITH"] = "以下を使ってリストを作成:";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_ITEM_TOOLTIP"] = "リストに項目を追加。";
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_TOOLTIP"] = "項目数が不定のリストを作成。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FIRST"] = "最初";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FROM_END"] = "位置:後ろから";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_FROM_START"] = "#";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_GET"] = "取得";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_GET_REMOVE"] = "取得して削除";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_LAST"] = "最後";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_RANDOM"] = "ランダム";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_REMOVE"] = "削除";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TAIL"] = "";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_FIRST"] = "リストの最初の項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_FROM"] = "リスト内の指定位置にある項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_LAST"] = "リストの最後の項目を返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_RANDOM"] = "ランダム アイテム リストを返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST"] = "リスト内の最初の項目を削除し返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM"] = "リスト内の指定位置にある項目を削除し、返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST"] = "リスト内の最後の項目を削除したあと返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM"] = "リストのランダムなアイテムを削除し返します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST"] = "リスト内の最初の項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM"] = "リスト内の指定された項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST"] = "リスト内の最後の項目を削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM"] = "リスト内にあるアイテムをランダムに削除します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_FROM_END"] = "終了位置:後ろから";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_FROM_START"] = "終了位置:";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_END_LAST"] = "最後まで";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-a-sublist"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FIRST"] = "最初からサブリストを取得する。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FROM_END"] = "端から #のサブリストを取得します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_START_FROM_START"] = "# からサブディレクトリのリストを取得します。";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_TAIL"] = "";
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_TOOLTIP"] = "リストの指定された部分のコピーを作成してくださ。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_FROM_END_TOOLTIP"] = "%1 は、最後の項目です。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_FROM_START_TOOLTIP"] = "%1 は、最初の項目です。";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_FIRST"] = "で以下のアイテムの最初の出現箇所を検索:";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_LAST"] = "で以下のテキストの最後の出現箇所を検索:";
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_TOOLTIP"] = "リスト項目の最初/最後に出現するインデックス位置を返します。項目が見つからない場合は %1 を返します。";
|
||||||
|
Blockly.Msg["LISTS_INLIST"] = "リスト";
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#is-empty"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_TITLE"] = "%1が空";
|
||||||
|
Blockly.Msg["LISTS_ISEMPTY_TOOLTIP"] = "リストが空の場合は、true を返します。";
|
||||||
|
Blockly.Msg["LISTS_LENGTH_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#length-of"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_LENGTH_TITLE"] = "%1の長さ";
|
||||||
|
Blockly.Msg["LISTS_LENGTH_TOOLTIP"] = "リストの長さを返します。";
|
||||||
|
Blockly.Msg["LISTS_REPEAT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#create-list-with"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_REPEAT_TITLE"] = "項目%1を%2回繰り返したリストを作成";
|
||||||
|
Blockly.Msg["LISTS_REPEAT_TOOLTIP"] = "与えられた値を指定された回数繰り返してリストを作成。";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#reversing-a-list";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_MESSAGE0"] = "%1を逆順に";
|
||||||
|
Blockly.Msg["LISTS_REVERSE_TOOLTIP"] = "リストのコピーを逆順にする。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#in-list--set"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INPUT_TO"] = "値:";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INSERT"] = "挿入位置:";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_SET"] = "セット";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST"] = "リストの先頭に項目を挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_FROM"] = "リスト内の指定位置に項目を挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_LAST"] = "リストの末尾に項目を追加します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM"] = "リストに項目をランダムに挿入します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_FIRST"] = "リスト内に最初の項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_FROM"] = "リスト内の指定された位置に項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_LAST"] = "リスト内の最後の項目を設定します。";
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_TOOLTIP_SET_RANDOM"] = "リスト内にランダムなアイテムを設定します。";
|
||||||
|
Blockly.Msg["LISTS_SORT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#sorting-a-list";
|
||||||
|
Blockly.Msg["LISTS_SORT_ORDER_ASCENDING"] = "昇順";
|
||||||
|
Blockly.Msg["LISTS_SORT_ORDER_DESCENDING"] = "降順";
|
||||||
|
Blockly.Msg["LISTS_SORT_TITLE"] = "%1 ( %2 ) に %3 を並び替える";
|
||||||
|
Blockly.Msg["LISTS_SORT_TOOLTIP"] = "リストのコピーを並べ替え";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_IGNORECASE"] = "アルファベット順(大文字・小文字の区別無し)";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_NUMERIC"] = "数値順";
|
||||||
|
Blockly.Msg["LISTS_SORT_TYPE_TEXT"] = "アルファベット順";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_HELPURL"] = "https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists"; // untranslated
|
||||||
|
Blockly.Msg["LISTS_SPLIT_LIST_FROM_TEXT"] = "テキストからリストを作る";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TEXT_FROM_LIST"] = "リストからテキストを作る";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TOOLTIP_JOIN"] = "テキストのリストを区切り記号で区切られた一つのテキストにする";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_TOOLTIP_SPLIT"] = "テキストを区切り記号で分割したリストにする";
|
||||||
|
Blockly.Msg["LISTS_SPLIT_WITH_DELIMITER"] = "区切り記号";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_FALSE"] = "偽";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_HELPURL"] = "https://github.com/google/blockly/wiki/Logic#values"; // untranslated
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_TOOLTIP"] = "true または false を返します。";
|
||||||
|
Blockly.Msg["LOGIC_BOOLEAN_TRUE"] = "真";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_HELPURL"] = "https://ja.wikipedia.org/wiki/不等式";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_EQ"] = "両方の入力が互いに等しい場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_GT"] = "最初の入力が 2 番目の入力よりも大きい場合は true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_GTE"] = "最初の入力が 2 番目の入力以上の場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_LT"] = "最初の入力が 2 番目の入力よりも小さい場合は true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_LTE"] = "最初の入力が 2 番目の入力以下の場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_COMPARE_TOOLTIP_NEQ"] = "両方の入力が互いに等しくない場合に true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_HELPURL"] = "https://ja.wikipedia.org/wiki/否定";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_TITLE"] = "%1ではない";
|
||||||
|
Blockly.Msg["LOGIC_NEGATE_TOOLTIP"] = "入力が false の場合は、true を返します。入力が true の場合は false を返します。";
|
||||||
|
Blockly.Msg["LOGIC_NULL"] = "null";
|
||||||
|
Blockly.Msg["LOGIC_NULL_HELPURL"] = "https://en.wikipedia.org/wiki/Nullable_type";
|
||||||
|
Blockly.Msg["LOGIC_NULL_TOOLTIP"] = "null を返します。";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_AND"] = "かつ";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_HELPURL"] = "https://github.com/google/blockly/wiki/Logic#logical-operations"; // untranslated
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_OR"] = "または";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_TOOLTIP_AND"] = "両方の入力が true のときに true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_OPERATION_TOOLTIP_OR"] = "少なくとも 1 つの入力が true のときに true を返します。";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_CONDITION"] = "テスト";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_HELPURL"] = "https://ja.wikipedia.org/wiki/%3F:";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_IF_FALSE"] = "false の場合";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_IF_TRUE"] = "true の場合";
|
||||||
|
Blockly.Msg["LOGIC_TERNARY_TOOLTIP"] = "'テスト' の条件をチェックします。条件が true の場合、'true' の値を返します。それ以外の場合 'false' のを返します。";
|
||||||
|
Blockly.Msg["MATH_ADDITION_SYMBOL"] = "+";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_HELPURL"] = "https://ja.wikipedia.org/wiki/算術";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_ADD"] = "2 つの数の合計を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_DIVIDE"] = "2 つの数の商を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MINUS"] = "2 つの数の差を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_MULTIPLY"] = "2 つの数の積を返します。";
|
||||||
|
Blockly.Msg["MATH_ARITHMETIC_TOOLTIP_POWER"] = "最初の数を2 番目の値で累乗した結果を返します。";
|
||||||
|
Blockly.Msg["MATH_ATAN2_HELPURL"] = "https://en.wikipedia.org/wiki/Atan2"; // untranslated
|
||||||
|
Blockly.Msg["MATH_ATAN2_TITLE"] = "atan2 of X:%1 Y:%2"; // untranslated
|
||||||
|
Blockly.Msg["MATH_ATAN2_TOOLTIP"] = "Return the arctangent of point (X, Y) in degrees from -180 to 180."; // untranslated
|
||||||
|
Blockly.Msg["MATH_CHANGE_HELPURL"] = "https://ja.wikipedia.org/wiki/加法";
|
||||||
|
Blockly.Msg["MATH_CHANGE_TITLE"] = "%1 を %2 増やす";
|
||||||
|
Blockly.Msg["MATH_CHANGE_TOOLTIP"] = "変数'%1'に数をたす。";
|
||||||
|
Blockly.Msg["MATH_CONSTANT_HELPURL"] = "https://ja.wikipedia.org/wiki/数学定数";
|
||||||
|
Blockly.Msg["MATH_CONSTANT_TOOLTIP"] = "いずれかの共通の定数のを返す: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (無限).";
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_HELPURL"] = "https://en.wikipedia.org/wiki/Clamping_(graphics)"; // untranslated
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_TITLE"] = "%1 を %2 以上 %3 以下の範囲に制限";
|
||||||
|
Blockly.Msg["MATH_CONSTRAIN_TOOLTIP"] = "指定した上限と下限の間に値を制限する(上限と下限の値を含む)。";
|
||||||
|
Blockly.Msg["MATH_DIVISION_SYMBOL"] = "÷";
|
||||||
|
Blockly.Msg["MATH_IS_DIVISIBLE_BY"] = "は以下で割りきれる:";
|
||||||
|
Blockly.Msg["MATH_IS_EVEN"] = "は偶数";
|
||||||
|
Blockly.Msg["MATH_IS_NEGATIVE"] = "は負";
|
||||||
|
Blockly.Msg["MATH_IS_ODD"] = "は奇数";
|
||||||
|
Blockly.Msg["MATH_IS_POSITIVE"] = "は正";
|
||||||
|
Blockly.Msg["MATH_IS_PRIME"] = "は素数";
|
||||||
|
Blockly.Msg["MATH_IS_TOOLTIP"] = "数字が、偶数、奇数、素数、整数、正数、負数、または特定の数で割り切れるかどうかを判定し、true か false を返します。";
|
||||||
|
Blockly.Msg["MATH_IS_WHOLE"] = "は整数";
|
||||||
|
Blockly.Msg["MATH_MODULO_HELPURL"] = "https://en.wikipedia.org/wiki/Modulo_operation";
|
||||||
|
Blockly.Msg["MATH_MODULO_TITLE"] = "%1÷%2の余り";
|
||||||
|
Blockly.Msg["MATH_MODULO_TOOLTIP"] = "2つの数値の割り算の余りを返す。";
|
||||||
|
Blockly.Msg["MATH_MULTIPLICATION_SYMBOL"] = "×";
|
||||||
|
Blockly.Msg["MATH_NUMBER_HELPURL"] = "https://ja.wikipedia.org/wiki/数";
|
||||||
|
Blockly.Msg["MATH_NUMBER_TOOLTIP"] = "数です。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_HELPURL"] = ""; // untranslated
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_AVERAGE"] = "リストの平均";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MAX"] = "リストの最大値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MEDIAN"] = "リストの中央値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MIN"] = "リストの最小値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_MODE"] = "リストの最頻値";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_RANDOM"] = "リストからランダムに選ばれた項目";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_STD_DEV"] = "リストの標準偏差";
|
||||||
|
Blockly.Msg["MATH_ONLIST_OPERATOR_SUM"] = "リストの合計";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_AVERAGE"] = "リストの数値の平均 (算術平均) を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MAX"] = "リストの最大値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MEDIAN"] = "リストの中央値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MIN"] = "リストの最小値を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_MODE"] = "リスト中の最頻項目のリストを返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_RANDOM"] = "リストからランダムに選ばれた要素を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_STD_DEV"] = "リストの標準偏差を返す。";
|
||||||
|
Blockly.Msg["MATH_ONLIST_TOOLTIP_SUM"] = "リストの数値を足して返す。";
|
||||||
|
Blockly.Msg["MATH_POWER_SYMBOL"] = "^";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_TITLE_RANDOM"] = "1未満の正の乱数";
|
||||||
|
Blockly.Msg["MATH_RANDOM_FLOAT_TOOLTIP"] = "0.0以上で1.0未満の範囲の乱数を返します。";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_HELPURL"] = "https://en.wikipedia.org/wiki/Random_number_generation";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_TITLE"] = "%1から%2までのランダムな整数";
|
||||||
|
Blockly.Msg["MATH_RANDOM_INT_TOOLTIP"] = "指定された(上下限を含む)範囲のランダムな整数を返します。";
|
||||||
|
Blockly.Msg["MATH_ROUND_HELPURL"] = "https://ja.wikipedia.org/wiki/端数処理";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUND"] = "四捨五入";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUNDDOWN"] = "切り捨て";
|
||||||
|
Blockly.Msg["MATH_ROUND_OPERATOR_ROUNDUP"] = "切り上げ";
|
||||||
|
Blockly.Msg["MATH_ROUND_TOOLTIP"] = "数値を切り上げるか切り捨てる";
|
||||||
|
Blockly.Msg["MATH_SINGLE_HELPURL"] = "https://ja.wikipedia.org/wiki/平方根";
|
||||||
|
Blockly.Msg["MATH_SINGLE_OP_ABSOLUTE"] = "絶対値";
|
||||||
|
Blockly.Msg["MATH_SINGLE_OP_ROOT"] = "平方根";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_ABS"] = "絶対値を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_EXP"] = "ネイピア数eの数値乗を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_LN"] = "数値の自然対数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_LOG10"] = "底が10の対数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_NEG"] = "負の数を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_POW10"] = "10の数値乗を返す。";
|
||||||
|
Blockly.Msg["MATH_SINGLE_TOOLTIP_ROOT"] = "平方根を返す。";
|
||||||
|
Blockly.Msg["MATH_SUBTRACTION_SYMBOL"] = "-";
|
||||||
|
Blockly.Msg["MATH_TRIG_ACOS"] = "acos";
|
||||||
|
Blockly.Msg["MATH_TRIG_ASIN"] = "asin";
|
||||||
|
Blockly.Msg["MATH_TRIG_ATAN"] = "atan";
|
||||||
|
Blockly.Msg["MATH_TRIG_COS"] = "cos";
|
||||||
|
Blockly.Msg["MATH_TRIG_HELPURL"] = "https://ja.wikipedia.org/wiki/三角関数";
|
||||||
|
Blockly.Msg["MATH_TRIG_SIN"] = "sin";
|
||||||
|
Blockly.Msg["MATH_TRIG_TAN"] = "tan";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ACOS"] = "アークコサイン(arccosin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ASIN"] = "アークサイン(arcsin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_ATAN"] = "アークタンジェント(arctan)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_COS"] = "(ラジアンではなく)度数の余弦(cosin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_SIN"] = "(ラジアンではなく)度数の正弦(sin)を返す。";
|
||||||
|
Blockly.Msg["MATH_TRIG_TOOLTIP_TAN"] = "(ラジアンではなく)度数の正接(tan)を返す。";
|
||||||
|
Blockly.Msg["NEW_COLOUR_VARIABLE"] = "色の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_NUMBER_VARIABLE"] = "数の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_STRING_VARIABLE"] = "文字列の変数を作る...";
|
||||||
|
Blockly.Msg["NEW_VARIABLE"] = "変数の作成…";
|
||||||
|
Blockly.Msg["NEW_VARIABLE_TITLE"] = "新しい変数の名前:";
|
||||||
|
Blockly.Msg["NEW_VARIABLE_TYPE_TITLE"] = "新しい変数の型:";
|
||||||
|
Blockly.Msg["ORDINAL_NUMBER_SUFFIX"] = ""; // untranslated
|
||||||
|
Blockly.Msg["PROCEDURES_ALLOW_STATEMENTS"] = "ステートメントを許可";
|
||||||
|
Blockly.Msg["PROCEDURES_BEFORE_PARAMS"] = "引数:";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLNORETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLNORETURN_TOOLTIP"] = "ユーザー定義関数 '%1' を実行します。";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLRETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_CALLRETURN_TOOLTIP"] = "ユーザー定義関数 '%1' を実行し、その出力を使用します。";
|
||||||
|
Blockly.Msg["PROCEDURES_CALL_BEFORE_PARAMS"] = "引数:";
|
||||||
|
Blockly.Msg["PROCEDURES_CREATE_DO"] = "'%1' を作成";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_COMMENT"] = "この関数の説明…";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_DO"] = "";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_PROCEDURE"] = "何かする";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_TITLE"] = "関数";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFNORETURN_TOOLTIP"] = "出力なしの関数を作成します。";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_HELPURL"] = "https://ja.wikipedia.org/wiki/サブルーチン";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_RETURN"] = "返す";
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_TOOLTIP"] = "一つの出力を持つ関数を作成します。";
|
||||||
|
Blockly.Msg["PROCEDURES_DEF_DUPLICATE_WARNING"] = "警告: この関数には重複するパラメーターがあります。";
|
||||||
|
Blockly.Msg["PROCEDURES_HIGHLIGHT_DEF"] = "関数の内容を強調表示します。";
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_HELPURL"] = "http://c2.com/cgi/wiki?GuardClause"; // untranslated
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_TOOLTIP"] = "1番目の値が true の場合、2番目の値を返します。";
|
||||||
|
Blockly.Msg["PROCEDURES_IFRETURN_WARNING"] = "警告: このブロックは、関数定義内でのみ使用できます。";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORARG_TITLE"] = "入力名:";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORARG_TOOLTIP"] = "関数への入力の追加。";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORCONTAINER_TITLE"] = "入力";
|
||||||
|
Blockly.Msg["PROCEDURES_MUTATORCONTAINER_TOOLTIP"] = "この関数への入力の追加、削除、順番変更。";
|
||||||
|
Blockly.Msg["REDO"] = "やり直す";
|
||||||
|
Blockly.Msg["REMOVE_COMMENT"] = "コメントを削除";
|
||||||
|
Blockly.Msg["RENAME_VARIABLE"] = "変数の名前を変える…";
|
||||||
|
Blockly.Msg["RENAME_VARIABLE_TITLE"] = "選択した%1の変数すべての名前を変える:";
|
||||||
|
Blockly.Msg["TEXT_APPEND_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-modification"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_APPEND_TITLE"] = "項目 %1 へテキストを追加 %2";
|
||||||
|
Blockly.Msg["TEXT_APPEND_TOOLTIP"] = "変数 '%1' にテキストを追加。";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#adjusting-text-case"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_LOWERCASE"] = "小文字に";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_TITLECASE"] = "タイトル ケースに";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_OPERATOR_UPPERCASE"] = "大文字に";
|
||||||
|
Blockly.Msg["TEXT_CHANGECASE_TOOLTIP"] = "別のケースに、テキストのコピーを返します。";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FIRST"] = "最初の文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FROM_END"] = "の、後ろから以下の数字番目の文字:";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_FROM_START"] = "の、以下の数字番目の文字:";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_CHARAT_LAST"] = "最後の文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_RANDOM"] = "ランダムな文字を得る";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TAIL"] = "";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TITLE"] = "テキスト %1 %2";
|
||||||
|
Blockly.Msg["TEXT_CHARAT_TOOLTIP"] = "指定された位置に文字を返します。";
|
||||||
|
Blockly.Msg["TEXT_COUNT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#counting-substrings";
|
||||||
|
Blockly.Msg["TEXT_COUNT_MESSAGE0"] = "%2に含まれる%1の数を数える";
|
||||||
|
Blockly.Msg["TEXT_COUNT_TOOLTIP"] = "とある文が別の文のなかに使われた回数を数える。";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_ITEM_TOOLTIP"] = "テキストへ項目を追加。";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_TITLE_JOIN"] = "結合";
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_TOOLTIP"] = "セクションを追加、削除、または順序変更して、ブロックを再構成。";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_END"] = "終了位置:後ろから";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_FROM_START"] = "終了位置:";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_END_LAST"] = "最後のの文字";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_HELPURL"] = "https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_INPUT_IN_TEXT"] = "テキスト";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FIRST"] = "の部分文字列を取得;最初から";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FROM_END"] = "の部分文字列を取得;開始位置:後ろから";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_START_FROM_START"] = "の部分文字列を取得;開始位置:";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_TAIL"] = "";
|
||||||
|
Blockly.Msg["TEXT_GET_SUBSTRING_TOOLTIP"] = "テキストの指定部分を返します。";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_HELPURL"] = "https://github.com/google/blockly/wiki/Text#finding-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_OPERATOR_FIRST"] = "で以下のテキストの最初の出現箇所を検索:";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_OPERATOR_LAST"] = "で以下のテキストの最後の出現箇所を検索:";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_TITLE"] = "テキスト %1 %2 %3";
|
||||||
|
Blockly.Msg["TEXT_INDEXOF_TOOLTIP"] = "二番目のテキストの中で一番目のテキストが最初/最後に出現したインデックスを返す。テキストが見つからない場合は%1を返す。";
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_HELPURL"] = "https://github.com/google/blockly/wiki/Text#checking-for-empty-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_TITLE"] = "%1が空";
|
||||||
|
Blockly.Msg["TEXT_ISEMPTY_TOOLTIP"] = "与えられたテキストが空の場合は true を返す。";
|
||||||
|
Blockly.Msg["TEXT_JOIN_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-creation"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_JOIN_TITLE_CREATEWITH"] = "テキストの作成:";
|
||||||
|
Blockly.Msg["TEXT_JOIN_TOOLTIP"] = "任意の数の項目一部を一緒に接合してテキストを作成。";
|
||||||
|
Blockly.Msg["TEXT_LENGTH_HELPURL"] = "https://github.com/google/blockly/wiki/Text#text-modification"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_LENGTH_TITLE"] = "%1の長さ";
|
||||||
|
Blockly.Msg["TEXT_LENGTH_TOOLTIP"] = "与えられたテキストの(スペースを含む)文字数を返す。";
|
||||||
|
Blockly.Msg["TEXT_PRINT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#printing-text"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_PRINT_TITLE"] = "%1 を表示";
|
||||||
|
Blockly.Msg["TEXT_PRINT_TOOLTIP"] = "指定したテキスト、番号または他の値を印刷します。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_HELPURL"] = "https://github.com/google/blockly/wiki/Text#getting-input-from-the-user"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TOOLTIP_NUMBER"] = "ユーザーに数値のインプットを求める。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TOOLTIP_TEXT"] = "ユーザーにテキスト入力を求める。";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TYPE_NUMBER"] = "メッセージで番号の入力を求める";
|
||||||
|
Blockly.Msg["TEXT_PROMPT_TYPE_TEXT"] = "メッセージでテキスト入力を求める";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#replacing-substrings";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_MESSAGE0"] = "%3に含まれる%1を%2に置換";
|
||||||
|
Blockly.Msg["TEXT_REPLACE_TOOLTIP"] = "文に含まれるキーワードを置換する。";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_HELPURL"] = "https://github.com/google/blockly/wiki/Text#reversing-text";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_MESSAGE0"] = "%1を逆順に";
|
||||||
|
Blockly.Msg["TEXT_REVERSE_TOOLTIP"] = "文の文字を逆順にする。";
|
||||||
|
Blockly.Msg["TEXT_TEXT_HELPURL"] = "https://ja.wikipedia.org/wiki/文字列";
|
||||||
|
Blockly.Msg["TEXT_TEXT_TOOLTIP"] = "文字、単語、または行のテキスト。";
|
||||||
|
Blockly.Msg["TEXT_TRIM_HELPURL"] = "https://github.com/google/blockly/wiki/Text#trimming-removing-spaces"; // untranslated
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_BOTH"] = "両端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_LEFT"] = "左端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_OPERATOR_RIGHT"] = "右端のスペースを取り除く";
|
||||||
|
Blockly.Msg["TEXT_TRIM_TOOLTIP"] = "スペースを 1 つまたは両方の端から削除したのち、テキストのコピーを返します。";
|
||||||
|
Blockly.Msg["TODAY"] = "今日";
|
||||||
|
Blockly.Msg["UNDO"] = "取り消す";
|
||||||
|
Blockly.Msg["VARIABLES_DEFAULT_NAME"] = "項目";
|
||||||
|
Blockly.Msg["VARIABLES_GET_CREATE_SET"] = "'セット%1を作成します。";
|
||||||
|
Blockly.Msg["VARIABLES_GET_HELPURL"] = "https://github.com/google/blockly/wiki/Variables#get"; // untranslated
|
||||||
|
Blockly.Msg["VARIABLES_GET_TOOLTIP"] = "この変数の値を返します。";
|
||||||
|
Blockly.Msg["VARIABLES_SET"] = "%1 に %2 をセット";
|
||||||
|
Blockly.Msg["VARIABLES_SET_CREATE_GET"] = "'%1 を取得' を作成します。";
|
||||||
|
Blockly.Msg["VARIABLES_SET_HELPURL"] = "https://github.com/google/blockly/wiki/Variables#set"; // untranslated
|
||||||
|
Blockly.Msg["VARIABLES_SET_TOOLTIP"] = "この入力を変数と等しくなるように設定します。";
|
||||||
|
Blockly.Msg["VARIABLE_ALREADY_EXISTS"] = "変数名 '%1' は既に存在しています。";
|
||||||
|
Blockly.Msg["VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE"] = "'%2' 型の '%1' という名前の変数が既に存在します。";
|
||||||
|
Blockly.Msg["WORKSPACE_COMMENT_DEFAULT_TEXT"] = "ここへ入力";
|
||||||
|
Blockly.Msg["CONTROLS_FOREACH_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_FOR_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSEIF_TITLE_ELSEIF"] = Blockly.Msg["CONTROLS_IF_MSG_ELSEIF"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_ELSE_TITLE_ELSE"] = Blockly.Msg["CONTROLS_IF_MSG_ELSE"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_IF_TITLE_IF"] = Blockly.Msg["CONTROLS_IF_MSG_IF"];
|
||||||
|
Blockly.Msg["CONTROLS_IF_MSG_THEN"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["CONTROLS_WHILEUNTIL_INPUT_DO"] = Blockly.Msg["CONTROLS_REPEAT_INPUT_DO"];
|
||||||
|
Blockly.Msg["LISTS_CREATE_WITH_ITEM_TITLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_HELPURL"] = Blockly.Msg["LISTS_INDEX_OF_HELPURL"];
|
||||||
|
Blockly.Msg["LISTS_GET_INDEX_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_GET_SUBLIST_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_INDEX_OF_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["LISTS_SET_INDEX_INPUT_IN_LIST"] = Blockly.Msg["LISTS_INLIST"];
|
||||||
|
Blockly.Msg["MATH_CHANGE_TITLE_ITEM"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_COMMENT"] = Blockly.Msg["PROCEDURES_DEFNORETURN_COMMENT"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_DO"] = Blockly.Msg["PROCEDURES_DEFNORETURN_DO"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_PROCEDURE"] = Blockly.Msg["PROCEDURES_DEFNORETURN_PROCEDURE"];
|
||||||
|
Blockly.Msg["PROCEDURES_DEFRETURN_TITLE"] = Blockly.Msg["PROCEDURES_DEFNORETURN_TITLE"];
|
||||||
|
Blockly.Msg["TEXT_APPEND_VARIABLE"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
Blockly.Msg["TEXT_CREATE_JOIN_ITEM_TITLE_ITEM"] = Blockly.Msg["VARIABLES_DEFAULT_NAME"];
|
||||||
|
|
||||||
|
Blockly.Msg["MATH_HUE"] = "230";
|
||||||
|
Blockly.Msg["LOOPS_HUE"] = "120";
|
||||||
|
Blockly.Msg["LISTS_HUE"] = "260";
|
||||||
|
Blockly.Msg["LOGIC_HUE"] = "210";
|
||||||
|
Blockly.Msg["VARIABLES_HUE"] = "330";
|
||||||
|
Blockly.Msg["TEXTS_HUE"] = "160";
|
||||||
|
Blockly.Msg["PROCEDURES_HUE"] = "290";
|
||||||
|
Blockly.Msg["COLOUR_HUE"] = "20";
|
||||||
|
Blockly.Msg["VARIABLES_DYNAMIC_HUE"] = "310";
|
BIN
scripts/models/tiny_face_detector_model-shard1
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"weights":[{"name":"conv0/filters","shape":[3,3,3,16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.009007044399485869,"min":-1.2069439495311063}},{"name":"conv0/bias","shape":[16],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.005263455241334205,"min":-0.9211046672334858}},{"name":"conv1/depthwise_filter","shape":[3,3,16,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.004001977630690033,"min":-0.5042491814669441}},{"name":"conv1/pointwise_filter","shape":[1,1,16,32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.013836609615999109,"min":-1.411334180831909}},{"name":"conv1/bias","shape":[32],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0015159862590771096,"min":-0.30926119685173037}},{"name":"conv2/depthwise_filter","shape":[3,3,32,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002666276225856706,"min":-0.317286870876948}},{"name":"conv2/pointwise_filter","shape":[1,1,32,64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.015265831292844286,"min":-1.6792414422128714}},{"name":"conv2/bias","shape":[64],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0020280554598453,"min":-0.37113414915168985}},{"name":"conv3/depthwise_filter","shape":[3,3,64,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006100742489683862,"min":-0.8907084034938438}},{"name":"conv3/pointwise_filter","shape":[1,1,64,128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.016276211832083907,"min":-2.0508026908425725}},{"name":"conv3/bias","shape":[128],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.003394414279975143,"min":-0.7637432129944072}},{"name":"conv4/depthwise_filter","shape":[3,3,128,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.006716050119961009,"min":-0.8059260143953211}},{"name":"conv4/pointwise_filter","shape":[1,1,128,256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.021875603993733724,"min":-2.8875797271728514}},{"name":"conv4/bias","shape":[256],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.0041141652009066415,"min":-0.8187188749804216}},{"name":"conv5/depthwise_filter","shape":[3,3,256,1],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008423839597141042,"min":-0.9013508368940915}},{"name":"conv5/pointwise_filter","shape":[1,1,256,512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.030007277283014035,"min":-3.8709387695088107}},{"name":"conv5/bias","shape":[512],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.008402082966823203,"min":-1.4871686851277068}},{"name":"conv8/filters","shape":[1,1,512,25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.028336129469030042,"min":-4.675461362389957}},{"name":"conv8/bias","shape":[25],"dtype":"float32","quantization":{"dtype":"uint8","scale":0.002268134028303857,"min":-0.41053225912299807}}],"paths":["tiny_face_detector_model-shard1"]}]
|
47
scripts/oled.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import Adafruit_SSD1306
|
||||||
|
from PIL import Image
|
||||||
|
from PIL import ImageDraw
|
||||||
|
from PIL import ImageFont
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
FONT_SIZE = 12
|
||||||
|
LINE_SPACING = 4
|
||||||
|
|
||||||
|
args = sys.argv
|
||||||
|
linenum = int(args[1]) # 0 origin
|
||||||
|
if linenum >= 0:
|
||||||
|
text = args[2]
|
||||||
|
|
||||||
|
RST = 24
|
||||||
|
|
||||||
|
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
|
||||||
|
|
||||||
|
disp.begin()
|
||||||
|
|
||||||
|
if linenum < 0:
|
||||||
|
disp.clear()
|
||||||
|
disp.display()
|
||||||
|
exit()
|
||||||
|
|
||||||
|
width = disp.width
|
||||||
|
height = disp.height
|
||||||
|
image = Image.new('1', (width, height))
|
||||||
|
draw = ImageDraw.Draw(image)
|
||||||
|
|
||||||
|
#draw.rectangle((0, 0, width, height), outline=0, fill=0)
|
||||||
|
|
||||||
|
font = ImageFont.truetype(
|
||||||
|
'/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf', 12)
|
||||||
|
|
||||||
|
LINE_HEIGHT = FONT_SIZE + LINE_SPACING
|
||||||
|
|
||||||
|
x = 0
|
||||||
|
y = linenum * LINE_HEIGHT
|
||||||
|
draw.rectangle((x, y, width, y+LINE_HEIGHT), outline=0, fill=0) # 行消去
|
||||||
|
draw.text((0, y), text, font=font, fill=255)
|
||||||
|
|
||||||
|
disp.image(image)
|
||||||
|
disp.display()
|
123
scripts/predict.js
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
const CLASSES = {0:'zero', 1:'one', 2:'two', 3:'three', 4:'four',5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine'}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// start button event
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
$("#start-button").click(function(){
|
||||||
|
loadModel() ;
|
||||||
|
startWebcam();
|
||||||
|
});
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// load model
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
let model;
|
||||||
|
async function loadModel() {
|
||||||
|
console.log("model loading..");
|
||||||
|
$("#console").html(`<li>model loading...</li>`);
|
||||||
|
model=await tf.loadModel(`http://localhost:8080/sign_language_vgg16/model.json`);
|
||||||
|
console.log("model loaded.");
|
||||||
|
$("#console").html(`<li>VGG16 pre trained model loaded.</li>`);
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// start webcam
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
var video;
|
||||||
|
function startWebcam() {
|
||||||
|
console.log("video streaming start.");
|
||||||
|
$("#console").html(`<li>video streaming start.</li>`);
|
||||||
|
video = $('#main-stream-video').get(0);
|
||||||
|
vendorUrl = window.URL || window.webkitURL;
|
||||||
|
|
||||||
|
navigator.getMedia = navigator.getUserMedia ||
|
||||||
|
navigator.webkitGetUserMedia ||
|
||||||
|
navigator.mozGetUserMedia ||
|
||||||
|
navigator.msGetUserMedia;
|
||||||
|
|
||||||
|
navigator.getMedia({
|
||||||
|
video: true,
|
||||||
|
audio: false
|
||||||
|
}, function(stream) {
|
||||||
|
localStream = stream;
|
||||||
|
video.srcObject = stream;
|
||||||
|
video.play();
|
||||||
|
}, function(error) {
|
||||||
|
alert("Something wrong with webcam!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// predict button event
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
$("#predict-button").click(function(){
|
||||||
|
setInterval(predict, 1000/10);
|
||||||
|
});
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// TensorFlow.js method
|
||||||
|
// predict tensor
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
async function predict(){
|
||||||
|
let tensor = captureWebcam();
|
||||||
|
|
||||||
|
let prediction = await model.predict(tensor).data();
|
||||||
|
let results = Array.from(prediction)
|
||||||
|
.map(function(p,i){
|
||||||
|
return {
|
||||||
|
probability: p,
|
||||||
|
className: CLASSES[i]
|
||||||
|
};
|
||||||
|
}).sort(function(a,b){
|
||||||
|
return b.probability-a.probability;
|
||||||
|
}).slice(0,5);
|
||||||
|
|
||||||
|
$("#console").empty();
|
||||||
|
|
||||||
|
results.forEach(function(p){
|
||||||
|
$("#console").append(`<li>${p.className} : ${p.probability.toFixed(6)}</li>`);
|
||||||
|
console.log(p.className,p.probability.toFixed(6))
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//------------------------------
|
||||||
|
// capture streaming video
|
||||||
|
// to a canvas object
|
||||||
|
//------------------------------
|
||||||
|
|
||||||
|
function captureWebcam() {
|
||||||
|
var canvas = document.createElement("canvas");
|
||||||
|
var context = canvas.getContext('2d');
|
||||||
|
canvas.width = video.width;
|
||||||
|
canvas.height = video.height;
|
||||||
|
|
||||||
|
context.drawImage(video, 0, 0, video.width, video.height);
|
||||||
|
tensor_image = preprocessImage(canvas);
|
||||||
|
|
||||||
|
return tensor_image;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// TensorFlow.js method
|
||||||
|
// image to tensor
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
function preprocessImage(image){
|
||||||
|
let tensor = tf.fromPixels(image).resizeNearestNeighbor([100,100]).toFloat();
|
||||||
|
let offset = tf.scalar(255);
|
||||||
|
return tensor.div(offset).expandDims();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------
|
||||||
|
// clear button event
|
||||||
|
//-----------------------
|
||||||
|
|
||||||
|
$("#clear-button").click(function clear() {
|
||||||
|
location.reload();
|
||||||
|
});
|
46
scripts/prettify.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
!function(){/*
|
||||||
|
|
||||||
|
Copyright (C) 2006 Google Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
"undefined"!==typeof window&&(window.PR_SHOULD_USE_CONTINUATION=!0);
|
||||||
|
(function(){function T(a){function d(e){var a=e.charCodeAt(0);if(92!==a)return a;var c=e.charAt(1);return(a=w[c])?a:"0"<=c&&"7">=c?parseInt(e.substring(1),8):"u"===c||"x"===c?parseInt(e.substring(2),16):e.charCodeAt(1)}function f(e){if(32>e)return(16>e?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(e){var c=e.substring(1,e.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));
|
||||||
|
e=[];var a="^"===c[0],b=["["];a&&b.push("^");for(var a=a?1:0,g=c.length;a<g;++a){var h=c[a];if(/\\[bdsw]/i.test(h))b.push(h);else{var h=d(h),k;a+2<g&&"-"===c[a+1]?(k=d(c[a+2]),a+=2):k=h;e.push([h,k]);65>k||122<h||(65>k||90<h||e.push([Math.max(65,h)|32,Math.min(k,90)|32]),97>k||122<h||e.push([Math.max(97,h)&-33,Math.min(k,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});c=[];g=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=g[1]+1?g[1]=Math.max(g[1],h[1]):c.push(g=h);for(a=0;a<c.length;++a)h=
|
||||||
|
c[a],b.push(f(h[0])),h[1]>h[0]&&(h[1]+1>h[0]&&b.push("-"),b.push(f(h[1])));b.push("]");return b.join("")}function m(e){for(var a=e.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),b=a.length,d=[],g=0,h=0;g<b;++g){var k=a[g];"("===k?++h:"\\"===k.charAt(0)&&(k=+k.substring(1))&&(k<=h?d[k]=-1:a[g]=f(k))}for(g=1;g<d.length;++g)-1===d[g]&&(d[g]=++E);for(h=g=0;g<b;++g)k=a[g],
|
||||||
|
"("===k?(++h,d[h]||(a[g]="(?:")):"\\"===k.charAt(0)&&(k=+k.substring(1))&&k<=h&&(a[g]="\\"+d[k]);for(g=0;g<b;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(e.ignoreCase&&q)for(g=0;g<b;++g)k=a[g],e=k.charAt(0),2<=k.length&&"["===e?a[g]=c(k):"\\"!==e&&(a[g]=k.replace(/[a-zA-Z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var E=0,q=!1,l=!1,n=0,b=a.length;n<b;++n){var p=a[n];if(p.ignoreCase)l=!0;else if(/[a-z]/i.test(p.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,
|
||||||
|
""))){q=!0;l=!1;break}}for(var w={b:8,t:9,n:10,v:11,f:12,r:13},r=[],n=0,b=a.length;n<b;++n){p=a[n];if(p.global||p.multiline)throw Error(""+p);r.push("(?:"+m(p)+")")}return new RegExp(r.join("|"),l?"gi":"g")}function U(a,d){function f(a){var b=a.nodeType;if(1==b){if(!c.test(a.className)){for(b=a.firstChild;b;b=b.nextSibling)f(b);b=a.nodeName.toLowerCase();if("br"===b||"li"===b)m[l]="\n",q[l<<1]=E++,q[l++<<1|1]=a}}else if(3==b||4==b)b=a.nodeValue,b.length&&(b=d?b.replace(/\r\n?/g,"\n"):b.replace(/[ \t\r\n]+/g,
|
||||||
|
" "),m[l]=b,q[l<<1]=E,E+=b.length,q[l++<<1|1]=a)}var c=/(?:^|\s)nocode(?:\s|$)/,m=[],E=0,q=[],l=0;f(a);return{a:m.join("").replace(/\n$/,""),c:q}}function J(a,d,f,c,m){f&&(a={h:a,l:1,j:null,m:null,a:f,c:null,i:d,g:null},c(a),m.push.apply(m,a.g))}function V(a){for(var d=void 0,f=a.firstChild;f;f=f.nextSibling)var c=f.nodeType,d=1===c?d?a:f:3===c?W.test(f.nodeValue)?a:d:d;return d===a?void 0:d}function G(a,d){function f(a){for(var l=a.i,n=a.h,b=[l,"pln"],p=0,q=a.a.match(m)||[],r={},e=0,t=q.length;e<
|
||||||
|
t;++e){var z=q[e],v=r[z],g=void 0,h;if("string"===typeof v)h=!1;else{var k=c[z.charAt(0)];if(k)g=z.match(k[1]),v=k[0];else{for(h=0;h<E;++h)if(k=d[h],g=z.match(k[1])){v=k[0];break}g||(v="pln")}!(h=5<=v.length&&"lang-"===v.substring(0,5))||g&&"string"===typeof g[1]||(h=!1,v="src");h||(r[z]=v)}k=p;p+=z.length;if(h){h=g[1];var A=z.indexOf(h),C=A+h.length;g[2]&&(C=z.length-g[2].length,A=C-h.length);v=v.substring(5);J(n,l+k,z.substring(0,A),f,b);J(n,l+k+A,h,K(v,h),b);J(n,l+k+C,z.substring(C),f,b)}else b.push(l+
|
||||||
|
k,v)}a.g=b}var c={},m;(function(){for(var f=a.concat(d),l=[],n={},b=0,p=f.length;b<p;++b){var w=f[b],r=w[3];if(r)for(var e=r.length;0<=--e;)c[r.charAt(e)]=w;w=w[1];r=""+w;n.hasOwnProperty(r)||(l.push(w),n[r]=null)}l.push(/[\0-\uffff]/);m=T(l)})();var E=d.length;return f}function x(a){var d=[],f=[];a.tripleQuotedStrings?d.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
|
||||||
|
null,"'\""]):a.multiLineStrings?d.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):d.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);a.verbatimStrings&&f.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var c=a.hashComments;c&&(a.cStyleComments?(1<c?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,
|
||||||
|
null,"#"]),f.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):d.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(f.push(["com",/^\/\/[^\r\n]*/,null]),f.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));if(c=a.regexLiterals){var m=(c=1<c?"":"\n\r")?".":"[\\S\\s]";f.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
|
||||||
|
("/(?=[^/*"+c+"])(?:[^/\\x5B\\x5C"+c+"]|\\x5C"+m+"|\\x5B(?:[^\\x5C\\x5D"+c+"]|\\x5C"+m+")*(?:\\x5D|$))+/")+")")])}(c=a.types)&&f.push(["typ",c]);c=(""+a.keywords).replace(/^ | $/g,"");c.length&&f.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]);d.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);c="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(c+="(?!s*/)");f.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,
|
||||||
|
null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(c),null]);return G(d,f)}function L(a,d,f){function c(a){var b=a.nodeType;if(1==b&&!t.test(a.className))if("br"===a.nodeName.toLowerCase())m(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)c(a);else if((3==b||4==b)&&f){var e=a.nodeValue,d=e.match(q);d&&(b=e.substring(0,d.index),a.nodeValue=b,(e=e.substring(d.index+
|
||||||
|
d[0].length))&&a.parentNode.insertBefore(l.createTextNode(e),a.nextSibling),m(a),b||a.parentNode.removeChild(a))}}function m(a){function c(a,b){var e=b?a.cloneNode(!1):a,k=a.parentNode;if(k){var k=c(k,1),d=a.nextSibling;k.appendChild(e);for(var f=d;f;f=d)d=f.nextSibling,k.appendChild(f)}return e}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;a=c(a.nextSibling,0);for(var e;(e=a.parentNode)&&1===e.nodeType;)a=e;b.push(a)}for(var t=/(?:^|\s)nocode(?:\s|$)/,q=/\r\n?|\n/,l=a.ownerDocument,n=l.createElement("li");a.firstChild;)n.appendChild(a.firstChild);
|
||||||
|
for(var b=[n],p=0;p<b.length;++p)c(b[p]);d===(d|0)&&b[0].setAttribute("value",d);var w=l.createElement("ol");w.className="linenums";d=Math.max(0,d-1|0)||0;for(var p=0,r=b.length;p<r;++p)n=b[p],n.className="L"+(p+d)%10,n.firstChild||n.appendChild(l.createTextNode("\u00a0")),w.appendChild(n);a.appendChild(w)}function t(a,d){for(var f=d.length;0<=--f;){var c=d[f];I.hasOwnProperty(c)?D.console&&console.warn("cannot override language handler %s",c):I[c]=a}}function K(a,d){a&&I.hasOwnProperty(a)||(a=/^\s*</.test(d)?
|
||||||
|
"default-markup":"default-code");return I[a]}function M(a){var d=a.j;try{var f=U(a.h,a.l),c=f.a;a.a=c;a.c=f.c;a.i=0;K(d,c)(a);var m=/\bMSIE\s(\d+)/.exec(navigator.userAgent),m=m&&8>=+m[1],d=/\n/g,t=a.a,q=t.length,f=0,l=a.c,n=l.length,c=0,b=a.g,p=b.length,w=0;b[p]=q;var r,e;for(e=r=0;e<p;)b[e]!==b[e+2]?(b[r++]=b[e++],b[r++]=b[e++]):e+=2;p=r;for(e=r=0;e<p;){for(var x=b[e],z=b[e+1],v=e+2;v+2<=p&&b[v+1]===z;)v+=2;b[r++]=x;b[r++]=z;e=v}b.length=r;var g=a.h;a="";g&&(a=g.style.display,g.style.display="none");
|
||||||
|
try{for(;c<n;){var h=l[c+2]||q,k=b[w+2]||q,v=Math.min(h,k),A=l[c+1],C;if(1!==A.nodeType&&(C=t.substring(f,v))){m&&(C=C.replace(d,"\r"));A.nodeValue=C;var N=A.ownerDocument,u=N.createElement("span");u.className=b[w+1];var B=A.parentNode;B.replaceChild(u,A);u.appendChild(A);f<h&&(l[c+1]=A=N.createTextNode(t.substring(v,h)),B.insertBefore(A,u.nextSibling))}f=v;f>=h&&(c+=2);f>=k&&(w+=2)}}finally{g&&(g.style.display=a)}}catch(y){D.console&&console.log(y&&y.stack||y)}}var D="undefined"!==typeof window?
|
||||||
|
window:{},B=["break,continue,do,else,for,if,return,while"],F=[[B,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],H=[F,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],
|
||||||
|
O=[F,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],P=[F,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],
|
||||||
|
F=[F,"abstract,async,await,constructor,debugger,enum,eval,export,from,function,get,import,implements,instanceof,interface,let,null,of,set,undefined,var,with,yield,Infinity,NaN"],Q=[B,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],R=[B,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],
|
||||||
|
B=[B,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,W=/\S/,X=x({keywords:[H,P,O,F,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",Q,R,B],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),
|
||||||
|
I={};t(X,["default-code"]);t(G([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),"default-markup htm html mxml xhtml xml xsl".split(" "));t(G([["pln",/^[\s]+/,
|
||||||
|
null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);
|
||||||
|
t(G([],[["atv",/^[\s\S]+/]]),["uq.val"]);t(x({keywords:H,hashComments:!0,cStyleComments:!0,types:S}),"c cc cpp cxx cyc m".split(" "));t(x({keywords:"null,true,false"}),["json"]);t(x({keywords:P,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:S}),["cs"]);t(x({keywords:O,cStyleComments:!0}),["java"]);t(x({keywords:B,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);t(x({keywords:Q,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);t(x({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",
|
||||||
|
hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);t(x({keywords:R,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);t(x({keywords:F,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]);t(x({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,
|
||||||
|
regexLiterals:!0}),["coffee"]);t(G([],[["str",/^[\s\S]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:G,registerLangHandler:t,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,f){f=f||!1;d=d||null;var c=document.createElement("div");c.innerHTML="<pre>"+a+"</pre>";
|
||||||
|
c=c.firstChild;f&&L(c,f,!0);M({j:d,m:f,h:c,l:1,a:null,i:null,c:null,g:null});return c.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function f(){for(var c=D.PR_SHOULD_USE_CONTINUATION?b.now()+250:Infinity;p<x.length&&b.now()<c;p++){for(var d=x[p],l=g,n=d;n=n.previousSibling;){var m=n.nodeType,u=(7===m||8===m)&&n.nodeValue;if(u?!/^\??prettify\b/.test(u):3!==m||/\S/.test(n.nodeValue))break;if(u){l={};u.replace(/\b(\w+)=([\w:.%+-]+)/g,function(a,b,c){l[b]=c});break}}n=d.className;if((l!==g||r.test(n))&&
|
||||||
|
!e.test(n)){m=!1;for(u=d.parentNode;u;u=u.parentNode)if(v.test(u.tagName)&&u.className&&r.test(u.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=l.lang;if(!m){var m=n.match(w),q;!m&&(q=V(d))&&z.test(q.tagName)&&(m=q.className.match(w));m&&(m=m[1])}if(B.test(d.tagName))u=1;else var u=d.currentStyle,y=t.defaultView,u=(u=u?u.whiteSpace:y&&y.getComputedStyle?y.getComputedStyle(d,null).getPropertyValue("white-space"):0)&&"pre"===u.substring(0,3);y=l.linenums;(y="true"===y||+y)||(y=(y=n.match(/\blinenums\b(?::(\d+))?/))?
|
||||||
|
y[1]&&y[1].length?+y[1]:!0:!1);y&&L(d,y,u);M({j:m,h:d,m:y,l:u,a:null,i:null,c:null,g:null})}}}p<x.length?D.setTimeout(f,250):"function"===typeof a&&a()}for(var c=d||document.body,t=c.ownerDocument||document,c=[c.getElementsByTagName("pre"),c.getElementsByTagName("code"),c.getElementsByTagName("xmp")],x=[],q=0;q<c.length;++q)for(var l=0,n=c[q].length;l<n;++l)x.push(c[q][l]);var c=null,b=Date;b.now||(b={now:function(){return+new Date}});var p=0,w=/\blang(?:uage)?-([\w.]+)(?!\S)/,r=/\bprettyprint\b/,
|
||||||
|
e=/\bprettyprinted\b/,B=/pre|xmp/i,z=/^code$/i,v=/^(?:pre|code|xmp)$/i,g={};f()}},H=D.define;"function"===typeof H&&H.amd&&H("google-code-prettify",[],function(){return Y})})();}()
|
1
scripts/prettify_desert.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
pre .atn,pre .kwd,pre .tag{font-weight:700}pre.prettyprint{display:block;background-color:#333}pre .nocode{background-color:none;color:#000}pre .str{color:#ffa0a0}pre .kwd{color:khaki}pre .com{color:#87ceeb}pre .typ{color:#98fb98}pre .lit{color:#cd5c5c}pre .pln,pre .pun{color:#fff}pre .tag{color:khaki}pre .atn{color:#bdb76b}pre .atv{color:#ffa0a0}pre .dec{color:#98fb98}ol.linenums{margin-top:0;margin-bottom:0;color:#AEAEAE}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}@media print{pre.prettyprint{background-color:none}code .str,pre .str{color:#060}code .kwd,pre .kwd{color:#006;font-weight:700}code .com,pre .com{color:#600;font-style:italic}code .typ,pre .typ{color:#404;font-weight:700}code .lit,pre .lit{color:#044}code .pun,pre .pun{color:#440}code .pln,pre .pln{color:#000}code .tag,pre .tag{color:#006;font-weight:700}code .atn,pre .atn{color:#404}code .atv,pre .atv{color:#060}}
|
BIN
scripts/sign_language_vgg16/group1-shard1of1
Normal file
BIN
scripts/sign_language_vgg16/group2-shard1of1
Normal file
BIN
scripts/sign_language_vgg16/group3-shard1of1
Normal file
BIN
scripts/sign_language_vgg16/group4-shard1of1
Normal file
BIN
scripts/sign_language_vgg16/group5-shard1of2
Normal file
BIN
scripts/sign_language_vgg16/group5-shard2of2
Normal file
BIN
scripts/sign_language_vgg16/group6-shard1of1
Normal file
1
scripts/sign_language_vgg16/model.json
Normal file
18127
scripts/skyway.js
Normal file
2
scripts/tensorflow.min.js
vendored
Normal file
8
scripts/test.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
var count=10;
|
||||||
|
var id = setInterval(() => {
|
||||||
|
console.log(count--);
|
||||||
|
if (count<0) {
|
||||||
|
console.log(' : 終了 - Node Test JS');
|
||||||
|
clearInterval(id);
|
||||||
|
}
|
||||||
|
}, 1000);
|
14
scripts/test.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
|
||||||
|
for i in range(10,0,-1):
|
||||||
|
# print (i, flush=True) # flush=True を指定することで、バッファが無効になる
|
||||||
|
print i
|
||||||
|
sys.stdout.flush() # python2.x
|
||||||
|
time.sleep(1)
|
||||||
|
# print ('終了 - Python test')
|
||||||
|
print '終了 - Python test'
|
||||||
|
|