Commit graph

80 commits

Author SHA1 Message Date
Christopher Willis-Ford
de9e2be265 Add EVENT extension block type
An EVENT block is like a HAT block but it has no implementation
function. Its stack runs when the VM emits the corresponding event.
2018-04-04 23:44:59 -07:00
Christopher Willis-Ford
af058b8146 Support LOOP and CONDITIONAL blocks in extensions
A LOOP block is like a conditional, but the LOOP block will be
re-evaluated after any child branch runs.

Also:
- Support using '---' as a block separator
- Refactor common code from `_registerExtensionPrimitives` and
  `_refreshExtensionPrimitives` into new `_fillExtensionCategory`
- Improve error reporting during block conversion
2018-04-04 22:19:48 -07:00
Michael "Z" Goddard
3c473f6ba8
Translate scratch 2 video sensing into scratch 3 extension
- Add videoSensing extension to extension-manager
2018-03-29 15:15:11 -04:00
Christopher Willis-Ford
1049e90a8f Wrap extension menu function to provide context
When the extension system calls a function to retrieve extension menu
items, it now provides the ID of the current editing target. There's
also now a little bit of error-checking on the results.
2018-03-20 15:26:27 -07:00
Christopher Willis-Ford
2932f232c4 Improve developer feedback for missing block func 2018-03-20 15:26:12 -07:00
picklesrus
16ecaab1be Fix up comment. 2018-03-02 11:07:22 -08:00
picklesrus
1910968b13 Fix lint errors. 2018-02-16 10:49:26 -08:00
picklesrus
b6bb92d8f6 Adding support for dynamic menus in extensions. 2018-01-26 14:36:36 -08:00
chrisgarrity
f51cf9877e
Preliminary localization (#777)
* localize the block and menu strings in the pen extension
* adds .tx/config to be able to push translations to transifex
* includes format-message to localize strings and extracting them.
* add setLocale function to VM to allow GUI to pass in locale data.
* refresh block definitions when the locale changes.

### Still to be decided
For now just extracting messages from the pen extension into their own file. We’ll need to decide if each category gets its own file, or group all the strings into one resource.
2017-12-11 15:41:45 -05:00
Eric Rosenbaum
9611401e1c Move pen and wedo into extensions folder 2017-12-01 10:31:04 -05:00
Eric Rosenbaum
961b3476b2 Move the music extension into a new extensions directory 2017-11-13 16:22:37 -05:00
Eric Rosenbaum
b2941f8c5a Load music as internal extension 2017-11-07 11:27:33 -05:00
Chris Willis-Ford
91420375d5
Merge pull request #724 from cwillisf/no-dupe-extensions
Prevent duplicate extensions
2017-11-01 21:29:00 -07:00
Paul Kaplan
18398d010b Add hideFromPalette flag for hiding legacy blocks 2017-11-01 11:30:15 -04:00
Christopher Willis-Ford
8bb48e2a53 Add built-in extension "URL" to _loadedExtensions
Dupe prevention works better when you actually record the necessary
info...
2017-10-31 13:00:19 -07:00
Christopher Willis-Ford
ae878b2050 Simplify extension duplication prevention station
Since we will only have builtin extensions for a while, the
more-complicated, watchdog-based extension duplication prevention has
been replaced with one that treats the extension URL as equivalent to
the extension ID. This is true only for built-in extensions, so once we
start supporting third-party extensions we will likely need to bring
back the watchdog (commit e4381b4693) and
the more-complex duplication prevention (commit
670e51d335).

The code here should be treated as a last resort: ideally the GUI should
check if a particular extension is loaded (maybe by calling the
Extension Manager's new `isExtensionLoaded` method) and avoid calling
`loadExtensionURL` if it is.
2017-10-31 12:35:18 -07:00
Christopher Willis-Ford
670e51d335 Refuse to register second extension with same ID
If an extension attempts to register with the same ID as another
extension which has already registered, the new registration is refused.
If the extension is in a worker and no other extension is successfully
registered by that worker, the watchdog system will terminate the
"empty" worker.
2017-10-31 12:24:26 -07:00
Christopher Willis-Ford
e4381b4693 Add an init watchdog for extension workers
If an extension worker does not complete initialization in a reasonable
amount of time (currently 15 seconds) then the worker will be
terminated. A complete initialization includes registering an extension.
2017-10-31 11:28:56 -07:00
Chris Willis-Ford
a8ae7bc5b4 Merge pull request #700 from cwillisf/extension-menus
Extensions: implement drop-down menus
2017-10-13 09:49:42 -07:00
Christopher Willis-Ford
c1681e54d5 Implement drop-down menus for extension blocks
Also, add `ANGLE` argument type (like `NUMBER` but adds an angle picker)
2017-10-06 23:33:33 -07:00
Christopher Willis-Ford
b6727a766f Fix pen tests 2017-10-04 16:07:50 -07:00
Christopher Willis-Ford
e9aed49a05 Make loadExtensionURL handle built-in extensions
WeDo2 and Pen blocks have been converted to internal extensions, and can
now be loaded by giving `loadExtensionURL` the string 'pen' or 'wedo2'
instead of an actual URL.
2017-10-04 13:00:39 -07:00
Christopher Willis-Ford
772da24d9e Add integration test for a non-worker extension 2017-10-02 12:02:44 -07:00
Christopher Willis-Ford
7a21d619bf Add a way to load an extension without a Worker
The new `_registerInternalExtension` method on the extension manager
will register an extension object (an object with a `getInfo()` method)
with the extension system without sandboxing the object in a Worker.
2017-09-27 00:01:47 -04:00
Christopher Willis-Ford
799d61ac98 Cleanup 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
d43749d675 WIP for demo 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
64bde25d22 Offer a promise for extension worker init 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
403adb743c Track extension blocks in the Runtime 2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
42255bbcfa Collect extension info, prep scratch-blocks data
The Extension Manager now calls an extension's `getInfo` method, then
creates `scratch-blocks`-compatible XML and JSON block data from the
results.
2017-09-06 00:57:03 -06:00
Christopher Willis-Ford
7fb7f0dc7b WIP Extension Manager
When asked to load an extension, the Extension Manager starts up a new
Worker. That worker runs the message dispatch system as well as an
instance of the new `ExtensionWorker` class, which will load the desired
extension and register it with the extension system.

Extensions, placed in `./src/extensions/*.js`, are now processed by
Webpack as separate entry points and packed into an `extensions`
subdirectory in the output.

Still to do: query an extension's information, including the blocks it
provides, and register that information with the VM, GUI, etc.
2017-09-06 00:57:03 -06:00